path: root/merge-tree.c
diff options
authorLinus Torvalds <>2006-05-04 00:21:08 (GMT)
committerJunio C Hamano <>2006-05-04 05:06:45 (GMT)
commitdcb3450fd8785d76dd3d25aa49be66190aa5e7f3 (patch)
treed67f23c99110c10edb5383bf5d98dc0da16edd39 /merge-tree.c
parent935e714204fe167aa6172a733e7131ee5b4577f4 (diff)
sha1_to_hex() usage cleanup
Somebody on the #git channel complained that the sha1_to_hex() thing uses a static buffer which caused an error message to show the same hex output twice instead of showing two different ones. That's pretty easily rectified by making it uses a simple LRU of a few buffers, which also allows some other users (that were aware of the buffer re-use) to be written in a more straightforward manner. Signed-off-by: Linus Torvalds <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'merge-tree.c')
1 files changed, 2 insertions, 4 deletions
diff --git a/merge-tree.c b/merge-tree.c
index 50528d5..cc7b5bd 100644
--- a/merge-tree.c
+++ b/merge-tree.c
@@ -24,16 +24,14 @@ static const char *sha1_to_hex_zero(const unsigned char *sha1)
static void resolve(const char *base, struct name_entry *branch1, struct name_entry *result)
- char branch1_sha1[50];
/* If it's already branch1, don't bother showing it */
if (!branch1)
- memcpy(branch1_sha1, sha1_to_hex_zero(branch1->sha1), 41);
printf("0 %06o->%06o %s->%s %s%s\n",
branch1->mode, result->mode,
- branch1_sha1, sha1_to_hex_zero(result->sha1),
+ sha1_to_hex_zero(branch1->sha1),
+ sha1_to_hex_zero(result->sha1),
base, result->path);