summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 17d9c7e)
raw | patch | inline | side by side (parent: 17d9c7e)
author | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 28 Dec 2008 18:47:12 +0000 (13:47 -0500) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 28 Dec 2008 22:16:19 +0000 (17:16 -0500) |
Only supported for files in the currently checked out head.
Requested by Cyril Romain.
Requested by Cyril Romain.
NEWS | patch | blob | history | |
tig.c | patch | blob | history |
index 4d91c7eca9dce38ff9feb9957ead68d4efbf10c3..361e3b0399615991f0720e849994e3f1468c261b 100644 (file)
--- a/NEWS
+++ b/NEWS
- Display repository references in the sorted order: tags, heads,
tracked remotes, remotes.
- Add bash completion for blame.
+ - Tree view: edit files of the current branch.
Bug fixes:
index 6e5b0b4b9e131db046d322deacefada5079bb5b4..4216d8700846bc48ba6ca7f95699dd4e0e59b6c3 100644 (file)
--- a/tig.c
+++ b/tig.c
static FILE *opt_tty = NULL;
#define is_initial_commit() (!*opt_head_rev)
+#define is_head_commit(rev) (!strcmp((rev), "HEAD") || !strcmp(opt_head_rev, (rev)))
static enum request
parse_options(int argc, const char *argv[])
}
string_copy(opt_ref, view->vid);
- string_format(opt_file, "%s%s", opt_path, tree_path(line));
return request;
+ case REQ_EDIT:
+ if (line->type != LINE_TREE_FILE) {
+ report("Edit only supported for files");
+ } else if (!is_head_commit(view->vid)) {
+ report("Edit only supported for files in the current work tree");
+ } else {
+ open_editor(TRUE, opt_file);
+ }
+ return REQ_NONE;
+
case REQ_TREE_PARENT:
if (!*opt_path) {
/* quit view if at top of tree */
if (line->type == LINE_TREE_FILE) {
string_copy_rev(ref_blob, text);
+ string_format(opt_file, "%s%s", opt_path, tree_path(line));
} else if (line->type != LINE_TREE_DIR) {
return;