From e83bbbdef8e8b59e5397fba415de615031d314a1 Mon Sep 17 00:00:00 2001 From: Thomas Koutcher Date: Fri, 9 Feb 2024 19:44:16 +0100 Subject: [PATCH] Fix untracked changes staging behaviour in plain stage view * Close the view after staging an untracked file. * Fix issue with 11238ef7fb35ab769cf673c1f90b99bc634c7d13 and maximized views to allow the use of WATCH_INDEX trigger. --- NEWS.adoc | 2 +- src/stage.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 9f24fedca..879c44848 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -26,7 +26,7 @@ Bug fixes: - Fix readline echo when stdin is redirected. (#1229) - Fix tig blame --reverse. (#1300) - Fix status view lockup. - - Fix chunk staging behaviour in plain stage view. + - Fix untracked changes and chunk staging behaviour in plain stage view. tig-2.5.8 --------- diff --git a/src/stage.c b/src/stage.c index d198b843d..348cea362 100644 --- a/src/stage.c +++ b/src/stage.c @@ -283,9 +283,7 @@ stage_update(struct view *view, struct line *line, update_t update_type) return false; } - watch_apply(&view->watch, stage_line_type == LINE_STAT_STAGED - ? WATCH_INDEX_UNSTAGED_YES | WATCH_INDEX_UNTRACKED_YES - : WATCH_INDEX_STAGED_YES); + watch_apply(&view->watch, WATCH_INDEX); return true; } @@ -684,10 +682,11 @@ stage_request(struct view *view, enum request request, struct line *line) * stage view if it doesn't. */ if (view->parent && !stage_exists(view, &stage_status, stage_line_type)) { stage_line_type = 0; - return view->parent == &status_view + return view->parent == &status_view && view_is_displayed(view->parent) ? view_request(view->parent, REQ_ENTER) : REQ_VIEW_CLOSE; - } + } else if (stage_line_type == LINE_STAT_UNTRACKED) + return REQ_VIEW_CLOSE; refresh_view(view);