summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1bace42)
raw | patch | inline | side by side (parent: 1bace42)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 19 Sep 2007 00:50:12 +0000 (02:50 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 19 Sep 2007 00:55:46 +0000 (02:55 +0200) |
.. by prefixing the file path with opt_cdup if requested.
tig.c | patch | blob | history |
index ac2aba0f1b26da9be2e928a88f2fb51ff6c5c59d..3811a228aebbd6ce018cef41600b22b491acdcd9 100644 (file)
--- a/tig.c
+++ b/tig.c
}
static void
-open_editor(struct view *view, char *file)
+open_editor(struct view *view, bool from_root, char *file)
{
char cmd[SIZEOF_STR];
char file_sq[SIZEOF_STR];
char *editor;
+ char *prefix = from_root ? opt_cdup : "";
editor = getenv("GIT_EDITOR");
if (!editor && *opt_editor)
editor = "vi";
if (sq_quote(file_sq, 0, file) < sizeof(file_sq) &&
- string_format(cmd, "%s %s", editor, file_sq)) {
+ string_format(cmd, "%s %s%s", editor, prefix, file_sq)) {
def_prog_mode(); /* save current tty modes */
endwin(); /* restore original tty modes */
system(cmd);
if (!status)
return request;
- open_editor(view, status->name);
+ open_editor(view, status->status != '?', status->name);
break;
case REQ_ENTER:
if (!stage_status.name[0])
return request;
- open_editor(view, stage_status.name);
+ open_editor(view, stage_status.status != '?', stage_status.name);
break;
case REQ_ENTER: