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

SYNC FORK always only syncs the base repo's default branch #33271

Open
tkoeferli opened this issue Jan 14, 2025 · 7 comments · May be fixed by #33319
Open

SYNC FORK always only syncs the base repo's default branch #33271

tkoeferli opened this issue Jan 14, 2025 · 7 comments · May be fixed by #33319
Labels

Comments

@tkoeferli
Copy link

Description

In 1.23.1, the "sync fork" only syncs the base repo's default branch. As in GitHub it should sync the same branch of the forked repo in the base repo as well.

Gitea Version

1.23.1

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?

self hosted.
gitea-1.23.1-linux-amd64

Database

MySQL/MariaDB

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jan 14, 2025

Description

In 1.23.1, the "sync fork" only syncs the base repo's default branch. As in GitHub it should sync the same branch of the forked repo in the base repo as well.

Related:

@changchaishi

It seems that GitHub also defaults to the "main" (default) branch:

image

@wxiaoguang wxiaoguang added the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Jan 15, 2025
@tkoeferli
Copy link
Author

This is not true. If the branch in the forked repo is the same as in the base repo, it will take this. Of course, if you are on a new branch in the fork, it will asume the default in the base.
grafik

@wxiaoguang
Copy link
Contributor

This is not true. If the branch in the forked repo is the same as in the base repo, it will take this. Of course, if you are on a new branch in the fork, it will asume the default in the base.

I see, then we need a new logic:

  • check the same branch name
  • check the default branch name

? It sounds strange. What if the forked branch gets renamed? Does GitHub remember the base branch instead of guessing it?

@wxiaoguang wxiaoguang removed the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Jan 15, 2025
@tkoeferli
Copy link
Author

In this case it will take the default branch in the base repo, as the renamed branch is only in the fork.
This renamed branch will become a new (private) branch in the fork.
I do not see a use case to rename a (forked) branch, it's better to create a new branch. After that, it's up to me to keep my branch in Sync.

@wxiaoguang
Copy link
Contributor

So let me try to summarize the solution: suppose there is a branch-a in fork repo:

  1. if branch-a exists in base repo: try to sync base:branch-a to fork:branch-a
  2. if branch-a doesn't exist in base repo: try to sync base:main to fork:branch-a

Is it good enough?

@tkoeferli
Copy link
Author

Yes I think this okay.
Altough 2. is dangerous and could fail.

Thanks!

@wxiaoguang wxiaoguang self-assigned this Jan 15, 2025
@wxiaoguang wxiaoguang linked a pull request Jan 18, 2025 that will close this issue
@wxiaoguang
Copy link
Contributor

-> Improve sync fork behavior #33319

@wxiaoguang wxiaoguang removed their assignment Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants