Merge branch 'cc/replace-graft'
authorJunio C Hamano <gitster@pobox.com>
Sun, 27 Jul 2014 22:14:18 +0000 (15:14 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 27 Jul 2014 22:14:18 +0000 (15:14 -0700)
"git replace" learned a "--graft" option to rewrite parents of a
commit.

* cc/replace-graft:
replace: add test for --graft with a mergetag
replace: check mergetags when using --graft
replace: add test for --graft with signed commit
replace: remove signature when using --graft
contrib: add convert-grafts-to-replace-refs.sh
Documentation: replace: add --graft option
replace: add test for --graft
replace: add --graft option
replace: cleanup redirection style in tests

1  2 
Documentation/git-replace.txt
builtin/replace.c
commit.c
commit.h
index 089dcac0478407a89aea702988adcb4135510180,e1be2e62709ee8b50e199e86310f6c5536869788..8fff598fd6e86c3e4a3e30e3c41f1c63ffb6a212
@@@ -73,14 -74,15 +74,23 @@@ OPTION
        newly created object. See linkgit:git-var[1] for details about
        how the editor will be chosen.
  
 +--raw::
 +      When editing, provide the raw object contents rather than
 +      pretty-printed ones. Currently this only affects trees, which
 +      will be shown in their binary form. This is harder to work with,
 +      but can help when repairing a tree that is so corrupted it
 +      cannot be pretty-printed. Note that you may need to configure
 +      your editor to cleanly read and write binary data.
 +
+ --graft <commit> [<parent>...]::
+       Create a graft commit. A new commit is created with the same
+       content as <commit> except that its parents will be
+       [<parent>...] instead of <commit>'s parents. A replacement ref
+       is then created to replace <commit> with the newly created
+       commit. See contrib/convert-grafts-to-replace-refs.sh for an
+       example script based on this option that can convert grafts to
+       replace refs.
  -l <pattern>::
  --list <pattern>::
        List replace refs for objects that match the given pattern (or
index d1ea2c2e5606f2091efb487dc1599ec0a9116a6e,d29026fe215f428824753aba12f2e5782607cf2c..294b61b97e20ac9b5684bd6a180da37ebef43db9
@@@ -315,8 -423,8 +429,9 @@@ int cmd_replace(int argc, const char **
                OPT_CMDMODE('l', "list", &cmdmode, N_("list replace refs"), MODE_LIST),
                OPT_CMDMODE('d', "delete", &cmdmode, N_("delete replace refs"), MODE_DELETE),
                OPT_CMDMODE('e', "edit", &cmdmode, N_("edit existing object"), MODE_EDIT),
+               OPT_CMDMODE('g', "graft", &cmdmode, N_("change a commit's parents"), MODE_GRAFT),
                OPT_BOOL('f', "force", &force, N_("replace the ref if it exists")),
 +              OPT_BOOL(0, "raw", &raw, N_("do not pretty-print contents for --edit")),
                OPT_STRING(0, "format", &format, N_("format"), N_("use this format")),
                OPT_END()
        };
                if (argc != 1)
                        usage_msg_opt("-e needs exactly one argument",
                                      git_replace_usage, options);
 -              return edit_and_replace(argv[0], force);
 +              return edit_and_replace(argv[0], force, raw);
  
+       case MODE_GRAFT:
+               if (argc < 1)
+                       usage_msg_opt("-g needs at least one argument",
+                                     git_replace_usage, options);
+               return create_graft(argc, argv, force);
        case MODE_LIST:
                if (argc > 1)
                        usage_msg_opt("only one pattern can be given with -l",
diff --cc commit.c
Simple merge
diff --cc commit.h
Simple merge