git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] sequencer: write useful reflog message for fast-forward
Date: Tue, 18 Jun 2013 11:53:52 -0700	[thread overview]
Message-ID: <7vzjun45dr.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1371580518-32455-1-git-send-email-artagnon@gmail.com> (Ramkumar Ramachandra's message of "Wed, 19 Jun 2013 00:05:18 +0530")

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> The following command
>
>   $ git cherry-pick --ff b8bb3f
>
> writes the following uninformative message to the reflog
>
>   cherry-pick
>
> Improve it to
>
>   cherry-pick: fast-forward to b8bb3f
>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---

Perhaps, but a few questions in general (i.e. not limited to the
difference the patch brings in, but because you are touching the
codepath anyway).

 - Is this limited to cherry-pick?  do_pick_commit() which is the
   caller of fast_forward_to() is called not just for cherry-pick
   but also for revert, and I do not see anything that makes sure
   that it is called only when (opts->action == REPLAY_CHERRY_PICK).

 - Do we want to abbreviate?  For that matter, why even say "to
   $commit", which can be seen in the "from to" part of the reflog
   record anyway?

In other words:

	strbuf_addf(&sb, "%s: fast-forward", action_name(opts))

might be sufficient, and when sequencer learns to handle more than
cherry-pick and revert, we won't have to remember that we need to
change this part.

>  sequencer.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index ab6f8a7..ae63ff3 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -273,12 +273,14 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from,
>  			   int unborn)
>  {
>  	struct ref_lock *ref_lock;
> +	struct strbuf sb = STRBUF_INIT;
>  
>  	read_cache();
>  	if (checkout_fast_forward(from, to, 1))
>  		exit(1); /* the callee should have complained already */
>  	ref_lock = lock_any_ref_for_update("HEAD", unborn ? null_sha1 : from, 0);
> -	return write_ref_sha1(ref_lock, to, "cherry-pick");
> +	strbuf_addf(&sb, "cherry-pick: fast-forward to %s", find_unique_abbrev(to, DEFAULT_ABBREV));
> +	return write_ref_sha1(ref_lock, to, sb.buf);
>  }
>  
>  static int do_recursive_merge(struct commit *base, struct commit *next,

  reply	other threads:[~2013-06-18 18:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18 18:35 [PATCH] sequencer: write useful reflog message for fast-forward Ramkumar Ramachandra
2013-06-18 18:53 ` Junio C Hamano [this message]
2013-06-18 19:02   ` 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=7vzjun45dr.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /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).