Skip to content

Commit b3cbef9

Browse files
committed
Repository.GitCommand(): make method public
1 parent 939c176 commit b3cbef9

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

git/batch_obj_iter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type BatchObjectIter struct {
2727
// `io.WriteCloser` should normally be closed and the iterator's
2828
// output drained before `Close()` is called.
2929
func (repo *Repository) NewBatchObjectIter() (*BatchObjectIter, io.WriteCloser, error) {
30-
cmd := repo.gitCommand("cat-file", "--batch", "--buffer")
30+
cmd := repo.GitCommand("cat-file", "--batch", "--buffer")
3131

3232
in, err := cmd.StdinPipe()
3333
if err != nil {

git/git.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func NewRepository(path string) (*Repository, error) {
8484
}, nil
8585
}
8686

87-
func (repo *Repository) gitCommand(callerArgs ...string) *exec.Cmd {
87+
func (repo *Repository) GitCommand(callerArgs ...string) *exec.Cmd {
8888
args := []string{
8989
// Disable replace references when running our commands:
9090
"--no-replace-objects",

git/gitconfig.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Config struct {
3636
// `configKeyMatchesPrefix()`), and strip off the prefix in the keys
3737
// that are returned.
3838
func (repo *Repository) GetConfig(prefix string) (*Config, error) {
39-
cmd := repo.gitCommand("config", "--list", "-z")
39+
cmd := repo.GitCommand("config", "--list", "-z")
4040

4141
out, err := cmd.Output()
4242
if err != nil {
@@ -114,7 +114,7 @@ func configKeyMatchesPrefix(key, prefix string) (bool, string) {
114114
}
115115

116116
func (repo *Repository) ConfigStringDefault(key string, defaultValue string) (string, error) {
117-
cmd := repo.gitCommand(
117+
cmd := repo.GitCommand(
118118
"config",
119119
"--default", defaultValue,
120120
key,
@@ -133,7 +133,7 @@ func (repo *Repository) ConfigStringDefault(key string, defaultValue string) (st
133133
}
134134

135135
func (repo *Repository) ConfigBoolDefault(key string, defaultValue bool) (bool, error) {
136-
cmd := repo.gitCommand(
136+
cmd := repo.GitCommand(
137137
"config",
138138
"--type", "bool",
139139
"--default", strconv.FormatBool(defaultValue),
@@ -155,7 +155,7 @@ func (repo *Repository) ConfigBoolDefault(key string, defaultValue bool) (bool,
155155
}
156156

157157
func (repo *Repository) ConfigIntDefault(key string, defaultValue int) (int, error) {
158-
cmd := repo.gitCommand(
158+
cmd := repo.GitCommand(
159159
"config",
160160
"--type", "int",
161161
"--default", strconv.Itoa(defaultValue),

git/obj_iter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type ObjectIter struct {
2727
func (repo *Repository) NewObjectIter(
2828
args ...string,
2929
) (*ObjectIter, io.WriteCloser, error) {
30-
cmd1 := repo.gitCommand(append([]string{"rev-list", "--objects"}, args...)...)
30+
cmd1 := repo.GitCommand(append([]string{"rev-list", "--objects"}, args...)...)
3131
in1, err := cmd1.StdinPipe()
3232
if err != nil {
3333
return nil, nil, err
@@ -45,7 +45,7 @@ func (repo *Repository) NewObjectIter(
4545
return nil, nil, err
4646
}
4747

48-
cmd2 := repo.gitCommand("cat-file", "--batch-check", "--buffer")
48+
cmd2 := repo.GitCommand("cat-file", "--batch-check", "--buffer")
4949
in2, err := cmd2.StdinPipe()
5050
if err != nil {
5151
out1.Close()

git/ref_iter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type ReferenceIter struct {
2323
// NewReferenceIter returns an iterator that iterates over all of the
2424
// references in `repo`.
2525
func (repo *Repository) NewReferenceIter() (*ReferenceIter, error) {
26-
cmd := repo.gitCommand(
26+
cmd := repo.GitCommand(
2727
"for-each-ref", "--format=%(objectname) %(objecttype) %(objectsize) %(refname)",
2828
)
2929

0 commit comments

Comments
 (0)