@matheusbsbs / matheus-bagliano / commits / 0185c683c9
Fork 0

sequencer: rename amend_author to author_to_rename

The purpose of amend_author was to free() the malloc()'d string obtained from get_author() while amending a commit. But we can also use the variable to free() the author at our convenience. Rename it to convey this meaning. Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Rohit Ashiwal committed Nov 1, 2019 at 19:30 UTC 0185c683c90baed447e96c18aafb705c91012b25
1 file changed +3 -3
sequencer.c
+3 -3
@@ -1354,7 +1354,7 @@ static int try_to_commit(struct repository *r,
1354 struct commit_extra_header *extra = NULL;
1355 struct strbuf err = STRBUF_INIT;
1356 struct strbuf commit_msg = STRBUF_INIT;
1357 - char *amend_author = NULL;
1357 + char *author_to_free = NULL;
1358 const char *hook_commit = NULL;
1359 enum commit_msg_cleanup_mode cleanup;
1360 int res = 0;
@@ -1375,7 +1375,7 @@ static int try_to_commit(struct repository *r,
1375 strbuf_addstr(msg, orig_message);
1376 hook_commit = "HEAD";
1377 }
1378 - author = amend_author = get_author(message);
1378 + author = author_to_free = get_author(message);
1379 unuse_commit_buffer(current_head, message);
1380 if (!author) {
1381 res = error(_("unable to parse commit author"));
@@ -1474,7 +1474,7 @@ out:
1474 free_commit_extra_headers(extra);
1475 strbuf_release(&err);
1476 strbuf_release(&commit_msg);
1477 - free(amend_author);
1477 + free(author_to_free);
1478
1479 return res;
1480 }