File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,10 @@ type ObjectType string
15
15
16
16
// Repository represents a Git repository on disk.
17
17
type Repository struct {
18
- path string
18
+ // gitDir is the path to the `GIT_DIR` for this repository. It
19
+ // might be absolute or it might be relative to the current
20
+ // directory.
21
+ gitDir string
19
22
20
23
// gitBin is the path of the `git` executable that should be used
21
24
// when running commands in this repository.
@@ -79,7 +82,7 @@ func NewRepository(path string) (*Repository, error) {
79
82
}
80
83
81
84
return & Repository {
82
- path : gitDir ,
85
+ gitDir : gitDir ,
83
86
gitBin : gitBin ,
84
87
}, nil
85
88
}
@@ -103,15 +106,16 @@ func (repo *Repository) GitCommand(callerArgs ...string) *exec.Cmd {
103
106
104
107
cmd .Env = append (
105
108
os .Environ (),
106
- "GIT_DIR=" + repo .path ,
109
+ "GIT_DIR=" + repo .gitDir ,
107
110
// Disable grafts when running our commands:
108
111
"GIT_GRAFT_FILE=" + os .DevNull ,
109
112
)
110
113
111
114
return cmd
112
115
}
113
116
114
- // Path returns the path to `repo`.
115
- func (repo * Repository ) Path () string {
116
- return repo .path
117
+ // GitDir returns the path to `repo`'s `GIT_DIR`. It might be absolute
118
+ // or it might be relative to the current directory.
119
+ func (repo * Repository ) GitDir () string {
120
+ return repo .gitDir
117
121
}
You can’t perform that action at this time.
0 commit comments