Skip to content

Commit

Permalink
Fix untracked changes staging behaviour in plain stage view
Browse files Browse the repository at this point in the history
* Close the view after staging an untracked file.

* Fix issue with 11238ef and maximized
  views to allow the use of WATCH_INDEX trigger.
  • Loading branch information
koutcher committed Feb 9, 2024
1 parent afea945 commit e83bbbd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------
Expand Down
9 changes: 4 additions & 5 deletions src/stage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit e83bbbd

Please sign in to comment.