Ævar Arnfjörð Bjarmason wrote: > On Tue, Jun 13 2017, Jonathan Nieder jotted: > > Ævar Arnfjörð Bjarmason wrote: >>> My understanding of that last part is that Jonathan/someone (see >>> reported-by in that patch) had some script which was renaming >>> branches, and it was easier for whatever reason to just make it no-op >>> if the rename would have yielded the same result as doing nothing at >>> all. >>> >>> Most likely your implementation will consist of just re-using the >>> logic in rename_branch() (and renaming it to e.g. >>> copy_or_rename_branch() ...) so you could just re-use the no-op >>> behavior we use for -m, or if there's some reason not to no-op and >>> error instead for -c we could just do that, but in any case this case >>> of `git branch -c master master` or `git branch -c currentbranch` >>> should be tested for. >> >> I may be missing some context, but notice that the above mentioned >> commit is about -M, not -m. > > The context was just that that commit added a change in how -M > interacted when clobbering the current HEAD, and that -C should have a > test for that behavior, which the patch now submitted to the list has: > > +test_expect_success 'git branch -C master master should work when master is checked out' ' > + git checkout master && > + git branch -C master master > +' Perfect, thanks. Carry on. :) Jonathan