2020-09-16 14:16:38 +02:00
|
|
|
TREES=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep tree | cut -f1 -d" ")
|
|
|
|
|
|
|
|
for TREE in $TREES; do
|
|
|
|
if [ "$(git cat-file -p $TREE | wc -l)" -eq 1 ]; then
|
|
|
|
if [ "$(git cat-file -p $TREE | cut -f1 | grep tree | wc -l)" -eq 1 ]; then
|
|
|
|
# So the tree has exactly one child, and it is a tree!
|
|
|
|
TREE2=$(git cat-file -p $TREE | cut -f1 | grep tree | cut -f3 -d" ")
|
|
|
|
if [ "$(git cat-file -p $TREE2 | wc -l)" -eq 1 ]; then
|
|
|
|
if [ "$(git cat-file -p $TREE2 | cut -f1 | grep tree | wc -l)" -eq 1 ]; then
|
|
|
|
# Same for its child! \o/
|
2020-09-29 20:36:57 +02:00
|
|
|
return 0
|
2020-09-16 14:16:38 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2020-09-29 20:36:57 +02:00
|
|
|
return 1
|