aboutsummaryrefslogtreecommitdiff
path: root/gitk
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@dorrigo.(none)>2005-07-18 12:16:35 -0400
committerPaul Mackerras <paulus@dorrigo.(none)>2005-07-18 12:16:35 -0400
commitf3b8b3ce3ec672ac096bb1431ea7e609f4624f45 (patch)
treeadf0d8ae30c68347d1e54d85b2c33e7296bdc3ff /gitk
parent4f2c2642ca7331e4950e8d6c1d112eef1918c980 (diff)
downloadgit-f3b8b3ce3ec672ac096bb1431ea7e609f4624f45.tar.gz
git-f3b8b3ce3ec672ac096bb1431ea7e609f4624f45.tar.xz
Allow short SHA1 IDs in the SHA1 entry field.
Diffstat (limited to 'gitk')
-rwxr-xr-xgitk19
1 files changed, 18 insertions, 1 deletions
diff --git a/gitk b/gitk
index d994eec91..9e52a3579 100755
--- a/gitk
+++ b/gitk
@@ -1949,18 +1949,35 @@ proc sha1change {n1 n2 op} {
proc gotocommit {} {
global sha1string currentid idline tagids
+ global lineid numcommits
+
if {$sha1string == {}
|| ([info exists currentid] && $sha1string == $currentid)} return
if {[info exists tagids($sha1string)]} {
set id $tagids($sha1string)
} else {
set id [string tolower $sha1string]
+ if {[regexp {^[0-9a-f]{4,39}$} $id]} {
+ set matches {}
+ for {set l 0} {$l < $numcommits} {incr l} {
+ if {[string match $id* $lineid($l)]} {
+ lappend matches $lineid($l)
+ }
+ }
+ if {$matches ne {}} {
+ if {[llength $matches] > 1} {
+ error_popup "Short SHA1 id $id is ambiguous"
+ return
+ }
+ set id [lindex $matches 0]
+ }
+ }
}
if {[info exists idline($id)]} {
selectline $idline($id)
return
}
- if {[regexp {^[0-9a-fA-F]{40}$} $sha1string]} {
+ if {[regexp {^[0-9a-fA-F]{4,}$} $sha1string]} {
set type "SHA1 id"
} else {
set type "Tag"