Skip to content

Commit 4765445

Browse files
author
Test User
committed
fix(api): correct staged_files tuple extraction and timestamp normalization
- Extract only path component from repo.index.entries.keys() tuples (keys are (path, stage) pairs, not plain strings) - Use .astimezone(UTC) before formatting commit timestamps for proper UTC normalization Addresses additional code review feedback for PR #282.
1 parent f8407a9 commit 4765445

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

codeframe/ui/routers/git.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ async def list_commits(
602602
short_hash=commit.hexsha[:7],
603603
message=commit.message.strip().split("\n")[0], # First line only
604604
author=str(commit.author),
605-
timestamp=commit.committed_datetime.isoformat().replace("+00:00", "Z"),
605+
timestamp=commit.committed_datetime.astimezone(UTC).isoformat().replace("+00:00", "Z"),
606606
files_changed=files_changed,
607607
)
608608
)
@@ -676,7 +676,8 @@ async def get_git_status(
676676
staged_files = [item.a_path for item in repo.index.diff("HEAD")]
677677
else:
678678
# No HEAD yet - all indexed files are staged
679-
staged_files = list(repo.index.entries.keys()) if repo.index.entries else []
679+
# entries.keys() returns (path, stage) tuples, extract just the path
680+
staged_files = [path for path, _stage in repo.index.entries.keys()] if repo.index.entries else []
680681
except git.BadName:
681682
# HEAD reference doesn't exist (empty repo)
682683
staged_files = []

0 commit comments

Comments
 (0)