Skip to content

Conversation

@jovnc
Copy link
Collaborator

@jovnc jovnc commented Jan 17, 2026

Fixes git-mastery/git-mastery#60

Would prefer not to set too strict restrictions on the git version (eg. must always be latest version, etc.) as additional features may not be required for the app, and thus it's not a requirement for users to update their git.

@jovnc jovnc added the enhancement New feature or request label Jan 17, 2026
@jovnc jovnc requested a review from Copilot January 17, 2026 15:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a minimum Git version requirement check to ensure users have Git 2.28.0 or later installed, which is necessary for sparse checkout functionality with the --filter option used by the application.

Changes:

  • Added a new Version.parse() method to parse plain version strings without a 'v' prefix
  • Replaced is_git_installed() with get_git_version() that returns the installed Git version or None
  • Integrated version checking into the check git command to validate the minimum version requirement

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
app/utils/version.py Added parse() method to parse plain version strings (e.g., '1.2.3') alongside existing parse_version_string() for 'v'-prefixed strings
app/utils/git.py Introduced MIN_GIT_VERSION constant (2.28.0) and replaced boolean is_git_installed() with get_git_version() that extracts version from git --version output
app/commands/check/git.py Updated git check command to retrieve git version, validate it meets minimum requirement, and display appropriate error messages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jovnc jovnc requested a review from woojiahao January 17, 2026 15:48
Copy link

@desmondwong1215 desmondwong1215 left a comment

Choose a reason for hiding this comment

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

LGTM! I have tested it and it works as intended.

if git_version is None:
error("Git is not installed")

info("Git is installed")

Choose a reason for hiding this comment

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

Just a small nit. I am ok with omitting the else clause to make a happy path, but will it be better if we add it for clarity and consistency, which is similar to lines 34 - 41?

if not config_user_name:
        error(
            f"You do not have {click.style('user.name', bold=True)} yet. Run {click.style('git config --global user.name <name>', bold=True, italic=True)}."
        )
else:
        info(
            f"You have set {click.style('user.name', bold=True)} as {click.style(config_user_name, bold=True, italic=True)}"
        )

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

error() does a sys.exit(1) call which stops the entire program.

I believe that the else is redundant for the other lines of code as well, generally we should keep the happy path prominent and not hide it in else clauses.

Do you think it would be better for me to remove the else in other lines instead?

Copy link
Collaborator Author

@jovnc jovnc Jan 24, 2026

Choose a reason for hiding this comment

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

But again, generally we don't want to touch code that isn't broken, so it should be a small issue, whether we decide to include or omit the else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check for minimum Git version

2 participants