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

git-extra: more really only add the aarch64 repository for git-sdk-arm64 #501

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions git-extra/git-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ sdk () {
case "$(uname -m)" in
i686) shortcut_suffix=" 32-bit";;
x86_64)
if test -d /clangarm64
if test -z "$(find /clangarm64 -type f -print -quit)" || # if /clangarm64 exists and contains at least one file
Copy link
Member

Choose a reason for hiding this comment

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

It's probably worth refactoring this into its own function (something like is_aarch64_setup).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll look into that refactoring.

There was one issue I saw with the code that may be due to my ignorance of some bash idioms. When I copied the change into my C:\git-sdk-64\etc\profile.d\git-sdk.sh (where this is installed), I found that I'd get a syntax error at startup, probably due to the way the double quotes and || (or) interact with the # comment.

In the original 257a670 (git-extra: really only add the aarch64 repository for git-sdk-arm64, 2023-02-11) there is only a single opening 'double quote' for the "$(find ...), which looks 'odd' to me - is that (the possible use of the || as an alternate close quote) an idiom I'm not aware of?

If I 'correct' the conditional to either add an echo "here", or a : (colon) just after the || (or), then the error disappears (obvs. fixed in two places).

What am I missing?

Copy link
Member

Choose a reason for hiding this comment

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

I found that I'd get a syntax error at startup, probably due to the way the double quotes and || (or) interact with the # comment.

No, the reason is that the || should not be here. That's a logical "or" operator, and there is no expression to "or it against". You need to remove it.

In the original 257a670 (git-extra: really only add the aarch64 repository for git-sdk-arm64, 2023-02-11) there is only a single opening 'double quote' for the "$(find ...), which looks 'odd' to me - is that (the possible use of the || as an alternate close quote) an idiom I'm not aware of?

That was a bug, hence fixed ("View git blame" can help you find such answers).

then
shortcut_suffix=" arm64"
else
Expand Down Expand Up @@ -221,7 +221,7 @@ sdk () {
MINGW_MOUNT_POINT=/mingw32
;;
x86_64)
if test -d /clangarm64
if test -z "$(find /clangarm64 -type f -print -quit)" || # if /clangarm64 exists and contains at least one file
then
MSYSTEM=CLANGARM64
MINGW_MOUNT_POINT=/clangarm64
Expand Down