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

Re: [PATCH 3/3] branch: add a --copy (-c) option to go with --move (-m)

From
Sahil Dua <sahildua2305@gmail.com>
Date
Jun 14, 2017, 08:01 UTC
Message-ID
<CALiud+=mE77ak2x9KHWHW1oumAecyBN8R+J8dnUw+fUnyurrVQ@mail.gmail.com>
In-Reply-To
<xmqqfuf37q2q.fsf@gitster.mtv.corp.google.com>
On Tue, Jun 13, 2017 at 7:30 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 39 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Sahil Dua <sahildua2305@gmail.com> writes:
>>
>>> Add the ability to --copy a branch and its reflog and configuration,
>>> this uses the same underlying machinery as the --move (-m) option
>>> except the reflog and configuration is copied instead of being moved.
>>>
>>> This is useful for e.g. copying a topic branch to a new version,
>>> e.g. work to work-2 after submitting the work topic to the list, while
>>> preserving all the tracking info and other configuration that goes
>>> with the branch, and unlike --move keeping the other already-submitted
>>> branch around for reference.
>>>
>>> Like --move, when the source branch is the currently checked out
>>> branch the HEAD is moved to the destination branch. In the case of
>>> --move we don't really have a choice (other than remaining on a
>>> detached HEAD), but it makes sense to do the same for --copy.
>>
>> I strongly disagree with this "it makes sense to do the same".  It
>> would equally (if not more) make sense to keep the HEAD pointing at
>> the same.
>>
>> Personally, I may use this feature if it didn't move HEAD, but I
>> wouldn't if HEAD gets moved.  But that may be just me.
>
> Ah, that came out to be stronger than I intended.
>
> While I do prefer "the HEAD is not moved by this command---if you
> want to move to the newly created branch after copying, check it out
> yourself" a lot better than what the patch does, I do not think I'd
> care so strongly that I'd reject this patch series unless the
> behaviour is changed.
>
> But I do react strongly to an unsubstantiated claim "it makes sense
> to do the same".  I can buy "We anticipate that in 50% of the case
> users would find this branch switching annoying and in the other 50%
> of the case, users would find it useful; since we need to pick one,
> we just randomly decide to do the same as --move", though.

Okay, "it makes sense to do the same" was not the best way to say it. Basically what it meant was that considering there are conflicting opinions about how --copy should work with respect to checking out branch automatically, it makes sense to do it the same way as --move just to come to a conclusion. If we get user feedback that a lot of users find it annoying, we can make it work the other way around (without checkout branch automatically).

I will fix the commit message to explain this in v2. Is that okay?
Previous: Junio C HamanoNext: Sahil Dua
Message 33 of 39 in “branch: add tests for new copy branch feature”
  1. 1/6 branch: add tests for new copy branch featureSahil Dua, May 31, 2017
  2. 4/6 config: modify function signature to include copy argumentSahil Dua, May 31, 2017
  3. 6/6 branch: don't copy or rename config when same branch nameSahil Dua, May 31, 2017
  4. 3/6 config: abstract out create section from key logicSahil Dua, May 31, 2017
  5. 2/6 branch: add copy branch optionSahil Dua, May 31, 2017
  6. Junio C HamanoJun 1, 2017
  7. Sahil DuaJun 1, 2017
  8. 5/6 config: add copy config section logicSahil Dua, May 31, 2017
  9. 1/3 branch: add tests for new copy branch featureSahil Dua, Jun 1, 2017
  10. 2/3 config: abstract out create section from key logicSahil Dua, Jun 1, 2017
  11. 3/3 branch: add copy branch feature implementationSahil Dua, Jun 1, 2017
  12. Ævar Arnfjörð BjarmasonJun 1, 2017
  13. Sahil DuaJun 1, 2017
  14. 1/3 branch: add tests for new copy branch featureSahil Dua, Jun 5, 2017
  15. 2/3 config: abstract out create section from key logicSahil Dua, Jun 5, 2017
  16. 3/3 branch: add copy branch feature implementationSahil Dua, Jun 5, 2017
  17. Sahil DuaJun 5, 2017
  18. Junio C HamanoJun 6, 2017
  19. Junio C HamanoJun 6, 2017
  20. Ævar Arnfjörð BjarmasonJun 6, 2017
  21. Sahil DuaJun 6, 2017
  22. Junio C HamanoJun 6, 2017
  23. 1/3 config: create a function to format section headersSahil Dua, Jun 13, 2017
  24. 2/3 branch: add test for -m renaming multiple config sectionsSahil Dua, Jun 13, 2017
  25. Junio C HamanoJun 13, 2017
  26. Ævar Arnfjörð BjarmasonJun 13, 2017
  27. Junio C HamanoJun 13, 2017
  28. Ævar Arnfjörð BjarmasonJun 13, 2017
  29. 2/3 branch: add test for -m renaming multiple config sectionsSahil Dua, Jun 18, 2017
  30. 3/3 branch: add a --copy (-c) option to go with --move (-m)Sahil Dua, Jun 13, 2017
  31. Junio C HamanoJun 13, 2017
  32. Junio C HamanoJun 13, 2017
  33. Sahil DuaJun 14, 2017
  34. 3/3 branch: add a --copy (-c) option to go with --move (-m)Sahil Dua, Jun 18, 2017
  35. Junio C HamanoJun 13, 2017
  36. Ævar Arnfjörð BjarmasonJun 13, 2017
  37. 1/3 config: create a function to format section headersSahil Dua, Jun 18, 2017
  38. Ramsay JonesJun 19, 2017
  39. Sahil DuaJun 19, 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.