Skip to content

Commit

Permalink
git commit -m 'fix a bug that prevents revwalking in shallow repos
Browse files Browse the repository at this point in the history
  • Loading branch information
romkatv committed Oct 22, 2020
1 parent 5912e80 commit 82cefe2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/revwalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,11 @@ static int add_parents_to_list(git_revwalk *walk, git_commit_list_node *commit,
git_commit_list_node *p = commit->parents[i];
p->uninteresting = 1;

/* git does it gently here, but we don't like missing objects */
if ((error = git_commit_list_parse(walk, p)) < 0)
return error;
if ((error = git_commit_list_parse(walk, p)) < 0) {
if (error != GIT_ENOTFOUND) return error;
/* this triggers on shallow repositories (e.g., cloned with --depth=0) */
error = 0;
}

if (p->parents)
mark_parents_uninteresting(p);
Expand Down

0 comments on commit 82cefe2

Please sign in to comment.