From: Junio C Hamano Date: Sun, 27 Jul 2014 22:14:18 +0000 (-0700) Subject: Merge branch 'cc/replace-graft' X-Git-Tag: v2.1.0-rc0~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/16737445a94cb9b18378fff973129d974c7cdf8a?ds=inline;hp=--cc Merge branch 'cc/replace-graft' "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 --- 16737445a94cb9b18378fff973129d974c7cdf8a diff --cc Documentation/git-replace.txt index 089dcac047,e1be2e6270..8fff598fd6 --- a/Documentation/git-replace.txt +++ b/Documentation/git-replace.txt @@@ -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 [...]:: + Create a graft commit. A new commit is created with the same + content as except that its parents will be + [...] instead of 's parents. A replacement ref + is then created to replace 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 :: --list :: List replace refs for objects that match the given pattern (or diff --cc builtin/replace.c index d1ea2c2e56,d29026fe21..294b61b97e --- a/builtin/replace.c +++ b/builtin/replace.c @@@ -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() }; @@@ -357,8 -464,14 +475,14 @@@ 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",