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

2 messages from 2007-06-13 to 2007-06-13. Participants: Aneesh Kumar K.V.
Thread: https://gitlist.dev/t/8582

## Aneesh Kumar K.V, 2007-06-13 08:46

Subject: [PATCH 1/2] gitview: Fix the blame interface.
Message-ID: <1181724376650-git-send-email-aneesh.kumar@gmail.com>
URL: https://gitlist.dev/e/1181724376650-git-send-email-aneesh.kumar%40gmail.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 |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview
index 098cb01..93ecfc1 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,10 @@ 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 = source.read(100)
+
 			except:
 				# resource temporary not available
 				return True
@@ -411,6 +415,19 @@ 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'):
+				try:
+					newline_index = buffer.rindex("\n")
+				except ValueError:
+					newline_index = 0
+
+				self.prev_read = buffer[newline_index:(len(buffer))]
+				buffer = buffer[0:newline_index]
+
 			for buff in buffer.split("\n"):
 				annotate_line = re.compile('^([0-9a-f]{40}) (.+) (.+) (.+)$')
 				m = annotate_line.match(buff)
-- 
1.5.2.1.255.gca6c0-dirty

```

## Aneesh Kumar K.V, 2007-06-13 08:46

Subject: [PATCH 2/2] gitview: run blame with -C -C
Message-ID: <11817244541467-git-send-email-aneesh.kumar@gmail.com>
URL: https://gitlist.dev/e/11817244541467-git-send-email-aneesh.kumar%40gmail.com
In-Reply-To: <1181724376650-git-send-email-aneesh.kumar@gmail.com>

```
From: Aneesh Kumar K.V <aneesh.kumar@gmail.com>

pass -C -C option to git-blame so that blame browsing
works when the data is copied over from other files.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
---
 contrib/gitview/gitview |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview
index 93ecfc1..5931766 100755
--- a/contrib/gitview/gitview
+++ b/contrib/gitview/gitview
@@ -533,7 +533,7 @@ class AnnotateWindow(object):
 
 		self.add_file_data(filename, commit_sha1, line_num)
 
-		fp = os.popen("git blame --incremental -- " + filename + " " + commit_sha1)
+		fp = os.popen("git blame --incremental -C -C -- " + filename + " " + commit_sha1)
 		flags = fcntl.fcntl(fp.fileno(), fcntl.F_GETFL)
 		fcntl.fcntl(fp.fileno(), fcntl.F_SETFL, flags | os.O_NONBLOCK)
 		self.io_watch_tag = gobject.io_add_watch(fp, gobject.IO_IN, self.data_ready)
-- 
1.5.2.1.255.gca6c0-dirty

```
