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

If the user does not specify the optional git_cli input, we should respect any pre-existing value of the JULIA_PKG_USE_CLI_GIT environment variable #39

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

DilumAluthge
Copy link
Member

…respect any pre-existing value of the `JULIA_PKG_USE_CLI_GIT` environment variable
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5484b0e) 100.00% compared to head (a432b34) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #39   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            2         2           
=========================================
  Hits             2         2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +42 to +52
INPUT_GIT_CLI_str = strip(ENV["INPUT_GIT_CLI"])
if isempty(INPUT_GIT_CLI_str)
# Empty = user did not provide this input = we should do nothing.
else
# Non-empty = user provided this input = we enforce that it must be either
# `true` or `false`.
INPUT_GIT_CLI_b = parse(Bool, INPUT_GIT_CLI_str)
ENV["JULIA_PKG_USE_CLI_GIT"] = "$(INPUT_GIT_CLI_b)"
if (VERSION < v"1.7-") && INPUT_GIT_CLI_b
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow)
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
INPUT_GIT_CLI_str = strip(ENV["INPUT_GIT_CLI"])
if isempty(INPUT_GIT_CLI_str)
# Empty = user did not provide this input = we should do nothing.
else
# Non-empty = user provided this input = we enforce that it must be either
# `true` or `false`.
INPUT_GIT_CLI_b = parse(Bool, INPUT_GIT_CLI_str)
ENV["JULIA_PKG_USE_CLI_GIT"] = "$(INPUT_GIT_CLI_b)"
if (VERSION < v"1.7-") && INPUT_GIT_CLI_b
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow)
end
git_cli = strip(ENV["INPUT_GIT_CLI"])
if !isempty(git_cli)
ENV["JULIA_PKG_USE_CLI_GIT"] = string(git_cli == "true")
if VERSION < v"1.7-" && git_cli == "true"
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow)
end

Alternatively, if we want to follow the original code's behavior where JULIA_PKG_USE_CLI_GIT is only set in Julia 1.7- and above we can do:

Suggested change
INPUT_GIT_CLI_str = strip(ENV["INPUT_GIT_CLI"])
if isempty(INPUT_GIT_CLI_str)
# Empty = user did not provide this input = we should do nothing.
else
# Non-empty = user provided this input = we enforce that it must be either
# `true` or `false`.
INPUT_GIT_CLI_b = parse(Bool, INPUT_GIT_CLI_str)
ENV["JULIA_PKG_USE_CLI_GIT"] = "$(INPUT_GIT_CLI_b)"
if (VERSION < v"1.7-") && INPUT_GIT_CLI_b
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow)
end
git_cli = strip(ENV["INPUT_GIT_CLI"])
if VERSION >= v"1.7-" && !isempty(git_cli)
ENV["JULIA_PKG_USE_CLI_GIT"] = string(git_cli == "true")
elseif VERSION < v"1.7-" && git_cli == "true"
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants