git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] gitview: Fix the blame interface.

From
Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Date
Jun 12, 2007, 17:35 UTC
Message-ID
<11816697213806-git-send-email-aneesh.kumar@gmail.com>

The async reading from the pipe was skipping some of the input lines. Fix the same by making sure that we add the partial content of the previous read to the newly read data.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
---
 contrib/gitview/gitview |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview
index 098cb01..286e974 100755
--- a/contrib/gitview/gitview
+++ b/contrib/gitview/gitview
@@ -352,6 +352,7 @@ class AnnotateWindow(object):
 		self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
 		self.window.set_border_width(0)
 		self.window.set_title("Git repository browser annotation window")
+		self.prev_read = ""
 
 		# Use two thirds of the screen by default
 		screen = self.window.get_screen()
@@ -401,7 +402,11 @@ class AnnotateWindow(object):
 	def data_ready(self, source, condition):
 		while (1):
 			try :
-				buffer = source.read(8192)
+				# A simple readline doesn't work
+				# a readline bug ??
+				buffer=""
+				buffer = source.read(100)
+
 			except:
 				# resource temporary not available
 				return True
@@ -411,6 +416,14 @@ class AnnotateWindow(object):
 				source.close()
 				return False
 
+			if (self.prev_read != ""):
+				buffer = self.prev_read + buffer
+				self.prev_read = ""
+
+			if (buffer[len(buffer) -1] != '\n'):
+				self.prev_read = buffer[buffer.rindex("\n"):(len(buffer))]
+				buffer = buffer[0:buffer.rindex("\n")]
+
 			for buff in buffer.split("\n"):
 				annotate_line = re.compile('^([0-9a-f]{40}) (.+) (.+) (.+)$')
 				m = annotate_line.match(buff)
@@ -419,7 +432,8 @@ class AnnotateWindow(object):
 					m = annotate_line.match(buff)
 					if not m:
 						continue
-					filename = m.group(2)
+					else:
+						filename = m.group(2)
 				else:
 					self.commit_sha1 = m.group(1)
 					self.source_line = int(m.group(2))
-- 
1.5.2.1.239.g75d8-dirty
Next: Aneesh Kumar K.V
Message 1 of 5 in “gitview: Fix the blame interface.”
  1. 1/2 gitview: Fix the blame interface.Aneesh Kumar K.V, Jun 12, 2007
  2. 2/2 gitview: run blame with -M and -CAneesh Kumar K.V, Jun 12, 2007
  3. Junio C HamanoJun 13, 2007
  4. Junio C HamanoJun 13, 2007
  5. Aneesh KumarJun 13, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.