# [tig PATCH] blame broken in recent master

2 messages from 2011-03-30 to 2011-04-09. Participants: Jeff King.
Thread: https://gitlist.dev/t/26930

## Jeff King, 2011-03-30 14:24

Subject: [tig PATCH] blame broken in recent master
Message-ID: <20110330142430.GA32523@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110330142430.GA32523%40sigill.intra.peff.net

```
As of 730ae86 (Rename prepare_io to prepare_update and make it more
specialized, 2011-03-16), "tig blame" finds no actual blamed commits.

The problem seems to be that prepare_update switched from calling
format_argv to argv_copy, and we end up calling "git blame %(blameargs)"
without "%(blameargs)" expanded. Blame looks like the only caller which
actually uses a placeholder, so it is the only one broken.

The patch below fixes it for me, but it seems like a hack. I'm not
really sure why the switch in prepare_update was made; clearly it is
part of some refactoring, but I'm not sure what your larger plans were.

---
diff --git a/tig.c b/tig.c
index c1e5270..9ef61d3 100644
--- a/tig.c
+++ b/tig.c
@@ -4240,15 +4240,20 @@ blame_read_file(struct view *view, const char *line, bool *read_file)
 			"git", "blame", "%(blameargs)", "--incremental",
 				*opt_ref ? opt_ref : "--incremental", "--", opt_file, NULL
 		};
+		const char **formatted_argv = NULL;
+
+		format_argv(&formatted_argv, blame_argv, FALSE, !view->prev);
 
 		if (view->lines == 0 && !view->prev)
 			die("No blame exist for %s", view->vid);
 
-		if (view->lines == 0 || !start_update(view, blame_argv, opt_cdup)) {
+		if (view->lines == 0 || !start_update(view, formatted_argv, opt_cdup)) {
 			report("Failed to load blame data");
+			argv_free(formatted_argv);
 			return TRUE;
 		}
 
+		argv_free(formatted_argv);
 		*read_file = FALSE;
 		return FALSE;
 

```

## Jeff King, 2011-04-09 19:00

Subject: Re: [tig PATCH] blame broken in recent master
Message-ID: <20110409190018.GA31579@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110409190018.GA31579%40sigill.intra.peff.net
In-Reply-To: <BANLkTinJm4Zp18D_M=TTLSDr6jBLcPB9RQ@mail.gmail.com>

```
On Sat, Apr 09, 2011 at 02:37:38PM -0400, Jonas Fonseca wrote:

> On Wed, Mar 30, 2011 at 10:24, Jeff King <peff@peff.net> wrote:
> 
> > As of 730ae86 (Rename prepare_io to prepare_update and make it more
> > specialized, 2011-03-16), "tig blame" finds no actual blamed commits.
> >
> > The problem seems to be that prepare_update switched from calling
> > format_argv to argv_copy, and we end up calling "git blame %(blameargs)"
> > without "%(blameargs)" expanded. Blame looks like the only caller which
> > actually uses a placeholder, so it is the only one broken.
> >
> > The patch below fixes it for me, but it seems like a hack. I'm not
> > really sure why the switch in prepare_update was made; clearly it is
> > part of some refactoring, but I'm not sure what your larger plans were.
> 
> I have fixed the issue in the current master.

Thanks, works perfectly here.

-Peff

```
