Skip to content

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.

@MartiUK MartiUK requested a review from daxgames February 25, 2020 10:54
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