summaryrefslogtreecommitdiff
path: root/branch.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-07-11 22:38:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-07-11 22:38:51 (GMT)
commitc2d01098fb69567f7a354fa8f89a6f23d522ed82 (patch)
tree19b17dbb203ba348f0634af6b6f51308b57ed71a /branch.h
parent2b970bc09fd76e210da4b19b5ee766b0722e1862 (diff)
parent9bef0b1e6ec371e786c2fba3edcc06ad040a536c (diff)
downloadgit-c2d01098fb69567f7a354fa8f89a6f23d522ed82.zip
git-c2d01098fb69567f7a354fa8f89a6f23d522ed82.tar.gz
git-c2d01098fb69567f7a354fa8f89a6f23d522ed82.tar.bz2
Merge branch 'ds/branch-checked-out'
Introduce a helper to see if a branch is already being worked on (hence should not be newly checked out in a working tree), which performs much better than the existing find_shared_symref() to replace many uses of the latter. * ds/branch-checked-out: branch: drop unused worktrees variable fetch: stop passing around unused worktrees variable branch: fix branch_checked_out() leaks branch: use branch_checked_out() when deleting refs fetch: use new branch_checked_out() and add tests branch: check for bisects and rebases branch: add branch_checked_out() helper
Diffstat (limited to 'branch.h')
-rw-r--r--branch.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/branch.h b/branch.h
index 560b6b9..ef56103 100644
--- a/branch.h
+++ b/branch.h
@@ -101,6 +101,13 @@ void create_branches_recursively(struct repository *r, const char *name,
const char *tracking_name, int force,
int reflog, int quiet, enum branch_track track,
int dry_run);
+
+/*
+ * If the branch at 'refname' is currently checked out in a worktree,
+ * then return the path to that worktree.
+ */
+const char *branch_checked_out(const char *refname);
+
/*
* Check if 'name' can be a valid name for a branch; die otherwise.
* Return 1 if the named branch already exists; return 0 otherwise.