fix(autopatch): Added 'pre_clean: true' to parameters section in config.yaml to handle unrelated git histories between c10-beta and a10- #2

Merged
eabdullin merged 1 commits from agent-fix/a10-beta-20260407-103406 into a10-beta 2026-04-07 11:39:09 +00:00
Owner

Automated fix by autopatch agent.

Summary: Added 'pre_clean: true' to parameters section in config.yaml to handle unrelated git histories between c10-beta and a10-beta branches.

Root cause

The error 'fatal: refusing to merge unrelated histories' occurred because the upstream CentOS Stream branch (c10-beta) and the AlmaLinux target branch (a10-beta) have no common git ancestor. The autopatch tool's reset_to_base_branch() function attempts a 'git merge c10-beta' which git refuses when histories are unrelated. Setting 'pre_clean: true' in the parameters section activates the pre-clean code path: the working directory is cleaned and files are copied directly from the base branch before the merge attempt. When the merge subsequently fails, the error is caught and ignored (pre_clean path), and the tool proceeds with file replacement instead. All actions applied successfully after the fix: delete_line, replace (6 entries), modify_release, and changelog_entry.

Original error

Type: RuntimeError

Traceback (most recent call last):
  File "/root/autopatch-tool/src/tools/tools.py", line 32, in run_command
    raise RuntimeError(error_message)
RuntimeError: Command failed: git merge c10-beta --no-edit -X theirs --no-commit
fatal: refusing to merge unrelated histories

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/autopatch-tool/src/webserv.py", line 77, in debrand_packages
    result = apply_modifications(
  File "/root/autopatch-tool/src/debranding.py", line 105, in apply_modifications
    git_repo.reset_to_base_branch(
  File "/root/autopatch-tool/src/tools/git.py", line 217, in reset_to_base_branch
    raise e
  File "/root/autopatch-tool/src/tools/git.py", line 211, in reset_to_base_branch
    self.merge_branch(base_branch, strategy='theirs', no_commit=True)
  File "/root/autopatch-tool/src/tools/git.py", line 182, in merge_branch
    self.run_in_repo(*command)
  File "/root/autopatch-tool/src/tools/git.py", line 83, in run_in_repo
    run_command(list(command), shell=shell)
  File "/root/autopatch-tool/src/tools/tools.py", line 36, in run_command
    raise RuntimeError(f"Error running command: {e}") from e
RuntimeError: Error running command: Command failed: git merge c10-beta --no-edit -X theirs --no-commit
fatal: refusing to merge unrelated histories

Package: grub2 | Webhook branch: c10-beta

Automated fix by autopatch agent. **Summary:** Added 'pre_clean: true' to parameters section in config.yaml to handle unrelated git histories between c10-beta and a10-beta branches. ### Root cause The error 'fatal: refusing to merge unrelated histories' occurred because the upstream CentOS Stream branch (c10-beta) and the AlmaLinux target branch (a10-beta) have no common git ancestor. The autopatch tool's reset_to_base_branch() function attempts a 'git merge c10-beta' which git refuses when histories are unrelated. Setting 'pre_clean: true' in the parameters section activates the pre-clean code path: the working directory is cleaned and files are copied directly from the base branch before the merge attempt. When the merge subsequently fails, the error is caught and ignored (pre_clean path), and the tool proceeds with file replacement instead. All actions applied successfully after the fix: delete_line, replace (6 entries), modify_release, and changelog_entry. ### Original error **Type:** `RuntimeError` ``` Traceback (most recent call last): File "/root/autopatch-tool/src/tools/tools.py", line 32, in run_command raise RuntimeError(error_message) RuntimeError: Command failed: git merge c10-beta --no-edit -X theirs --no-commit fatal: refusing to merge unrelated histories The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/root/autopatch-tool/src/webserv.py", line 77, in debrand_packages result = apply_modifications( File "/root/autopatch-tool/src/debranding.py", line 105, in apply_modifications git_repo.reset_to_base_branch( File "/root/autopatch-tool/src/tools/git.py", line 217, in reset_to_base_branch raise e File "/root/autopatch-tool/src/tools/git.py", line 211, in reset_to_base_branch self.merge_branch(base_branch, strategy='theirs', no_commit=True) File "/root/autopatch-tool/src/tools/git.py", line 182, in merge_branch self.run_in_repo(*command) File "/root/autopatch-tool/src/tools/git.py", line 83, in run_in_repo run_command(list(command), shell=shell) File "/root/autopatch-tool/src/tools/tools.py", line 36, in run_command raise RuntimeError(f"Error running command: {e}") from e RuntimeError: Error running command: Command failed: git merge c10-beta --no-edit -X theirs --no-commit fatal: refusing to merge unrelated histories ``` --- Package: `grub2` | Webhook branch: `c10-beta`
eabdullin added 1 commit 2026-04-07 10:34:07 +00:00
Added 'pre_clean: true' to parameters section in config.yaml to handle unrelated git histories between c10-beta and a10-beta branches.
eabdullin merged commit d39d036954 into a10-beta 2026-04-07 11:39:09 +00:00
eabdullin deleted branch agent-fix/a10-beta-20260407-103406 2026-04-07 11:39:09 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: autopatch/grub2#2
No description provided.