mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 22:39:38 +00:00
revwalk: Properly mark uninteresting commits
This commit is contained in:
parent
858dba58bf
commit
c68dee2a74
@ -269,10 +269,13 @@ static void mark_uninteresting(commit_object *commit)
|
|||||||
mark_uninteresting(commit->parents[i]);
|
mark_uninteresting(commit->parents[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_commit(git_revwalk *walk, commit_object *commit)
|
static int process_commit(git_revwalk *walk, commit_object *commit, int hide)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
if (hide)
|
||||||
|
mark_uninteresting(commit);
|
||||||
|
|
||||||
if (commit->seen)
|
if (commit->seen)
|
||||||
return GIT_SUCCESS;
|
return GIT_SUCCESS;
|
||||||
|
|
||||||
@ -281,9 +284,6 @@ static int process_commit(git_revwalk *walk, commit_object *commit)
|
|||||||
if ((error = commit_parse(walk, commit)) < GIT_SUCCESS)
|
if ((error = commit_parse(walk, commit)) < GIT_SUCCESS)
|
||||||
return git__rethrow(error, "Failed to process commit");
|
return git__rethrow(error, "Failed to process commit");
|
||||||
|
|
||||||
if (commit->uninteresting)
|
|
||||||
mark_uninteresting(commit);
|
|
||||||
|
|
||||||
return walk->enqueue(walk, commit);
|
return walk->enqueue(walk, commit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ static int process_commit_parents(git_revwalk *walk, commit_object *commit)
|
|||||||
int error = GIT_SUCCESS;
|
int error = GIT_SUCCESS;
|
||||||
|
|
||||||
for (i = 0; i < commit->out_degree && error == GIT_SUCCESS; ++i) {
|
for (i = 0; i < commit->out_degree && error == GIT_SUCCESS; ++i) {
|
||||||
error = process_commit(walk, commit->parents[i]);
|
error = process_commit(walk, commit->parents[i], commit->uninteresting);
|
||||||
}
|
}
|
||||||
|
|
||||||
return error == GIT_SUCCESS ? GIT_SUCCESS : git__rethrow(error, "Failed to process commit parents");
|
return error == GIT_SUCCESS ? GIT_SUCCESS : git__rethrow(error, "Failed to process commit parents");
|
||||||
@ -307,9 +307,7 @@ static int push_commit(git_revwalk *walk, const git_oid *oid, int uninteresting)
|
|||||||
if (commit == NULL)
|
if (commit == NULL)
|
||||||
return git__throw(GIT_ENOTFOUND, "Failed to push commit. Object not found");
|
return git__throw(GIT_ENOTFOUND, "Failed to push commit. Object not found");
|
||||||
|
|
||||||
commit->uninteresting = uninteresting;
|
return process_commit(walk, commit, uninteresting);
|
||||||
|
|
||||||
return process_commit(walk, commit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_revwalk_push(git_revwalk *walk, const git_oid *oid)
|
int git_revwalk_push(git_revwalk *walk, const git_oid *oid)
|
||||||
|
Loading…
Reference in New Issue
Block a user