Skip to content
Open
Show file tree
Hide file tree
Changes from 14 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: 18 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,25 @@ jobs:
run: |
tar xzf try-dist.tgz/try-*.tgz --strip-components=1
rm -r try-dist.tgz
./configure
./configure --disable-utils
make all
sudo make install

- name: Run tests with shell fallbacks
run: |
! which try-summary
! which try-commit
scripts/run_tests.sh

- name: Clean up build
run: |
sudo make clean

- name: Install utilities
run: |
autoconf
./configure
make all
sudo make install

- name: Run tests with utilities
Expand Down Expand Up @@ -116,17 +124,25 @@ jobs:
- name: Configure and build utilities
run: |
autoconf
./configure
./configure --disable-utils
make all
sudo make install

- name: Run tests with shell fallbacks
run: |
! which try-summary
! which try-commit
scripts/run_tests.sh

- name: Clean up build
run: |
sudo make clean

- name: Install utilities
run: |
autoconf
./configure
make all
sudo make install

- name: Run tests with utilities
Expand Down
8 changes: 6 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ INSTALL=@INSTALL@
DISTDIR=@PACKAGE_TARNAME@-@PACKAGE_VERSION@
DISTTGZ=$(DISTDIR).tgz

TARGETS=$(if $(findstring yes,@enable_utils@),utils/try-summary utils/try-commit) man/try.1.gz
TARGETS=utils/make-socket $(if $(findstring yes,@enable_utils@),utils/try-summary utils/try-commit) man/try.1.gz

all: $(TARGETS)

install: $(TARGETS)
$(INSTALL) -d $(bindir)
$(INSTALL) -m 755 try $(bindir)
$(INSTALL) -m 755 utils/make-socket $(bindir)
ifeq (@enable_utils@, yes)
$(INSTALL) -m 755 utils/try-summary $(bindir)
$(INSTALL) -m 755 utils/try-commit $(bindir)
Expand Down Expand Up @@ -58,7 +59,10 @@ utils/try-summary: utils/ignores.o utils/try-summary.o
utils/try-commit: utils/ignores.o utils/try-commit.o
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -g $^

test: try $(if $(findstring yes,@enable_utils@),utils/try-summary utils/try-commit)
utils/make-socket: utils/make-socket.o
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -g $^

test: try $(if $(findstring yes,@enable_utils@),utils/try-summary utils/try-commit) utils/make-socket
scripts/run_tests.sh

lint:
Expand Down
28 changes: 28 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ Vagrant.configure("2") do |config|
sudo apt-get update
sudo apt-get install -y git expect curl attr pandoc gcc make autoconf mergerfs
sudo chown -R vagrant:vagrant try
sudo modprobe overlay
cd try
autoconf && ./configure --disable-utils && make
sudo make install
scripts/run_tests.sh

sudo make clean

autoconf && ./configure && make
sudo make install
which try-commit || exit 2
Expand Down Expand Up @@ -78,10 +83,15 @@ Vagrant.configure("2") do |config|
# This is intentional, if we moved try to lv1 it'd work since itself does not contain a nested mount
sudo mv /home/vagrant/try /mnt/lv0
sudo chown -R vagrant:vagrant /mnt/lv0/try
sudo modprobe overlay

cd /mnt/lv0/try
autoconf && ./configure --disable-utils && make
sudo make install
scripts/run_tests.sh

sudo make clean

autoconf && ./configure && make
sudo make install
which try-commit || exit 2
Expand All @@ -97,6 +107,7 @@ Vagrant.configure("2") do |config|
sudo apt-get update
sudo apt-get install -y curl attr pandoc gcc make autoconf mergerfs zsh
sudo chown -R vagrant:vagrant try
sudo modprobe overlay
cd try


Expand Down Expand Up @@ -149,8 +160,18 @@ Vagrant.configure("2") do |config|
wget https://github.com/trapexit/mergerfs/releases/download/2.40.2/mergerfs-2.40.2-1.el9.x86_64.rpm
sudo rpm -i mergerfs-2.40.2-1.el9.x86_64.rpm
sudo chown -R vagrant:vagrant try
sudo modprobe overlay
cd try

autoconf && ./configure --disable-utils && make
Comment thread
mgree marked this conversation as resolved.
Outdated
sudo make install

autoconf && ./configure --disable-utils && make
sudo make install
TRY_TOP=$(pwd) scripts/run_tests.sh

sudo make clean

autoconf && ./configure && make
sudo make install
which try-commit || exit 2
Expand All @@ -167,8 +188,15 @@ Vagrant.configure("2") do |config|
wget https://github.com/trapexit/mergerfs/releases/download/2.40.2/mergerfs-2.40.2-1.fc39.x86_64.rpm
sudo rpm -i mergerfs-2.40.2-1.fc39.x86_64.rpm
sudo chown -R vagrant:vagrant try
sudo modprobe overlay
cd try

autoconf && ./configure --disable-utils && make
sudo make install
TRY_TOP=$(pwd) scripts/run_tests.sh

sudo make clean

