git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] for-each-ref: fix objectname:short bug

From
Jay Soffian <jaysoffian@gmail.com>
Date
Aug 26, 2010, 21:34 UTC
Message-ID
<1282858469-22116-1-git-send-email-jaysoffian@gmail.com>
In-Reply-To
<AANLkTikhcAC6Nf=jWQN40ascodaCte6v6e1JPfv-=To-@mail.gmail.com>

When objectname:short was introduced, it forgot to copy the result of find_unique_abbrev. Because the result of find_unique_abbrev is a pointer to static buffer, this resulted in the same value being substituted in for each ref.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
---
 builtin/for-each-ref.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index a2b28c6..89e75c6 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -228,7 +228,8 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
 			v->s = s;
 		}
 		else if (!strcmp(name, "objectname:short")) {
-			v->s = find_unique_abbrev(obj->sha1, DEFAULT_ABBREV);
+			v->s = xstrdup(find_unique_abbrev(obj->sha1,
+							  DEFAULT_ABBREV));
 		}
 	}
 }
-- 
1.7.2.2.170.gb30b3d
Previous: Jay SoffianNext: Jeff King
Message 2 of 4 in “objectname:short bug?”
  1. Jay SoffianAug 26, 2010
  2. for-each-ref: fix objectname:short bugJay Soffian, Aug 26, 2010
  3. Jeff KingAug 26, 2010
  4. Michael J GruberAug 27, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.