mirror of
https://github.com/ivabus/pantry
synced 2024-11-24 17:35:08 +03:00
git foo
will automatically install and run git-foo
(#3537)
This commit is contained in:
parent
0d2e40d20a
commit
85a0f8857a
3 changed files with 84 additions and 42 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -3,5 +3,4 @@
|
|||
"deno.lint": true,
|
||||
"deno.unstable": true,
|
||||
"deno.config": ".github/deno.jsonc",
|
||||
"deno.importMap": "../cli/import-map.json"
|
||||
}
|
31
projects/git-scm.org/git-shim
Executable file
31
projects/git-scm.org/git-shim
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
find_git_command() {
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
-*);;
|
||||
*)
|
||||
echo $arg
|
||||
return # found the command!
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
libexec="$(cd "$(dirname "$0")/.." && pwd)"/libexec
|
||||
|
||||
# extract the git subcommand
|
||||
cmd=$(find_git_command "$@")
|
||||
|
||||
if [ -z "$cmd" ]; then
|
||||
exec "$libexec/git" "$@"
|
||||
elif [ -x "$libexec/git-$_CMD" -a -f "$libexec/git-$cmd" ]; then
|
||||
exec "$libexec/git" "$@"
|
||||
elif type "git-$cmd" >/dev/null 2>&1; then
|
||||
exec "$libexec/git" "$@"
|
||||
elif command -v pkgx >/dev/null 2>&1 && pkg=$(pkgx --provider git-$cmd); then
|
||||
exec pkgx +$pkg "$libexec/git" "$@"
|
||||
else
|
||||
exec "$libexec/git" "$@"
|
||||
fi
|
|
@ -12,6 +12,7 @@ dependencies:
|
|||
curl.se/ca-certs: '*'
|
||||
perl.org: '*'
|
||||
libexpat.github.io: ~2
|
||||
pkgx.sh: ^1
|
||||
|
||||
runtime:
|
||||
env:
|
||||
|
@ -19,65 +20,76 @@ runtime:
|
|||
GIT_SSL_CAINFO: ${{deps.curl.se/ca-certs.prefix}}/ssl/cert.pem
|
||||
|
||||
build:
|
||||
script: |
|
||||
mv props/config.mak .
|
||||
script:
|
||||
- mv props/config.mak .
|
||||
|
||||
./configure $CONF
|
||||
make install $BAKE
|
||||
- ./configure
|
||||
--prefix={{ prefix }}
|
||||
--with-perl={{ deps.perl.org.prefix }}
|
||||
--with-gitconfig=etc/gitconfig
|
||||
|
||||
cd contrib/subtree
|
||||
make
|
||||
make install
|
||||
- make install --jobs {{ hw.concurrency }} NO_TCLTK=1
|
||||
|
||||
if test "{{ hw.platform }}" = "darwin"; then
|
||||
cd "$SRCROOT/contrib/credential/osxkeychain"
|
||||
make
|
||||
mv git-credential-osxkeychain "{{prefix}}"/bin
|
||||
make clean
|
||||
cd "$SRCROOT/contrib/subtree"
|
||||
fi
|
||||
- run: |
|
||||
make
|
||||
make install
|
||||
working-directory: contrib/subtree
|
||||
|
||||
mv git-subtree "{{prefix}}"/libexec
|
||||
- run: |
|
||||
make
|
||||
mv git-credential-osxkeychain "{{prefix}}"/bin
|
||||
make clean
|
||||
working-directory: contrib/credential/osxkeychain
|
||||
if: darwin
|
||||
|
||||
cd "{{prefix}}"
|
||||
DEBUG=1 fix-shebangs.ts bin/* libexec/*
|
||||
- run: mv git-subtree "{{prefix}}"/libexec
|
||||
working-directory: contrib/subtree
|
||||
|
||||
mkdir -p etc
|
||||
cp "$SRCROOT"/props/git* etc
|
||||
- run: fix-shebangs.ts bin/* libexec/*
|
||||
working-directory: ${{prefix}}
|
||||
|
||||
- run: cp "$SRCROOT"/props/gitconfig "$SRCROOT"/props/gitignore .
|
||||
working-directory: ${{prefix}}/etc
|
||||
|
||||
- run: |
|
||||
rm bin/git
|
||||
cp $SRCROOT/props/git-shim bin/git
|
||||
working-directory: ${{prefix}}
|
||||
env:
|
||||
V: 1
|
||||
BAKE:
|
||||
- --jobs {{ hw.concurrency }}
|
||||
- NO_TCLTK=1
|
||||
CONF:
|
||||
- --prefix={{ prefix }}
|
||||
- --with-perl={{ deps.perl.org.prefix }}
|
||||
- --with-gitconfig=etc/gitconfig
|
||||
INSTALL_STRIP: -s
|
||||
|
||||
test: |
|
||||
git clone https://github.com/teaxyz/white-paper 2>&1 | tee clone-output.txt
|
||||
test:
|
||||
# bug in pkgx where it doesn’t auto sync for --provides
|
||||
- pkgx --sync
|
||||
|
||||
# check that the templates can be found
|
||||
if grep -q 'warning: templates not found in' clone-output.txt; then
|
||||
false
|
||||
fi
|
||||
- run: |
|
||||
git clone https://github.com/teaxyz/white-paper 2>&1 | tee clone-output.txt
|
||||
if grep -q 'warning: templates not found in' clone-output.txt; then
|
||||
exit 1
|
||||
fi
|
||||
working-directory: $(mktemp -d)
|
||||
|
||||
mkdir foo
|
||||
cd foo
|
||||
touch .DS_Store testfile
|
||||
git init
|
||||
git add .
|
||||
test "$(git diff --name-only --cached)" = "testfile"
|
||||
- cd $(mktemp -d)
|
||||
|
||||
- run: |
|
||||
touch .DS_Store testfile
|
||||
git init
|
||||
git add .
|
||||
test "$(git diff --name-only --cached)" = "testfile"
|
||||
|
||||
# necessary so `git commit` will work
|
||||
git config user.email "you@example.com"
|
||||
git config user.name "Your Name"
|
||||
- |
|
||||
git config user.email "you@example.com"
|
||||
git config user.name "Your Name"
|
||||
|
||||
# necessary to check the libexec binaries work
|
||||
git commit --message "test"
|
||||
- git commit --message "test"
|
||||
|
||||
git subtree add --prefix teaxyz-subtree https://github.com/teaxyz/white-paper main --squash
|
||||
- git subtree add --prefix teaxyz-subtree https://github.com/teaxyz/white-paper main --squash
|
||||
|
||||
- git gone --version
|
||||
|
||||
provides:
|
||||
linux:
|
||||
|
|
Loading…
Reference in a new issue