Skip to content

Commit 412fdb8

Browse files
unhappychoiceclaude
andcommitted
fix: support non-GitHub repositories and local repos without remote
close: #308 Add fallback logic to create GitRepository from CLI-specified directory when git_repository is None in finalizing_step. This allows sessions to be saved with repository_id even for: - Non-GitHub repositories (GitLab, Bitbucket, etc.) - Local repositories without remote origin The fallback uses LocalGitRepositoryClient::create_from_local_path which creates a repository record with: - user_name: "local" - repository_name: directory name - remote_url: "file://{path}" This ensures repository_id is always available for session_results and stage_results tables, preventing the crash reported in the issue. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 92535ce commit 412fdb8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/presentation/game/models/loading_steps/finalizing_step.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use super::{ExecutionContext, Step, StepResult, StepType};
22
use crate::domain::models::DifficultyLevel;
33
use crate::domain::services::scoring::{SessionTracker, TotalTracker};
4+
use crate::infrastructure::git::LocalGitRepositoryClient;
45
use crate::presentation::game::GameData;
56
use crate::presentation::game::{SessionConfig, SessionManager, StageRepository};
67
use crate::presentation::ui::Colors;
@@ -56,7 +57,14 @@ impl Step for FinalizingStep {
5657
.git_repository
5758
.as_ref()
5859
.cloned()
59-
.or_else(GameData::get_git_repository);
60+
.or_else(GameData::get_git_repository)
61+
.or_else(|| {
62+
context
63+
.current_repo_path
64+
.as_ref()
65+
.or(context.repo_path)
66+
.and_then(|path| LocalGitRepositoryClient::create_from_local_path(path).ok())
67+
});
6068

6169
// Verify challenges are available in GameData
6270
let challenge_count = GameData::with_challenges(|c| c.len()).unwrap_or(0);

0 commit comments

Comments
 (0)