From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 2/2] checkout: do not write full sha1 to reflog
Date: Sat, 15 Jun 2013 23:08:26 +0530 [thread overview]
Message-ID: <1371317906-3991-3-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1371317906-3991-1-git-send-email-artagnon@gmail.com>
A snippet from a typical git session may look like this:
$ git checkout @~3
...
$ git checkout -
The reflog entries corresponding to the two checkouts look like:
f855138: checkout: moving from bdff0e3a374617dce784f801b97500d9ba2e4705 to co-reflog
bdff0e3: checkout: moving from co-reflog to HEAD~3
There is no need to write the full SHA-1 to the user-visible reflog; use
find_unique_abbrev() to shorten the first line like:
f855138: checkout: moving from bdff0e3 to co-reflog
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
builtin/checkout.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index f5b50e5..41b1929 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -619,7 +619,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
old_desc = old->name;
if (!old_desc && old->commit)
- old_desc = sha1_to_hex(old->commit->object.sha1);
+ old_desc = find_unique_abbrev(old->commit->object.sha1, DEFAULT_ABBREV);
strbuf_addf(&msg, "checkout: moving from %s to %s",
old_desc ? old_desc : "(invalid)", new->name);
--
1.8.3.1.438.g96d34e8
next prev parent reply other threads:[~2013-06-15 17:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-15 17:38 [PATCH 0/2] Slightly prettier reflog message from checkout Ramkumar Ramachandra
2013-06-15 17:38 ` [PATCH 1/2] sha1_name: stop hard-coding 40-character hex checks Ramkumar Ramachandra
2013-06-16 13:28 ` Phil Hord
2013-06-18 7:03 ` Ramkumar Ramachandra
2013-06-18 14:27 ` Junio C Hamano
2013-06-15 17:38 ` Ramkumar Ramachandra [this message]
2013-06-15 17:42 ` [PATCH 0/2] Slightly prettier reflog message from checkout Ramkumar Ramachandra
2013-06-16 1:24 ` Junio C Hamano
2013-06-16 9:21 ` Ramkumar Ramachandra
2013-06-17 2:59 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1371317906-3991-3-git-send-email-artagnon@gmail.com \
--to=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).