Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2247, fixes #2254 #2265

Merged
merged 1 commit into from
Mar 6, 2020
Merged

Fixes #2247, fixes #2254 #2265

merged 1 commit into from
Mar 6, 2020

Conversation

andyburgess
Copy link
Contributor

I believe the two referenced issues are due to the call to :compare_git_versions subroutine in init.bat.

:compare_git_versions
    if %errorlevel% geq 0 (
        :: compare the user git version against the vendored version
        %lib_git% compare_versions USER VENDORED

        :: use the user provided git if its version is greater than, or equal to the vendored git
        if %errorlevel% geq 0 if exist "%test_dir:~0,-4%\cmd\git.exe" (
            set "GIT_INSTALL_ROOT=%test_dir:~0,-4%"
            set test_dir=
            goto :FOUND_GIT
        ) else if %errorlevel% geq 0 (
            set "GIT_INSTALL_ROOT=%test_dir%"
            set test_dir=
            goto :FOUND_GIT
        ) else (
            call :verbose_output Found old %GIT_VERSION_USER% in "%test_dir%", but not using...
            set test_dir=
        )
    ) else (
        :: compare the user git version against the vendored version
        :: if the user provided git executable is not found
        if %errorlevel% equ -255 (
            call :verbose_output No git at "%git_executable%" found.
            set test_dir=
        )
    )
    exit /b

The problem is that inside the :compare_git_versions subroutine, if the user has non-vendored versions of git installed, the goto :FOUND_GIT line will move the program out of the subroutine without exiting, and the program will run until it reaches exit /b (line 373) at the end of the :PATH_ENHANCE subroutine. At that point it technically exits the :compare_git_versions subroutine and returns to the line after the call (line 189). I believe it repeats this process for every version of git found in path, so users with a lengthy user_profile.cmd end up doubling or tripling the items added to path. In my case, this was causing "The input line is too long" error as well.

Copy link
Member

@daxgames daxgames left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@daxgames daxgames merged commit a92bb19 into cmderdev:master Mar 6, 2020
@daxgames
Copy link
Member

daxgames commented Mar 6, 2020

@andyburgess Thanks for the PR!

@daxgames daxgames mentioned this pull request Jun 26, 2020
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