From: Junio C Hamano Date: Tue, 20 Oct 2026 19:51:53 GMT Subject: Re: [PATCH] branch: strip refs/heads/ from the --set-upstream-to hint Message-ID: In-Reply-To: "tsukasa-ino via GitGitGadget" writes: > hint: git branch --set-upstream-to=origin/refs/heads/feat > > The hint says origin/refs/heads/feat, but the correct name is > origin/feat. Running the command as printed fails, because the full > ref name is not a valid remote-tracking branch name here. Good observation. Thanks for noticing. > +test_expect_success '--set-upstream-to hint uses short remote-tracking branch name on locked config' ' > + test_when_finished "git branch -D hint-local" && > + test_when_finished "git update-ref -d refs/remotes/hintremote/hintbranch" && > + test_config remote.hintremote.url . && > + test_config remote.hintremote.fetch "+refs/heads/*:refs/remotes/hintremote/*" && > + git update-ref refs/remotes/hintremote/hintbranch HEAD && > + git branch hint-local && > + test_when_finished "rm -f .git/config.lock" && > + >.git/config.lock && > + test_must_fail git -c core.configLockTimeout=0 \ > + branch --set-upstream-to=hintremote/hintbranch hint-local 2>err && > + test_grep "git branch --set-upstream-to=hintremote/hintbranch\$" err && > + test_grep ! "refs/heads/" err Perhaps it makes sense to also test that the suggested command line is accepted after all of the above? > +' Thanks.