diff --git a/scalar.c b/scalar.c index cc4a1db08fab9e..bfc41aec1897e0 100644 --- a/scalar.c +++ b/scalar.c @@ -477,8 +477,13 @@ static char *default_cache_root(const char *root) { const char *env; - if (is_unattended()) - return xstrfmt("%s/.scalarCache", root); + if (is_unattended()) { + struct strbuf path = STRBUF_INIT; + strbuf_addstr(&path, root); + strip_last_path_component(&path); + strbuf_addstr(&path, "/.scalarCache"); + return strbuf_detach(&path, NULL); + } #ifdef WIN32 (void)env; diff --git a/t/t9210-scalar.sh b/t/t9210-scalar.sh index aadc397ead1fc4..826a3212252886 100755 --- a/t/t9210-scalar.sh +++ b/t/t9210-scalar.sh @@ -317,7 +317,7 @@ test_expect_success '`scalar clone` with GVFS-enabled server' ' cache_key="url_$(printf "%s" http://$HOST_PORT/ | tr A-Z a-z | test-tool sha1)" && - echo "$(pwd)/using-gvfs/.scalarCache/$cache_key" >expect && + echo "$(pwd)/.scalarCache/$cache_key" >expect && git -C using-gvfs/src config gvfs.sharedCache >actual && test_cmp expect actual &&