# git-fetch --update-head-ok ?

2 messages from 2006-10-03 to 2006-10-11. Participants: Martin Waitz, Junio C Hamano.
Thread: https://gitlist.dev/t/5794

## Martin Waitz, 2006-10-03 12:34

Subject: git-fetch --update-head-ok ?
Message-ID: <20061003123452.GK2871@admingilde.org>
URL: https://gitlist.dev/e/20061003123452.GK2871%40admingilde.org

```
hoi :)

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

diff --git a/git-fetch.sh b/git-fetch.sh
index 09a5d6c..5843639 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -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)

-- 
Martin Waitz

```

## Junio C Hamano, 2006-10-11 05:25

Subject: Re: git-fetch --update-head-ok ?
Message-ID: <7vzmc3whir.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vzmc3whir.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20061003123452.GK2871@admingilde.org>

```
Martin Waitz <tali@admingilde.org> writes:

> 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.

> @@ -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)
                ...

```
