Re: [PATCH v5 06/10] fast-export: add new --refspec option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 6, 2013, 21:00 UTC
- Message-ID
- <xmqq38n98cud.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CAMP44s246M5DaeX80tqzfjRWnbE4vKh-vp_tLW-qAQUFFPsP0Q@mail.gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 12 quoted lines
> On Thu, Oct 31, 2013 at 12:26 PM, Junio C Hamano <gitster@pobox.com> wrote: >> Felipe Contreras <felipe.contreras@gmail.com> writes: >> >>> +test_expect_success 'use refspec' ' >>> + git fast-export --refspec refs/heads/master:refs/heads/foobar master | \ >>> + grep "^commit " | sort | uniq > actual && >> >> It feels somewhat redundant that you have to twice say that you are >> pushing your "master", once with --refspec and then the branch >> name. Is this the best we can do? > > As this has been discussed before and no other solution came forward, yes.
We need to take that "no other solution came forward" with a grain of salt. After all, this is your itch, and if nobody was interested in helping you (which I think that we both understand entirely plausible, given the recent history), it only means you didn't think of any other solution.
I didn't think things through, but at the external UI level, I see a possibility of a nicer way to express the above.
In our "push" refspec (and export is about pushing what we have), a colonless refspec A is a short-hand for A:A, so the traditional
git fast-export master
can be thought of, in a new world order with a patch that lets you do a ref mapping, a short-hand for an identical mapping:
git fast-export master:master
It follows that the syntax naturally support
git fast-export refs/heads/master:refs/heads/foobar
I would think.
That approach lets you express ref mapping without a new option --refspec, which goes contrary to existing UI for any commands in Git (I think nobody takes refspec as a value to a dashed-option in the transport; both in fetch and push, they are proper operands, i.e. command line arguments to the command), no?