Code

Refuse to open deleted files from the status and stage views
authorJonas Fonseca <fonseca@diku.dk>
Sun, 16 Nov 2008 20:40:17 +0000 (21:40 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Sun, 16 Nov 2008 20:41:02 +0000 (21:41 +0100)
NEWS
tig.c

diff --git a/NEWS b/NEWS
index 47b5af8f592744b80d6411938d062bd6a267f745..5e2cae82a039b33b1095b4cd414e90171ede588a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,7 +15,7 @@ Bug fixes:
  - Separate blame revision and file argument by "--" to avoid problems.
  - Main view: fix redrawing of the last commit wrt. the revision graph.
  - Fix waiting for input after executing a run request in pager mode.
- - Status & stage view: refuse to open directories.
+ - Status & stage view: refuse to open directories and deleted files.
 
 tig-0.12.1
 ----------
diff --git a/tig.c b/tig.c
index 041e282fcf2e677bcea296b7fe01669091b90838..db6bde69f1b8062fd0b45f306d12c762b87fc631 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -4438,6 +4438,10 @@ status_request(struct view *view, enum request request, struct line *line)
        case REQ_EDIT:
                if (!status)
                        return request;
+               if (status->status == 'D') {
+                       report("File has been deleted.");
+                       return REQ_NONE;
+               }
 
                open_editor(status->status != '?', status->new.name);
                break;
@@ -4756,6 +4760,10 @@ stage_request(struct view *view, enum request request, struct line *line)
        case REQ_EDIT:
                if (!stage_status.new.name[0])
                        return request;
+               if (stage_status.status == 'D') {
+                       report("File has been deleted.");
+                       return REQ_NONE;
+               }
 
                open_editor(stage_status.status != '?', stage_status.new.name);
                break;