All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Schlemmer <azarah@nosferatu.za.org>
To: GIT Mailing Lists <git@vger.kernel.org>
Subject: [patch] fixup GECOS handling
Date: Mon, 18 Apr 2005 12:36:29 +0200	[thread overview]
Message-ID: <1113820589.16288.5.camel@nosferatu.lan> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1565 bytes --]

Hi,

The gecos is delimited by ',' or ';', so we should only use whatever
before the first ',' or ';' for the full name, and not just strip those.
Also, a '.' may be valid in the full name (Foo B. Zooman) or email
(foo.zooman@bar.com).

Signed-off-by: Martin Schlemmer <azarah@gentoo.org>

commit-tree.c: ec53a4565ec0033aaf6df2a48d233ccf4823e8b0
--- 1/commit-tree.c
+++ 2/commit-tree.c     2005-04-18 12:22:18.000000000 +0200
@@ -96,21 +96,6 @@
                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[] = {
@@ -313,6 +298,11 @@
        if (!pw)
                die("You don't exist. Go away!");
        realgecos = pw->pw_gecos;
+       /* The name is seperated from the room no., tel no, etc via [,;] */
+       if (strchr(realgecos, ','))
+               realgecos[strchr(realgecos, ',') - realgecos] = '\0';
+       else if (strchr(realgecos, ';'))
+               realgecos[strchr(realgecos, ';') - realgecos] = '\0';
        len = strlen(pw->pw_name);
        memcpy(realemail, pw->pw_name, len);
        realemail[len] = '@';


-- 
Martin Schlemmer


[-- Attachment #1.2: git-gecos.patch --]
[-- Type: text/x-patch, Size: 967 bytes --]

commit-tree.c: ec53a4565ec0033aaf6df2a48d233ccf4823e8b0
--- 1/commit-tree.c
+++ 2/commit-tree.c	2005-04-18 12:22:18.000000000 +0200
@@ -96,21 +96,6 @@
 		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[] = {
@@ -313,6 +298,11 @@
 	if (!pw)
 		die("You don't exist. Go away!");
 	realgecos = pw->pw_gecos;
+	/* The name is seperated from the room no., tel no, etc via ',' or ';' */
+	if (strchr(realgecos, ','))
+		realgecos[strchr(realgecos, ',') - realgecos] = '\0';
+	else if (strchr(realgecos, ';'))
+		realgecos[strchr(realgecos, ';') - realgecos] = '\0';
 	len = strlen(pw->pw_name);
 	memcpy(realemail, pw->pw_name, len);
 	realemail[len] = '@';

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2005-04-18 10:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-18 10:36 Martin Schlemmer [this message]
2005-04-18 12:35 ` [patch] fixup GECOS handling David Woodhouse
2005-04-18 12:58   ` Martin Schlemmer
2005-04-22 14:23   ` Martin Schlemmer
2005-04-22 16:16     ` Kyle Hayes
2005-04-22 16:58       ` Martin Schlemmer
2005-04-22 17:18         ` Petr Baudis
2005-04-22 17:25           ` Martin Schlemmer
2005-04-22 17:58           ` Kyle Hayes
2005-04-22 19:06             ` Martin Schlemmer
2005-04-22 20:46               ` Kyle Hayes
2005-04-23 23:38               ` Petr Baudis
2005-04-23 23:49                 ` Martin Schlemmer
2005-04-22 17:43         ` Kyle Hayes
2005-04-22 23:30       ` Andy Isaacson
2005-04-25 17:02         ` Kyle Hayes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1113820589.16288.5.camel@nosferatu.lan \
    --to=azarah@nosferatu.za.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.