Skip to contentSkip to conversation

git-fetch --update-head-ok ?

PATCH Martin Waitz 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

hoi :)

I have no idea why there is a --update-head-ok, but the code looks like it has a typo:

git-fetch.sh +1 -1
index 09a5d6c..5843639 100755
@@ -433,7 +433,7 @@ esac
 # If the original head was empty (i.e. no "master" yet), or
 # if we were told not to worry, we do not have to check.
 case ",$update_head_ok,$orig_head," in
-*,, | t,* )
+*,, | ,t,* )
        ;;
 *)
        curr_head=$(git-rev-parse --verify HEAD 2>/dev/null)
Signature · 1 line
Martin Waitz
#1 lore raw
Quoted 2 lines · Martin Waitz

I have no idea why there is a --update-head-ok, but the code looks like it has a typo:

I looked at it again, and indeed it looks like a typo.

git-fetch.sh esac · line 439

Quoted 9 lines
git-fetch.sh +1 -1
@@ -433,7 +433,7 @@ esac
 # If the original head was empty (i.e. no "master" yet), or
 # if we were told not to worry, we do not have to check.
 case ",$update_head_ok,$orig_head," in
-*,, | t,* )
+*,, | ,t,* )
        ;;
 *)
        curr_head=$(git-rev-parse --verify HEAD 2>/dev/null)

Interestingly enough, when update_head_ok is set, orig_head never is so the typo does not matter at all by pure accident (it was there from the very first version that introduced this feature).

It should just be something like this:

        case "$orig_head" in
        '')
                ;;
        ?*)
                curr_head=$(git-rev-parse --verify HEAD 2>/dev/null)
                ...