Files
forge/routers/web/repo/webgit.go
zeekayandHanzo Dev 9a07b4d089 legal: Hanzo AI, Inc. copyright above the upstream notices
2978 files. The fork is 2026-07-15 (rebrand: gitea.dev -> github.com/hanzoai/git),
so 2026 is the year, and "Copyright 2026 Hanzo AI, Inc." was already the form
used by the handful of files that had ours.

Shape is now:

	// Copyright 2026 Hanzo AI, Inc. All rights reserved.
	// Copyright 2015 The Gogs Authors. All rights reserved.
	// Copyright 2019 The Gitea Authors. All rights reserved.
	// SPDX-License-Identifier: MIT

Ours on top, theirs retained verbatim. Retained because MIT requires it, and
separately because they are true — those authors did write that code.

Not renamed to "The Git Authors": Git is a different project under a different
license, and putting its name here would attribute this code to people who have
nothing to do with it. Adding our line is the fix; overwriting theirs would have
been both a licence violation and a false statement.

gofmt still reports import-order drift in some of these files. It predates this
change (verified against a stash) and is left alone rather than burying a
one-line-per-file legal change under 3000 files of unrelated reordering.

Build clean.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 13:49:52 -07:00

42 lines
1.5 KiB
Go

// Copyright 2026 Hanzo AI, Inc. All rights reserved.
// Copyright 2025 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package repo
import (
user_model "github.com/hanzoai/git/models/user"
"github.com/hanzoai/git/modules/log"
"github.com/hanzoai/git/modules/setting"
"github.com/hanzoai/git/modules/util"
"github.com/hanzoai/git/services/context"
files_service "github.com/hanzoai/git/services/repository/files"
)
func WebGitOperationCommonData(ctx *context.Context) {
// TODO: more places like "wiki page" and "merging a pull request or creating an auto merge merging task"
emails, err := user_model.GetActivatedEmailAddresses(ctx, ctx.Doer.ID)
if err != nil {
log.Error("WebGitOperationCommonData: GetActivatedEmailAddresses: %v", err)
}
if ctx.Doer.KeepEmailPrivate {
emails = append([]string{ctx.Doer.GetPlaceholderEmail()}, emails...)
}
ctx.Data["CommitCandidateEmails"] = emails
ctx.Data["CommitDefaultEmail"] = ctx.Doer.GetEmail()
}
func WebGitOperationGetCommitChosenEmailIdentity(ctx *context.Context, email string) (_ *files_service.IdentityOptions, valid bool) {
if ctx.Data["CommitCandidateEmails"] == nil {
setting.PanicInDevOrTesting("no CommitCandidateEmails in context data")
}
emails, _ := ctx.Data["CommitCandidateEmails"].([]string)
if email == "" {
return nil, true
}
if util.SliceContainsString(emails, email, true) {
return &files_service.IdentityOptions{GitUserEmail: email}, true
}
return nil, false
}