Re: [PATCH 3/3] commit: Show the committer ident when is different from the parent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 30, 2008 at 10:47:16AM +0200, Santi Béjar wrote:

>   it does not work with the initial commit, I don't know why.
>   Even with this:
> 	if (!commit)
> 		return NULL;
> 
>   Can someone help me? Thanks

It segfaults for me, since you try to strdup NULL. I think you want to
return "" if there is no initial commit, so you can strcmp against the
current committer (or alternatively, explicitly check for NULL).

> +		parent_ident = xstrdup(get_parent_ident());
> +		if (strcmp(parent_ident, committer_ident))
> +			fprintf(fp,
> +				"# Committer: %s\n",
> +				committer_ident);
> +

Why strdup at all here, which leaks? Nobody else uses this variable, so
it should be sufficient to strcmp(get_parent_ident(), committer_ident)
once get_parent_ident promises to always return a valid string. Or
alternatively:

  parent_ident = get_parent_ident();
  if (!parent_ident || strcmp(parent_ident, committer_ident))


A few other comments (I like the idea overall):

  - I haven't looked at the code organization, so maybe it is not
    feasible, but it seems like this stuff should go into wt-status's
    implementation, which would show up in a git-status.

  - The output looks very cluttered. It would be nice to have

    # enter your commit message...
    #
    # Author: whatever
    # Committer: whatever
    #
    # other stuff

    IOW, put in a blank line on either side, but not between the two
    identities if both are shown.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux