mirror of https://github.com/databricks/cli.git
wip variable for .git
This commit is contained in:
parent
f7a76ff5d8
commit
f2e5c8b41a
|
@ -11,6 +11,7 @@ import (
|
|||
)
|
||||
|
||||
const gitIgnoreFileName = ".gitignore"
|
||||
const gitDirectoryName = ".git"
|
||||
|
||||
// Repository represents a Git repository or a directory
|
||||
// that could later be initialized as Git repository.
|
||||
|
@ -45,7 +46,7 @@ func (r *Repository) Root() string {
|
|||
|
||||
func (r *Repository) CurrentBranch() (string, error) {
|
||||
// load .git/HEAD
|
||||
ref, err := LoadReferenceFile(filepath.Join(r.rootPath, ".git", "HEAD"))
|
||||
ref, err := LoadReferenceFile(filepath.Join(r.rootPath, gitDirectoryName, "HEAD"))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -62,7 +63,7 @@ func (r *Repository) CurrentBranch() (string, error) {
|
|||
|
||||
func (r *Repository) LatestCommit() (string, error) {
|
||||
// load .git/HEAD
|
||||
ref, err := LoadReferenceFile(filepath.Join(r.rootPath, ".git", "HEAD"))
|
||||
ref, err := LoadReferenceFile(filepath.Join(r.rootPath, gitDirectoryName, "HEAD"))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -81,7 +82,7 @@ func (r *Repository) LatestCommit() (string, error) {
|
|||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
branchHeadRef, err := LoadReferenceFile(filepath.Join(r.rootPath, ".git", branchHeadPath))
|
||||
branchHeadRef, err := LoadReferenceFile(filepath.Join(r.rootPath, gitDirectoryName, branchHeadPath))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -186,7 +187,7 @@ func NewRepository(path string) (*Repository, error) {
|
|||
}
|
||||
|
||||
real := true
|
||||
rootPath, err := folders.FindDirWithLeaf(path, ".git")
|
||||
rootPath, err := folders.FindDirWithLeaf(path, gitDirectoryName)
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue