Skip to content

Commit 756d846

Browse files
committed
git-gui: Allow 'git gui version' outside of a repository
I got a little surprise one day when I tried to run 'git gui version' outside of a Git repository to determine what version of git-gui was installed on that system. Turns out we were doing the repository check long before we got around to command line argument handling. We now look to see if the only argument we have been given is 'version' or '--version', and if so, print out the version and exit immediately; long before we consider looking at the Git version or working directory. This way users can still get to the git-gui version number even if Git's version cannot be read. Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent bb616dd commit 756d846

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

git-gui.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ proc ask_popup {msg} {
299299
##
300300
## version check
301301

302+
if {{--version} eq $argv || {version} eq $argv} {
303+
puts "git-gui version $appvers"
304+
exit
305+
}
306+
302307
set req_maj 1
303308
set req_min 5
304309

@@ -5054,8 +5059,6 @@ enable_option branch
50545059
enable_option transport
50555060

50565061
switch -- $subcommand {
5057-
--version -
5058-
version -
50595062
browser -
50605063
blame {
50615064
disable_option multicommit
@@ -5426,11 +5429,6 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
54265429
# -- Not a normal commit type invocation? Do that instead!
54275430
#
54285431
switch -- $subcommand {
5429-
--version -
5430-
version {
5431-
puts "git-gui version $appvers"
5432-
exit
5433-
}
54345432
browser {
54355433
if {[llength $argv] != 1} {
54365434
puts stderr "usage: $argv0 browser commit"

0 commit comments

Comments
 (0)