@matheusbsbs / matheus-bagliano / commits / 6e4ba05c7f
Fork 0

git-gui: Correct starting of git-remote to handle -w option

Current versions of git-remote apparently are passing the -w option to Perl as part of the shbang line: #!/usr/bin/perl -w this caused a problem in git-gui and gave the user a Tcl error with the message: "git-remote not supported: #!/usr/bin/perl -w". The fix for this is to treat the shbang line as a Tcl list and look at the first element only for guessing the executable name. Once we know the executable name we use the remaining elements (if any exist) as arguments to the executable, before the script filename. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Sep 2, 2007 at 15:19 UTC 6e4ba05c7fee0d0140e2057b63f5ca4eea9a6053
1 file changed +2 -2
git-gui.sh
+2 -2
@@ -261,7 +261,7 @@ proc _git_cmd {name} {
261 set s [gets $f]
262 close $f
263
264 - switch -glob -- $s {
264 + switch -glob -- [lindex $s 0] {
265 #!*sh { set i sh }
266 #!*perl { set i perl }
267 #!*python { set i python }
@@ -275,7 +275,7 @@ proc _git_cmd {name} {
275 if {$interp eq {}} {
276 error "git-$name requires $i (not in PATH)"
277 }
278 - set v [list $interp $p]
278 + set v [concat [list $interp] [lrange $s 1 end] [list $p]]
279 } else {
280 # Assume it is builtin to git somehow and we
281 # aren't actually able to see a file for it.