summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ed9609d)
raw | patch | inline | side by side (parent: ed9609d)
author | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 1 Jun 2010 12:19:17 +0000 (08:19 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 1 Jun 2010 13:01:32 +0000 (09:01 -0400) |
tig.c | patch | blob | history |
index eaff28cdc04f98bdbffbd4f8e89b8da8e054feb0..08ef0b4e14e5e964b46b2ece681720249eab8d4c 100644 (file)
--- a/tig.c
+++ b/tig.c
* reading output from git-blame.
*/
-static const char *blame_head_argv[] = {
- "git", "blame", "--incremental", "--", "%(file)", NULL
-};
-
-static const char *blame_ref_argv[] = {
- "git", "blame", "--incremental", "%(ref)", "--", "%(file)", NULL
-};
-
-static const char *blame_cat_file_argv[] = {
- "git", "cat-file", "blob", "%(ref):%(file)", NULL
-};
-
struct blame_commit {
char id[SIZEOF_REV]; /* SHA1 ID. */
char title[128]; /* First line of the commit message. */
}
if (*opt_ref || !io_open(&view->io, "%s%s", opt_cdup, opt_file)) {
- if (!io_run_rd(&view->io, blame_cat_file_argv, opt_cdup, FORMAT_ALL))
+ const char *blame_cat_file_argv[] = {
+ "git", "cat-file", "blob", path, NULL
+ };
+
+ if (!string_format(path, "%s:%s", opt_ref, opt_file) ||
+ !io_run_rd(&view->io, blame_cat_file_argv, opt_cdup, FORMAT_NONE))
return FALSE;
}
blame_read_file(struct view *view, const char *line, bool *read_file)
{
if (!line) {
- const char **argv = *opt_ref ? blame_ref_argv : blame_head_argv;
+ const char *blame_argv[] = {
+ "git", "blame", "--incremental",
+ *opt_ref ? opt_ref : "--incremental", "--", opt_file, NULL
+ };
struct io io = {};
if (view->lines == 0 && !view->prev)
die("No blame exist for %s", view->vid);
- if (view->lines == 0 || !io_run_rd(&io, argv, opt_cdup, FORMAT_ALL)) {
+ if (view->lines == 0 || !io_run_rd(&io, blame_argv, opt_cdup, FORMAT_NONE)) {
report("Failed to load blame data");
return TRUE;
}