git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/RFC] branch: add tests for new copy branch feature

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jun 13, 2017, 18:08 UTC
Message-ID
<20170613180857.GI133952@aiede.mtv.corp.google.com>
In-Reply-To
<87o9tr3gxs.fsf@gmail.com>
Ævar Arnfjörð Bjarmason wrote:
> On Tue, Jun 13 2017, Jonathan Nieder jotted:
> > Ævar Arnfjörð Bjarmason wrote:
Show 25 quoted lines
>>> 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
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 8 of 10 in “branch: add tests for new copy branch feature”
  1. branch: add tests for new copy branch featureSahil Dua, May 28, 2017
  2. Ævar Arnfjörð BjarmasonMay 28, 2017
  3. Sahil DuaMay 29, 2017
  4. Ævar Arnfjörð BjarmasonMay 29, 2017
  5. Sahil DuaMay 29, 2017
  6. Jonathan NiederJun 13, 2017
  7. Ævar Arnfjörð BjarmasonJun 13, 2017
  8. Jonathan NiederJun 13, 2017
  9. Junio C HamanoMay 29, 2017
  10. Sahil DuaMay 29, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.