{"thread":{"id":"43575","subject":"Re: [PATCH] Fix git-for-each-refs broken for tags","startedAt":"2006-11-18T02:56:52Z","lastAt":"2006-11-18T04:54:31Z","messageCount":3,"participants":["Junio C Hamano","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"295707","messageId":"20061118025652.2970.10571.stgit@machine.or.cz","threadId":"43575","inReplyTo":null,"subject":"[PATCH] Fix git-for-each-refs broken for tags","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-11-18T02:56:52Z","receivedAt":"2006-11-18T02:56:52Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Unfortunately, git-for-each-refs is currently unusable for peeking into tag\ncomments, since it uses freed pointers, so it just prints out all sort of\ngarbage.\n\nThis makes it strdup() contents and body values.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n builtin-for-each-ref.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c\nindex 173bf38..227aa3c 100644\n--- a/builtin-for-each-ref.c\n+++ b/builtin-for-each-ref.c\n@@ -478,9 +478,9 @@ static void grab_sub_body_contents(struc\n \t\tif (!strcmp(name, \"subject\"))\n \t\t\tv->s = copy_line(subpos);\n \t\telse if (!strcmp(name, \"body\"))\n-\t\t\tv->s = bodypos;\n+\t\t\tv->s = xstrdup(bodypos);\n \t\telse if (!strcmp(name, \"contents\"))\n-\t\t\tv->s = subpos;\n+\t\t\tv->s = xstrdup(subpos);\n \t}\n }\n"},{"id":"295630","messageId":"7v4psxfjmw.fsf@assigned-by-dhcp.cox.net","threadId":"43575","inReplyTo":"20061118025652.2970.10571.stgit@machine.or.cz","subject":"Re: [PATCH] Fix git-for-each-refs broken for tags","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-18T04:45:11Z","receivedAt":"2006-11-18T04:45:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks for noticing.\n\nThis is not like rev-list where we walk all over the map of\nancestry graph, so it might be a simpler and better to keep\nthe buffer than to keep duplicate copies of pieces.\n\n\n"},{"id":"295788","messageId":"20061118045431.GL7201@pasky.or.cz","threadId":"43575","inReplyTo":"7v4psxfjmw.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Fix git-for-each-refs broken for tags","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-11-18T04:54:31Z","receivedAt":"2006-11-18T04:54:31Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Sat, Nov 18, 2006 at 05:45:11AM CET, Junio C Hamano wrote:\n> Thanks for noticing.\n> \n> This is not like rev-list where we walk all over the map of\n> ancestry graph, so it might be a simpler and better to keep\n> the buffer than to keep duplicate copies of pieces.\n\nI would rather not do that in any new code since it's gonna be a problem\nif you use this outside of the standalone command as part of libgit.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nThe meaning of Stonehenge in Traflamadorian, when viewed from above, is:\n\"Replacement part being rushed with all possible speed.\"\n"}]}