summaryrefslogtreecommitdiff
path: root/builtin-for-each-ref.c
diff options
context:
space:
mode:
authorPetr Baudis <pasky@suse.cz>2006-11-18 02:56:52 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-11-18 19:09:46 (GMT)
commitf8290630cb900fc5581e91a4cc055d2fba121db0 (patch)
tree111aaaf90925655bbf2ea181d24fdf7359820eef /builtin-for-each-ref.c
parent6b1f8c32b1a602734f14b9cf8a9f59a767752677 (diff)
downloadgit-f8290630cb900fc5581e91a4cc055d2fba121db0.zip
git-f8290630cb900fc5581e91a4cc055d2fba121db0.tar.gz
git-f8290630cb900fc5581e91a4cc055d2fba121db0.tar.bz2
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>
Diffstat (limited to 'builtin-for-each-ref.c')
-rw-r--r--builtin-for-each-ref.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 173bf38..227aa3c 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -478,9 +478,9 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct obj
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);
}
}