Re: [PATCH] checkout: abbreviate hash in suggest_reattach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 08, 2013 at 06:53:42PM +0300, Kevin Bracey wrote:

> After printing the list of left-behind commits (with abbreviated
> hashes), use an abbreviated hash in the suggested 'git branch' command;
> there's no point in outputting a full 40-character hex string in some
> friendly advice.
> 
> Signed-off-by: Kevin Bracey <kevin@xxxxxxxxx>

I think this makes sense. We generally use the full sha1 when the output
is meant to live for a long time, but that is not the case here.

I suspect I would have been annoyed by it, too, if I did not have
advice.detachedHEAD turned off. :)

> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index a9c1b5a..e168bfb 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -700,7 +700,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
>  			"If you want to keep them by creating a new branch, "
>  			"this may be a good time\nto do so with:\n\n"
>  			" git branch new_branch_name %s\n\n"),
> -			sha1_to_hex(commit->object.sha1));
> +			find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
>  }

Code looks obviously correct to me.

Acked-by: Jeff King <peff@xxxxxxxx>

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]