diff options
| author | Mark Levedahl <mlevedahl@gmail.com> | 2025-08-20 11:31:43 -0400 |
|---|---|---|
| committer | Johannes Sixt <j6t@kdbg.org> | 2025-08-21 20:35:26 +0200 |
| commit | e369dbeb794a21c381dd7b06dac880763140bfb3 (patch) | |
| tree | 2b6312fc07fdd25c7732709315f52c457a8ece79 | |
| parent | Merge branch 'cb/no-tcl86-on-macos' (diff) | |
| download | git-e369dbeb794a21c381dd7b06dac880763140bfb3.tar.gz git-e369dbeb794a21c381dd7b06dac880763140bfb3.zip | |
git-gui: simplify PATH de-duplication
git-gui since 8fe7861c51 ("git-gui: assure PATH has only absolute
elements.", 2025-04-11) uses a list to maintain order and a dict to
detect duplicated elements without quadratic complexity. But, Tcl's
dict explicitly maintains keys in the order first added, thus the list
is not needed. Simplify the code.
Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
| -rwxr-xr-x | git-gui.sh | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/git-gui.sh b/git-gui.sh index a931d7f7c9..9e0c47f842 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -103,7 +103,6 @@ if {[is_Windows]} { set _path_sep {:} } -set _search_path {} set _path_seen [dict create] foreach p [split $env(PATH) $_path_sep] { # Keep only absolute paths, getting rid of ., empty, etc. @@ -112,12 +111,9 @@ foreach p [split $env(PATH) $_path_sep] { } # Keep only the first occurence of any duplicates. set norm_p [file normalize $p] - if {[dict exists $_path_seen $norm_p]} { - continue - } dict set _path_seen $norm_p 1 - lappend _search_path $norm_p } +set _search_path [dict keys $_path_seen] unset _path_seen set env(PATH) [join $_search_path $_path_sep] |
