-
Notifications
You must be signed in to change notification settings - Fork 462
Add "--filter" flag to enable git partial clone #982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3339,6 +3339,99 @@ function e2e::sparse_checkout() { | |
| assert_file_eq "$ROOT/link/file2" "${FUNCNAME[0]}" | ||
| } | ||
|
|
||
| ############################################## | ||
| # Test filter (partial clone) with blob:none | ||
| ############################################## | ||
| function e2e::filter_partial_clone_blob_none() { | ||
| echo "${FUNCNAME[0]}" > "$REPO/file" | ||
| git -C "$REPO" commit -qam "${FUNCNAME[0]}" | ||
|
|
||
| GIT_SYNC \ | ||
| --one-time \ | ||
| --repo="file://$REPO" \ | ||
| --root="$ROOT" \ | ||
| --link="link" \ | ||
| --filter="blob:none" \ | ||
| --depth=0 | ||
| assert_link_exists "$ROOT/link" | ||
| assert_file_exists "$ROOT/link/file" | ||
| assert_file_eq "$ROOT/link/file" "${FUNCNAME[0]}" | ||
|
|
||
| # Verify the repo is a partial clone | ||
| if ! git -C "$ROOT/link" config --get remote.origin.promisor >/dev/null 2>&1; then | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain in comments what this block is doing? It doesn't seem to work - |
||
| # Check if the repo has a partial clone filter configured | ||
| local filter | ||
| filter=$(git -C "$ROOT/link" config --get remote.origin.partialclonefilter 2>/dev/null || true) | ||
| if [[ -z "$filter" ]]; then | ||
| fail "expected partial clone filter to be configured" | ||
| fi | ||
| fi | ||
| } | ||
|
|
||
| ############################################## | ||
| # Test filter with sparse-checkout | ||
| ############################################## | ||
| function e2e::filter_with_sparse_checkout() { | ||
| echo "!/*" > "$WORK/sparseconfig" | ||
| echo "!/*/" >> "$WORK/sparseconfig" | ||
| echo "file2" >> "$WORK/sparseconfig" | ||
| echo "${FUNCNAME[0]}" > "$REPO/file" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above - this is a noop |
||
| echo "${FUNCNAME[0]}" > "$REPO/file2" | ||
| mkdir -p "$REPO/dir" | ||
| echo "${FUNCNAME[0]}" > "$REPO/dir/file3" | ||
| git -C "$REPO" add file2 | ||
| git -C "$REPO" add dir | ||
| git -C "$REPO" commit -qam "${FUNCNAME[0]}" | ||
|
|
||
| GIT_SYNC \ | ||
| --one-time \ | ||
| --repo="file://$REPO" \ | ||
| --root="$ROOT" \ | ||
| --link="link" \ | ||
| --filter="blob:none" \ | ||
| --depth=1 \ | ||
| --sparse-checkout-file="$WORK/sparseconfig" | ||
| assert_link_exists "$ROOT/link" | ||
| assert_file_exists "$ROOT/link/file2" | ||
| assert_file_absent "$ROOT/link/dir/file3" | ||
| assert_file_absent "$ROOT/link/dir" | ||
| assert_file_eq "$ROOT/link/file2" "${FUNCNAME[0]}" | ||
| } | ||
|
|
||
| ############################################## | ||
| # Test filter syncing across updates | ||
| ############################################## | ||
| function e2e::filter_across_updates() { | ||
| # First sync | ||
| echo "${FUNCNAME[0]} 1" > "$REPO/file" | ||
| git -C "$REPO" commit -qam "${FUNCNAME[0]} 1" | ||
|
|
||
| GIT_SYNC \ | ||
| --period=100ms \ | ||
| --repo="file://$REPO" \ | ||
| --filter="blob:none" \ | ||
| --depth=0 \ | ||
| --root="$ROOT" \ | ||
| --link="link" \ | ||
| & | ||
| wait_for_sync "${MAXWAIT}" | ||
| assert_link_exists "$ROOT/link" | ||
| assert_file_exists "$ROOT/link/file" | ||
| assert_file_eq "$ROOT/link/file" "${FUNCNAME[0]} 1" | ||
| assert_metric_eq "${METRIC_GOOD_SYNC_COUNT}" 1 | ||
| assert_metric_eq "${METRIC_FETCH_COUNT}" 1 | ||
|
|
||
| # Move forward | ||
| echo "${FUNCNAME[0]} 2" > "$REPO/file" | ||
| git -C "$REPO" commit -qam "${FUNCNAME[0]} 2" | ||
| wait_for_sync "${MAXWAIT}" | ||
| assert_link_exists "$ROOT/link" | ||
| assert_file_exists "$ROOT/link/file" | ||
| assert_file_eq "$ROOT/link/file" "${FUNCNAME[0]} 2" | ||
| assert_metric_eq "${METRIC_GOOD_SYNC_COUNT}" 2 | ||
| assert_metric_eq "${METRIC_FETCH_COUNT}" 2 | ||
| } | ||
|
|
||
| ############################################## | ||
| # Test additional git configs | ||
| ############################################## | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests begin with the funcname already in the file, which makes this redundant