summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-07-18 04:53:14 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-07-18 04:53:14 (GMT)
commit85d2d59760e5de7f288109cb278eb91da0d5f9bf (patch)
tree1bd8c58da334fce06da06b975d5553d84b294512 /git-gui.sh
parentc52c94524bdf9bbe515137b7f3f0240bc10a7f63 (diff)
downloadgit-85d2d59760e5de7f288109cb278eb91da0d5f9bf.zip
git-85d2d59760e5de7f288109cb278eb91da0d5f9bf.tar.gz
git-85d2d59760e5de7f288109cb278eb91da0d5f9bf.tar.bz2
git-gui: Allow browser subcommand to start in subdirectory
Like our blame subcommand the browser subcommand now accepts both a revision and a path, just a revision or just a path. This way the user can start the subcommand on any branch, or on any subtree. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh46
1 files changed, 20 insertions, 26 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 9ddb61e..267d606 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1976,27 +1976,7 @@ proc usage {} {
# -- Not a normal commit type invocation? Do that instead!
#
switch -- $subcommand {
-browser {
- set subcommand_args {rev?}
- switch [llength $argv] {
- 0 { load_current_branch }
- 1 {
- set current_branch [lindex $argv 0]
- if {[regexp {^[0-9a-f]{1,39}$} $current_branch]} {
- if {[catch {
- set current_branch \
- [git rev-parse --verify $current_branch]
- } err]} {
- puts stderr $err
- exit 1
- }
- }
- }
- default usage
- }
- browser::new $current_branch
- return
-}
+browser -
blame {
set subcommand_args {rev? path}
if {$argv eq {}} usage
@@ -2044,12 +2024,26 @@ blame {
set current_branch $head
}
- if {$head eq {} && ![file exists $path]} {
- puts stderr "fatal: cannot stat path $path: No such file or directory"
- exit 1
+ switch -- $subcommand {
+ browser {
+ if {$head eq {}} {
+ if {$path ne {} && [file isdirectory $path]} {
+ set head $current_branch
+ } else {
+ set head $path
+ set path {}
+ }
+ }
+ browser::new $head $path
+ }
+ blame {
+ if {$head eq {} && ![file exists $path]} {
+ puts stderr "fatal: cannot stat path $path: No such file or directory"
+ exit 1
+ }
+ blame::new $head $path
+ }
}
-
- blame::new $head $path
return
}
citool -