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

Some branches have disappeared from the GUI. #28443

Closed
raptyk opened this issue Dec 12, 2023 · 3 comments
Closed

Some branches have disappeared from the GUI. #28443

raptyk opened this issue Dec 12, 2023 · 3 comments
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail

Comments

@raptyk
Copy link

raptyk commented Dec 12, 2023

Description

I am in the process of migrating from the old gitolite3 repository to gitea.

I have migrated 8 repositories correctly however with 3 I have a problem. The problem is that in the Gitea GUI and in the postgress database in the "branch" table I see only a few of the dozen branches. These branches are present after downloading the code from the new gitea repository however I can't see them in the GUI.

Running the "Sync missed branches from git data to databases" option doesn't help, and I only see a few errors in the logs:

2023/12/12 17:32:54 ...repository/branch.go:384:handlerBranchSync() [E] syncRepoBranches [32] failed: pq: invalid byte sequence for encoding "UTF8": 0xea 0x6b 0x73
2023/12/12 17:32:54 ...repository/branch.go:384:handlerBranchSync() [E] syncRepoBranches [24] failed: pq: invalid byte sequence for encoding "UTF8": 0xbf

In a nutshell what I did:

  1. I downloaded the old repository to a local drive along with all the branches.
  2. I added a second origin pointing to the gitea server in the same directory.
  3. I uploaded all the branches to the new gitea repository.
  4. in the GUI I see only a few branches, after downloading from the new repo I see all the branches.

I suspect this has to do with coding some commit or other special character topics. How to solve this problem?

Gitea Version

1.21.1 (in docker & postgresql)

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

error-2-branches-only-encoding
error-2-branches-only

Git Version

No response

Operating System

official docker image, postgresql

How are you running Gitea?

docker

Database

PostgreSQL

@lunny
Copy link
Member

lunny commented Dec 13, 2023

Maybe related #28162

@raptyk
Copy link
Author

raptyk commented Dec 13, 2023

Many hours later... I've found that some commit messages contained special characters outside of Unicode (Polish letters), and Gitea was unable to insert those messages into the database (a silent error was noted in the log).

I've found some solutions/workarounds for this type of migration problem, but I still think it should be fixed in Gitea because users may not even be aware that some branches have disappeared.

  1. Download sources from the original Git repository.

  2. Replace specia characters and change the encoding in every commit message from the original (Windows-1250) to UTF-8. Some letters might be distorted.
    replace all Ą->A, Ń->N, Ł->L etc:
    git filter-repo --replace-refs delete-no-add --replace-message polskie.txt --force
    change encoding:
    git filter-branch --msg-filter 'iconv -f windows-1250 -t utf-8 || cat' -- --all

  3. Push the converted repository to Gitea.

polskie.txt

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Dec 13, 2023

Maybe it has been fixed by #28356 and has been backported to 1.21.2

For the old missing branches, you can sync them from your admin panel.

@wxiaoguang wxiaoguang 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 Dec 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 2024
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
Projects
None yet
Development

No branches or pull requests

3 participants