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

fix: support Apple Git #54

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion atlas
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ display_pull_params() {

check_git_version() {
MINIMUM_GIT_VERSION="2.25.0" # The `git sparse-checkout` subcommand was introduced in 2.25.0
GIT_VERSION=$(git --version | grep 'git version' | sed -e 's/git version //g')
GIT_VERSION=$(git --version | grep 'git version' | sed -e 's/ .Apple Git-.*//gI' | sed -e 's/git version //g')

# Check if GIT_VERSION is a valid version number
if ! echo "$GIT_VERSION" | grep -Eq '^[0-9]+(\.[0-9]+){1,3}$';
Expand Down
29 changes: 29 additions & 0 deletions spec/minimum_git_version_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,35 @@ Describe 'Works on version 2.25.0'
End


Describe 'Works on Apple git 2.39.3 / Apple Git-146'
git() {
echo 'git version 2.39.3 (Apple Git-146)'
}

Include ./atlas

It 'Works'
When call check_git_version
The status should be success
End
End


Describe 'Fails on Apple git 2.19.3 / Apple Git-50'
git() {
echo 'git version 2.19.3 (Apple Git-50)'
}

Include ./atlas

It 'Detect the version correctly and fails'
When call check_git_version
The output should equal 'Git version 2.19.3 is not supported. Please upgrade to 2.25.0 or higher.'
The status should be failure
End
End


Describe 'Require git version 2.25.0 at least'
git() {
echo "git version 2.20.1"
Expand Down
Loading