Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Updated agit doc for git-repo#27014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

@siennathesane
Copy link
Contributor

@siennathesanesiennathesane commentedSep 11, 2023
edited by lunny
Loading

Added basic reference instructions to unblockgit-repo users who don't use Gerrit but use Gitea.

Added basic reference instructions to unblock `git-repo` users who don't use Gerrit but use Gitea.
@GiteaBotGiteaBot added this to the1.20.5 milestoneSep 11, 2023
@GiteaBotGiteaBot added the lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelSep 11, 2023

1. Create a file in`$GITEA_CUSTOM/public/` called`ssh_info`
2. Populate it with`{"type":"agit","version":2}`
3. Add a rewrite rule for your reverse proxy which rewrites the request path equaling`/ssh_info` to`/assets/ssh_info`
Copy link
Member

@silverwindsilverwindSep 11, 2023
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Don't we already provide a mechanism to put files into root, like/robots.txt? Or maybe that path is already occupied, not familiar with/ssh_info.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The only one I could find was/assets/<file>, andrepo/git-repo expect it to be at the root of the host 🤷🏼‍♀️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The quite old "assets" handler logic is: if local file exists, then use it, otherwise, pass it to other handles.

However, the logic has been changed long time ago, the local file doesn't have higher priority than other handlers.

For example: if you have a file in{Custom}/public/my-name and an orgmy-name

  • For quite old logic (very long time ago): the local file{Custom}/public/my-name is served
    • Users could serve any custom files without reverse proxy tweaks.
  • For current logic (has been changed long time ago): the orgmy-name is severed.

TBH, the quite old logic looks good to me, while I guess some nice features were changed unintentionally by many round iterations.

Copy link
Contributor

@wxiaoguangwxiaoguangSep 12, 2023
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The change was introduced by : "add /assets as root dir of public files#15219" and "Customization files should not require /assets path segment#15906" in 1.15

After that PR, users couldn't serve their custom files in web root anymore.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There is special handling for robots.txt to remain under the root path. Maybe we could include the ssh_info in the binary directly? It would require reserving the "ssh_info" username, but I think that would be acceptable as a "breaking" change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would prefer to take the "quite old logic" back, then end users could still have the ability to serve any file in the web root.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hmm, gitea has defined/ssh_info router, but the type has been defined asgitea (example:https://try.gitea.io/ssh_info), That's because I'm not sureagit flow has been fully implement. looks need more work. and I hasn't checking whether gitea can be used withgit-repo tool also.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

whether gitea can be used withgit-repo tool also.

I'm working through why it hasn't been working as intended, and this is what I've found so far. If the router has implemented/ssh_info but it's wrong, then we should fix it. It's ultimately something from Gerrit:

https://github.com/GerritCodeReview/gerrit/blob/587e12178e06e63c0ac8c31e6ec0cbc59b232eea/java/com/google/gerrit/httpd/raw/SshInfoServlet.java#L31-L48

@lunny
Copy link
Member

Please send the patch to v1.21(main branch) first

@wxiaoguang
Copy link
Contributor

wxiaoguang commentedSep 13, 2023
edited
Loading

Please send the patch to v1.21(main branch) first

Is there a clear conclusion? Before doing future changes, I guess it should clarify the details first?

There are 2 problems:

  1. Should we invite the ability of serving any file in "custom/public" directory back?
  2. Does Gitea fully support agit version 2? Whether gitea works with git-repo tool?

@a1012112796
Copy link
Member

@mxplusb maybe you need this plugin, ref:https://github.com/alibaba/git-repo-go/blob/master/helper/proto-external.go

