aboutsummaryrefslogtreecommitdiff
path: root/git-pull.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-11-02 13:37:16 -0800
committerJunio C Hamano <gitster@pobox.com>2008-11-02 13:37:16 -0800
commitf6276b788f26c3c148c2d5465a6b03fc09bb785c (patch)
tree51087b88150e40113d3c90f3822f0e0c9e5a4caa /git-pull.sh
parent86e67a088c581da4da36acf0edd8c27b1033e51e (diff)
parentb0ad11ea165e07308fc02a5091efbe2e2d22237c (diff)
downloadgit-f6276b788f26c3c148c2d5465a6b03fc09bb785c.tar.gz
git-f6276b788f26c3c148c2d5465a6b03fc09bb785c.tar.xz
Merge branch 'js/maint-fetch-update-head' into maint
* js/maint-fetch-update-head: pull: allow "git pull origin $something:$current_branch" into an unborn branch Fix fetch/pull when run without --update-head-ok
Diffstat (limited to 'git-pull.sh')
-rwxr-xr-xgit-pull.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/git-pull.sh b/git-pull.sh
index 75c36100a..664fe3441 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -124,7 +124,7 @@ orig_head=$(git rev-parse --verify HEAD 2>/dev/null)
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.
@@ -172,7 +172,7 @@ esac
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