diff --git a/git-pull.sh b/git-pull.sh
index 75c36100a2f858bcf2663d2b4560654787963175..664fe34419e9aeef1af8fac820cc423a641f5525 100755 (executable)
--- a/git-pull.sh
+++ b/git-pull.sh
git fetch --update-head-ok "$@" || exit 1
curr_head=$(git rev-parse --verify HEAD 2>/dev/null)
-if test "$curr_head" != "$orig_head"
+if test -n "$orig_head" && test "$curr_head" != "$orig_head"
then
# The fetch involved updating the current branch.
if test -z "$orig_head"
then
- git update-ref -m "initial pull" HEAD $merge_head "" &&
+ git update-ref -m "initial pull" HEAD $merge_head "$curr_head" &&
git read-tree --reset -u HEAD || exit 1
exit
fi