summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d41b43e)
raw | patch | inline | side by side (parent: d41b43e)
author | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 9 Jul 2007 01:19:59 +0000 (21:19 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 9 Jul 2007 02:34:51 +0000 (22:34 -0400) |
If the end-user feeds us an abbreviated SHA-1 on the command line for
`git gui browser` or `git gui blame` we now unabbreviate the value
through `git rev-parse` so that the title section of the blame or
browser window shows the user the complete SHA-1 as Git determined
it to be.
If the abbreviated value was ambiguous we now complain with the
standard error message(s) as reported by git-rev-parse --verify,
so that the user can understand what might be wrong and correct
their command line.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
`git gui browser` or `git gui blame` we now unabbreviate the value
through `git rev-parse` so that the title section of the blame or
browser window shows the user the complete SHA-1 as Git determined
it to be.
If the abbreviated value was ambiguous we now complain with the
standard error message(s) as reported by git-rev-parse --verify,
so that the user can understand what might be wrong and correct
their command line.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index ac043677c89ed6b94d3d40cf0078c33cd130bdd7..1844c9067cb7e7db220adc9aae1febd1ccfee1ad 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
set subcommand_args {rev?}
switch [llength $argv] {
0 { load_current_branch }
- 1 { set current_branch [lindex $argv 0] }
+ 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
if {$head eq {}} {
load_current_branch
} else {
+ if {[regexp {^[0-9a-f]{1,39}$} $head]} {
+ if {[catch {
+ set head [git rev-parse --verify $head]
+ } err]} {
+ puts stderr $err
+ exit 1
+ }
+ }
set current_branch $head
}