mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-02 11:50:37 +08:00
fix(azure-provider): handle renamed files as new files
This fixes a bug when azure-provider tries to fetch original content of a renamed file and fails since the file doesn't exist in base yet. Also handles case when `diff_type` includes multiple actions as `edit, rename`. This can be improved to fetch the actual old content using the old path before renaming, but IMO for azure devops since its dying anyway, this fix should be enough.
This commit is contained in:
@ -326,13 +326,13 @@ class AzureDevopsProvider(GitProvider):
|
||||
edit_type = EDIT_TYPE.ADDED
|
||||
elif diff_types[file] == "delete":
|
||||
edit_type = EDIT_TYPE.DELETED
|
||||
elif diff_types[file] == "rename":
|
||||
elif "rename" in diff_types[file]: # diff_type can be `rename` | `edit, rename`
|
||||
edit_type = EDIT_TYPE.RENAMED
|
||||
|
||||
version = GitVersionDescriptor(
|
||||
version=base_sha.commit_id, version_type="commit"
|
||||
)
|
||||
if edit_type == EDIT_TYPE.ADDED:
|
||||
if edit_type == EDIT_TYPE.ADDED or edit_type == EDIT_TYPE.RENAMED:
|
||||
original_file_content_str = ""
|
||||
else:
|
||||
try:
|
||||
|
Reference in New Issue
Block a user