Skip to content

feat: add git installation check before running mirror command#9

Merged
ditahkk merged 1 commit into
mainfrom
fix/check-git-installed
Dec 20, 2025
Merged

feat: add git installation check before running mirror command#9
ditahkk merged 1 commit into
mainfrom
fix/check-git-installed

Conversation

@ditahkk

@ditahkk ditahkk commented Dec 20, 2025

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added Git installation validation with fast-fail behavior.
    • Integrated platform-specific installation guidance for Windows, macOS, and Linux.
  • Documentation

    • Updated release notes with comprehensive Git installation instructions and package manager options.
    • Added version 0.0.4 changelog entry with platform-specific setup guidance.

✏️ Tip: You can customize this high-level summary in your review settings.

@ditahkk ditahkk self-assigned this Dec 20, 2025
@ditahkk ditahkk linked an issue Dec 20, 2025 that may be closed by this pull request
4 tasks
@coderabbitai

coderabbitai Bot commented Dec 20, 2025

Copy link
Copy Markdown

Walkthrough

The pull request adds a Git installation check as a pre-flight validation step to the ztigit application. A new CheckGitInstalled() function verifies Git availability in the system PATH with platform-specific error guidance. The check is integrated into the mirror command entry point, and documentation is updated to reflect the feature.

Changes

Cohort / File(s) Summary
Documentation Updates
CHANGELOG.md, RELEASE_NOTES.md
Added v0.0.4 release notes documenting the Git installation check feature with platform-specific installation instructions (Windows, macOS, Linux) and updated version references (0.0.3...0.0.4).
Git Pre-flight Check Implementation
internal/mirror/preflight.go
New public function CheckGitInstalled() that verifies Git is available in PATH; returns detailed platform-specific installation guidance via gitNotFoundMessage() when Git is not found.
Mirror Command Integration
cmd/ztigit/main.go
Added guard clause in runMirror() to invoke CheckGitInstalled() before command execution, enabling fast-fail behavior if Git is unavailable.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Specific areas for attention: Verify the platform-specific error messages in gitNotFoundMessage() are accurate and user-friendly; confirm guard clause placement in runMirror() executes before any side effects.

Possibly related PRs

Suggested reviewers

  • godsonten
  • ditahm6

Poem

🐰 A rabbit hops along the path,
Checking if Git's there, not wrath,
Fast-fail wisdom saves the day,
Platform guides light up the way! ✨
No broken mirrors, all is well,
This safety tale we fondly tell.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a Git installation check before the mirror command runs, which is reflected across all modified files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/check-git-installed

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
RELEASE_NOTES.md (1)

93-93: Optional: Format the Full Changelog link as proper Markdown.

The bare URL triggers a markdownlint warning. Consider formatting it as a proper Markdown link for consistency.

🔎 Suggested formatting
-**Full Changelog**: https://github.com/zsoftly/ztigit/compare/0.0.3...0.0.4
+[**Full Changelog**](https://github.com/zsoftly/ztigit/compare/0.0.3...0.0.4)
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between acffa7e and 1f0ce7c.

📒 Files selected for processing (4)
  • CHANGELOG.md (1 hunks)
  • RELEASE_NOTES.md (2 hunks)
  • cmd/ztigit/main.go (1 hunks)
  • internal/mirror/preflight.go (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
cmd/ztigit/main.go (1)
internal/mirror/preflight.go (1)
  • CheckGitInstalled (18-24)
🪛 markdownlint-cli2 (0.18.1)
RELEASE_NOTES.md

18-18: Bare URL used

(MD034, no-bare-urls)


49-49: Bare URL used

(MD034, no-bare-urls)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: 2b. Test (windows-latest)
🔇 Additional comments (5)
CHANGELOG.md (1)

8-21: LGTM! Clear and comprehensive changelog entry.

The 0.0.4 release notes accurately document the Git installation check feature with good detail on the platform-specific guidance provided.

internal/mirror/preflight.go (2)

16-24: LGTM! Appropriate use of exec.LookPath for Git detection.

The implementation correctly uses exec.LookPath to verify Git availability in the system PATH, and provides actionable error messages when Git is not found.


26-78: No action required. The code compiles successfully and the red function is properly defined and accessible within the mirror package.

cmd/ztigit/main.go (1)

101-104: LGTM! Excellent guard clause placement.

The Git installation check is correctly positioned as the first validation in runMirror, ensuring fast-fail behavior before any context initialization or other operations proceed. The error is properly propagated to the caller.

RELEASE_NOTES.md (1)

5-60: LGTM! Excellent user-facing documentation.

The release notes clearly document the new Git installation check feature with helpful platform-specific examples that show exactly what users will see when Git is not installed.

@ditahkk ditahkk merged commit 7c90aa7 into main Dec 20, 2025
9 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Dec 21, 2025
4 tasks
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.

Create One-Liner Installation Scripts

2 participants