Re: git log doesn't allow %x00 in custom format anymore?

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: git log doesn't allow %x00 in custom format anymore?

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:49:43

Jeff King [off-list ref] writes:
quoted hunk
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index efe9360..3b2dca0 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -147,8 +147,10 @@ static void show_commit(struct commit *commit, void *data)
 			}
 		} else {
 			if (revs->commit_format != CMIT_FMT_USERFORMAT ||
-			    buf.len)
-				printf("%s%c", buf.buf, info->hdr_termination);
+			    buf.len) {
+				fwrite(buf.buf, 1, buf.len, stdout);
+				putchar(info->hdr_termination);
+			}
 		}
 		strbuf_release(&buf);
 	} else {
Sounds like a sane thing to do, yes.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

Re: git log doesn't allow %x00 in custom format anymore?

From: Drew Northup <hidden>
Date: 2016-06-15 22:49:43

On Thu, 2010-10-07 at 19:40 +0200, Matthieu Moy wrote:
Jeff King [off-list ref] writes:
quoted
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index efe9360..3b2dca0 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -147,8 +147,10 @@ static void show_commit(struct commit *commit, void *data)
 			}
 		} else {
 			if (revs->commit_format != CMIT_FMT_USERFORMAT ||
-			    buf.len)
-				printf("%s%c", buf.buf, info->hdr_termination);
+			    buf.len) {
+				fwrite(buf.buf, 1, buf.len, stdout);
+				putchar(info->hdr_termination);
+			}
 		}
 		strbuf_release(&buf);
 	} else {
Sounds like a sane thing to do, yes.
Agreed. I could have sworn that printf() used standard C-strings which
terminate with %x00!

-- 
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help