Re: [PATCH] tagger id
- From
Eric W. Biederman <ebiederm@xmission.com>
- Date
- Jul 12, 2005, 06:50 UTC
- Message-ID
- <m18y0c1prv.fsf@ebiederm.dsl.xmission.com>
- In-Reply-To
- <m1slyk63k2.fsf_-_@ebiederm.dsl.xmission.com>
ebiederm@xmission.com (Eric W. Biederman) writes:
Show 13 quoted lines
> This patch adds a command git-id for use on > the command line to see what git will set your id too, > and for use in scripts (git-tag-script) so they can get your git id. > > The common code for computing the git-id is moved to ident.c > > Fix parse_date to not mind being passed a constant date > to parse. > > The code to compute the identifier has been restructured > to at least make a reasonable stab at error handling. The > original version had so many unchecked return values it was > just scary to think about.
Well except for a small bug, but serious bug...
Show 13 quoted lines
> diff --git a/commit-tree.c b/commit-tree.c > --- a/commit-tree.c > +++ b/commit-tree.c > @@ -184,8 +126,8 @@ int main(int argc, char **argv) > add_buffer(&buffer, &size, "parent %s\n", > sha1_to_hex(parent_sha1[i])); > > /* Person/date information */ > - add_buffer(&buffer, &size, "author %s <%s> %s\n", gecos, email, date); > - add_buffer(&buffer, &size, "committer %s <%s> %s\n\n", commitgecos, > commitemail, realdate); > + add_buffer(&buffer, &size, "author %s <%s> %s\n", author); > + add_buffer(&buffer, &size, "committer %s <%s> %s\n\n", committer);
This should be:
> + add_buffer(&buffer, &size, "author %s\n", author); > + add_buffer(&buffer, &size, "committer %s\n\n", committer);
Show 22 quoted lines
>
> /* And add the comment */
> while (fgets(comment, sizeof(comment), stdin) != NULL)
> diff --git a/id.c b/id.c
> new file mode 100644
> --- /dev/null
> +++ b/id.c
> @@ -0,0 +1,36 @@
> +#include "cache.h"
> +#include <stdio.h>
> +#include <errno.h>
> +#include <string.h>
> +
> +static char *id_usage = "git-id [--author | --committer]";
> +
> +int main(int argc, char **argv)
> +{
> + char buf[1000];
> + int (*ident)(char *buf, size_t bufsize);
> + int i;
> +
> + ident = git_committer_ident;Should this default to git_author_ident or git_committer_ident? I'm not really certain how we expect to use the different flavors.
Eric