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

Re: [PATCH] git-rebase.sh: Display error output from git-checkout when detaching HEAD fails.

From
RSRob Shearman <robertshearman@gmail.com>
Date
Jul 14, 2008, 19:57 UTC
Message-ID
<1096648c0807141257i76f70322p5a16c86c1c826a66@mail.gmail.com>
In-Reply-To
<7vr6a0hvvu.fsf@gitster.siamese.dyndns.org>
2008/7/11 Junio C Hamano <gitster@pobox.com>:
Show 13 quoted lines
> Robert Shearman <robertshearman@gmail.com> writes:
>> diff --git a/git-rebase.sh b/git-rebase.sh
>> index e2d85ee..0da2210 100755
>> --- a/git-rebase.sh
>> +++ b/git-rebase.sh
>> @@ -376,7 +376,7 @@ fi
>>
>>  # Detach HEAD and reset the tree
>>  echo "First, rewinding head to replay your work on top of it..."
>> -git checkout "$onto^0" >/dev/null 2>&1 ||
>
> I think this very much is done deliberately by somebody who knows the
> shell to discard everything.

Why wasn't "git checkout "$onto^0" &> /dev/null" used then? Then only reason I can come up with would be portability, but it seems surprising to me.

Show 6 quoted lines
>> +git checkout "$onto^0" 2>&1 >/dev/null ||
>
> And if it is beneficial to show the error, you just do not touch fd #2,
> like this:
>
>        git checkout "$onto^0" >/dev/null

Absolutely. I was just trying to fix the statement to what I thought was the original intent.

Show 10 quoted lines
> As I do not see any reason to send the error message to stdout like you
> did.
>
> I also suspect that this part of the script predates 6124aee (add a quiet
> option to git-checkout, 2007-02-01) where the command learned to be more
> quiet during the normal operation.  Perhaps you can replace the line with
>
>        git checkout -q "$onto^0"
>
> and be done with it.  I haven't tested it, though.

I just tested it and it solves the original issue whilst not displaying unnecessary messages during a rebase. For reference, the attached script reproduces the issue that I was trying to solve.

Should I resend the patch (like the following) now that it is effectively completely your work?

-git checkout "$onto^0" >/dev/null 2>&1 || +git checkout -q "$onto^0" ||

-- 
Rob Shearman
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “git-rebase.sh: Display error output from git-checkout when detaching HEAD fails.”
  1. git-rebase.sh: Display error output from git-checkout when detaching HEAD fails.Robert Shearman, Jul 11, 2008
  2. Junio C HamanoJul 11, 2008
  3. Rob ShearmanJul 14, 2008
  4. Junio C HamanoJul 15, 2008

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.