Fix typos: unknow -> unknown, pktLineTypeUnknow -> pktLineTypeUnknown (#36419)

This commit is contained in:
luo jiyin
2026-01-22 09:17:06 +08:00
committed by GitHub
parent a3a3e581aa
commit 6a5f9e12f9
4 changed files with 13 additions and 13 deletions

View File

@@ -596,8 +596,8 @@ Gitea or set your environment appropriately.`, "")
hookOptions.RefFullNames = make([]git.RefName, 0, hookBatchSize) hookOptions.RefFullNames = make([]git.RefName, 0, hookBatchSize)
for { for {
// note: pktLineTypeUnknow means pktLineTypeFlush and pktLineTypeData all allowed // note: pktLineTypeUnknown means pktLineTypeFlush and pktLineTypeData all allowed
rs, err = readPktLine(ctx, reader, pktLineTypeUnknow) rs, err = readPktLine(ctx, reader, pktLineTypeUnknown)
if err != nil { if err != nil {
return err return err
} }
@@ -616,7 +616,7 @@ Gitea or set your environment appropriately.`, "")
if hasPushOptions { if hasPushOptions {
for { for {
rs, err = readPktLine(ctx, reader, pktLineTypeUnknow) rs, err = readPktLine(ctx, reader, pktLineTypeUnknown)
if err != nil { if err != nil {
return err return err
} }
@@ -713,8 +713,8 @@ Gitea or set your environment appropriately.`, "")
type pktLineType int64 type pktLineType int64
const ( const (
// UnKnow type // Unknown type
pktLineTypeUnknow pktLineType = 0 pktLineTypeUnknown pktLineType = 0
// flush-pkt "0000" // flush-pkt "0000"
pktLineTypeFlush pktLineType = iota pktLineTypeFlush pktLineType = iota
// data line // data line

View File

@@ -114,7 +114,7 @@ func TestFindRenamedBranch(t *testing.T) {
assert.True(t, exist) assert.True(t, exist)
assert.Equal(t, "master", branch.To) assert.Equal(t, "master", branch.To)
_, exist, err = git_model.FindRenamedBranch(t.Context(), 1, "unknow") _, exist, err = git_model.FindRenamedBranch(t.Context(), 1, "unknown")
assert.NoError(t, err) assert.NoError(t, err)
assert.False(t, exist) assert.False(t, exist)
} }

View File

@@ -172,11 +172,11 @@ func getStorageSectionByType(rootCfg ConfigProvider, typ string) (ConfigSection,
targetType := targetSec.Key("STORAGE_TYPE").String() targetType := targetSec.Key("STORAGE_TYPE").String()
if targetType == "" { if targetType == "" {
if !IsValidStorageType(StorageType(typ)) { if !IsValidStorageType(StorageType(typ)) {
return nil, 0, fmt.Errorf("unknow storage type %q", typ) return nil, 0, fmt.Errorf("unknown storage type %q", typ)
} }
targetSec.Key("STORAGE_TYPE").SetValue(typ) targetSec.Key("STORAGE_TYPE").SetValue(typ)
} else if !IsValidStorageType(StorageType(targetType)) { } else if !IsValidStorageType(StorageType(targetType)) {
return nil, 0, fmt.Errorf("unknow storage type %q for section storage.%v", targetType, typ) return nil, 0, fmt.Errorf("unknown storage type %q for section storage.%v", targetType, typ)
} }
return targetSec, targetSecIsTyp, nil return targetSec, targetSecIsTyp, nil
@@ -202,7 +202,7 @@ func getStorageTargetSection(rootCfg ConfigProvider, name, typ string, sec Confi
} }
} }
// check stoarge name thirdly // check storage name thirdly
targetSec, _ := rootCfg.GetSection(storageSectionName + "." + name) targetSec, _ := rootCfg.GetSection(storageSectionName + "." + name)
if targetSec != nil { if targetSec != nil {
targetType := targetSec.Key("STORAGE_TYPE").String() targetType := targetSec.Key("STORAGE_TYPE").String()

View File

@@ -129,22 +129,22 @@ func TestUnknowUser(t *testing.T) {
session := loginUser(t, "user1") session := loginUser(t, "user1")
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeReadUser, auth_model.AccessTokenScopeReadOrganization) token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeReadUser, auth_model.AccessTokenScopeReadOrganization)
req := NewRequest(t, "GET", "/api/v1/users/unknow/orgs/org25/permissions"). req := NewRequest(t, "GET", "/api/v1/users/unknown/orgs/org25/permissions").
AddTokenAuth(token) AddTokenAuth(token)
resp := MakeRequest(t, req, http.StatusNotFound) resp := MakeRequest(t, req, http.StatusNotFound)
var apiError api.APIError var apiError api.APIError
DecodeJSON(t, resp, &apiError) DecodeJSON(t, resp, &apiError)
assert.Equal(t, "user redirect does not exist [name: unknow]", apiError.Message) assert.Equal(t, "user redirect does not exist [name: unknown]", apiError.Message)
} }
func TestUnknowOrganization(t *testing.T) { func TestUnknownOrganization(t *testing.T) {
defer tests.PrepareTestEnv(t)() defer tests.PrepareTestEnv(t)()
session := loginUser(t, "user1") session := loginUser(t, "user1")
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeReadUser, auth_model.AccessTokenScopeReadOrganization) token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeReadUser, auth_model.AccessTokenScopeReadOrganization)
req := NewRequest(t, "GET", "/api/v1/users/user1/orgs/unknow/permissions"). req := NewRequest(t, "GET", "/api/v1/users/user1/orgs/unknown/permissions").
AddTokenAuth(token) AddTokenAuth(token)
resp := MakeRequest(t, req, http.StatusNotFound) resp := MakeRequest(t, req, http.StatusNotFound)
var apiError api.APIError var apiError api.APIError