Skip to content
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
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ jobs:
- name: Verify completion files are up to date
run: ./scripts/generate-completions.sh --check

bash-compatibility:
name: macOS Bash 3.2
runs-on: macos-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false

- name: Exercise CLI startup and shell integration with system Bash
shell: /bin/bash --noprofile --norc -eo pipefail {0}
run: |
export PATH="$PWD/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
export XDG_CACHE_HOME="$RUNNER_TEMP/gtr-cache"
/bin/bash --version
git gtr --version
./bin/gtr --version
git gtr init bash > "$RUNNER_TEMP/gtr-init.bash"
/bin/bash -n "$RUNNER_TEMP/gtr-init.bash"
source "$RUNNER_TEMP/gtr-init.bash"

test:
name: Tests
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion lib/commands/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ _init_emit_posix_trust_helpers() {
# Keep the snapshot encoding and extraction identical to the CLI.
_init_emit_snapshot_helpers

# Keep case patterns balanced inside this substitution for Bash 3.2's parser.
template=$(cat <<'EOF'
__FUNC___gtrconfig_path() {
__SHELL_PRELUDE__
Expand Down Expand Up @@ -186,7 +187,7 @@ __SHELL_PRELUDE__
_gtr_birth_time="${_gtr_identity#*:*:}"
_gtr_birth_time="${_gtr_birth_time%%:*}"
case "$_gtr_birth_time" in
''|0|0.*|*[!0-9.]*) return 1 ;;
(''|0|0.*|*[!0-9.]*) return 1 ;;
esac
printf '%s\n%s\n' "$_gtr_common_dir" "$_gtr_identity"
}
Expand Down
Loading