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

Re: [PATCH v2 3/3] rebase: rebasing can also be done when HEAD is detached

From
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Date
Nov 28, 2017, 16:15 UTC
Message-ID
<1511885730.10193.8.camel@gmail.com>
In-Reply-To
<xmqqlgir8770.fsf@gitster.mtv.corp.google.com>
On Tue, 2017-11-28 at 11:31 +0900, Junio C Hamano wrote:
Show 6 quoted lines
> Kaartic Sivaraam <kaartic.sivaraam@gmail.com> writes:
> 
> > +		if test "$branch_or_commit" = "HEAD" &&
> > +			 !(git symbolic-ref -q HEAD)
> 
> Did you need a subshell here? 

No. That's a consequence of me not remembering that I would span a sub- shell with a simple '()' when I was doing that part. (partial transition from C to shell)

Show 12 quoted lines
>  Now with a proper test with
> "symbolic-ref -q HEAD", I wonder if you'd need to check if the
> original was named HEAD in the first place (I do not feel strongly
> enough to say that checking is wrong, at least not yet, but the
> above does make me wonder), and instead something like
> 
> 	if ! git symbolic-ref -q HEAD
> 	then
> 		...
> 
> might be sufficient.  I dunno.
> 

It does seem you're right. The only thing we would be losing is the short-circuiting when $branch_or_commit is not HEAD (which I suspect to be the case most of the time). So, I'm not sure if I should remove the check (of course, I'll change the check to avoid spawning a sub-shell).

Thanks, Kaartic

Previous: Junio C HamanoNext: Kaartic Sivaraam
Message 8 of 18 in “rebase: rebasing can also be done when HEAD is detached”
  1. rebase: rebasing can also be done when HEAD is detachedKaartic Sivaraam, Nov 21, 2017
  2. Junio C HamanoNov 22, 2017
  3. 0/3 rebase: give precise error messageKaartic Sivaraam, Nov 27, 2017
  4. 1/3 rebase: use a more appropriate variable nameKaartic Sivaraam, Nov 27, 2017
  5. 2/3 rebase: distinguish user input by quoting itKaartic Sivaraam, Nov 27, 2017
  6. 3/3 rebase: rebasing can also be done when HEAD is detachedKaartic Sivaraam, Nov 27, 2017
  7. Junio C HamanoNov 28, 2017
  8. Kaartic SivaraamNov 28, 2017
  9. 3/3 rebase: rebasing can also be done when HEAD is detachedKaartic Sivaraam, Dec 1, 2017
  10. Junio C HamanoNov 28, 2017
  11. Kaartic SivaraamNov 28, 2017
  12. Junio C HamanoNov 29, 2017
  13. Kaartic SivaraamNov 29, 2017
  14. Junio C HamanoNov 29, 2017
  15. 0/3 rebase: give precise error messagesKaartic Sivaraam, Dec 16, 2017
  16. 1/3 rebase: consistently use branch_name variableKaartic Sivaraam, Dec 16, 2017
  17. 2/3 rebase: distinguish user input by quoting itKaartic Sivaraam, Dec 16, 2017
  18. 3/3 rebase: rebasing can also be done when HEAD is detachedKaartic Sivaraam, Dec 16, 2017

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.