forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgitconfig.go
28 lines (21 loc) · 819 Bytes
/
gitconfig.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package scmauth
import (
"path/filepath"
"github.com/golang/glog"
)
const GitConfigName = ".gitconfig"
// GitConfig implements SCMAuth interface for using a custom .gitconfig file
type GitConfig struct{}
// Setup adds the secret .gitconfig as an include to the .gitconfig file to be used in the build
func (_ GitConfig) Setup(baseDir string, context SCMAuthContext) error {
glog.V(4).Infof("Adding user-provided gitconfig %s to build gitconfig", filepath.Join(baseDir, GitConfigName))
return ensureGitConfigIncludes(filepath.Join(baseDir, GitConfigName), context)
}
// Name returns the name of this auth method.
func (_ GitConfig) Name() string {
return GitConfigName
}
// Handles returns true if the secret file is a gitconfig
func (_ GitConfig) Handles(name string) bool {
return name == GitConfigName
}