summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-01-10 21:44:39 +1100
committerPaul Mackerras <paulus@samba.org>2008-01-10 21:44:39 +1100
commit5be25a8f8560a88145ea31f0ca530393ee2094da (patch)
treee7afb016440cf868c98217534e157ff1836693bf
parent6636b88ea127d2dc88b5d5872e29aec35acd2b6e (diff)
downloadgit-5be25a8f8560a88145ea31f0ca530393ee2094da.tar.gz
gitk: Fix handling of flag arguments
Despite the name, the --revs-only flag to git rev-parse doesn't make it output only revision IDs. It makes it output only arguments that are suitable for giving to git rev-list. So make start_rev_list and updatecommits cope with arguments output by git rev-parse that aren't revision IDs. This way we won't get an error when an argument such as "-300" has been given to gitk and the view is updated. Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-xgitk9
1 files changed, 6 insertions, 3 deletions
diff --git a/gitk b/gitk
index 0dacfdadf1..97d1be092a 100755
--- a/gitk
+++ b/gitk
@@ -110,7 +110,7 @@ proc start_rev_list {view} {
$viewargs($view)]
set viewincl($view) {}
foreach c $commits {
- if {![string match "^*" $c]} {
+ if {[regexp {^[0-9a-fA-F]{40}$} $c]} {
lappend viewincl($view) $c
}
}
@@ -187,14 +187,17 @@ proc updatecommits {} {
$viewargs($view)]
set pos {}
set neg {}
+ set flags {}
foreach c $commits {
if {[string match "^*" $c]} {
lappend neg $c
- } else {
+ } elseif {[regexp {^[0-9a-fA-F]{40}$} $c]} {
if {!([info exists varcid($view,$c)] ||
[lsearch -exact $viewincl($view) $c] >= 0)} {
lappend pos $c
}
+ } else {
+ lappend flags $c
}
}
if {$pos eq {}} {
@@ -206,7 +209,7 @@ proc updatecommits {} {
set viewincl($view) [concat $viewincl($view) $pos]
if {[catch {
set fd [open [concat | git log --no-color -z --pretty=raw --parents \
- --boundary $pos $neg "--" $viewfiles($view)] r]
+ --boundary $pos $neg $flags "--" $viewfiles($view)] r]
} err]} {
error_popup "Error executing git log: $err"
exit 1