{"thread":{"id":"26930","subject":"[tig PATCH] blame broken in recent master","startedAt":"2011-03-30T14:24:30Z","lastAt":"2011-04-09T19:00:18Z","messageCount":2,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"164690","messageId":"20110330142430.GA32523@sigill.intra.peff.net","threadId":"26930","inReplyTo":null,"subject":"[tig PATCH] blame broken in recent master","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-03-30T14:24:30Z","receivedAt":"2011-03-30T14:24:30Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"As of 730ae86 (Rename prepare_io to prepare_update and make it more\nspecialized, 2011-03-16), \"tig blame\" finds no actual blamed commits.\n\nThe problem seems to be that prepare_update switched from calling\nformat_argv to argv_copy, and we end up calling \"git blame %(blameargs)\"\nwithout \"%(blameargs)\" expanded. Blame looks like the only caller which\nactually uses a placeholder, so it is the only one broken.\n\nThe patch below fixes it for me, but it seems like a hack. I'm not\nreally sure why the switch in prepare_update was made; clearly it is\npart of some refactoring, but I'm not sure what your larger plans were.\n\n---\ndiff --git a/tig.c b/tig.c\nindex c1e5270..9ef61d3 100644\n--- a/tig.c\n+++ b/tig.c\n@@ -4240,15 +4240,20 @@ blame_read_file(struct view *view, const char *line, bool *read_file)\n \t\t\t\"git\", \"blame\", \"%(blameargs)\", \"--incremental\",\n \t\t\t\t*opt_ref ? opt_ref : \"--incremental\", \"--\", opt_file, NULL\n \t\t};\n+\t\tconst char **formatted_argv = NULL;\n+\n+\t\tformat_argv(&formatted_argv, blame_argv, FALSE, !view->prev);\n \n \t\tif (view->lines == 0 && !view->prev)\n \t\t\tdie(\"No blame exist for %s\", view->vid);\n \n-\t\tif (view->lines == 0 || !start_update(view, blame_argv, opt_cdup)) {\n+\t\tif (view->lines == 0 || !start_update(view, formatted_argv, opt_cdup)) {\n \t\t\treport(\"Failed to load blame data\");\n+\t\t\targv_free(formatted_argv);\n \t\t\treturn TRUE;\n \t\t}\n \n+\t\targv_free(formatted_argv);\n \t\t*read_file = FALSE;\n \t\treturn FALSE;\n \n"},{"id":"165496","messageId":"20110409190018.GA31579@sigill.intra.peff.net","threadId":"26930","inReplyTo":"BANLkTinJm4Zp18D_M=TTLSDr6jBLcPB9RQ@mail.gmail.com","subject":"Re: [tig PATCH] blame broken in recent master","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-04-09T19:00:18Z","receivedAt":"2011-04-09T19:00:18Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Apr 09, 2011 at 02:37:38PM -0400, Jonas Fonseca wrote:\n\n> On Wed, Mar 30, 2011 at 10:24, Jeff King <peff@peff.net> wrote:\n> \n> > As of 730ae86 (Rename prepare_io to prepare_update and make it more\n> > specialized, 2011-03-16), \"tig blame\" finds no actual blamed commits.\n> >\n> > The problem seems to be that prepare_update switched from calling\n> > format_argv to argv_copy, and we end up calling \"git blame %(blameargs)\"\n> > without \"%(blameargs)\" expanded. Blame looks like the only caller which\n> > actually uses a placeholder, so it is the only one broken.\n> >\n> > The patch below fixes it for me, but it seems like a hack. I'm not\n> > really sure why the switch in prepare_update was made; clearly it is\n> > part of some refactoring, but I'm not sure what your larger plans were.\n> \n> I have fixed the issue in the current master.\n\nThanks, works perfectly here.\n\n-Peff\n"}]}