This repository was archived by the owner on Sep 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 534
Submodules init and update #270
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
498dbf7
storage: git.Storer move to storage.Storer and module handling
mcuadros b3b6e51
submodule init implementation
mcuadros b18d649
plumbing/object: allow TreeIter return SubModule entries
mcuadros c551c29
submodule init implementation
mcuadros 940a16c
format/index: sort the Entries before encode
mcuadros f8b5557
config: adding Config.Core.Worktree
mcuadros 65351f8
Repository.Init now handles non-standard .git location
mcuadros 7e990a8
submodule init and update implementation
mcuadros 09110d8
config: added Config.Submodules
mcuadros d6a6dec
submodule update implementation
mcuadros ed288b3
documentation and API improvements
mcuadros 790fbda
rebase master
mcuadros File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,8 @@ type Config struct { | |
// IsBare if true this repository is assumed to be bare and has no | ||
// working directory associated with it | ||
IsBare bool | ||
// Worktree is the path to the root of the working tree | ||
Worktree string | ||
} | ||
// Remote list of repository remotes | ||
Remotes map[string]*RemoteConfig | ||
|
@@ -76,6 +78,7 @@ const ( | |
fetchKey = "fetch" | ||
urlKey = "url" | ||
bareKey = "bare" | ||
worktreeKey = "worktree" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change this to |
||
) | ||
|
||
// Unmarshal parses a git-config file and stores it | ||
|
@@ -97,6 +100,8 @@ func (c *Config) unmarshalCore() { | |
if s.Options.Get(bareKey) == "true" { | ||
c.Core.IsBare = true | ||
} | ||
|
||
c.Core.Worktree = s.Options.Get(worktreeKey) | ||
} | ||
|
||
func (c *Config) unmarshalRemotes() error { | ||
|
@@ -129,6 +134,10 @@ func (c *Config) Marshal() ([]byte, error) { | |
func (c *Config) marshalCore() { | ||
s := c.raw.Section(coreSection) | ||
s.SetOption(bareKey, fmt.Sprintf("%t", c.Core.IsBare)) | ||
|
||
if c.Core.Worktree != "" { | ||
s.SetOption(worktreeKey, c.Core.Worktree) | ||
} | ||
} | ||
|
||
func (c *Config) marshalRemotes() { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ var _ = Suite(&ConfigSuite{}) | |
func (s *ConfigSuite) TestUnmarshall(c *C) { | ||
input := []byte(`[core] | ||
bare = true | ||
worktree = foo | ||
[remote "origin"] | ||
url = [email protected]:mcuadros/go-git.git | ||
fetch = +refs/heads/*:refs/remotes/origin/* | ||
|
@@ -22,15 +23,39 @@ func (s *ConfigSuite) TestUnmarshall(c *C) { | |
c.Assert(err, IsNil) | ||
|
||
c.Assert(cfg.Core.IsBare, Equals, true) | ||
c.Assert(cfg.Core.Worktree, Equals, "foo") | ||
c.Assert(cfg.Remotes, HasLen, 1) | ||
c.Assert(cfg.Remotes["origin"].Name, Equals, "origin") | ||
c.Assert(cfg.Remotes["origin"].URL, Equals, "[email protected]:mcuadros/go-git.git") | ||
c.Assert(cfg.Remotes["origin"].Fetch, DeepEquals, []RefSpec{"+refs/heads/*:refs/remotes/origin/*"}) | ||
} | ||
|
||
func (s *ConfigSuite) TestMarshall(c *C) { | ||
output := []byte(`[core] | ||
bare = true | ||
worktree = bar | ||
[remote "origin"] | ||
url = [email protected]:mcuadros/go-git.git | ||
`) | ||
|
||
cfg := NewConfig() | ||
cfg.Core.IsBare = true | ||
cfg.Core.Worktree = "bar" | ||
cfg.Remotes["origin"] = &RemoteConfig{ | ||
Name: "origin", | ||
URL: "[email protected]:mcuadros/go-git.git", | ||
} | ||
|
||
b, err := cfg.Marshal() | ||
c.Assert(err, IsNil) | ||
|
||
c.Assert(string(b), Equals, string(output)) | ||
} | ||
|
||
func (s *ConfigSuite) TestUnmarshallMarshall(c *C) { | ||
input := []byte(`[core] | ||
bare = true | ||
worktree = foo | ||
custom = ignored | ||
[remote "origin"] | ||
url = [email protected]:mcuadros/go-git.git | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
change name to
WorkTtree
.Add full stop at the end of the phrase.
We should call it
WorkTreePath
.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.
worktree is a single word, is a concept. I think that is enough to explained that is a path, since a worktree and is a string.