autoconf && ./configure && make
sudo make install
which try-commit || exit 2
Expand Down
22 changes: 11 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ AC_ARG_ENABLE([utils],
[don't compile C utilities for summarizing and committing changes (default is yes)])],
[enable_utils=${enableval}], [enable_utils=yes])


AC_REQUIRE_AUX_FILE([utils/make-socket.c])

# build tools
AC_PROG_CC

# CFLAGS AND CPPFLAGGS
AUTO_CFLAGS=""
AUTO_CPPFLAGS=""

if test "$enable_utils" = "yes"
then
AC_REQUIRE_AUX_FILE([utils/try-commit.c])

# build tools
AC_PROG_CC

# CFLAGS and CPPFLAGGS
if test -z "$CFLAGS"
then
AUTO_CFLAGS="-g -Wall -O2"
else
AUTO_CFLAGS=""
fi
AUTO_CPPFLAGS=""
AUTO_CPPFLAGS=""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should go now, since we've set it unconditionally above.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this comment is still active---no need to set AUTO_CPPFLAGS here.


CFLAGS=${CFLAGS-"$AUTO_CFLAGS"}
Comment thread
mgree marked this conversation as resolved.
CPPFLAGS=${CPPFLAGS-"$AUTO_CPPFLAGS"}
Expand Down
8 changes: 2 additions & 6 deletions package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ stdenv.mkDerivation {
pname = "try";
version = "latest";

src = fetchFromGitHub {
owner = "binpash";
repo = "try";
rev = "67052d8f20725f3cdc22ffaec33f7b7c14f1eb6b";
hash = "sha256-8mfCmqN50pRAeNTJUlRVrRQulWon4b2OL4Ug/ygBhB0=";
};
src = ./.;

# skip TRY_REQUIRE_PROG as it detects executable dependencies by running it
postPatch = ''
Expand All @@ -40,6 +35,7 @@ stdenv.mkDerivation {
install -Dt $out/bin try
install -Dt $out/bin utils/try-commit
install -Dt $out/bin utils/try-summary
install -Dt $out/bin utils/make-socket
wrapProgram $out/bin/try --prefix PATH : ${
lib.makeBinPath [
coreutils
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_trycase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ check_file() {
lf="${lf%)}"

case "$cf" in
(file|dir|symlink|nonexist|opaque|whiteout);;
(file|dir|symlink|nonexist|opaque|whiteout|fifo|socket);;
(*) printf "ERROR: $1: invalid changed file: %s\n" "$cf"
: $((ERRORS += 1))
;;
Expand Down
87 changes: 87 additions & 0 deletions test/all-commit-cases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,90 @@ echo arrivederci >formerdir/it/file2 || fail
[ -L formerdir ] || fail
[ "$(readlink formerdir)" = "/this/is/a/broken/symlink" ] || fail
rm formerdir || fail

# // TRYCASE(fifo, file)

: $((COUNT += 1))

! [ -e newpipe ] || fail
"$TRY" -y "touch newpipe; echo new >newpipe"
[ -f newpipe ] || fail
[ "$(cat newpipe)" = "new" ] || fail
"$TRY" -y "rm newpipe; mkfifo newpipe"
[ -p newpipe ] || fail
rm newpipe

# // TRYCASE(fifo, dir)

: $((COUNT += 1))

! [ -e newpipe ] || fail
"$TRY" -y "mkdir newpipe"
[ -d newpipe ] || fail
"$TRY" -y "rm -r newpipe; mkfifo newpipe"
[ -p newpipe ] || fail
rm newpipe

# // TRYCASE(fifo, symlink)

: $((COUNT += 1))

! [ -e newpipe ] || fail
ln -s "$TRY" newpipe
[ -L newpipe ] || fail
"$TRY" -y "rm newpipe; mkfifo newpipe"
[ -p newpipe ] || fail
rm newpipe

# // TRYCASE(fifo, nonexist)

: $((COUNT += 1))

! [ -e newpipe ] || fail
"$TRY" -y "mkfifo newpipe"
[ -p newpipe ] || fail
rm newpipe

# // TRYCASE(socket, file)

: $((COUNT += 1))

! [ -e newsock ] || fail
Comment thread
mgree marked this conversation as resolved.
"$TRY" -y "touch newsock; echo hello> newsock"
[ -f newsock ] || fail
[ "$(cat newsock)" = "hello" ] || fail
"$TRY" -y "rm newsock; make-socket newsock"
[ -S newsock ] || fail
rm newsock

# // TRYCASE(socket, dir)

: $((COUNT += 1))

! [ -e newsock ] || fail
Comment thread
mgree marked this conversation as resolved.
"$TRY" -y "mkdir newsock"
[ -d newsock ] || fail
"$TRY" -y "rm -r newsock; make-socket newsock"
[ -S newsock ] || fail
rm newsock

# // TRYCASE(socket, symlink)

: $((COUNT += 1))

! [ -e newsock ] || fail
ln -s "$TRY" newsock
[ -L newsock ] || fail
"$TRY" -y "rm newsock; make-socket newsock"
! [ -e newlink ] || fail
[ -S newsock ] || fail
rm newsock

# // TRYCASE(socket, nonexist)

: $((COUNT += 1))

! [ -e newsock ]
"$TRY" -y "make-socket newsock"
[ -S newsock ] || fail
rm newsock
6 changes: 1 addition & 5 deletions test/explore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ trap 'cleanup' EXIT
try_workspace="$(mktemp -d)"
cd "$try_workspace" || exit 9

SHELL="/usr/bin/env bash --norc"
export SHELL
PS1="# "
export PS1

echo hi >expected.out

cat >explore.exp <<EOF
Expand All @@ -30,6 +25,7 @@ cat >explore.exp <<EOF
set timeout 3

spawn "$TRY" explore
send -- "PS1='# '\r"
Comment thread
mgree marked this conversation as resolved.
Outdated
expect {
# Ignore the warnings
"Warning*" {
Expand Down
Loading
Loading