Handle initial commit properly.

This commit is contained in:
Jason Tibbitts 2011-03-24 14:05:14 -05:00
parent 466e29c326
commit f65d9b36f2

View file

@ -10,7 +10,11 @@ tmp=$(mktemp /tmp/git.update.XXXXXX)
tree=$(mktemp /tmp/git.diff-tree.XXXXXX)
zero="0000000000000000000000000000000000000000"
git diff-tree -r "$old_rev" "$new_rev" > $tree
if [[ "$old_rev" == "$zero" ]]; then
git diff-tree -r --root "$new_rev" | sed '1d' > $tree
else
git diff-tree -r "$old_rev" "$new_rev" > $tree
fi
while read old_mode new_mode old_sha1 new_sha1 status name; do
# skip lines showing parent commit
[[ -z "$new_sha1" ]] && continue;