summaryrefslogtreecommitdiff
path: root/builtin-commit.c
diff options
context:
space:
mode:
authorLibravatar Thomas Rast <trast@student.ethz.ch>2010-03-12 18:04:34 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-03-12 21:55:40 -0800
commit6360d343af9acf7366be6ff89740f5077e12277b (patch)
treeae4f1e77e120cf24e951ec729a7e006a50a880a7 /builtin-commit.c
parentrebase: support automatic notes copying (diff)
downloadtgif-6360d343af9acf7366be6ff89740f5077e12277b.tar.xz
commit --amend: copy notes to the new commit
Teaches 'git commit --amend' to copy notes. The catch is that this must also be guarded by --no-post-rewrite, which we use to prevent --amend from copying notes during a rebase -i 'edit'/'reword'. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-commit.c')
-rw-r--r--builtin-commit.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin-commit.c b/builtin-commit.c
index f476d85293..ccc4f926c0 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -1340,6 +1340,12 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
rerere(0);
run_hook(get_index_file(), "post-commit", NULL);
if (amend && !no_post_rewrite) {
+ struct notes_rewrite_cfg *cfg;
+ cfg = init_copy_notes_for_rewrite("amend");
+ if (cfg) {
+ copy_note_for_rewrite(cfg, head_sha1, commit_sha1);
+ finish_copy_notes_for_rewrite(cfg);
+ }
run_rewrite_hook(head_sha1, commit_sha1);
}
if (!quiet)