Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRohit Ashiwal <rohit.ashiwal265@gmail.com>2019-11-01 16:59:59 +0300
committerJunio C Hamano <gitster@pobox.com>2019-11-02 09:34:50 +0300
commitc068bcc59b4f16322a77b6a47b53d44b05c51fec (patch)
tree355ded6c6469782797f9c658dd447c9b1952832e /sequencer.c
parentba51d2fb24b1a41b8cc15270a06f24c35c0fcf19 (diff)
sequencer: allow callers of read_author_script() to ignore fields
The current callers of the read_author_script() function read name, email and date from the author script. Allow callers to signal that they are not interested in some among these three fields by passing NULL. Note that fields that are ignored still must exist and be formatted correctly in the author script. Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sequencer.c b/sequencer.c
index 2adcf5a639..b759c940f8 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -824,9 +824,19 @@ int read_author_script(const char *path, char **name, char **email, char **date,
error(_("missing 'GIT_AUTHOR_DATE'"));
if (date_i < 0 || email_i < 0 || date_i < 0 || err)
goto finish;
- *name = kv.items[name_i].util;
- *email = kv.items[email_i].util;
- *date = kv.items[date_i].util;
+
+ if (name)
+ *name = kv.items[name_i].util;
+ else
+ free(kv.items[name_i].util);
+ if (email)
+ *email = kv.items[email_i].util;
+ else
+ free(kv.items[email_i].util);
+ if (date)
+ *date = kv.items[date_i].util;
+ else
+ free(kv.items[date_i].util);
retval = 0;
finish:
string_list_clear(&kv, !!retval);