summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--remote-curl.c6
-rwxr-xr-xt/t5541-http-push-smart.sh15
2 files changed, 20 insertions, 1 deletions
diff --git a/remote-curl.c b/remote-curl.c
index e4cd321844..0b331faa72 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -119,7 +119,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 23be8ce92d..26c28cec54 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -456,6 +456,21 @@ test_expect_success 'push status output scrubs password' '
grep "^To $HTTPD_URL/smart/test_repo.git" status
'
+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 \