mbox series

[00/12] The merge-base logic vs missing commit objects

Message ID pull.1657.git.1707813709.gitgitgadget@gmail.com (mailing list archive)
Headers show
Series The merge-base logic vs missing commit objects | expand

Message

Kazuhiro Kato via GitGitGadget Feb. 13, 2024, 8:41 a.m. UTC
This patch series is in the same spirit as what I proposed in
https://lore.kernel.org/git/pull.1651.git.1707212981.gitgitgadget@gmail.com/,
where I tackled missing tree objects. This here patch series tackles missing
commit objects instead: Git's merge-base logic handles these missing commit
objects as if there had not been any commit object at all, i.e. if two
commits' merge base commit is missing, they will be treated as if they had
no common commit history at all, which is a bug. Those commit objects should
not be missing, of course, i.e. this is only a problem in corrupt
repositories.

This patch series is a bit more tricky than the "missing tree objects" one,
though: The function signature of quite a few functions need to be changed
to allow callers to discern between "missing commit object" vs "no
merge-base found".

And of course it gets even more tricky because in shallow and partial clones
we expect commit objects to be missing, and that must not be treated like an
error but the existing logic is actually desirable in those scenarios.

I am deeply sorry both about the length of this patch series as well as
having to send it in the -rc phase.

Johannes Schindelin (12):
  paint_down_to_common: plug a memory leak
  Let `repo_in_merge_bases()` report missing commits
  Prepare `repo_in_merge_bases_many()` to optionally expect missing
    commits
  Prepare `paint_down_to_common()` for handling shallow commits
  commit-reach: start reporting errors in `paint_down_to_common()`
  merge_bases_many(): pass on errors from `paint_down_to_common()`
  get_merge_bases_many_0(): pass on errors from `merge_bases_many()`
  repo_get_merge_bases(): pass on errors from `merge_bases_many()`
  get_octopus_merge_bases(): pass on errors from `merge_bases_many()`
  repo_get_merge_bases_many(): pass on errors from `merge_bases_many()`
  repo_get_merge_bases_many_dirty(): pass on errors from
    `merge_bases_many()`
  paint_down_to_common(): special-case shallow/partial clones

 bisect.c                         |   7 +-
 builtin/branch.c                 |  12 +-
 builtin/fast-import.c            |   6 +-
 builtin/fetch.c                  |   2 +
 builtin/log.c                    |  30 +++--
 builtin/merge-base.c             |  18 ++-
 builtin/merge-tree.c             |   5 +-
 builtin/merge.c                  |  26 ++--
 builtin/pull.c                   |   9 +-
 builtin/rebase.c                 |   8 +-
 builtin/receive-pack.c           |   6 +-
 builtin/rev-parse.c              |   5 +-
 commit-reach.c                   | 202 +++++++++++++++++++------------
 commit-reach.h                   |  26 ++--
 commit.c                         |   7 +-
 diff-lib.c                       |   5 +-
 http-push.c                      |   5 +-
 log-tree.c                       |   5 +-
 merge-ort.c                      |  81 +++++++++++--
 merge-recursive.c                |  52 ++++++--
 notes-merge.c                    |   3 +-
 object-name.c                    |   5 +-
 remote.c                         |   2 +-
 revision.c                       |  10 +-
 sequencer.c                      |   8 +-
 shallow.c                        |  21 ++--
 submodule.c                      |   7 +-
 t/helper/test-reach.c            |  11 +-
 t/t4301-merge-tree-write-tree.sh |  12 ++
 29 files changed, 413 insertions(+), 183 deletions(-)


base-commit: 564d0252ca632e0264ed670534a51d18a689ef5d
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1657%2Fdscho%2Fmerge-base-and-missing-objects-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1657/dscho/merge-base-and-missing-objects-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1657

Comments

Junio C Hamano Feb. 13, 2024, 6:37 p.m. UTC | #1
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> I am deeply sorry both about the length of this patch series as well as
> having to send it in the -rc phase.

You do not have to ;-), but thanks.

Also outside the scope of -rc, there were some untied loose ends in
the missing tree thing before we can move to a new topic, if I
recall correctly.

Speaking of -rc, the project would be helped by your expertise a lot
if you gave a quick Ack on the make_relative() thing [*].


[Reference]

 * f6628636 (unit-tests: do show relative file paths on non-Windows,
   too, 2024-02-11)
   https://lore.kernel.org/git/xmqqle7r9enn.fsf_-_@gitster.g/