@matheusbsbs / matheus-bagliano / commits / 5be25a8f85
Fork 0

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>

Paul Mackerras committed Jan 10, 2008 at 21:44 UTC 5be25a8f8560a88145ea31f0ca530393ee2094da
1 file changed +6 -3
gitk
+6 -3
@@ -110,7 +110,7 @@ proc start_rev_list {view} {
110 $viewargs($view)]
111 set viewincl($view) {}
112 foreach c $commits {
113 - if {![string match "^*" $c]} {
113 + if {[regexp {^[0-9a-fA-F]{40}$} $c]} {
114 lappend viewincl($view) $c
115 }
116 }
@@ -187,14 +187,17 @@ proc updatecommits {} {
187 $viewargs($view)]
188 set pos {}
189 set neg {}
190 + set flags {}
191 foreach c $commits {
192 if {[string match "^*" $c]} {
193 lappend neg $c
193 - } else {
194 + } elseif {[regexp {^[0-9a-fA-F]{40}$} $c]} {
195 if {!([info exists varcid($view,$c)] ||
196 [lsearch -exact $viewincl($view) $c] >= 0)} {
197 lappend pos $c
198 }
199 + } else {
200 + lappend flags $c
201 }
202 }
203 if {$pos eq {}} {
@@ -206,7 +209,7 @@ proc updatecommits {} {
209 set viewincl($view) [concat $viewincl($view) $pos]
210 if {[catch {
211 set fd [open [concat | git log --no-color -z --pretty=raw --parents \
209 - --boundary $pos $neg "--" $viewfiles($view)] r]
212 + --boundary $pos $neg $flags "--" $viewfiles($view)] r]
213 } err]} {
214 error_popup "Error executing git log: $err"
215 exit 1