Re: [PATCH v3 1/2 / RFC] builtin/branch: stop supporting the use of --set-upstream option

2 messages, 2 authors, 2017-08-17 · open the first message on its own page

Re: [PATCH v3 1/2 / RFC] builtin/branch: stop supporting the use of --set-upstream option

From: Junio C Hamano <hidden>
Date: 2017-08-16 19:09:53

Kaartic Sivaraam [off-list ref] writes:
On Wednesday 16 August 2017 12:28 AM, Junio C Hamano wrote:
quoted
Some refactoring to make it easier to reuse it from the new caller
would be necessary. 
Sorry but I think I don't get that correctly. What's the "new caller"
being referred to here?
What should be refactored?
You said that "checkout" does not do a necessary check that is done
in "branch", so presumably "branch" already has a code to do so that
is not called by the current "checkout", right?  Then you would add
a new caller in "checkout" to trigger the same check that is already
done in "branch", but the code "branch" uses _might_ be too specific
to the kind of data the current implementation of "branch" uses and
it _may_ not be easy to call it directly from "checkout" (I didn't
check if that is the case).  If so, then the check implemented in
the current "branch" may need to be refactored before it can easily
be called from the new caller you would be adding to "checkout".

Re: [PATCH v3 1/2 / RFC] builtin/branch: stop supporting the use of --set-upstream option

From: Kaartic Sivaraam <hidden>
Date: 2017-08-17 02:03:56

On Wed, 2017-08-16 at 12:09 -0700, Junio C Hamano wrote:
You said that "checkout" does not do a necessary check that is done
in "branch", so presumably "branch" already has a code to do so that
is not called by the current "checkout", right?  Then you would add
a new caller in "checkout" to trigger the same check that is already
done in "branch", but the code "branch" uses _might_ be too specific
to the kind of data the current implementation of "branch" uses and
it _may_ not be easy to call it directly from "checkout" (I didn't
check if that is the case).  If so, then the check implemented in
the current "branch" may need to be refactored before it can easily
be called from the new caller you would be adding to "checkout".
Thanks. Now I get it. What about doing that check in
branch.c::create_branch or branch.c::validate_new_branchname? I guess
creating a branch named HEAD isn't that good an idea in any case. Doing
the check there might prevent a similar situation in future, I guess.
Further "branch" and "checkout" do call branch.c::create_branch which
in turn calls branch.c::validate_new_branchname.

-- 
Kaartic
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help