-
Notifications
You must be signed in to change notification settings - Fork 534
config: adds branches to config for tracking branches against remotes… #803
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution, this was a pending feature for a long time, so is a very welcome PR.
I just request small changes.
config/branch.go
Outdated
// Remote name of remote to track | ||
Remote string | ||
// Merge is the local refspec for the branch | ||
Merge string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the only value accepted in Merge
is a branch the type should be a ReferenceName
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick feedback, I'll update the PR as soon as I can
config/branch.go
Outdated
return errBranchEmptyName | ||
} | ||
|
||
if b.Merge != "" && !strings.HasPrefix(b.Merge, "refs/heads/") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check this using ReferenceName.IsBranch
config/config.go
Outdated
// Branches list of branches, the key is the branch name and should | ||
// equal Branch.Name | ||
Branches map[string]*Branch | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this extra line and also the 58.
@@ -87,19 +92,31 @@ func (c *Config) Validate() error { | |||
} | |||
} | |||
|
|||
for name, b := range c.Branches { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not covered by tests.
config/branch.go
Outdated
// Branch contains information on the | ||
// local branches and which remote to track | ||
type Branch struct { | ||
// Name name of branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to repeat the word name.
…, updates clone to track when cloning a branch. Fixes src-d#313 Signed-off-by: Jeremy Chambers <[email protected]>
aabcd10
to
02335b1
Compare
Cloning against a branch will also track that branch against the remote. Allows the ability to create and modify branch tracking in git config.
…, updates clone to track when cloning a branch. Fixes Setup tracking for default branch when cloned. #313
Signed-off-by: Jeremy Chambers [email protected]