Skip to content

Agit workflow instructions do not work #27579

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
strk opened this issue Oct 11, 2023 · 12 comments
Closed

Agit workflow instructions do not work #27579

strk opened this issue Oct 11, 2023 · 12 comments
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail type/docs This PR mainly updates/creates documentation

Comments

@strk
Copy link
Member

strk commented Oct 11, 2023

Description

I've followed instructions in https://docs.gitea.com/usage/agit-setup but could not make a pull request automatically created.
Logs of Gitea also don't mention anything.

$ git push origin HEAD:refs/for/master -o title="Test title" -o topic="Test topic" -o description="Test description"
To git.osgeo.org:postgis/postgis.git
 * [new reference]       HEAD -> refs/for/master

Gitea Version

1.20.5

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

The test I've run on try.gitea.io failed but in a different way:

[strk@c19:/tmp/test2(agit)] git push origin HEAD:refs/for/master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 257 bytes | 257.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: 
remote: Gitea: Unexpected ref: refs/for/master
To try.gitea.io:strk/test2.git
 ! [remote rejected] HEAD -> refs/for/master (pre-receive hook declined)
error: failed to push some refs to 'try.gitea.io:strk/test2.git'

Database

None

@strk strk added type/bug type/docs This PR mainly updates/creates documentation labels Oct 11, 2023
@lng2020
Copy link
Member

lng2020 commented Oct 14, 2023

Currently, the default branch name is main. The docs should be updated.

@lng2020 lng2020 added issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail and removed type/bug labels Oct 14, 2023
lunny pushed a commit that referenced this issue Oct 15, 2023
Backport #27621 by @lng2020

It's main now.
relevant #27579

Co-authored-by: Nanguan Lin <[email protected]>
@lunny
Copy link
Member

lunny commented Oct 15, 2023

@strk Could you confirm git push origin HEAD:refs/for/main will fix your problem? The last word should be the base repository target branch name.

@strk
Copy link
Member Author

strk commented Oct 16, 2023

In our case the base repository target branch is still "master", but I confirm try.osgeo.org does work if I push to the target repository. I've yet to test doing this on try.osgeo.org and ideed it works (as long as -o topic is given).

Is it supposed to also work when pushing to fork instead of target repository ?

@lunny
Copy link
Member

lunny commented Oct 16, 2023

In our case the base repository target branch is still "master", but I confirm try.osgeo.org does work if I push to the target repository. I've yet to test doing this on try.osgeo.org and ideed it works (as long as -o topic is given).

Is it supposed to also work when pushing to fork instead of target repository ?

Pushing to fork will create a PR of the fork repository. In Agit workflow, there is no fork concept.

@strk
Copy link
Member Author

strk commented Oct 16, 2023

So, I've tried back to git.osgeo.org/gitea and neither pushing refs/for/master (the real name of target) nor refs/for/main triggered the creation of a pull request. Rather those refs were created in the origin repository:

[strk@c19:/usr/local/src/postgis/postgis(drop-obsoleted-strings)] git push origin HEAD:refs/for/main -o topic="test topic"
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 8 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 575 bytes | 575.00 KiB/s, done.
Total 6 (delta 4), reused 0 (delta 0), pack-reused 0
remote: . Processing 1 references
remote: Processed 1 references in total
To git.osgeo.org:postgis/postgis.git
 * [new reference]       HEAD -> refs/for/main
[strk@c19:/usr/local/src/postgis/postgis(drop-obsoleted-strings)] git push origin HEAD:refs/for/master -o topic="test topic"
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: . Processing 1 references
remote: Processed 1 references in total
To git.osgeo.org:postgis/postgis.git
 * [new reference]       HEAD -> refs/for/master

@lng2020
Copy link
Member

lng2020 commented Oct 16, 2023

but I confirm try.osgeo.org does work if I push to the target repository.

Do you mean try.gitea.io?

So it works in try.gitea.io but doesn't work in your host, which is git.osgeo.org?

@strk
Copy link
Member Author

strk commented Oct 16, 2023

@lng2020 exactly, at least not for this repository: https://git.osgeo.org/gitea/postgis/postgis -- feel free to try !

@lng2020
Copy link
Member

lng2020 commented Oct 16, 2023

@lng2020 exactly, at least not for this repository: https://git.osgeo.org/gitea/postgis/postgis -- feel free to try !

will look into it later

@strk
Copy link
Member Author

strk commented Oct 16, 2023

One concern I have is that this support seems to imply anyone can create branches to the target repository effectively making the size associated to that repository bigger, how to limit that ? https://try.gitea.io/strk/test2/pulls/7#issuecomment-169018

@strk
Copy link
Member Author

strk commented Oct 16, 2023

Currently, the default branch name is main. The docs should be updated.

I've filed #27652 doing ALSO this

@strk
Copy link
Member Author

strk commented Oct 16, 2023

Consulting the source code I saw that "proc-receive" git hook is used for Agit, and that hook is only supported by git starting at version 2.29 -- on git.osgeo.org we're currently runnign an older version of git, which might explain the problem.

@strk
Copy link
Member Author

strk commented Oct 16, 2023

I've added a note about 2.29 requirement in the docs too, in #27652

strk added a commit to strk/gitea that referenced this issue Oct 17, 2023
lunny pushed a commit that referenced this issue Oct 17, 2023
Clarify Agit PR creation documentation

See #27579
@lunny lunny closed this as completed Oct 17, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail type/docs This PR mainly updates/creates documentation
Projects
None yet
Development

No branches or pull requests

3 participants