Skip to content

Commit 95d5b97

Browse files
committed
Fix test
1 parent b08875a commit 95d5b97

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

models/fixtures/branch.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,15 @@
165165
is_deleted: false
166166
deleted_by_id: 0
167167
deleted_unix: 0
168+
169+
-
170+
id: 22
171+
repo_id: 1
172+
name: 'develop'
173+
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
174+
commit_message: "Initial commit"
175+
commit_time: 1489927679
176+
pusher_id: 1
177+
is_deleted: false
178+
deleted_by_id: 0
179+
deleted_unix: 0

services/repository/files/update.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ func ChangeRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use
111111
return nil, err
112112
} else if !exist && !repo.IsEmpty {
113113
return nil, git_model.ErrBranchNotExist{
114+
RepoID: repo.ID,
114115
BranchName: opts.OldBranch,
115116
}
116117
}

tests/integration/repofiles_change_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package integration
55

66
import (
7+
"fmt"
78
"net/url"
89
"path/filepath"
910
"strings"
@@ -490,7 +491,7 @@ func TestChangeRepoFilesErrors(t *testing.T) {
490491
filesResponse, err := files_service.ChangeRepoFiles(git.DefaultContext, repo, doer, opts)
491492
assert.Error(t, err)
492493
assert.Nil(t, filesResponse)
493-
expectedError := "branch does not exist [name: " + opts.OldBranch + "]"
494+
expectedError := fmt.Sprintf("branch does not exist [repo_id: %d name: %s]", repo.ID, opts.OldBranch)
494495
assert.EqualError(t, err, expectedError)
495496
})
496497

0 commit comments

Comments
 (0)