Skip to content

Conversation

mstv
Copy link
Member

@mstv mstv commented Mar 13, 2025

Addresses #12185 (comment)

Proposed changes

ChecklistSettingsPage:

  • Check used git version
  • Display versions of used git (WSL) and of configured native git (if different)

GitVersion:

  • Simplify by always identifying the GitVersion by means of gitExecutable.Command + gitExecutable.PrefixArguments
  • Reduce dictionary lookups and handle exceptions
  • Unindent namespace
  • Exit early
  • Apply code style

IExecutable:

  • Add property PrefixArguments

Screenshots

Before

image

After

image

Test methodology

  • manual
  • to be tested with real WSL, please

Please do not squash merge


✒️ I contribute this code under The Developer Certificate of Origin.

@mstv mstv self-assigned this Mar 13, 2025
@gerhardol
Copy link
Member

to be tested with real WSL, please

good change but do not work for me
Can debug, but it may take a few days
(have not looked at the code at all)

@RussKie RussKie requested a review from Copilot March 14, 2025 10:14
@RussKie
Copy link
Member

RussKie commented Mar 14, 2025

:shipit:

Copy link

@Copilot 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 pull request improves the display and detection of the Git version in the ChecklistSettingsPage by distinguishing between the native and used (WSL) Git versions. It also simplifies Git version retrieval by identifying it solely using the GitExecutable.Command.

  • Changed ChecklistSettingsPage to compute and display a combined Git version string.
  • Updated GitVersion to use a simplified API with nullable annotations.
  • Adjusted GitModule to remove unused parameters related to WSL.

Reviewed Changes

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

File Description
src/app/GitUI/CommandsDialogs/SettingsDialog/Pages/ChecklistSettingsPage.cs Updates UI logic to display native and used Git versions appropriately.
src/app/GitCommands/Git/GitVersion.cs Refactors the Git version retrieval method with nullable enable and cleaner caching logic.
src/app/GitCommands/Git/GitModule.cs Removes the redundant _wslDistro parameter to align with the simplified GitVersion API.

@mstv
Copy link
Member Author

mstv commented Mar 14, 2025

Works as intended - for me

image

image

image

mstv added a commit to mstv/gitextensions that referenced this pull request Mar 14, 2025
@mstv
Copy link
Member Author

mstv commented Mar 14, 2025

Finally, I have realized that the wsl arguments are not added to the IExecutable.Command.

@gerhardol gerhardol mentioned this pull request Mar 15, 2025
Copy link
Member

@gerhardol gerhardol left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment on lines 49 to 51
= gitExecutable is null ? AppSettings.GitCommand
: string.IsNullOrWhiteSpace(gitExecutable.PrefixArguments) ? gitExecutable.Command
: $"{gitExecutable.Command} {gitExecutable.PrefixArguments}";
Copy link
Member

Choose a reason for hiding this comment

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

please reformat or indent

Suggested change
= gitExecutable is null ? AppSettings.GitCommand
: string.IsNullOrWhiteSpace(gitExecutable.PrefixArguments) ? gitExecutable.Command
: $"{gitExecutable.Command} {gitExecutable.PrefixArguments}";
= gitExecutable is null
? AppSettings.GitCommand
: string.IsNullOrWhiteSpace(gitExecutable.PrefixArguments)
? gitExecutable.Command
: $"{gitExecutable.Command} {gitExecutable.PrefixArguments}";

mstv added 4 commits March 16, 2025 19:33
by always identifying by means of gitExecutable.Command+.PrefixArguments

Refs: gitextensions#12264
and display versions of used git (WSL) and configured native git

Refs: gitextensions#12264
@mstv mstv force-pushed the feat/git_version branch from 469b55d to 9808672 Compare March 16, 2025 18:37
@mstv mstv merged commit 9808672 into gitextensions:master Mar 16, 2025
3 of 4 checks passed
@mstv mstv deleted the feat/git_version branch March 16, 2025 18:38
@mstv mstv added this to the v5.3 milestone Mar 20, 2025
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.

3 participants