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

Re: [PATCH] commit: correct advice about aborting a cherry-pick

From
Jeff King <peff@peff.net>
Date
Jul 29, 2013, 15:23 UTC
Message-ID
<20130729152345.GA10393@sigill.intra.peff.net>
In-Reply-To
<7vtxjd1jje.fsf@alter.siamese.dyndns.org>
On Mon, Jul 29, 2013 at 08:18:45AM -0700, Junio C Hamano wrote:
Show 14 quoted lines
> >  	if (file_exists(git_path("MERGE_HEAD")))
> >  		whence = FROM_MERGE;
> > -	else if (file_exists(git_path("CHERRY_PICK_HEAD")))
> > +	else if (file_exists(git_path("CHERRY_PICK_HEAD"))) {
> >  		whence = FROM_CHERRY_PICK;
> > +		if (file_exists(git_path("sequencer")))
> > +			sequencer_in_use = 1;
> 
> Should this be
> 
> 	sequencer_in_use = file_exists(...)
> 
> so readers do not have to wonder what the variable is initialized
> to?

Yeah, I think that is a readability improvement. I suppose the use-site could also just run "file_exists" itself, but I wanted to keep the filesystem-reading "magic name" bits together.

I had also originally considered adding new states to "whence" to cover these cases (i.e., FROM_CHERRY_PICK_MULTI), but there are fallouts all over the place for call sites that do not care whether we are in the single- or multi-commit mode.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 15 of 18 in “commit: correct advice about aborting a cherry-pick”
  1. commit: correct advice about aborting a cherry-pickRamkumar Ramachandra, Jul 26, 2013
  2. Jeff KingJul 26, 2013
  3. Ramkumar RamachandraJul 26, 2013
  4. Jeff KingJul 26, 2013
  5. Ramkumar RamachandraJul 26, 2013
  6. Jonathan NiederJul 26, 2013
  7. Jeff KingJul 26, 2013
  8. Jeff KingJul 26, 2013
  9. Jeff KingJul 26, 2013
  10. Jonathan NiederJul 26, 2013
  11. Jeff KingJul 26, 2013
  12. Jeff KingJul 26, 2013
  13. Ramkumar RamachandraJul 27, 2013
  14. Junio C HamanoJul 29, 2013
  15. Jeff KingJul 29, 2013
  16. Junio C HamanoJul 29, 2013
  17. Junio C HamanoJul 29, 2013
  18. Ramkumar RamachandraJul 27, 2013

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.