Skip to content

Commit 8938410

Browse files
committed
git-gui: Trim trailing slashes from untracked submodule names
Oddly enough `git ls-files --others` supplies us the name of an untracked submodule by including the trailing slash but that same git version will not accept the name with a trailing slash through `git update-index --stdin`. Stripping off that final slash character before loading it into our file lists allows git-gui to stage changes to submodules just like any other file. This change should give git-gui users some basic submodule support, but it is strictly at the plumbing level as we do not actually know about calling the git-submodule porcelain that is a recent addition to git 1.5.3. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
1 parent 3b9dfde commit 8938410

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

git-gui.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,11 @@ proc read_ls_others {fd after} {
10101010
set pck [split $buf_rlo "\0"]
10111011
set buf_rlo [lindex $pck end]
10121012
foreach p [lrange $pck 0 end-1] {
1013-
merge_state [encoding convertfrom $p] ?O
1013+
set p [encoding convertfrom $p]
1014+
if {[string index $p end] eq {/}} {
1015+
set p [string range $p 0 end-1]
1016+
}
1017+
merge_state $p ?O
10141018
}
10151019
rescan_done $fd buf_rlo $after
10161020
}

0 commit comments

Comments
 (0)