Re: [PATCH 2/2] push: Add '--current', which pushes only the current branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jakub Narebski <jnareb@xxxxxxxxx> writes:

> Junio C Hamano wrote:
>> Jakub Narebski <jnareb@xxxxxxxxx> writes:
>> 
>>> Brief recap, to check if I understand things correctly:
>>>
>>> 1. If you use "matching" more often, then it should be enough
>>>    to provide remote.<remotename>.push with refspec or wildcard
>>>    refspec. 
>> 
>> Eh, excuse me, what refspec would you write there?  "matching"
>> is defined to push the intersection of what we have and what
>> they have when "git-push" is run.  I do not think there is any
>> way to write that in remote.$there.push and cast in stone.
> [...]
>>>    Question: what to do if there is no remote.<remotename>.push?
>>>    Assume 1-1 matching?
>> 
>> One-to-one is what 'matching' does, and the way to trigger it is
>> not to have a remote.$there.push.
>
> I'm sorry, I had to have "stupid" moment. Thanks a lot for complete 
> explanation of git-push, anyway.
>
>
>>>    ... If one wants to push only current branch, one
>>>    would use "git push --current" or "git push <remotename> HEAD".
>> 
>> I think that is the proposal by Steffen (added back CC).
>> 
>> I am wondering if an alternative approach could be simpler.  If
>> we teach "git-push" to notice when only the refspecs are given
>> without remotename, and default to branch.$current.remote in
>> such a case, 
>
> Including default remote when branch.<branchname>.remote is not set?
>
>> IOW, make these: 
>> 
>> 	$ git push HEAD
>>       $ git push next
>> 
>> push the obvious thing to the default remote, I _think_ we can
>> achieve the same effect as --current and a bit more.
>
> The only problem would be when there is conflict between remote name and 
> branch name...

Yes.  *If* we were to do that fallback it has to be something
like this:

 (1) does $0 look like remote and $1..$n look like a refspec?  If
     so do not fallback;

 (2) Do we have branch.$current.remote?  If not, we cannot
     fallback so error out.

 (3) otherwise, does $0 look like a refspec?  If so, try insert
     it before the params, treating $0..$n all refspecs.

> So for scripts it would be "git push -- HEAD"; still shorter than
> "git push --current".

scripts should be as explicit as they need to be.

What matters is the case when the command cannot be explicit,
just like you cannot write --matching with explicit refspecs.

> BTW. what would happen for "git push branch1 branch2" if branch1 has 
> different remote than branch2?

Read my example more carefully.  It says "push HEAD" and "push
next" while on 'pu' and it takes branch.pu.remote.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux