Skip to contentSkip to conversation

Use user supplied origin name for extension.partialcone instead of hardcoded value.

PATCH In review Xin Li 3 participants 7 messages May 23, 2019 – May 29, 2019

lore
Share & tools
lore

Xin Li

author
#0 lore raw

PATCH 1/1 Use user supplied origin name for extension.partialcone instead of hardcoded value.

---
 builtin/clone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/clone.c +1 -1
index 50bde99618..822208a346 100644
@@ -1215,7 +1215,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);
Signature · 1 line
2.22.0.rc1.257.g3120a18244-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Xin Li

Subject: Use user supplied origin name for extension.partialcone instead of hardcoded value.

Good catch!

Nits:

- s/partialcone/partialclone/ (missing "l")

- subject lines in git.git tend to be of the form "subsystem: lowercase summary" with no trailing period. So maybe something like:

clone: respect user supplied origin name when setting up partial clone

Quoted 4 lines
---
 builtin/clone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

The change looks obviously good. With or without a commit message change like suggested above,

Thanks.

author
#2 lore raw

PATCH 1/1 clone: respect user supplied origin name when setting up partial clone

---
 builtin/clone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/clone.c +1 -1
index 50bde99618..822208a346 100644
@@ -1215,7 +1215,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);
Signature · 1 line
2.22.0.rc1.257.g3120a18244-goog
#3 lore raw

Re: [PATCH] clone: respect user supplied origin name when setting up partial clone

Quoted 5 lines · Xin Li
---
 builtin/clone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks. Can you add a test to demonstrate existing breakage without this single-line code change in the same patch?

Quoted 14 lines
builtin/clone.c +1 -1
index 50bde99618..822208a346 100644
@@ -1215,7 +1215,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);
author
#4 lore raw

PATCH v3 1/1 clone: respect user supplied origin name when setting up partial clone

---
 builtin/clone.c  |  2 +-
 t/t5601-clone.sh | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)
builtin/clone.c +1 -1
index 50bde99618..822208a346 100644
@@ -1215,7 +1215,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);
t/t5601-clone.sh +13 -2
index d6948cbdab..3595162c32 100755
@@ -634,7 +634,7 @@ 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" &&
 
@@ -646,8 +646,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}" "${URL}" &&
 	git clone --filter=blob:limit=0 "$URL" client &&
 
 	git -C client fsck &&
@@ -664,6 +670,11 @@ test_expect_success 'partial clone' '
 	partial_clone server "file://$(pwd)/server"
 '
 
+test_expect_success 'partial clone with -o' '
+	partial_clone_server server "file://$(pwd)/server" &&
+	git clone -o blah --filter=blob:limit=0 "${URL}" client
+'
+
 test_expect_success 'partial clone: warn if server does not support object filtering' '
 	rm -rf server client &&
 	test_create_repo server &&
Signature · 1 line
2.22.0.rc1.257.g3120a18244-goog
author
#5 lore raw

PATCH v4 1/1 clone: respect user supplied origin name when setting up partial clone

---
 builtin/clone.c  |  2 +-
 t/t5601-clone.sh | 16 +++++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)
builtin/clone.c +1 -1
index 50bde99618..822208a346 100644
@@ -1215,7 +1215,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);
t/t5601-clone.sh +13 -3
index d6948cbdab..22066bb88c 100755
@@ -634,9 +634,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" &&
@@ -646,8 +645,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 &&
@@ -664,6 +669,11 @@ test_expect_success 'partial clone' '
 	partial_clone server "file://$(pwd)/server"
 '
 
+test_expect_success 'partial clone with -o' '
+	partial_clone_server server "file://$(pwd)/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 &&
Signature · 1 line
2.22.0.rc1.257.g3120a18244-goog
author
#6 lore raw

PATCH v5 1/1 clone: respect user supplied origin name when setting up partial clone

---
 builtin/clone.c  |  2 +-
 t/t5601-clone.sh | 16 +++++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)
builtin/clone.c +1 -1
index 50bde99618..822208a346 100644
@@ -1215,7 +1215,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);
t/t5601-clone.sh +13 -3
index d6948cbdab..1fae8ae223 100755
@@ -634,9 +634,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" &&
@@ -646,8 +645,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 &&
@@ -664,6 +669,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 &&
Signature · 1 line
2.22.0.rc1.257.g3120a18244-goog