Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 3 additions & 30 deletions gvfs-helper-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,35 +191,6 @@ static void gh_client__update_loose_cache(const char *line)
odb_loose_cache_add_new_oid(gh_client__chosen_odb, &oid);
}

/*
* Update the packed-git list to include the newly created packfile.
*/
static void gh_client__update_packed_git(const char *line)
{
struct strbuf path = STRBUF_INIT;
const char *v1_filename;
struct packed_git *p;
int is_local;

if (!skip_prefix(line, "packfile ", &v1_filename))
BUG("update_packed_git: invalid line '%s'", line);

/*
* ODB[0] is the local .git/objects. All others are alternates.
*/
is_local = (gh_client__chosen_odb == the_repository->objects->sources);

strbuf_addf(&path, "%s/pack/%s",
gh_client__chosen_odb->path, v1_filename);
strbuf_strip_suffix(&path, ".pack");
strbuf_addstr(&path, ".idx");

p = add_packed_git(the_repository, path.buf, path.len, is_local);
if (p)
packfile_store_add_pack(the_repository->objects->packfiles, p);
strbuf_release(&path);
}

/*
* CAP_OBJECTS verbs return the same format response:
*
Expand Down Expand Up @@ -279,7 +250,6 @@ static int gh_client__objects__receive_response(
}

else if (starts_with(line, "packfile")) {
gh_client__update_packed_git(line);
ghc |= GHC__CREATED__PACKFILE;
nr_packfile++;
}
Expand All @@ -300,6 +270,9 @@ static int gh_client__objects__receive_response(
}
}

if (ghc & GHC__CREATED__PACKFILE)
packfile_store_reprepare(the_repository->objects->packfiles);

*p_ghc = ghc;
*p_nr_loose = nr_loose;
*p_nr_packfile = nr_packfile;
Expand Down
17 changes: 16 additions & 1 deletion t/t5799-gvfs-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1285,15 +1285,30 @@ test_expect_success 'integration: explicit commit/trees, implicit blobs: diff 2
>OUT.output 2>OUT.stderr
'

trace_has_queue_oid () {
oid=$1
grep "gh_client__queue_oid: $oid"
}

trace_has_immediate_oid () {
oid=$1
grep "gh_client__get_immediate: $oid"
}

test_expect_success 'integration: fully implicit: diff 2 commits' '
test_when_finished "per_test_cleanup" &&
start_gvfs_protocol_server &&

# Implicitly demand-load everything without any pre-seeding.
#
GIT_TRACE2_EVENT="$(pwd)/diff-trace.txt" \
git -C "$REPO_T1" -c core.useGVFSHelper=true \
diff $(cat m1.branch)..$(cat m3.branch) \
>OUT.output 2>OUT.stderr
>OUT.output 2>OUT.stderr &&

oid=$(git -C "$REPO_SRC" rev-parse main:file9.txt.t) &&
trace_has_queue_oid $oid <diff-trace.txt &&
! trace_has_immediate_oid $oid <diff-trace.txt
'

# T1 should be considered contaminated at this point.
Expand Down
Loading