@@ -3345,6 +3345,93 @@ function e2e::sparse_checkout() {
33453345 assert_file_eq " $ROOT /link/file2" " ${FUNCNAME[0]} "
33463346}
33473347
3348+ # #############################################
3349+ # Test filter (partial clone) with blob:none
3350+ # #############################################
3351+ function e2e::filter_partial_clone_blob_none() {
3352+ GIT_SYNC \
3353+ --one-time \
3354+ --repo=" file://$REPO " \
3355+ --root=" $ROOT " \
3356+ --link=" link" \
3357+ --filter=" blob:none" \
3358+ --depth=0
3359+ assert_link_exists " $ROOT /link"
3360+ assert_file_exists " $ROOT /link/file"
3361+ assert_file_eq " $ROOT /link/file" " ${FUNCNAME[0]} "
3362+
3363+ # Verify partial clone is in effect: git fetch --filter creates a
3364+ # .promisor marker alongside each pack file containing filtered objects.
3365+ local pack_dir
3366+ pack_dir=" $( git -C " $ROOT /link" rev-parse --git-common-dir) /objects/pack"
3367+ if ! ls " $pack_dir " /* .promisor > /dev/null 2>&1 ; then
3368+ fail " expected .promisor pack marker (partial clone)"
3369+ fi
3370+ }
3371+
3372+ # #############################################
3373+ # Test filter with sparse-checkout
3374+ # #############################################
3375+ function e2e::filter_with_sparse_checkout() {
3376+ echo " !/*" > " $WORK /sparseconfig"
3377+ echo " !/*/" >> " $WORK /sparseconfig"
3378+ echo " file2" >> " $WORK /sparseconfig"
3379+ echo " ${FUNCNAME[0]} " > " $REPO /file2"
3380+ mkdir -p " $REPO /dir"
3381+ echo " ${FUNCNAME[0]} " > " $REPO /dir/file3"
3382+ git -C " $REPO " add file2
3383+ git -C " $REPO " add dir
3384+ git -C " $REPO " commit -qam " ${FUNCNAME[0]} "
3385+
3386+ GIT_SYNC \
3387+ --one-time \
3388+ --repo=" file://$REPO " \
3389+ --root=" $ROOT " \
3390+ --link=" link" \
3391+ --filter=" blob:none" \
3392+ --depth=1 \
3393+ --sparse-checkout-file=" $WORK /sparseconfig"
3394+ assert_link_exists " $ROOT /link"
3395+ assert_file_exists " $ROOT /link/file2"
3396+ assert_file_absent " $ROOT /link/dir/file3"
3397+ assert_file_absent " $ROOT /link/dir"
3398+ assert_file_eq " $ROOT /link/file2" " ${FUNCNAME[0]} "
3399+ }
3400+
3401+ # #############################################
3402+ # Test filter syncing across updates
3403+ # #############################################
3404+ function e2e::filter_across_updates() {
3405+ # First sync
3406+ echo " ${FUNCNAME[0]} 1" > " $REPO /file"
3407+ git -C " $REPO " commit -qam " ${FUNCNAME[0]} 1"
3408+
3409+ GIT_SYNC \
3410+ --period=100ms \
3411+ --repo=" file://$REPO " \
3412+ --filter=" blob:none" \
3413+ --depth=0 \
3414+ --root=" $ROOT " \
3415+ --link=" link" \
3416+ &
3417+ wait_for_sync " ${MAXWAIT} "
3418+ assert_link_exists " $ROOT /link"
3419+ assert_file_exists " $ROOT /link/file"
3420+ assert_file_eq " $ROOT /link/file" " ${FUNCNAME[0]} 1"
3421+ assert_metric_eq " ${METRIC_GOOD_SYNC_COUNT} " 1
3422+ assert_metric_eq " ${METRIC_FETCH_COUNT} " 1
3423+
3424+ # Move forward
3425+ echo " ${FUNCNAME[0]} 2" > " $REPO /file"
3426+ git -C " $REPO " commit -qam " ${FUNCNAME[0]} 2"
3427+ wait_for_sync " ${MAXWAIT} "
3428+ assert_link_exists " $ROOT /link"
3429+ assert_file_exists " $ROOT /link/file"
3430+ assert_file_eq " $ROOT /link/file" " ${FUNCNAME[0]} 2"
3431+ assert_metric_eq " ${METRIC_GOOD_SYNC_COUNT} " 2
3432+ assert_metric_eq " ${METRIC_FETCH_COUNT} " 2
3433+ }
3434+
33483435# #############################################
33493436# Test additional git configs
33503437# #############################################
0 commit comments