On Tue, Nov 09 2021, Anders Kaseorg wrote:
quoted hunk ↗ jump to hunk
[...]
if (!validate_branchname(name, ref))
return 0;
@@ -208,9 +208,11 @@ int validate_new_branchname(const char *name, struct strbuf *ref, int force)
die(_("A branch named '%s' already exists."),
ref->buf + strlen("refs/heads/"));
- head = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
- if (!is_bare_repository() && head && !strcmp(head, ref->buf))
- die(_("Cannot force update the current branch."));
+ wt = find_shared_symref("HEAD", ref->buf);
+ if (wt && !wt->is_bare)
+ die(_("Cannot force update the branch '%s'"
die() etc. messages should start with lower-case. See CodingGuidelines.
Here you're changing an existing die() message, but since it's something
translators will need to re-do let's fix it while we're at it.