summaryrefslogtreecommitdiff
path: root/branch.h
diff options
context:
space:
mode:
authorGlen Choo <chooglen@google.com>2022-01-29 00:04:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-02-01 22:18:49 (GMT)
commitbc0893cf3b0ee376ef5b6ed293b1525480a9d720 (patch)
tree4bb458d2053d0a84494e0417dbd156e421314893 /branch.h
parente89f151db13684924feb0cd0a0ca3a13c1d71516 (diff)
downloadgit-bc0893cf3b0ee376ef5b6ed293b1525480a9d720.zip
git-bc0893cf3b0ee376ef5b6ed293b1525480a9d720.tar.gz
git-bc0893cf3b0ee376ef5b6ed293b1525480a9d720.tar.bz2
branch: make create_branch() always create a branch
With the previous commit, there are no more invocations of create_branch() that do not create a branch because: * BRANCH_TRACK_OVERRIDE is no longer passed * clobber_head_ok = true and force = false is never passed Assert these situations, delete dead code and ensure that we're handling clobber_head_ok and force correctly by introducing tests for `git branch --force`. As a result, create_branch() now always creates a branch. Helped-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Glen Choo <chooglen@google.com> Reviewed-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'branch.h')
-rw-r--r--branch.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/branch.h b/branch.h
index ab2315c..cf3a4d3 100644
--- a/branch.h
+++ b/branch.h
@@ -52,8 +52,8 @@ void dwim_and_setup_tracking(struct repository *r, const char *new_ref,
*
* - force enables overwriting an existing (non-head) branch
*
- * - clobber_head_ok allows the currently checked out (hence existing)
- * branch to be overwritten; without 'force', it has no effect.
+ * - clobber_head_ok, when enabled with 'force', allows the currently
+ * checked out (head) branch to be overwritten
*
* - reflog creates a reflog for the branch
*