summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-06-27 10:04:26 (GMT)
committerPaul Mackerras <paulus@samba.org>2005-06-27 10:04:26 (GMT)
commit7e952e797c98fca1853463247bcaf3b8d58bc36c (patch)
tree149a6ef18a269ef8dbcf9df40886d1f637eae0e7
parent74daedb62cd2aa0420ee7fac5180246508867679 (diff)
downloadgit-7e952e797c98fca1853463247bcaf3b8d58bc36c.zip
git-7e952e797c98fca1853463247bcaf3b8d58bc36c.tar.gz
git-7e952e797c98fca1853463247bcaf3b8d58bc36c.tar.bz2
Fix a bug where we would corrupt the stuff read from git-rev-list.
If we have a very long commit message, and we end up getting a bufferfull of data from git-rev-list that all belongs to one commit, we ended up throwing away the data from a previous read that should have been included. The result was a error message about not being able to parse the output of git-rev-list. Also, if the git-rev-list output that we can't parse is long, only put the first 80 chars in the error message. Otherwise we end up with an enormous error window.
-rwxr-xr-xgitk9
1 files changed, 7 insertions, 2 deletions
diff --git a/gitk b/gitk
index 0e95d9d..e72c9c7 100755
--- a/gitk
+++ b/gitk
@@ -81,16 +81,21 @@ to allow selection of commits to be displayed.)}
while 1 {
set i [string first "\0" $stuff $start]
if {$i < 0} {
- set leftover [string range $stuff $start end]
+ append leftover [string range $stuff $start end]
return
}
set cmit [string range $stuff $start [expr {$i - 1}]]
if {$start == 0} {
set cmit "$leftover$cmit"
+ set leftover {}
}
set start [expr {$i + 1}]
if {![regexp {^([0-9a-f]{40})\n} $cmit match id]} {
- error_popup "Can't parse git-rev-list output: {$cmit}"
+ set shortcmit $cmit
+ if {[string length $shortcmit] > 80} {
+ set shortcmit "[string range $shortcmit 0 80]..."
+ }
+ error_popup "Can't parse git-rev-list output: {$shortcmit}"
exit 1
}
set cmit [string range $cmit 41 end]