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
diff options
context:
space:
mode:
-rw-r--r--worktree.c17
-rw-r--r--worktree.h7
2 files changed, 6 insertions, 18 deletions
diff --git a/worktree.c b/worktree.c
index 62a7eb9342..a98f77d19f 100644
--- a/worktree.c
+++ b/worktree.c
@@ -536,18 +536,10 @@ void strbuf_worktree_ref(const struct worktree *wt,
strbuf_addstr(sb, refname);
}
-const char *worktree_ref(const struct worktree *wt, const char *refname)
-{
- static struct strbuf sb = STRBUF_INIT;
-
- strbuf_reset(&sb);
- strbuf_worktree_ref(wt, &sb, refname);
- return sb.buf;
-}
-
int other_head_refs(each_ref_fn fn, void *cb_data)
{
struct worktree **worktrees, **p;
+ struct strbuf refname = STRBUF_INIT;
int ret = 0;
worktrees = get_worktrees();
@@ -559,14 +551,17 @@ int other_head_refs(each_ref_fn fn, void *cb_data)
if (wt->is_current)
continue;
+ strbuf_reset(&refname);
+ strbuf_worktree_ref(wt, &refname, "HEAD");
if (!refs_read_ref_full(get_main_ref_store(the_repository),
- worktree_ref(wt, "HEAD"),
+ refname.buf,
RESOLVE_REF_READING,
&oid, &flag))
- ret = fn(worktree_ref(wt, "HEAD"), &oid, flag, cb_data);
+ ret = fn(refname.buf, &oid, flag, cb_data);
if (ret)
break;
}
free_worktrees(worktrees);
+ strbuf_release(&refname);
return ret;
}
diff --git a/worktree.h b/worktree.h
index 516744c433..1449b6bf5d 100644
--- a/worktree.h
+++ b/worktree.h
@@ -136,11 +136,4 @@ void strbuf_worktree_ref(const struct worktree *wt,
struct strbuf *sb,
const char *refname);
-/*
- * Return a refname suitable for access from the current ref
- * store. The result will be destroyed at the next call.
- */
-const char *worktree_ref(const struct worktree *wt,
- const char *refname);
-
#endif