Skip to content

fix: Check git command return codes in init_git_repo#4

Merged
aorumbayev merged 3 commits intophase2from
copilot/sub-pr-2
Jan 29, 2026
Merged

fix: Check git command return codes in init_git_repo#4
aorumbayev merged 3 commits intophase2from
copilot/sub-pr-2

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 29, 2026

init_git_repo() was returning True after attempting to create an initial commit, but never verified that git add or git commit succeeded. In environments without git user.name/user.email configured (or other commit failures), the repo would have no valid base branch ref, causing subsequent worktree creation to fail despite the function reporting success.

Changes:

  • Check return codes for git add, git commit, and git branch -M commands
  • Return False when any git operation fails
  • Simplify final return to return commit_result.returncode == 0
# Before: commands executed but return codes ignored
subprocess.run(["git", "add", ".gitkeep"], ...)
subprocess.run(["git", "commit", "-m", "Initial commit"], ...)
return True  # Always returns True

# After: return codes checked, False on failure
add_result = subprocess.run(["git", "add", ".gitkeep"], ...)
if add_result.returncode != 0:
    return False
    
commit_result = subprocess.run(["git", "commit", "-m", "Initial commit"], ...)
return commit_result.returncode == 0

This ensures worktree creation only proceeds when the base branch has a valid commit reference.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 29, 2026 01:27
- Add return code checking for `git add` command
- Add return code checking for `git commit` command
- Return False when either command fails (e.g., missing git user.name/user.email)
- Ensures function only returns True when initial commit is successfully created
- Prevents subsequent worktree creation failures due to missing base branch ref

Addresses review feedback on PR #2

Co-authored-by: aorumbayev <[email protected]>
- Check return code of `git branch -M` command in the fallback path
- Ensures consistent error handling across all git commands
- Prevents continuing with commit attempts when branch rename fails

Co-authored-by: aorumbayev <[email protected]>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 29, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED tests/test_planner.py tests/test_signals.py tests/test_prompt_loader.py tests/test_e2e_smoke.py tests/test_lock.py tests/test_worktree.py tests/test_sessions.py tests/conftest.py tests/__init__.py (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update Kagan Phase 2 refactor based on feedback fix: Check git command return codes in init_git_repo Jan 29, 2026
Copilot AI requested a review from aorumbayev January 29, 2026 01:30
@aorumbayev aorumbayev marked this pull request as ready for review January 29, 2026 01:38
@aorumbayev aorumbayev merged commit 18fad83 into phase2 Jan 29, 2026
1 check passed
@aorumbayev aorumbayev deleted the copilot/sub-pr-2 branch January 29, 2026 01:38
aorumbayev added a commit that referenced this pull request Feb 14, 2026
- Add GitHub sync status indicator to board header showing connection
  and sync state (○/◉ icons with color coding)
- Add Shift+G keyboard shortcut for GitHub sync action
- Add github_sync action to kanban commands and command palette
- Implement _github_sync_flow to invoke plugin sync operation
- Update keybinding hints to show sync action when GitHub connected
- Extract GitHub connection status from Repo.scripts in base screen
- Add TUI smoke tests for GitHub status header and hints visibility

Co-authored-by: kagan <kagan@58b7aac6>
aorumbayev added a commit that referenced this pull request Feb 14, 2026
Source: .github/context/github-plugin-v1/tickets/GH-5-pr-review-gate.md
Dependency: GH-4.
Add create/link PR operations and enforce REVIEW transition guardrails including lease checks.
aorumbayev added a commit that referenced this pull request Feb 14, 2026
Source: .github/context/github-plugin-v1/tickets/GH-4-tui-connected-repo-ux.md
Dependency: GH-3.
Add connected-state indicator, sync controls, and issue metadata visibility in TUI.

---
_Rebase conflict detected_

---
**Review Feedback (2026-02-14 12:19):**
Rebase state is stale (`rebase in progress`) and merge cannot proceed. Resolve rebase cleanly and re-request review.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants