summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-09-19 01:47:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-09-19 01:47:53 (GMT)
commit8a044c7f1d56cef657be342e40de0795d688e882 (patch)
treeb5d4380a0379d2f8d47fd91a130ecb4cea503a30 /submodule.c
parentdafbe1993e54bccb80501a98812105a7bcddc748 (diff)
parent873ea90d61fa45ec91af3864c2e336bfe489d181 (diff)
downloadgit-8a044c7f1d56cef657be342e40de0795d688e882.zip
git-8a044c7f1d56cef657be342e40de0795d688e882.tar.gz
git-8a044c7f1d56cef657be342e40de0795d688e882.tar.bz2
Merge branch 'nd/prune-in-worktree'
"git gc" and friends when multiple worktrees are used off of a single repository did not consider the index and per-worktree refs of other worktrees as the root for reachability traversal, making objects that are in use only in other worktrees to be subject to garbage collection. * nd/prune-in-worktree: refs.c: reindent get_submodule_ref_store() refs.c: remove fallback-to-main-store code get_submodule_ref_store() rev-list: expose and document --single-worktree revision.c: --reflog add HEAD reflog from all worktrees files-backend: make reflog iterator go through per-worktree reflog revision.c: --all adds HEAD from all worktrees refs: remove dead for_each_*_submodule() refs.c: move for_each_remote_ref_submodule() to submodule.c revision.c: use refs_for_each*() instead of for_each_*_submodule() refs: add refs_head_ref() refs: move submodule slash stripping code to get_submodule_ref_store refs.c: refactor get_submodule_ref_store(), share common free block revision.c: --indexed-objects add objects from all worktrees revision.c: refactor add_index_objects_to_pending() refs.c: use is_dir_sep() in resolve_gitlink_ref() revision.h: new flag in struct rev_info wrt. worktree-related refs
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c
index 3cea822..075c55f 100644
--- a/submodule.c
+++ b/submodule.c
@@ -69,6 +69,13 @@ int is_staging_gitmodules_ok(const struct index_state *istate)
return 1;
}
+static int for_each_remote_ref_submodule(const char *submodule,
+ each_ref_fn fn, void *cb_data)
+{
+ return refs_for_each_remote_ref(get_submodule_ref_store(submodule),
+ fn, cb_data);
+}
+
/*
* Try to update the "path" entry in the "submodule.<name>" section of the
* .gitmodules file. Return 0 only if a .gitmodules file was found, a section
@@ -1627,6 +1634,8 @@ static int find_first_merges(struct object_array *result, const char *path,
oid_to_hex(&a->object.oid));
init_revisions(&revs, NULL);
rev_opts.submodule = path;
+ /* FIXME: can't handle linked worktrees in submodules yet */
+ revs.single_worktree = path != NULL;
setup_revisions(ARRAY_SIZE(rev_args)-1, rev_args, &revs, &rev_opts);
/* save all revisions from the above list that contain b */