summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9e211ea)
raw | patch | inline | side by side (parent: 9e211ea)
author | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 10 May 2010 02:24:44 +0000 (22:24 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 30 May 2010 04:40:53 +0000 (00:40 -0400) |
tig.c | patch | blob | history |
index a31d18eb23bd1213610bc94fe78f09e2836bff8d..32f4b648493b2bbfb4aacf16de78ff0240f22e08 100644 (file)
--- a/tig.c
+++ b/tig.c
}
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);
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:
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);
}
{
switch (request) {
case REQ_EDIT:
- open_blob_editor();
+ open_blob_editor(view->vid);
return REQ_NONE;
default:
return pager_request(view, request, line);