diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-07-30 13:20:34 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-07-30 13:20:34 -0700 |
commit | c2796ac1c2807a46d1db90e47c892ba96bfdb276 (patch) | |
tree | 0226f00f741c76e85bc4157945c8fa7e4ce084a5 | |
parent | Merge branch 'cc/pretty-contents-size' into master (diff) | |
parent | remote-curl: make --force-with-lease work with non-ASCII ref names (diff) | |
download | tgif-c2796ac1c2807a46d1db90e47c892ba96bfdb276.tar.xz |
Merge branch 'bc/push-cas-cquoted-refname' into master
Pushing a ref whose name contains non-ASCII character with the
"--force-with-lease" option did not work over smart HTTP protocol,
which has been corrected.
* bc/push-cas-cquoted-refname:
remote-curl: make --force-with-lease work with non-ASCII ref names
-rw-r--r-- | remote-curl.c | 6 | ||||
-rwxr-xr-x | t/t5541-http-push-smart.sh | 15 |
2 files changed, 20 insertions, 1 deletions
diff --git a/remote-curl.c b/remote-curl.c index 5cbc6e5002..c9921c552c 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -121,7 +121,11 @@ static int set_option(const char *name, const char *value) } else if (!strcmp(name, "cas")) { struct strbuf val = STRBUF_INIT; - strbuf_addf(&val, "--" CAS_OPT_NAME "=%s", value); + strbuf_addstr(&val, "--force-with-lease="); + if (*value != '"') + strbuf_addstr(&val, value); + else if (unquote_c_style(&val, value, NULL)) + return -1; string_list_append(&cas_options, val.buf); strbuf_release(&val); return 0; diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh index 463d0f12e5..187454f5dd 100755 --- a/t/t5541-http-push-smart.sh +++ b/t/t5541-http-push-smart.sh @@ -479,6 +479,21 @@ test_expect_success 'clone/fetch scrubs password from reflogs' ' ! grep "$HTTPD_URL_USER_PASS" reflog ' +test_expect_success 'Non-ASCII branch name can be used with --force-with-lease' ' + cd "$ROOT_PATH" && + git clone "$HTTPD_URL_USER_PASS/smart/test_repo.git" non-ascii && + cd non-ascii && + git checkout -b rama-de-árbol && + test_commit F && + git push --force-with-lease origin rama-de-árbol && + git ls-remote origin refs/heads/rama-de-árbol >actual && + git ls-remote . refs/heads/rama-de-árbol >expect && + test_cmp expect actual && + git push --delete --force-with-lease origin rama-de-árbol && + git ls-remote origin refs/heads/rama-de-árbol >actual && + test_must_be_empty actual +' + test_expect_success 'colorize errors/hints' ' cd "$ROOT_PATH"/test_repo_clone && test_must_fail git -c color.transport=always -c color.advice=always \ |