forked from forgejo/forgejo
Update repo's default branch when adding new files in an empty one (#25017)
Fix #25014 Only API needs this fix. On the Web UI, users could only add new file on the default branch.
This commit is contained in:
parent
a5acec329e
commit
a90988d63f
3 changed files with 15 additions and 8 deletions
|
@ -137,4 +137,10 @@ func TestEmptyRepoAddFileByAPI(t *testing.T) {
|
|||
req = NewRequest(t, "GET", "/user30/empty/src/branch/new_branch/new-file.txt")
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.Contains(t, resp.Body.String(), "newly-added-api-file")
|
||||
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/user30/empty?token=%s", token))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
var apiRepo api.Repository
|
||||
DecodeJSON(t, resp, &apiRepo)
|
||||
assert.Equal(t, "new_branch", apiRepo.DefaultBranch)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue