#5472 Error Message When Pushing Private Branches to Forked Repositories
Closed: Fixed 4 months ago by wombelix. Opened 4 months ago by jnsamyak.

Description:

Releng issue: https://pagure.io/releng/issue/11968

Several users have encountered an error message when pushing private branches to their forks of various repositories, including google-noto-sans-cjk-fonts. The issue appears to be related to a pre-push script in Pagure that fails to handle private branches correctly.

Steps to Reproduce:

Clone a repository using fedpkg clone <repo-name>.
Fork the repository using fedpkg fork.
Create a new branch and switch to it: git branch <new-branch> and git checkout <new-branch>.
Add commits to the new branch.
Push the branch to the fork: git push <remote> <new-branch>.

Observed Behavior:

The push operation completes, but an error message is logged from the remote. The error seems to originate from the pre-push script which cannot handle private branches. Here is an example log snippet:

The pre-push script can't check private branches. Push operation continues.
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 8 threads
Compressing objects: 100% (11/11), done.
Writing objects: 100% (16/16), 6.64 KiB | 6.64 MiB/s, done.
Total 16 (delta 1), reused 15 (delta 0), pack-reused 0
remote:   - to fedora-message
remote: 2024-02-19 05:48:24,637 [WARNING] pagure.lib.notify: pagure is about to send a message that has no schemas: pagure.git.branch.creation
remote: Sending to redis to log activity and send commit notification emails
remote: ERROR: ['git', 'diff', '--name-status', '-z', '^0000000000000000000000000000000000000000', '6a72681f0228f0dae29d649a5a9e04f62e0cff7f'] =-- 128
remote: 
remote: fatal: bad object 0000000000000000000000000000000000000000
remote: 
remote: * Publishing information for 1 commits
remote:   - to fedora-message
remote: 2024-02-19 05:48:24,819 [WARNING] pagure.lib.notify: pagure is about to send a message that has no schemas: pagure.git.receive
remote: 
remote: Create a pull-request for <new-branch>
remote:    https://src.fedoraproject.org/fork/<user>/rpms/<repo-name>/diff/rawhide..<new-branch>

Analysis:

The error seems to be caused by an issue in Pagure's handling of private branches in the pre-push script. Specifically, the error occurs when the script tries to process a commit with an old revision hash of all zeros (0000000000000000000000000000000000000000). The problematic code can be found in Pagure's git.py file, where the old revision is incorrectly replaced:

elif set(oldrev) == set(["0"]):
    oldrev = "^%s" % oldrev

This should likely be (Check Aurelien's comment from the releng issue)

oldrev = "^%s" % newrev

Request:

Please investigate and fix the handling of private branches in the pre-push script to prevent these errors from occurring. This issue (I take it as a warning that is not blocking but it still affects multiple users and repositories, making it a significant concern for those using private branches in their workflows.)


Metadata Update from @wombelix:
- Issue assigned to wombelix

4 months ago

Metadata Update from @wombelix:
- Issue set to the milestone: 5.14

4 months ago

Metadata Update from @wombelix:
- Assignee reset

4 months ago

Metadata Update from @wombelix:
- Issue assigned to wombelix

4 months ago

Metadata Update from @wombelix:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

4 months ago

Log in to comment on this ticket.

Metadata