pr-1651/dscho/merge-tree-and-missing-objects-v3
tagged this
22 Feb 14:36
I recently looked into issues where git merge-tree calls returned bogus data (in one instance returning an empty tree for non-empty merge parents). By the time I had a look at the corresponding repository, the issue was no longer reproducible, but a closer look at the code combined with some manual experimenting turned up the fact that missing tree objects aren't handled as errors by git merge-tree. While at it, I added a commit on top that tries to catch all remaining unchecked parse_tree() calls. This patch series is based on 5f43cf5b2e4 (merge-tree: accept 3 trees as arguments, 2024-01-28) (the original tip commit of js/merge-tree-3-trees) because I introduced three unchecked parse_tree() calls in that topic. Changes since v2: * Fixed the new "missing tree object" test case in t4301 that succeeded for the wrong reason. * Adjusted the new "missing blob object" test case to avoid succeeding for the wrong reason. * Simplified the "missing blob object" test case. Changes since v1: * Simplified the test case, avoiding a subshell and a pipe in the process. * Added a patch to remove a superfluous subtree->object.parsed guard around a parse_tree(subtree) call. Johannes Schindelin (5): merge-tree: fail with a non-zero exit code on missing tree objects merge-ort: do check `parse_tree()`'s return value t4301: verify that merge-tree fails on missing blob objects Always check `parse_tree*()`'s return value cache-tree: avoid an unnecessary check builtin/checkout.c | 19 ++++++++++++++++--- builtin/clone.c | 3 ++- builtin/commit.c | 3 ++- builtin/merge-tree.c | 6 ++++++ builtin/read-tree.c | 3 ++- builtin/reset.c | 4 ++++ cache-tree.c | 4 ++-- merge-ort.c | 16 +++++++++++----- merge-recursive.c | 3 ++- merge.c | 5 ++++- reset.c | 5 +++++ sequencer.c | 4 ++++ t/t4301-merge-tree-write-tree.sh | 27 +++++++++++++++++++++++++++ 13 files changed, 87 insertions(+), 15 deletions(-) base-commit: 5f43cf5b2e4b68386d3774bce880b0f74d801635 Submitted-As: https://lore.kernel.org/git/pull.1651.v3.git.1708612605.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.1651.git.1707212981.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.1651.v2.git.1707324461.gitgitgadget@gmail.com
Assets 2
-
2024-02-22T14:36:45Z -
2024-02-22T14:36:45Z - Loading