Commits

Anonymous committed 756d846

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 <spearce@spearce.org>

Comments (0)

Files changed (1)

 ##
 ## version check
 
+if {{--version} eq $argv || {version} eq $argv} {
+	puts "git-gui version $appvers"
+	exit
+}
+
 set req_maj 1
 set req_min 5
 
 enable_option transport
 
 switch -- $subcommand {
---version -
-version -
 browser -
 blame {
 	disable_option multicommit
 # -- Not a normal commit type invocation?  Do that instead!
 #
 switch -- $subcommand {
---version -
-version {
-	puts "git-gui version $appvers"
-	exit
-}
 browser {
 	if {[llength $argv] != 1} {
 		puts stderr "usage: $argv0 browser commit"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.