From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Sahil Dua <sahildua2305@gmail.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH/RFC] branch: add tests for new copy branch feature
Date: Tue, 13 Jun 2017 20:01:35 +0200 [thread overview]
Message-ID: <87o9tr3gxs.fsf@gmail.com> (raw)
In-Reply-To: <20170613175501.GH133952@aiede.mtv.corp.google.com>
On Tue, Jun 13 2017, Jonathan Nieder jotted:
> Hi,
>
> Ævar Arnfjörð Bjarmason wrote:
>
>> So the reason we have this for -m is:
>>
>> commit 3f59481e33
>> Author: Jonathan Nieder <jrnieder@gmail.com>
>> Date: Fri Nov 25 20:30:02 2011 -0600
>>
>> branch: allow a no-op "branch -M <current-branch> HEAD"
>>
>> Overwriting the current branch with a different commit is forbidden, as it
>> will make the status recorded in the index and the working tree out of
>> sync with respect to the HEAD. There however is no reason to forbid it if
>> the current branch is renamed to itself, which admittedly is something
>> only an insane user would do, but is handy for scripts.
>>
>> 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
+'
next prev parent reply other threads:[~2017-06-13 18:02 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-28 22:56 [PATCH/RFC] branch: add tests for new copy branch feature Sahil Dua
2017-05-28 23:30 ` Ævar Arnfjörð Bjarmason
2017-05-29 20:41 ` Sahil Dua
2017-05-29 20:50 ` Ævar Arnfjörð Bjarmason
2017-05-29 22:23 ` Sahil Dua
2017-06-13 17:55 ` Jonathan Nieder
2017-06-13 18:01 ` Ævar Arnfjörð Bjarmason [this message]
2017-06-13 18:08 ` Jonathan Nieder
2017-05-29 2:09 ` Junio C Hamano
2017-05-29 19:39 ` Sahil Dua
2017-05-31 23:35 ` [PATCH/RFC v2 1/6] " Sahil Dua
2017-05-31 23:35 ` [PATCH/RFC v2 6/6] branch: don't copy or rename config when same branch name Sahil Dua
2017-05-31 23:35 ` [PATCH/RFC v2 3/6] config: abstract out create section from key logic Sahil Dua
2017-05-31 23:35 ` [PATCH/RFC v2 4/6] config: modify function signature to include copy argument Sahil Dua
2017-05-31 23:35 ` [PATCH/RFC v2 2/6] branch: add copy branch option Sahil Dua
2017-06-01 1:50 ` Junio C Hamano
2017-06-01 16:09 ` Sahil Dua
2017-05-31 23:35 ` [PATCH/RFC v2 5/6] config: add copy config section logic Sahil Dua
2017-06-01 18:35 ` [PATCH/RFC v3 1/3] branch: add tests for new copy branch feature Sahil Dua
2017-06-01 18:35 ` [PATCH/RFC v3 2/3] config: abstract out create section from key logic Sahil Dua
2017-06-01 18:35 ` [PATCH/RFC v3 3/3] branch: add copy branch feature implementation Sahil Dua
2017-06-01 18:59 ` Ævar Arnfjörð Bjarmason
2017-06-01 22:05 ` Sahil Dua
2017-06-05 20:40 ` [PATCH/RFC v4 1/3] branch: add tests for new copy branch feature Sahil Dua
2017-06-05 20:40 ` [PATCH/RFC v4 2/3] config: abstract out create section from key logic Sahil Dua
2017-06-05 20:40 ` [PATCH/RFC v4 3/3] branch: add copy branch feature implementation Sahil Dua
2017-06-05 20:52 ` Sahil Dua
2017-06-06 0:10 ` Junio C Hamano
2017-06-06 0:14 ` Junio C Hamano
2017-06-06 7:39 ` Ævar Arnfjörð Bjarmason
2017-06-06 10:13 ` Sahil Dua
2017-06-06 12:03 ` Junio C Hamano
2017-06-13 16:17 ` [PATCH 1/3] config: create a function to format section headers Sahil Dua
2017-06-13 16:17 ` [PATCH 2/3] branch: add test for -m renaming multiple config sections Sahil Dua
2017-06-13 17:10 ` Junio C Hamano
2017-06-13 17:31 ` Ævar Arnfjörð Bjarmason
2017-06-13 17:39 ` Junio C Hamano
2017-06-13 17:53 ` Ævar Arnfjörð Bjarmason
2017-06-18 21:17 ` [PATCH v2 " Sahil Dua
2017-06-13 16:17 ` [PATCH 3/3] branch: add a --copy (-c) option to go with --move (-m) Sahil Dua
2017-06-13 17:05 ` Junio C Hamano
2017-06-13 17:30 ` Junio C Hamano
2017-06-14 8:01 ` Sahil Dua
2017-06-18 21:19 ` [PATCH v2 " Sahil Dua
2017-06-13 17:06 ` [PATCH 1/3] config: create a function to format section headers Junio C Hamano
2017-06-13 17:09 ` Ævar Arnfjörð Bjarmason
2017-06-18 21:16 ` [PATCH v2 " Sahil Dua
2017-06-19 12:08 ` Ramsay Jones
2017-06-19 14:51 ` Sahil Dua
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o9tr3gxs.fsf@gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=sahildua2305@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.