Skip to content

Commit

Permalink
Merge branch 'xl/record-partial-clone-origin'
Browse files Browse the repository at this point in the history
When creating a partial clone, the object filtering criteria is
recorded for the origin of the clone, but this incorrectly used a
hardcoded name "origin" to name that remote; it has been corrected
to honor the "--origin <name>" option.

* xl/record-partial-clone-origin:
  clone: respect user supplied origin name when setting up partial clone
  • Loading branch information
gitster committed Jun 17, 2019
2 parents dedc046 + 1c4a9f9 commit 14f49b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
remote_head_points_at, &branch_top);

if (filter_options.choice)
partial_clone_register("origin", &filter_options);
partial_clone_register(option_origin, &filter_options);

if (is_local)
clone_local(path, git_dir);
Expand Down
16 changes: 13 additions & 3 deletions t/t5601-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,8 @@ test_expect_success CASE_INSENSITIVE_FS 'colliding file detection' '
test_i18ngrep "the following paths have collided" icasefs/warning
'

partial_clone () {
partial_clone_server () {
SERVER="$1" &&
URL="$2" &&

rm -rf "$SERVER" client &&
test_create_repo "$SERVER" &&
Expand All @@ -642,8 +641,14 @@ partial_clone () {
test_commit -C "$SERVER" two &&
HASH2=$(git hash-object "$SERVER/two.t") &&
test_config -C "$SERVER" uploadpack.allowfilter 1 &&
test_config -C "$SERVER" uploadpack.allowanysha1inwant 1 &&
test_config -C "$SERVER" uploadpack.allowanysha1inwant 1
}

partial_clone () {
SERVER="$1" &&
URL="$2" &&

partial_clone_server "${SERVER}" &&
git clone --filter=blob:limit=0 "$URL" client &&

git -C client fsck &&
Expand All @@ -660,6 +665,11 @@ test_expect_success 'partial clone' '
partial_clone server "file://$(pwd)/server"
'

test_expect_success 'partial clone with -o' '
partial_clone_server server &&
git clone -o blah --filter=blob:limit=0 "file://$(pwd)/server" client
'

test_expect_success 'partial clone: warn if server does not support object filtering' '
rm -rf server client &&
test_create_repo server &&
Expand Down

0 comments on commit 14f49b2

Please sign in to comment.