summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2011-11-08 15:38:07 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-11-09 22:27:11 -0800
commited7a42a0752fd71cf04273b8e691966dd2c33ebe (patch)
tree222f7e6815eecc11fb319526172e275e15d75ae5 /builtin/commit.c
parentmerge: force edit and no-ff mode when merging a tag object (diff)
downloadtgif-ed7a42a0752fd71cf04273b8e691966dd2c33ebe.tar.xz
commit: teach --amend to carry forward extra headers
After running "git pull $there for-linus" to merge a signed tag, the integrator may need to amend the resulting merge commit to fix typoes in it. Teach --amend option to read the existing extra headers, and carry them forward. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 4688a738f7..fca7ea01f3 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1382,6 +1382,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
int allow_fast_forward = 1;
struct wt_status s;
struct commit *current_head = NULL;
+ struct commit_extra_header *extra = NULL;
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(builtin_commit_usage, builtin_commit_options);
@@ -1483,12 +1484,16 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
exit(1);
}
- if (commit_tree(sb.buf, active_cache_tree->sha1, parents, sha1,
- author_ident.buf)) {
+ if (amend)
+ extra = read_commit_extra_headers(current_head);
+
+ if (commit_tree_extended(sb.buf, active_cache_tree->sha1, parents, sha1,
+ author_ident.buf, extra)) {
rollback_index_files();
die(_("failed to write commit object"));
}
strbuf_release(&author_ident);
+ free_commit_extra_headers(extra);
ref_lock = lock_any_ref_for_update("HEAD",
!current_head