Re: [PATCH v2 0/4] Add support for mailmap in cat-file

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Siddharth Asthana <siddharthasthana31@xxxxxxxxx> writes:
>
>> Changes in v2:
>> - The commit_rewrite_person() has been improved by restricting it to
>>   traverse only the header part of the object buffers.
>> - The callers of commit_rewrite_person() now don't require to call it
>>   multiple times for different headers. They can pass an array of
>>   headers and commit_rewrite_person() replaces idents only on those
>>   headers.
>> - commit_rewrite_person() has been renamed to a suitable name which
>>   expresses its functionality clearly.
>> - More tests have been added to test the --[no-]-use-mailmap option for
>>   the tag objects.
>> - Redundant operations from the tests have been removed.
>
> I agree with the general direction and the implementation strategy.
> I've noticed a few decl-after-statement and also at least one public
> helper function that does not need to be public.  Are you building
> with "make DEVELOPER=YesPlease"?  It enables -pedantic and -Werror,
> -Wdeclaration-after-statement, among other options (see the
> config.mak.dev file for the complete list) to help you catch these
> locally before sendign your patches to the list.

Here is what I prepared on top of your series to make them compile
while queuing them on a topic branch.

 builtin/cat-file.c | 7 +++++--
 revision.c         | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 6dc750a367..4ca024a018 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -40,11 +40,14 @@ static const char *force_path;
 static struct string_list mailmap = STRING_LIST_INIT_NODUP;
 static int use_mailmap;
 
-char *replace_idents_using_mailmap(char *object_buf, size_t *size)
+static char *replace_idents_using_mailmap(char *, size_t *);
+
+static char *replace_idents_using_mailmap(char *object_buf, size_t *size)
 {
 	struct strbuf sb = STRBUF_INIT;
-	strbuf_attach(&sb, object_buf, *size, *size + 1);
 	const char *headers[] = { "author ", "committer ", "tagger ", NULL };
+
+	strbuf_attach(&sb, object_buf, *size, *size + 1);
 	apply_mailmap_to_header(&sb, headers, &mailmap);
 	*size = sb.len;
 	return strbuf_detach(&sb, NULL);
diff --git a/revision.c b/revision.c
index b561d6b5b5..767c6225df 100644
--- a/revision.c
+++ b/revision.c
@@ -3787,10 +3787,10 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
 		strbuf_addstr(&buf, message);
 
 	if (opt->grep_filter.header_list && opt->mailmap) {
+		const char *commit_headers[] = { "author ", "committer ", NULL };
+
 		if (!buf.len)
 			strbuf_addstr(&buf, message);
-
-		const char *commit_headers[] = { "author ", "committer ", NULL };
 		apply_mailmap_to_header(&buf, commit_headers, opt->mailmap);
 	}
 
-- 
2.37.0-211-gafcdf5f063




[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