Re: [PATCH v3 2/4] format-patch: improve head calculation for cover-letter

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

 



Felipe Contreras <felipe.contreras@xxxxxxxxx> writes:

> If we do it after the revision traversal we can be sure that this is
> indeed a commit that will be processed (i.e. not a merge) and it's the
> top most one (thus removing the NEEDSWORK comment).

There may not be a single top-most one anyway (which is what that
"randomly pick" comment refers to and punts), so taking the tip
after traversal is just as good as doing it before.  So this is a
good change, but it still is punting.

The "head" is used only to produce the fake "From xxxxx <datestamp>"
line to mark the output as format-patch output to /etc/magic, so it
does not make sense to do anything fancier, like erroring out with
"You specified two or more tips and we cannot pick one".

So it is a good thing to punt.

I like this simplification.  Good job.

> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
> ---
>  builtin/log.c | 20 ++------------------
>  1 file changed, 2 insertions(+), 18 deletions(-)
>
> diff --git a/builtin/log.c b/builtin/log.c
> index 8f0b2e8..6c78d7f 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -1319,24 +1319,6 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
>  	rev.show_root_diff = 1;
>  
>  	if (cover_letter) {
>  		if (!branch_name)
>  			branch_name = find_branch_name(&rev);
>  	}
> @@ -1372,6 +1354,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
>  		list = xrealloc(list, nr * sizeof(list[0]));
>  		list[nr - 1] = commit;
>  	}
> +	if (nr > 0)
> +		head = list[0];
>  	total = nr;
>  	if (!keep_subject && auto_number && total > 1)
>  		numbered = 1;
--
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]