Change merge-cache and git-merge-one-file to use the SHA1 of the file
[git.git] / commit-tree.c
index b209575..cbb7d12 100644 (file)
@@ -83,11 +83,11 @@ static void finish_buffer(char *tag, char **bufp, unsigned int *sizep)
 static void remove_special(char *p)
 {
        char c;
-       char *dst = p;
+       char *dst = p, *src = p;
 
        for (;;) {
-               c = *p;
-               p++;
+               c = *src;
+               src++;
                switch(c) {
                case '\n': case '<': case '>':
                        continue;
@@ -96,6 +96,21 @@ static void remove_special(char *p)
                if (!c)
                        break;
        }
+
+       /*
+        * Go back, and remove crud from the end: some people
+        * have commas etc in their gecos field
+        */
+       dst--;
+       while (--dst >= p) {
+               unsigned char c = *dst;
+               switch (c) {
+               case ',': case ';': case '.':
+                       *dst = 0;
+                       continue;
+               }
+               break;
+       }
 }
 
 static const char *month_names[] = {