package mainimport ("bufio""encoding/json""errors""fmt""io""log""os""strings""github.com/alibaba/git-repo-go/cap""github.com/alibaba/git-repo-go/config""github.com/alibaba/git-repo-go/encode""github.com/alibaba/git-repo-go/helper""github.com/urfave/cli/v2")funcmain() {app:=&cli.App{Name:"git-repo-helper-proto-gitea",Usage:"gitea protocol helper for git repo",Action:cmdMain,Flags: []cli.Flag{&cli.BoolFlag{Name:"upload",Usage:"for upload hook",},&cli.BoolFlag{Name:"download",Usage:"for download hook",},&cli.Int64Flag{Name:"version",Usage:"hook version",},},}iferr:=app.Run(os.Args);err!=nil {log.Fatal(err)}}funcgetGitPushCommand(o*config.UploadOptions) (*helper.GitPushCommand,error) {var (gitPushCmd= helper.GitPushCommand{})cmds:= []string{"git","push"}ifo.RemoteURL=="" {returnnil,errors.New("empty review url for helper")}gitURL:=config.ParseGitURL(o.RemoteURL)ifgitURL==nil|| (gitURL.Proto!="ssh"&&gitURL.Proto!="http"&&gitURL.Proto!="https") {returnnil,fmt.Errorf("bad review URL: %s",o.RemoteURL)}if!cap.GitCanPushOptions() {log.Fatalln("cannot send push options, for your git version is too low")}for_,pushOption:=rangeo.PushOptions {cmds=append(cmds,"-o",pushOption)}refSpec:=""localBranch:=strings.TrimPrefix(o.LocalBranch,config.RefsHeads)destBranch:=strings.TrimPrefix(o.DestBranch,config.RefsHeads)iflocalBranch=="" {refSpec="HEAD"}else {refSpec=config.RefsHeads+localBranch}if!o.CodeReview.Empty() {log.Fatalln("gitea not support for-review now")}else {refSpec+=fmt.Sprintf(":refs/for/%s/%s",destBranch,localBranch)}ifo.Title!="" {cmds=append(cmds,"-o","title="+encode.B64Encode(o.Title))}ifo.Description!="" {cmds=append(cmds,"-o","description="+encode.B64Encode(o.Description))}// TODO:// if o.Issue != "" {// cmds = append(cmds, "-o", "issue="+encode.B64Encode(o.Issue))// }// if o.People != nil && len(o.People) > 0 && len(o.People[0]) > 0 {// reviewers := strings.Join(o.People[0], ",")// cmds = append(cmds, "-o", "reviewers="+encode.B64Encode(reviewers))// }// if o.People != nil && len(o.People) > 1 && len(o.People[1]) > 0 {// cc := strings.Join(o.People[1], ",")// cmds = append(cmds, "-o", "cc="+encode.B64Encode(cc))// }// if o.NoEmails {// cmds = append(cmds, "-o", "notify=no")// }// if o.Private {// cmds = append(cmds, "-o", "private=yes")// }// if o.WIP {// cmds = append(cmds, "-o", "wip=yes")// }// if o.OldOid != "" {// cmds = append(cmds, "-o", "old-oid="+o.OldOid)// }ifo.RemoteName!="" {cmds=append(cmds,o.RemoteName)}else {cmds=append(cmds,o.RemoteURL)}cmds=append(cmds,refSpec)gitPushCmd.Cmd=cmds[0]gitPushCmd.Args=cmds[1:]return&gitPushCmd,nil}funccmdUpload()error {log.Printf("cmdUpload ...\n")input,err:=io.ReadAll(os.Stdin)iferr!=nil {returnerr}cfg:= config.UploadOptions{}err=json.Unmarshal(input,&cfg)iferr!=nil {log.Printf("Error: cmdUpload: %v\n",err)returnerr}log.Printf("Debug: cmdUpload: %#v\n",cfg)result,err:=getGitPushCommand(&cfg)iferr!=nil {returnerr}resultBytes,err:=json.Marshal(result)iferr!=nil {returnerr}_,err=os.Stdout.Write(resultBytes)returnerr}funccmdDownload()error {scan:=bufio.NewScanner(os.Stdin)if!scan.Scan() {returnerrors.New("no input data")}parts:=strings.SplitN(scan.Text()," ",3)iflen(parts)!=2 {returnerrors.New("no enough params")}log.Println("cmdDownload: ",parts[0],parts[1])fmt.Printf("refs/pull/%s/head\n",parts[0])returnnil}varlogFp*os.FiletypeemptyWriterstruct{}func (e*emptyWriter)Write(p []byte) (nint,errerror) {returnlen(p),nil}funcinitLogFile()error {debugFile:=os.Getenv("GIT_REPO_GITEA_DEBUG")iflen(debugFile)==0 {log.SetOutput(&emptyWriter{})returnnil}varerrerrorlogFp,err=os.OpenFile(debugFile,os.O_CREATE|os.O_WRONLY|os.O_TRUNC,0o644)iferr==nil {log.SetOutput(logFp)}returnerr}funccmdMain(ctx*cli.Context)error {iferr:=initLogFile();err!=nil {returnerr}deferfunc() {iflogFp!=nil {logFp.Close()}}()ifctx.Bool("upload") {returncmdUpload()}ifctx.Bool("download") {returncmdDownload()}returnnil}

@lunnylunny modified the milestones:1.20.5,1.20.6Oct 4, 2023
@lunnylunny removed this from the1.20.6 milestoneNov 26, 2023
@go-giteago-gitea locked asresolvedand limited conversation to collaboratorsSep 14, 2024
lunny pushed a commit that referenced this pull requestJun 12, 2025
*Fix#34707* Fix dropdown filter handling*Fix#27014
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@silverwindsilverwindsilverwind left review comments

@techknowlogicktechknowlogicktechknowlogick left review comments

@wxiaoguangwxiaoguangwxiaoguang left review comments

@a1012112796a1012112796Awaiting requested review from a1012112796

Assignees

No one assigned

Labels

lgtm/need 2This PR needs two approvals by maintainers to be considered for merging.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@siennathesane@lunny@wxiaoguang@a1012112796@silverwind@techknowlogick@GiteaBot

[8]ページ先頭

©2009-2025 Movatter.jp