Skip to content

Commit b9786b9

Browse files
derrickstoleedscho
authored andcommitted
scalar: .scalarCache should live above enlistment
We should not be putting the .scalarCache inside the enlistment as a sibling to the 'src' directory. This only happens in "unattended" mode, but it also negates any benefit of a shared object cache because each enlistment absolutely does not share any objects with others. Move the shared object cache in this case to a level above the enlistment, so at least there is some hope that it can be reused. This is also critical to the upcoming --no-src option, since the shared object cache cannot be located within the Git repository. Signed-off-by: Derrick Stolee <[email protected]>
1 parent 0f8b05a commit b9786b9

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

scalar.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,13 @@ static char *default_cache_root(const char *root)
532532
{
533533
const char *env;
534534

535-
if (is_unattended())
536-
return xstrfmt("%s/.scalarCache", root);
535+
if (is_unattended()) {
536+
struct strbuf path = STRBUF_INIT;
537+
strbuf_addstr(&path, root);
538+
strip_last_path_component(&path);
539+
strbuf_addstr(&path, "/.scalarCache");
540+
return strbuf_detach(&path, NULL);
541+
}
537542

538543
#ifdef WIN32
539544
(void)env;

t/t9210-scalar.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ test_expect_success '`scalar clone` with GVFS-enabled server' '
427427
cache_key="url_$(printf "%s" http://$HOST_PORT/ |
428428
tr A-Z a-z |
429429
test-tool sha1)" &&
430-
echo "$(pwd)/using-gvfs/.scalarCache/$cache_key" >expect &&
430+
echo "$(pwd)/.scalarCache/$cache_key" >expect &&
431431
git -C using-gvfs/src config gvfs.sharedCache >actual &&
432432
test_cmp expect actual &&
433433

0 commit comments

Comments
 (0)