Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t/helper
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2017-04-24 13:01:23 +0300
committerJunio C Hamano <gitster@pobox.com>2017-04-25 07:28:55 +0300
commitfa099d23227f88b5a1cd79c646551130d9b36e6d (patch)
treef5308d3f4b446b027099b9720070023f5f2fa89a /t/helper
parent17eff96b83be5c4c25e33a40e632d1b55c506d33 (diff)
worktree.c: kill parse_ref() in favor of refs_resolve_ref_unsafe()
The manual parsing code is replaced with a call to refs_resolve_ref_unsafe(). The manual parsing code must die because only refs/files-backend.c should do that. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper')
-rw-r--r--t/helper/test-ref-store.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index 2d84c45ffe..4a487c014e 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -1,5 +1,6 @@
#include "cache.h"
#include "refs.h"
+#include "worktree.h"
static const char *notnull(const char *arg, const char *name)
{
@@ -32,6 +33,23 @@ static const char **get_store(const char **argv, struct ref_store **refs)
strbuf_release(&sb);
*refs = get_submodule_ref_store(gitdir);
+ } else if (skip_prefix(argv[0], "worktree:", &gitdir)) {
+ struct worktree **p, **worktrees = get_worktrees(0);
+
+ for (p = worktrees; *p; p++) {
+ struct worktree *wt = *p;
+
+ if (!wt->id) {
+ /* special case for main worktree */
+ if (!strcmp(gitdir, "main"))
+ break;
+ } else if (!strcmp(gitdir, wt->id))
+ break;
+ }
+ if (!*p)
+ die("no such worktree: %s", gitdir);
+
+ *refs = get_worktree_ref_store(*p);
} else
die("unknown backend %s", argv[0]);