Note1: Depends on en/remerge-diff (but no need to pick it up; it's still RFC). (Note2: This is a continuation of my series at [0], but I can't change the base repository for a pull request in GitHub so I had to open a new PR and that makes it look like a new series. [0] https://lore.kernel.org/git/pull.1114.v2.git.git.1641403655.gitgitgadget@xxxxxxxxx/) == Basic Summary == This series introduces a new mode to git merge-tree allowing it to perform real merges (three-way text content merges, recursive ancestor consolidation, rename detection, proper directory/file conflict handling, etc.) and write the result as a toplevel tree. It doesn't touch the working tree or index, and doesn't create any commits or update any refs. == Updates Log == Updates since v2 (thanks to Christian, Dscho, Ramsay, and René for suggestions and comments on v2): * Significant changes to output format: * Flags no longer take a filename for additional output; they write to stdout instead. * More information included by default when there are conflicts (no need to request it with additional flags, instead flags can be used to suppress it). * Provide (mode, oid, stage, file) tuples -- i.e. ls-files -u style of information -- when there are conflicts. Add a flag to only list conflicted files if that's preferred. * Much more thorough manual for git-merge-tree.txt * Renamed option from --real to --write-tree * Accept an optional --trivial-merge option to get old style merge-tree behavior * Allow both --write-tree and --trivial-merge to be omitted since we can deduce which from number of arguments * Document exit code when the merge cannot be run (so we can distinguish other error cases from conflicts) * testcase cleanups: test_tick, early skip of test when using recursive backend, variable renames, etc. * various minor code cleanups * Add a new --allow-unrelated-histories option (with same meaning as the one used in git merge) * Rebased on top of en/remerge-diff to avoid a small conflict Updates since v1 (thanks to Johannes Altmanninger and Fabian for suggestions on v1): * Fixed a bad patch splitting, and a style issue pointed out by Johannes Altimanninger * Fixed misleading commit messages in new test cases * Fixed my comments about how commit-tree could be used to correctly use two -p flags == Other notes == Stuff intentionally NOT included, but which others seemed to feel strongly about; they'd need to convince me more on these: * Any form of diff output[1] * A way to omit printing the generated tree hash[2][3] In regards to these, also see also some of the new info in Documentation/git-merge-tree.txt, namely the expanded paragraph on "the second form is deprecated" in the description as regards diff output usability and performance, and also the final paragraph of the new "Mistakes to avoid" section in regards to tree hash. [1] https://lore.kernel.org/git/nycvar.QRO.7.76.6.2201101427440.339@xxxxxxxxxxxxxxxxx/ (section starting with "Providing a tree") [2] https://lore.kernel.org/git/CABPp-BHvXrP0sTTmuTYfACoJTCcm9+wk_f441nj4TstrmQdqMQ@xxxxxxxxxxxxxx/ (sections starting with "avoid printing" and "Where did I suggest") [3] https://lore.kernel.org/git/CABPp-BGdbh=HM7jA+_RTwSWVcMr_qvEY7RoNXooeBT2NB4Ubzw@xxxxxxxxxxxxxx/ (section starting with "Providing a tree object") Elijah Newren (12): merge-tree: rename merge_trees() to trivial_merge_trees() merge-tree: move logic for existing merge into new function merge-tree: add option parsing and initial shell for real merge function merge-tree: implement real merges merge-ort: split out a separate display_update_messages() function merge-ort: allow update messages to be written to different file stream merge-tree: support including merge messages in output merge-ort: provide a merge_get_conflicted_files() helper function merge-tree: provide a list of which files have conflicts merge-tree: provide easy access to `ls-files -u` style info merge-tree: add a --allow-unrelated-histories flag git-merge-tree.txt: add a section on potentional usage mistakes Documentation/git-merge-tree.txt | 182 +++++++++++++++++++++++++++++-- builtin/merge-tree.c | 178 ++++++++++++++++++++++++++++-- git.c | 2 +- merge-ort.c | 109 ++++++++++++------ merge-ort.h | 30 +++++ t/t4301-merge-tree-real.sh | 163 +++++++++++++++++++++++++++ 6 files changed, 603 insertions(+), 61 deletions(-) create mode 100755 t/t4301-merge-tree-real.sh base-commit: ea5df61cf358d3c831189e2f04863abc2157e3e1 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1122%2Fnewren%2Fin-core-merge-tree-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1122/newren/in-core-merge-tree-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/1122 -- gitgitgadget