mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-29 14:00:52 +01:00
show deleted file names in outgoing changes
This commit is contained in:
committed by
Sam Chau
parent
9c510998f9
commit
1ae0151676
@@ -87,15 +87,24 @@ def get_outgoing_changes(repo):
|
||||
x, y, file_path = item[0], item[1], item[3:]
|
||||
logger.debug(f"Parsed status: x={x}, y={y}, file_path={file_path}")
|
||||
|
||||
full_path = os.path.join(repo.working_dir, file_path)
|
||||
|
||||
is_staged = x != ' ' and x != '?'
|
||||
is_deleted = x == 'D' or y == 'D'
|
||||
|
||||
if is_deleted:
|
||||
try:
|
||||
# Get the content of the file from the last commit
|
||||
file_content = repo.git.show(f'HEAD:{file_path}')
|
||||
yaml_content = yaml.safe_load(file_content)
|
||||
original_name = yaml_content.get('name', 'Unknown')
|
||||
original_id = yaml_content.get('id', '')
|
||||
except Exception as e:
|
||||
logger.warning(f"Could not retrieve original name for deleted file {file_path}: {str(e)}")
|
||||
original_name = "Unknown"
|
||||
original_id = ""
|
||||
|
||||
changes.append({
|
||||
'name': 'Deleted File',
|
||||
'id': '',
|
||||
'name': original_name,
|
||||
'id': original_id,
|
||||
'type': determine_type(file_path),
|
||||
'status': 'Deleted',
|
||||
'file_path': file_path,
|
||||
|
||||
Reference in New Issue
Block a user