Skip to content
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

Upgrade go git #28628

Closed
wants to merge 22 commits into from
Closed

Upgrade go git #28628

wants to merge 22 commits into from

Conversation

lunny
Copy link
Member

@lunny lunny commented Dec 28, 2023

Upgrade github.com/go-git/go-git/v5 from v5.9.0 -> v5.11.0

@lunny lunny added the backport/v1.21 This PR should be backported to Gitea 1.21 label Dec 28, 2023
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 28, 2023
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 28, 2023
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Dec 28, 2023
@wxiaoguang
Copy link
Contributor

Unfortunately, ref #28518

image

BUT

image

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Dec 28, 2023
@denyskon denyskon added the giteabot/update-branch Hint for the bot that it should update a PR with the latest state on main label Jan 3, 2024
@GiteaBot GiteaBot removed the giteabot/update-branch Hint for the bot that it should update a PR with the latest state on main label Jan 3, 2024
@denyskon denyskon self-requested a review January 3, 2024 10:06
@techknowlogick
Copy link
Member

CI fail seems related

@harryzcy
Copy link
Contributor

It seems to be the issue with go-git. I can get the commit using git cat-file -p <sha>, but go-git gives object not found

Maybe go-git is not reading objects/info/alternates correctly, when the file structure is the following:

.
├── branches
├── config
├── description
├── HEAD
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── fsmonitor-watchman.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── pre-merge-commit.sample
│   ├── prepare-commit-msg.sample
│   ├── pre-push.sample
│   ├── pre-rebase.sample
│   ├── pre-receive.sample
│   ├── push-to-checkout.sample
│   └── update.sample
├── index
├── info
│   └── exclude
├── logs
│   └── HEAD
├── objects
│   ├── info
│   │   └── alternates
│   └── pack
├── packed-refs
└── refs
    ├── heads
    └── tags

@lunny
Copy link
Member Author

lunny commented Jan 15, 2024

It seems to be the issue with go-git. I can get the commit using git cat-file -p <sha>, but go-git gives object not found

Maybe go-git is not reading objects/info/alternates correctly, when the file structure is the following:

.
├── branches
├── config
├── description
├── HEAD
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── fsmonitor-watchman.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── pre-merge-commit.sample
│   ├── prepare-commit-msg.sample
│   ├── pre-push.sample
│   ├── pre-rebase.sample
│   ├── pre-receive.sample
│   ├── push-to-checkout.sample
│   └── update.sample
├── index
├── info
│   └── exclude
├── logs
│   └── HEAD
├── objects
│   ├── info
│   │   └── alternates
│   └── pack
├── packed-refs
└── refs
    ├── heads
    └── tags

Can you send this issue to upstream?

@harryzcy
Copy link
Contributor

Can you send this issue to upstream?

Done go-git/go-git#1002

@denyskon denyskon added the type/upstream This is an issue in one of Gitea's dependencies and should be reported there label Jan 15, 2024
@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 16, 2024
@wxiaoguang wxiaoguang removed the type/upstream This is an issue in one of Gitea's dependencies and should be reported there label Jan 16, 2024
for scanner.Scan() {
// FIXME: we just use the first alternate because it seems go-git don't support multiple alternates yet
altPath := scanner.Text()
options.AlternatesFS = osfs.New(altPath)
Copy link

Choose a reason for hiding this comment

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

If altPath is relative to the host root dir, you probably want:
options.AlternatesFS = osfs.New("/")

I think this might work as well:
options.AlternatesFS = osfs.New(altPath, osfs.WithBoundOS())

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Changed in 4f26e65, but it seems I'm still not lucky.
Does this work in Windows?

options.AlternatesFS = osfs.New("/")

Copy link

Choose a reason for hiding this comment

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

My understanding is that osfs.New("") and osfs.New("/") are equivalent. But looking across go-git, we seem to only use the former - for example on the default loader.

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: osfs.New("") is not the same as osfs.New("/")

And I think there are some other problems in go-git: go-git/go-git#1006

@lunny
Copy link
Member Author

lunny commented Jan 22, 2024

replaced by #28893

@lunny lunny closed this Jan 22, 2024
@lunny lunny deleted the lunny/upgrade_gogit branch January 22, 2024 10:25
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2024
@lunny lunny removed the backport/v1.21 This PR should be backported to Gitea 1.21 label Mar 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants