Skip to content

Commit

Permalink
sequencer: rename amend_author to author_to_rename
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
r1walz authored and gitster committed Nov 2, 2019
1 parent cbd8db1 commit 0185c68
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sequencer.c
Expand Up @@ -1354,7 +1354,7 @@ static int try_to_commit(struct repository *r,
struct commit_extra_header *extra = NULL;
struct strbuf err = STRBUF_INIT;
struct strbuf commit_msg = STRBUF_INIT;
char *amend_author = NULL;
char *author_to_free = NULL;
const char *hook_commit = NULL;
enum commit_msg_cleanup_mode cleanup;
int res = 0;
Expand All @@ -1375,7 +1375,7 @@ static int try_to_commit(struct repository *r,
strbuf_addstr(msg, orig_message);
hook_commit = "HEAD";
}
author = amend_author = get_author(message);
author = author_to_free = get_author(message);
unuse_commit_buffer(current_head, message);
if (!author) {
res = error(_("unable to parse commit author"));
Expand Down Expand Up @@ -1474,7 +1474,7 @@ static int try_to_commit(struct repository *r,
free_commit_extra_headers(extra);
strbuf_release(&err);
strbuf_release(&commit_msg);
free(amend_author);
free(author_to_free);

return res;
}
Expand Down

0 comments on commit 0185c68

Please sign in to comment.