Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set -i on git read-tree (#17102) #17103

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integrations/pull_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func TestCantMergeUnrelated(t *testing.T) {
}).(*models.Repository)
path := models.RepoPath(user1.Name, repo1.Name)

_, err := git.NewCommand("read-tree", "--empty").RunInDir(path)
_, err := git.NewCommand("read-tree", "-i", "--empty").RunInDir(path)
assert.NoError(t, err)

stdin := bytes.NewBufferString("Unrelated File")
Expand Down
4 changes: 2 additions & 2 deletions modules/git/repo_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (repo *Repository) ReadTreeToIndex(treeish string) error {
}

func (repo *Repository) readTreeToIndex(id SHA1) error {
_, err := NewCommand("read-tree", id.String()).RunInDir(repo.Path)
_, err := NewCommand("read-tree", "-i", id.String()).RunInDir(repo.Path)
if err != nil {
return err
}
Expand All @@ -37,7 +37,7 @@ func (repo *Repository) readTreeToIndex(id SHA1) error {

// EmptyIndex empties the index
func (repo *Repository) EmptyIndex() error {
_, err := NewCommand("read-tree", "--empty").RunInDir(repo.Path)
_, err := NewCommand("read-tree", "-i", "--empty").RunInDir(repo.Path)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion modules/repofiles/temp_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (t *TemporaryUploadRepository) Clone(branch string) error {

// SetDefaultIndex sets the git index to our HEAD
func (t *TemporaryUploadRepository) SetDefaultIndex() error {
if _, err := git.NewCommand("read-tree", "HEAD").RunInDir(t.basePath); err != nil {
if _, err := git.NewCommand("read-tree", "-i", "HEAD").RunInDir(t.basePath); err != nil {
return fmt.Errorf("SetDefaultIndex: %v", err)
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion services/pull/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func rawMerge(pr *models.PullRequest, doer *models.User, mergeStyle models.Merge
errbuf.Reset()

// Read base branch index
if err := git.NewCommand("read-tree", "HEAD").RunInDirPipeline(tmpBasePath, &outbuf, &errbuf); err != nil {
if err := git.NewCommand("read-tree", "-i", "HEAD").RunInDirPipeline(tmpBasePath, &outbuf, &errbuf); err != nil {
log.Error("git read-tree HEAD: %v\n%s\n%s", err, outbuf.String(), errbuf.String())
return "", fmt.Errorf("Unable to read base branch in to the index: %v\n%s\n%s", err, outbuf.String(), errbuf.String())
}
Expand Down
2 changes: 1 addition & 1 deletion services/pull/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func checkConflicts(pr *models.PullRequest, gitRepo *git.Repository, tmpBasePath
pr.Status = models.PullRequestStatusChecking

// 3. Read the base branch in to the index of the temporary repository
_, err = git.NewCommand("read-tree", "base").RunInDir(tmpBasePath)
_, err = git.NewCommand("read-tree", "-i", "base").RunInDir(tmpBasePath)
if err != nil {
return false, fmt.Errorf("git read-tree %s: %v", pr.BaseBranch, err)
}
Expand Down