diff options
author | Junio C Hamano <junkio@cox.net> | 2005-12-13 17:21:41 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-12-19 18:32:44 -0800 |
commit | 47dd0d595d04ee5283dfd8a0b4cbd6e6de8ad57f (patch) | |
tree | 49a5c32f9fbcd84e328e6b285d8d1393271563e8 /sha1_name.c | |
parent | 1c15afb9343bca82e687d008ec983a9110ac9c40 (diff) | |
download | git-47dd0d595d04ee5283dfd8a0b4cbd6e6de8ad57f.tar.gz |
diff: --abbrev option
When I show transcripts to explain how something works, I often
find myself hand-editing the diff-raw output to shorten various
object names in the output.
This adds --abbrev option to the diff family, which shortens
diff-raw output and diff-tree commit id headers.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_name.c')
-rw-r--r-- | sha1_name.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sha1_name.c b/sha1_name.c index 67b69a54fb..b13ed78cee 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -188,7 +188,10 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len) { int status; static char hex[41]; + memcpy(hex, sha1_to_hex(sha1), 40); + if (len == 40) + return hex; while (len < 40) { unsigned char sha1_ret[20]; status = get_short_sha1(hex, len, sha1_ret, 1); |