Skip to content

Commit

Permalink
paint_down_to_common(): special-case shallow/partial clones
Browse files Browse the repository at this point in the history
In shallow/partial clones, we _expect_ commits to be missing. Let's
teach the merge-base logic to ignore those and simply go ahead and
treat the involved commit histories as cut off at that point.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Feb 11, 2024
1 parent e7fcc96 commit 3389460
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion commit-reach.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "tag.h"
#include "commit-reach.h"
#include "ewah/ewok.h"
#include "shallow.h"
#include "promisor-remote.h"

/* Remember to update object flag allocation in object.h */
#define PARENT1 (1u<<16)
Expand Down Expand Up @@ -115,7 +117,9 @@ static int paint_down_to_common(struct repository *r,
* dispatched with a `die()`.
*/
free_commit_list(*result);
if (ignore_missing_commits)
if (ignore_missing_commits ||
is_repository_shallow(r) ||
repo_has_promisor_remote(r))
return 0;
return error(_("could not parse commit %s"),
oid_to_hex(&p->object.oid));
Expand Down

0 comments on commit 3389460

Please sign in to comment.