Skip to content

Commit e0a280c

Browse files
btuckerclaude
andcommitted
Handle empty git repo in get_file_content_from_repo
Add ValueError to the exception handler to gracefully handle cases where the temporary git repo has no commits yet. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e860505 commit e0a280c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/claude_code_transcripts/code_view.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,8 @@ def get_file_content_from_repo(repo: Repo, file_path: str) -> Optional[str]:
647647
try:
648648
blob = repo.head.commit.tree / file_path
649649
return blob.data_stream.read().decode("utf-8")
650-
except (KeyError, TypeError):
650+
except (KeyError, TypeError, ValueError):
651+
# ValueError occurs when repo has no commits yet
651652
return None
652653

653654

0 commit comments

Comments
 (0)