Imported Upstream version 2.5.0
[scm/test.git] / config / config.go
index 089565b..0f0c5a2 100644 (file)
@@ -232,10 +232,22 @@ func (c *Configuration) SetValidRemote(name string) error {
        return nil
 }
 
+func (c *Configuration) SetValidPushRemote(name string) error {
+       if err := git.ValidateRemote(name); err != nil {
+               return err
+       }
+       c.SetPushRemote(name)
+       return nil
+}
+
 func (c *Configuration) SetRemote(name string) {
        c.currentRemote = &name
 }
 
+func (c *Configuration) SetPushRemote(name string) {
+       c.pushRemote = &name
+}
+
 func (c *Configuration) Remotes() []string {
        c.loadGitConfig()
        return c.remotes
@@ -295,7 +307,8 @@ func (c *Configuration) loadGitDirs() {
        if err != nil {
                errMsg := err.Error()
                tracerx.Printf("Error running 'git rev-parse': %s", errMsg)
-               if !strings.Contains(errMsg, "Not a git repository") {
+               if !strings.Contains(strings.ToLower(errMsg),
+                       "not a git repository") {
                        fmt.Fprintf(os.Stderr, "Error: %s\n", errMsg)
                }
                c.gitDir = &gitdir
@@ -310,8 +323,8 @@ func (c *Configuration) LocalGitStorageDir() string {
        return c.Filesystem().GitStorageDir
 }
 
-func (c *Configuration) LocalReferenceDir() string {
-       return c.Filesystem().ReferenceDir
+func (c *Configuration) LocalReferenceDirs() []string {
+       return c.Filesystem().ReferenceDirs
 }
 
 func (c *Configuration) LFSStorageDir() string {
@@ -345,7 +358,12 @@ func (c *Configuration) Filesystem() *fs.Filesystem {
 
        if c.fs == nil {
                lfsdir, _ := c.Git.Get("lfs.storage")
-               c.fs = fs.New(c.LocalGitDir(), c.LocalWorkingDir(), lfsdir)
+               c.fs = fs.New(
+                       c.Os,
+                       c.LocalGitDir(),
+                       c.LocalWorkingDir(),
+                       lfsdir,
+               )
        }
 
        return c.fs