Re: What's cooking in git.git (Jul 2017, #04; Thu, 13)
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 15, 2017, 11:12 UTC
- Message-ID
- <87iniu2bty.fsf@gmail.com>
- In-Reply-To
- <xmqqo9snsy0k.fsf@gitster.mtv.corp.google.com>
On Thu, Jul 13 2017, Junio C. Hamano jotted:
Show 14 quoted lines
> Here are the topics that have been cooking. Commits prefixed with > [...] > > * jc/allow-lazy-cas (2017-07-06) 1 commit > - push: disable lazy --force-with-lease by default > > Because "git push --force-with-lease[=<ref>]" that relies on the > stability of remote-tracking branches is unsafe when something > fetches into the repository behind user's back, it is now disabled > by default. A new configuration variable can be used to enable it > by users who know what they are doing. This would pave the way to > possibly turn `--force` into `--force-with-lease`. > > Will wait for feedback, then merge to and cook in 'next'.
Aside from the feedback I just sent now 87k23a2d28.fsf@gmail.com, there's my outstanding comment on the config variable name in 877ezkbn6x.fsf@gmail.com which is waiting on your feedback.
Show 14 quoted lines
> * sd/branch-copy (2017-06-18) 3 commits > - branch: add a --copy (-c) option to go with --move (-m) > - branch: add test for -m renaming multiple config sections > - config: create a function to format section headers > > "git branch" learned "-c/-C" to create and switch to a new branch > by copying an existing one. > > Undecided. > > I personally do not think "branch --copy master backup" while on > "master" that switches to "backup" is a good UI, and I *will* say > "I told you so" when users complain after we merge this down to > 'next' and eventually to 'master'.
For anyone following along with this. The reason Sahil & I hacked it up like that is because that's analogous to what the --move option does.
Let's see what *nix does:
$ rm -rf /tmp/{master,backup}; mkdir /tmp/master && cd /tmp/master && mv /tmp/{master,backup} ; file /tmp/{master,backup}
/tmp/master: cannot open `/tmp/master' (No such file or directory)
/tmp/backup: directorySimilarly to that, when you're on "master" "git branch --move backup" could have left you on an orphan branch, but it doesn't, it's the equivalent of "mv && cd" in *nix terms.
So since our --move is really --move-and-checkout I think it would be confusing to introduce a --copy sister option that has the semantics of --copy-no-checkout instead of a corresponding --copy-and-checkout.
I think it's easier to explain & use an option that's "like --move except the old branch doesn't get deleted", which is what this does, instead of "actually not analogous to --move at all".
I happen to want to use this for something where the semantics on that topic work better for me, but I recognize that that's just a matter of taste, if we were green-fielding this I wouldn't mind either way.
But since we're not, and especially with all the confusion around checkout/branch (some of the hairiest UX in git) I think our --move & --copy should be symmetric in the same way that mv(1) an cp(1) are symmetric. Let's not add yet another special case to whether a ref is created/checked out when being manipulated by some mode of checkout/branch.