From: Junio C Hamano Date: Wed, 18 Sep 2024 20:24:07 GMT Subject: Re: [PATCH 4/4] remote: check branch names Message-ID: In-Reply-To: <82a08e44-3822-4a26-ad09-4ca1a9b44c11@gmail.com> phillip.wood123@gmail.com writes: > ... Given that "git remote > set-branches" has only ever supported "real" branch names and patterns > on the command line and no-one has complained I wonder if we're better > off doing something like > > if (strbuf_check_branch_ref(&buf, branch_name) || > strcmp(buf.buf + 11, branch_name)) > error(_("invalid branch name '%s'", branch_name)); > > where the "buf.buf + 11" skips "refs/heads/" Yeah, replacing +11 with skip_prefix() or something for readability, such a check might be good enough in pracrice. Thanks.