mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 11:06:32 +00:00
revwalk: introduce tests that hide old commits
Introduce some tests that show some commits, while hiding some commits that have a timestamp older than the common ancestors of these two commits.
This commit is contained in:
committed by
Carlos Martín Nieto
parent
e8ab13b3fd
commit
565fb8dcd4
@@ -28,8 +28,8 @@ static int foreach_cb(const git_oid *oid, void *data)
|
||||
|
||||
/*
|
||||
* $ git --git-dir tests/resources/testrepo.git count-objects --verbose
|
||||
* count: 47
|
||||
* size: 4
|
||||
* count: 60
|
||||
* size: 240
|
||||
* in-pack: 1640
|
||||
* packs: 3
|
||||
* size-pack: 425
|
||||
@@ -44,7 +44,7 @@ void test_odb_foreach__foreach(void)
|
||||
git_repository_odb(&_odb, _repo);
|
||||
|
||||
cl_git_pass(git_odb_foreach(_odb, foreach_cb, &nobj));
|
||||
cl_assert_equal_i(47 + 1640, nobj); /* count + in-pack */
|
||||
cl_assert_equal_i(60 + 1640, nobj); /* count + in-pack */
|
||||
}
|
||||
|
||||
void test_odb_foreach__one_pack(void)
|
||||
@@ -118,7 +118,7 @@ void test_odb_foreach__files_in_objects_dir(void)
|
||||
|
||||
cl_git_pass(git_repository_odb(&odb, repo));
|
||||
cl_git_pass(git_odb_foreach(odb, foreach_cb, &nobj));
|
||||
cl_assert_equal_i(47 + 1640, nobj); /* count + in-pack */
|
||||
cl_assert_equal_i(60 + 1640, nobj); /* count + in-pack */
|
||||
|
||||
git_odb_free(odb);
|
||||
git_repository_free(repo);
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
x-▌]jC!FШЛ*f)Ч]║■@Х
|
||||
з
Х8фУZ▄║ш╞iШvЬЮ>Й╜М╢╠Os0┐B%s)f▄ниMИlяhЖV4╒5┴╡Ь┼┐▐ е&4я∙@:║Dе)oIr`▐▓╫$МLп■┬ВYШ─wЙsб╔FЙ╪эХнвВоgЙМ■Ж∙а`А$╫■b╜КАДoЫ;▌╣╥шцФU|пЫ╨оzOЪ╬u}пз/ъ._╓╙Пв│~╟ЬуДJ
|
||||
@@ -0,0 +1,4 @@
|
||||
x<01><>K
|
||||
1]η}%<25>N'7ήΐδΣγ8‰ΌΎρ
|
||||
ξκΌ\Χuι 5zc†¤<E280A0>
6¤Η8ωb,β”ΚDΞ2Ί0†'«QΌbγƒΗ@<40>©¬Rφ“QΚ[<5B>Α94‰)ϊ£qοsmp+<2B>Ψ
|
||||
άηΊΎλgφGΧΗ<CEA7>η=<3D>r]/ ΄3<CE84>((‚£tR<74>aΗΛΞ<CE9B>φΆ>‹ψ±EΞ
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
x<01><>½jÄ0„Sû)¶»*aõ»„ãš”éò+íúl8[A–ÉëÇ×äÒ
33¥®ëÒÁ¡yéM$ÌmÈ*Öç ã$q²äG?YŒAœ5<
ßÜtëà<C3AB>¦8rÂÀ£5Á<35>Ž”³7nD#.d‹<18>)~ŠNÈ0Ë„‰)R,‰|,h½’jQ*töóÑçÚàC~¸ |ÍuÝëïzÒ§ºÝ—>ùÔõ
|
||||
Æ’³d¼ðŠ„8œô\Õõ¿ùáSÛ]!7ÞÊ—ýÈÏsö,[¯P2üfw^Ä
|
||||
@@ -0,0 +1,2 @@
|
||||
x-Î]ŠÃ0à}Î)t<>.þQJ),{‚öŽ-7<>º^\‡^<>Ò·AÌ7(”œ×FÓW«"ÀˆA%ŒÉ£y’Ù‘g<>iTI´Ód†?_åÑÀ™<>#ê•Ø[‰Ó(-§DÎ0wdp²ƒßÚR*\Bi
~ÊŽÏðç[öëý;”|mµa´djRjè×þa“
|
||||
¿ñåk„ëRòs×Ò÷t¾mÙæ<C399>G"7±á©{ì~ø¥LD›
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
x-ЮQJ1PПs<D09F>О<EFBFBD>вIz2= В <20>@/<2F>tz7f"й,^пЌњWМЂЄеКp<>FWЫgkйЪЦбыЖ`т$Д8J<38>ё<>0cИ<>Џиѕ<D0B8><D195>Й<>5
|
||||
ЩIв<EFBFBD><EFBFBD>J>!+<2B>ГN<>UШФл(УЛД1рЕDi<_х7<D185>.5ю<EFBFBD>OвъXЗ[ЯС#Ў<>fЖѓсаoљ;іЅеы]ы\МЇгeх<>ў=<3D>Р[@tггє&ѕxH<78>Пh<><68>ћYJn
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -473,3 +473,51 @@ void test_revwalk_basic__big_timestamp(void)
|
||||
git_signature_free(sig);
|
||||
|
||||
}
|
||||
|
||||
/* Ensure that we correctly hide a commit that is (timewise) older
|
||||
* than the commits that we are showing.
|
||||
*
|
||||
* % git rev-list 8e73b76..bd75801
|
||||
* bd758010071961f28336333bc41e9c64c9a64866
|
||||
*/
|
||||
void test_revwalk_basic__old_hidden_commit_one(void)
|
||||
{
|
||||
git_oid new_id, old_id, oid;
|
||||
|
||||
revwalk_basic_setup_walk("testrepo.git");
|
||||
|
||||
cl_git_pass(git_oid_fromstr(&new_id, "bd758010071961f28336333bc41e9c64c9a64866"));
|
||||
cl_git_pass(git_revwalk_push(_walk, &new_id));
|
||||
|
||||
cl_git_pass(git_oid_fromstr(&old_id, "8e73b769e97678d684b809b163bebdae2911720f"));
|
||||
cl_git_pass(git_revwalk_hide(_walk, &old_id));
|
||||
|
||||
cl_git_pass(git_revwalk_next(&oid, _walk));
|
||||
cl_assert(!git_oid_streq(&oid, "bd758010071961f28336333bc41e9c64c9a64866"));
|
||||
|
||||
cl_git_fail_with(GIT_ITEROVER, git_revwalk_next(&oid, _walk));
|
||||
}
|
||||
|
||||
/* Ensure that we correctly hide a commit that is (timewise) older
|
||||
* than the commits that we are showing.
|
||||
*
|
||||
* % git rev-list bd75801 ^b91e763
|
||||
* bd758010071961f28336333bc41e9c64c9a64866
|
||||
*/
|
||||
void test_revwalk_basic__old_hidden_commit_two(void)
|
||||
{
|
||||
git_oid new_id, old_id, oid;
|
||||
|
||||
revwalk_basic_setup_walk("testrepo.git");
|
||||
|
||||
cl_git_pass(git_oid_fromstr(&new_id, "bd758010071961f28336333bc41e9c64c9a64866"));
|
||||
cl_git_pass(git_revwalk_push(_walk, &new_id));
|
||||
|
||||
cl_git_pass(git_oid_fromstr(&old_id, "b91e763008b10db366442469339f90a2b8400d0a"));
|
||||
cl_git_pass(git_revwalk_hide(_walk, &old_id));
|
||||
|
||||
cl_git_pass(git_revwalk_next(&oid, _walk));
|
||||
cl_assert(!git_oid_streq(&oid, "bd758010071961f28336333bc41e9c64c9a64866"));
|
||||
|
||||
cl_git_fail_with(GIT_ITEROVER, git_revwalk_next(&oid, _walk));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user