Code

Fix regression from "Improve staging of diff chunks"
authorJonas Fonseca <fonseca@diku.dk>
Thu, 10 Apr 2008 21:51:57 +0000 (23:51 +0200)
committerJonas Fonseca <fonseca@diku.dk>
Thu, 10 Apr 2008 21:51:57 +0000 (23:51 +0200)
In commit 234918423a4fac44375317e6c9e7ee54ea09379c the change to
stage_update reads:

 static bool
 stage_update(struct view *view, struct line *line)
 {
-       if (!opt_no_head && stage_line_type != LINE_STAT_UNTRACKED &&
-           (line->type == LINE_DIFF_CHUNK || !stage_status.status)) {
-               if (!stage_update_chunk(view, line)) {

where the !stage_status.status part was meant to match whole sections.
Reinstate this behavior so that pressing 'u' when in the stage view for
a section of changes it will stage all changed files in that section.

tig.c

diff --git a/tig.c b/tig.c
index 83523de419bc34c1036a014881bb3629f7d8c52d..2fa9018225db1e28b515e52dd1ac936de740e97b 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -4548,6 +4548,18 @@ stage_update(struct view *view, struct line *line)
                        return FALSE;
                }
 
+       } else if (!stage_status.status) {
+               view = VIEW(REQ_VIEW_STATUS);
+
+               for (line = view->line; line < view->line + view->lines; line++)
+                       if (line->type == stage_line_type)
+                               break;
+
+               if (!status_update_files(view, line + 1)) {
+                       report("Failed to update files");
+                       return FALSE;
+               }
+
        } else if (!status_update_file(&stage_status, stage_line_type)) {
                report("Failed to update file");
                return FALSE;