Thread (8 messages) flat view 8 messages, 4 authors, 2016-06-15

Re: [BUG] Empty reflogs and "git log -g"

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:53
Subsystem: the rest · Maintainer: Linus Torvalds

Hi,

[Cc'ing the mailing list, not the newsgroup]

On Thu, 8 Feb 2007, Jakub Narebski wrote:
Johannes Schindelin wrote:
quoted
On Thu, 8 Feb 2007, Santi Béjar wrote:
quoted
 when a reflog entry do not have a reflog message the refs@{num} syntax 
gives a different result than with 'git log -g'. Actually 'git log -g' 
just skips this ref.
I could be that some older git version produces empty messages. But I'd 
regard the empty messages to be the problem. Or is the current Git version 
still producing such entries?
StGIT used to produce no reflog messages; I don't know if this has 
improved. But you can have old reflog entries with empty messages; git 
log -g should deal with them IMHO.
I just tried. An empty string is not enough. The tab before the message 
has to be lacking, too.

Here's a small patch, if you have to have it.

---

 refs.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/refs.c b/refs.c
index 7e07fc4..ba5bd2d 100644
--- a/refs.c
+++ b/refs.c
@@ -1189,12 +1189,14 @@ int for_each_reflog_ent(const char *ref, each_reflog_ent_fn fn, void *cb_data)
 		    !message || message[0] != ' ' ||
 		    (message[1] != '+' && message[1] != '-') ||
 		    !isdigit(message[2]) || !isdigit(message[3]) ||
-		    !isdigit(message[4]) || !isdigit(message[5]) ||
-		    message[6] != '\t')
+		    !isdigit(message[4]) || !isdigit(message[5]))
 			continue; /* corrupt? */
 		email_end[1] = '\0';
 		tz = strtol(message + 1, NULL, 10);
-		message += 7;
+		if (message[6] != '\t')
+			message += 6;
+		else
+			message += 7;
 		ret = fn(osha1, nsha1, buf+82, timestamp, tz, message, cb_data);
 		if (ret)
 			break;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help