@matheusbsbs / matheus-bagliano / commits / f8290630cb
Fork 0

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 garbage. 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>

Petr Baudis committed Nov 18, 2006 at 03:56 UTC f8290630cb900fc5581e91a4cc055d2fba121db0
1 file changed +2 -2
builtin-for-each-ref.c
+2 -2
@@ -478,9 +478,9 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct obj
478 if (!strcmp(name, "subject"))
479 v->s = copy_line(subpos);
480 else if (!strcmp(name, "body"))
481 - v->s = bodypos;
481 + v->s = xstrdup(bodypos);
482 else if (!strcmp(name, "contents"))
483 - v->s = subpos;
483 + v->s = xstrdup(subpos);
484 }
485 }
486