diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-05-31 17:07:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-31 17:07:51 +0800 |
commit | a90988d63f25f510886073f2b4f00780e775fed0 (patch) | |
tree | 7f564785eb061dc00db5827d60505c3ee0839f2e /tests/integration | |
parent | a5acec329e2ca61044f1e1d96858624f2c4a46ac (diff) | |
download | gitea-a90988d63f25f510886073f2b4f00780e775fed0.tar.gz gitea-a90988d63f25f510886073f2b4f00780e775fed0.zip |
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.
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/empty_repo_test.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/integration/empty_repo_test.go b/tests/integration/empty_repo_test.go index 73331bc933..cfb2456223 100644 --- a/tests/integration/empty_repo_test.go +++ b/tests/integration/empty_repo_test.go @@ -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) } |