git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings

From
SBSanti Béjar <santi@agolina.net>
Date
Dec 3, 2010, 20:23 UTC
Message-ID
<AANLkTikwdqQpmyxZu-kp7UHjYnKuVxs8urxM=9c=66H0@mail.gmail.com>
In-Reply-To
<AANLkTin-9pb7cxsAvDqWj3So47_zq5co9TZRWux9ezxz@mail.gmail.com>
On Fri, Dec 3, 2010 at 8:05 PM, Sverre Rabbelier <srabbelier@gmail.com> wrote:
Show 6 quoted lines
> Heya,
>
> On Fri, Dec 3, 2010 at 20:00, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> Does the following take care of it?
>
> Yes.

I also think it fixes, but I wonder if it's the best fix. One thing is that show-branch is an ancillary command, and not a plumbing command (but there is already a call to show-branch, but it should probably be change to merge-base now that it handles three commit as arguments).

The problem is that many parts of git-pull.sh/git-parse-remote.sh assume that you are not in a detached HEAD. Can you confirm that the following patch fixes it?

diff --git i/git-parse-remote.sh w/git-parse-remote.sh
index 5f47b18..6d0a5de 100644
--- i/git-parse-remote.sh
+++ w/git-parse-remote.sh
@@ -68,7 +68,7 @@ get_remote_merge_branch () {
            test -z "$origin" && origin=$default
            curr_branch=$(git symbolic-ref -q HEAD)
            [ "$origin" = "$default" ] &&
-           echo $(git for-each-ref --format='%(upstream)' $curr_branch)
+           echo $(git for-each-ref --format='%(upstream)' HEAD)
            ;;
        *)
            repo=$1

I'm wondering if most of $curr_branch should be changed to HEAD, I'll check it.

HTH,
Santi
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 4 of 8 in “BUG: git pull --rebase on detatched head prints a lot of usage warnings”
  1. Sverre RabbelierDec 3, 2010
  2. Jonathan NiederDec 3, 2010
  3. Sverre RabbelierDec 3, 2010
  4. Santi BéjarDec 3, 2010
  5. Sverre RabbelierDec 3, 2010
  6. Junio C HamanoDec 3, 2010
  7. Santi BéjarDec 3, 2010
  8. Junio C HamanoDec 3, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.