From a19348e27860acac456f74cc414625d9d7fe7ff1 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Wed, 3 Jan 2024 18:17:36 -0800 Subject: [PATCH] cmds: prevent StageUntracked from staging all files When the list of files to stage is empty then the Stage command, which is a base class of the StageUntracked command, will fallback to staging all (modified) files. This behavior is unwanted when dealing with untracked files. This is doubly-so when the user has `gui.displayuntracked = false` configured because the untracked file list will always be empty. Closes: #1371 Reported-by: @pkzc via github.com Signed-off-by: David Aguilar --- CHANGES.rst | 4 ++++ cola/cmds.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 112121fa..eb3a769c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,10 @@ Usability, bells and whistles * "Stage Changed Files To Commit" was added to the available toolbar actions. (`#1371 `_) +* "Stage Untracked" no longer stages modified files when the list of + untracked files to stage is empty. + (`#1371 `_) + * `Ctrl + Space` can now be used to display the autocomplete options in input fields that provide autocompletion. diff --git a/cola/cmds.py b/cola/cmds.py index d0b4e5c1..d246e24a 100644 --- a/cola/cmds.py +++ b/cola/cmds.py @@ -2657,6 +2657,10 @@ class StageUntracked(StageCarefully): def init_paths(self): self.paths = self.model.untracked + def stage_all(self): + """Disable the stage_all() behavior for untracked files""" + return (0, '', '') + class StageModifiedAndUntracked(StageCarefully): """Stage all untracked files.""" -- 2.11.4.GIT