git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-gui: deal with unknown files when pressing the "Stage Changed" button

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
May 27, 2011, 15:40 UTC
Message-ID
<20110527154020.GA2273@book.hvoigt.net>

As a shortcut the "Stage Changed" button can be used to stage all current changes in the worktree which are not set to ignore. Previously unknown files would be ignored. The user might want to say: "Just save everything in my worktree". To support this workflow we now ask whether the user also wants to stage the unknown files if there are some present.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
 lib/index.tcl |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/lib/index.tcl b/lib/index.tcl
index 5d7bbf2..e38b647 100644
--- a/lib/index.tcl
+++ b/lib/index.tcl
@@ -356,12 +356,21 @@ proc do_add_all {} {
 	global file_states
 
 	set paths [list]
+	set unknown_paths [list]
 	foreach path [array names file_states] {
 		switch -glob -- [lindex $file_states($path) 0] {
 		U? {continue}
 		?M -
 		?T -
 		?D {lappend paths $path}
+		?O {lappend unknown_paths $path}
+		}
+	}
+	if {[llength $unknown_paths]} {
+		set reply [ask_popup [mc "There are unknown files do you also want
+to stage those?"]]
+		if {$reply} {
+			set paths [concat $paths $unknown_paths]
 		}
 	}
 	add_helper {Adding all changed files} $paths
-- 
1.7.5.1.219.g4c6b2
Message 1 of 1 in “git-gui: deal with unknown files when pressing the "Stage Changed" button”
  1. git-gui: deal with unknown files when pressing the "Stage Changed" buttonHeiko Voigt, May 27, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.