mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-24 16:20:08 +01:00
17 lines
734 B
Text
17 lines
734 B
Text
|
TREES=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep tree | cut -f1 -d" ")
|
||
|
|
||
|
for OUTER_TREE in $TREES; do
|
||
|
NUMBER_OF_BLOB_CHILDREN=$(git cat-file -p $OUTER_TREE | cut -f2 -d" " | grep blob | wc -l)
|
||
|
NUMBER_OF_TREE_CHILDREN=$(git cat-file -p $OUTER_TREE | cut -f2 -d" " | grep tree | wc -l)
|
||
|
|
||
|
if [ $NUMBER_OF_BLOB_CHILDREN -eq 2 -a $NUMBER_OF_TREE_CHILDREN -eq 1 ]; then
|
||
|
TREE_CHILD=$(git cat-file -p $OUTER_TREE | cut -f1 | grep tree | cut -d" " -f3)
|
||
|
NUMBER_OF_BLOB_CHILDREN_OF_TREE_CHILD=$(git cat-file -p $TREE_CHILD | cut -f2 -d" " | grep blob | wc -l)
|
||
|
if [ $NUMBER_OF_BLOB_CHILDREN_OF_TREE_CHILD -eq 2 ]; then
|
||
|
exit 0
|
||
|
fi
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
exit 1
|