Thread (1 message) 1 message, 1 author, 2016-06-15
DORMANTno replies

[PATCH] remove_special() tentative fix.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:41:53

quoted
quoted
quoted
quoted
"LT" == Linus Torvalds [off-list ref] writes:
LT> On Mon, 18 Apr 2005, Petr Baudis wrote:
quoted
Am I just slow or does the first dst-- make it miss the last trailing
/[,;.]/?
LT> Hopefully not. It _should_ make it miss the last '\0', but hey, it got my
LT> usual amount of testing (ie none). I'm sure Brad can tell us whether it
LT> makes any difference..

No, you are both slow ;-)  At that point p is not the beginning
of the input anymore.  This is a *tentative* fix to implement
your intended solution.

I have a suspicion that your intended solution would not work on
systems that really use these GECOS subfields, though.  These
commas are there to separate subfields and your intended
solution would keep the office numbers etc. as part of commiter
name.  Honestly, I think your COMMITTER_* environment variable
idea is far better than playing games like this, although at the
same time I sympathize your not wanting to encourage people to
lie about the committer identity.

Signed-off-by: Junio C Hamano <redacted> 
---

cd /opt/packrat/playpen/public/in-place/git/git/
show-diff commit-tree.c
commit-tree.c: ec53a4565ec0033aaf6df2a48d233ccf4823e8b0
--- commit-tree.c
+++ commit-tree.c	2005-04-17 18:43:39.000000000 -0700
@@ -83,6 +83,7 @@ static void finish_buffer(char *tag, cha
 static void remove_special(char *p)
 {
 	char c;
+	char *begin = p;
 	char *dst = p;
 
 	for (;;) {
@@ -102,7 +103,7 @@ static void remove_special(char *p)
 	 * have commas etc in their gecos field
 	 */
 	dst--;
-	while (--dst >= p) {
+	while (--dst >= begin) {
 		unsigned char c = *dst;
 		switch (c) {
 		case ',': case ';': case '.':
Compilation finished at Sun Apr 17 18:44:55
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help