Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
6f80bf4a
Commit
6f80bf4a
authored
Apr 16, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3037 from libgit2/cmn/hide-then-push
Handle hide-then-push in the revwalk
parents
fa7281db
05d92026
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
8 deletions
+31
-8
include/git2/revwalk.h
+10
-8
src/revwalk.c
+4
-0
tests/revwalk/basic.c
+17
-0
No files found.
include/git2/revwalk.h
View file @
6f80bf4a
...
...
@@ -90,15 +90,17 @@ GIT_EXTERN(int) git_revwalk_new(git_revwalk **out, git_repository *repo);
GIT_EXTERN
(
void
)
git_revwalk_reset
(
git_revwalk
*
walker
);
/**
*
Mark a commit to start traversal from.
*
Add a new root for the traversal
*
* The given OID must belong to a committish on the walked
* repository.
* The pushed commit will be marked as one of the roots from which to
* start the walk. This commit may not be walked if it or a child is
* hidden.
*
* At least one commit must be pushed onto the walker before a walk
* can be started.
*
* The given commit will be used as one of the roots
* when starting the revision walk. At least one commit
* must be pushed onto the walker before a walk can
* be started.
* The given id must belong to a committish on the walked
* repository.
*
* @param walk the walker being used for the traversal.
* @param id the oid of the commit to start from.
...
...
@@ -135,7 +137,7 @@ GIT_EXTERN(int) git_revwalk_push_head(git_revwalk *walk);
/**
* Mark a commit (and its ancestors) uninteresting for the output.
*
* The given
OID
must belong to a committish on the walked
* The given
id
must belong to a committish on the walked
* repository.
*
* The resolved commit and all its parents will be hidden from the
...
...
src/revwalk.c
View file @
6f80bf4a
...
...
@@ -144,6 +144,10 @@ static int push_commit(git_revwalk *walk, const git_oid *oid, int uninteresting,
if
(
commit
==
NULL
)
return
-
1
;
/* error already reported by failed lookup */
/* A previous hide already told us we don't want this commit */
if
(
commit
->
uninteresting
)
return
0
;
if
(
uninteresting
)
walk
->
did_hide
=
1
;
else
...
...
tests/revwalk/basic.c
View file @
6f80bf4a
...
...
@@ -314,6 +314,23 @@ void test_revwalk_basic__disallow_non_commit(void)
cl_git_fail
(
git_revwalk_push
(
_walk
,
&
oid
));
}
void
test_revwalk_basic__hide_then_push
(
void
)
{
git_oid
oid
;
int
i
=
0
;
revwalk_basic_setup_walk
(
NULL
);
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
"5b5b025afb0b4c913b4c338a42934a3863bf3644"
));
cl_git_pass
(
git_revwalk_hide
(
_walk
,
&
oid
));
cl_git_pass
(
git_revwalk_push
(
_walk
,
&
oid
));
while
(
git_revwalk_next
(
&
oid
,
_walk
)
==
0
)
i
++
;
cl_assert_equal_i
(
i
,
0
);
}
void
test_revwalk_basic__push_range
(
void
)
{
revwalk_basic_setup_walk
(
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment