Skip to content

Commit

Permalink
git-gui: add support for filenames starting with tilde
Browse files Browse the repository at this point in the history
prevent TCL from doing tilde expansion on literal filenames.

This fixes git-for-windows/git#4349

Signed-off-by: Matthias Aßhauer <[email protected]>
  • Loading branch information
rimrul committed Mar 23, 2023
1 parent a5005de commit bf0ac32
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,7 @@ proc do_explore {} {
# Open file relative to the working tree by the default associated app.
proc do_file_open {file} {
global _gitworktree
if {[string index $file 0] eq {~}} {set file ./$file}
set explorer [get_explorer]
set full_file_path [file join $_gitworktree $file]
exec $explorer [file nativename $full_file_path] &
Expand Down
1 change: 1 addition & 0 deletions lib/diff.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ proc show_other_diff {path w m cont_info} {
set max_sz 100000
set type unknown
if {[catch {
if {[string index $path 0] eq {~}} {set path ./$path}
set type [file type $path]
switch -- $type {
directory {
Expand Down
2 changes: 1 addition & 1 deletion lib/index.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ proc delete_helper {path_list path_index deletion_errors batch_size \

set path [lindex $path_list $path_index]

set deletion_failed [catch {file delete -- $path} deletion_error]
set deletion_failed [catch {file delete -- ./$path} deletion_error]

if {$deletion_failed} {
lappend deletion_errors [list "$deletion_error"]
Expand Down

0 comments on commit bf0ac32

Please sign in to comment.