1. Stefan Saasen
  2. git


Petr Baudis  committed f829063

Fix git-for-each-refs broken for tags

Unfortunately, git-for-each-refs is currently unusable for peeking into tag
comments, since it uses freed pointers, so it just prints out all sort of

This makes it strdup() contents and body values.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>

  • Participants
  • Parent commits 6b1f8c3
  • Branches master

Comments (0)

Files changed (1)

File builtin-for-each-ref.c

View file
  • Ignore whitespace
 		if (!strcmp(name, "subject"))
 			v->s = copy_line(subpos);
 		else if (!strcmp(name, "body"))
-			v->s = bodypos;
+			v->s = xstrdup(bodypos);
 		else if (!strcmp(name, "contents"))
-			v->s = subpos;
+			v->s = xstrdup(subpos);