* [PATCH] checkout: abbreviate hash in suggest_reattach
@ 2013-04-08 15:53 Kevin Bracey
2013-04-08 21:03 ` Jeff King
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Bracey @ 2013-04-08 15:53 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Jeff King, Kevin Bracey
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@bracey.fi>
---
builtin/checkout.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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));
}
/*
--
1.8.2.445.gfcda34b
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] checkout: abbreviate hash in suggest_reattach
2013-04-08 15:53 [PATCH] checkout: abbreviate hash in suggest_reattach Kevin Bracey
@ 2013-04-08 21:03 ` Jeff King
0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2013-04-08 21:03 UTC (permalink / raw)
To: Kevin Bracey; +Cc: git, Junio C Hamano
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@bracey.fi>
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@peff.net>
-Peff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-08 21:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-08 15:53 [PATCH] checkout: abbreviate hash in suggest_reattach Kevin Bracey
2013-04-08 21:03 ` Jeff King
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).