From 47160e2fd648baf177f4949a6b69455824f1d618 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sun, 9 May 2010 22:24:44 -0400 Subject: [PATCH] Make open_blob_editor use its own argv show and take blob ID as an argument --- tig.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tig.c b/tig.c index a31d18e..32f4b64 100644 --- a/tig.c +++ b/tig.c @@ -4662,14 +4662,15 @@ tree_draw(struct view *view, struct line *line, unsigned int lineno) } static void -open_blob_editor() +open_blob_editor(const char *id) { + const char *blob_argv[] = { "git", "cat-file", "blob", id, NULL }; char file[SIZEOF_STR] = "/tmp/tigblob.XXXXXX"; int fd = mkstemp(file); if (fd == -1) report("Failed to create temporary file"); - else if (!io_run_append(blob_ops.argv, FORMAT_ALL, fd)) + else if (!io_run_append(blob_argv, FORMAT_NONE, fd)) report("Failed to save blob data to file"); else open_editor(file); @@ -4681,6 +4682,7 @@ static enum request tree_request(struct view *view, enum request request, struct line *line) { enum open_flags flags; + struct tree_entry *entry = line->data; switch (request) { case REQ_VIEW_BLAME: @@ -4696,7 +4698,7 @@ tree_request(struct view *view, enum request request, struct line *line) if (line->type != LINE_TREE_FILE) { report("Edit only supported for files"); } else if (!is_head_commit(view->vid)) { - open_blob_editor(); + open_blob_editor(entry->id); } else { open_editor(opt_file); } @@ -4847,7 +4849,7 @@ blob_request(struct view *view, enum request request, struct line *line) { switch (request) { case REQ_EDIT: - open_blob_editor(); + open_blob_editor(view->vid); return REQ_NONE; default: return pager_request(view, request, line); -- 2.30.2