git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	Ramkumar Ramachandra <artagnon@gmail.com>,
	Git List <git@vger.kernel.org>
Subject: Re: [PATCH] commit: correct advice about aborting a cherry-pick
Date: Mon, 29 Jul 2013 08:23:45 -0700	[thread overview]
Message-ID: <20130729152345.GA10393@sigill.intra.peff.net> (raw)
In-Reply-To: <7vtxjd1jje.fsf@alter.siamese.dyndns.org>

On Mon, Jul 29, 2013 at 08:18:45AM -0700, Junio C Hamano wrote:

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

  reply	other threads:[~2013-07-29 15:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 18:12 [PATCH] commit: correct advice about aborting a cherry-pick Ramkumar Ramachandra
2013-07-26 19:16 ` Jeff King
2013-07-26 21:17   ` Ramkumar Ramachandra
2013-07-26 21:24     ` Jeff King
2013-07-26 21:27       ` Ramkumar Ramachandra
2013-07-26 21:37       ` Jonathan Nieder
2013-07-26 21:40         ` Jeff King
2013-07-26 22:43           ` Jeff King
2013-07-26 23:05             ` Jeff King
2013-07-26 23:08               ` Jonathan Nieder
2013-07-26 23:19                 ` Jeff King
2013-07-26 23:39                   ` Jeff King
2013-07-27  8:07                     ` Ramkumar Ramachandra
2013-07-29 15:18                     ` Junio C Hamano
2013-07-29 15:23                       ` Jeff King [this message]
2013-07-29 15:48                         ` Junio C Hamano
2013-07-29 15:15             ` Junio C Hamano
2013-07-27  8:19         ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130729152345.GA10393@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).