Re: [PATCH 1/2] Allow users to require source branch on git-checkout -b.

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

 



Shawn Pearce <spearce@xxxxxxxxxxx> writes:

> Junio C Hamano <junkio@xxxxxxx> wrote:
>> "Shawn O. Pearce" <spearce@xxxxxxxxxxx> writes:
>> > This introduces a new config option: checkout.requireSourceBranch,
>> 
>> You could turn it around and make it a per-branch configuration,
>> like:
>> 
>> 	[branch "main"]
>>         	allowbranchbydefault = true
>
> Are you suggesting that we change "git-checkout -b" to by default
> require the source branch, but the user can restore the original
> behavior by setting the above per-branch configuration option?

Under my suggestion, the new git-checkout -b (and git-branch)
would:

 (0) proceed if there is an explicit branch point specified on
     the command like, just like now;

 (1) allow omission of branch-point if the current branch has
     allowbranchbydefault configuration set as in above.  A new
     branch is created forking off of the current HEAD;

 (2) allow omission of branch-point if no branch has such
     configuration; in other words, existing repositories that
     do not have the allowbranchbydefault configuration anywhere
     are not affected.  A new branch is created forking off of
     the current HEAD;

 (3) otherwise, it barfs if you do not give an explicit
     branch-point.

and a newly created repository that is newbie friendly has one
such configuration automatically set for 'master' (if created
with git-init) or whatever the primary branch is (if created
with git-clone).

Note that (2) is rather important, although I think the current
implementation of repo-config is cumbersome to use for this
purpose and probably needs to be enhanced.


-
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]