From 78b0d1650ea58749a82e1c1bc10e53e4fb8765b2 Mon Sep 17 00:00:00 2001 From: David Vaillant Date: Tue, 29 Jan 2019 22:48:33 +0100 Subject: [PATCH] Adr init with spaces in "alternate-dir" path fails Fixes #72 --- src/_adr_dir | 2 +- tests/alternative-dir-with-space.expected | 12 ++++++++++++ tests/alternative-dir-with-space.sh | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tests/alternative-dir-with-space.expected create mode 100644 tests/alternative-dir-with-space.sh diff --git a/src/_adr_dir b/src/_adr_dir index 27a3c48..419a786 100755 --- a/src/_adr_dir +++ b/src/_adr_dir @@ -13,7 +13,7 @@ function absdir() { (cd $(dirname $1) && pwd -P) } -while [ $(absdir $reldir) != / ] +while [ "$(absdir $reldir)" != / ] do if [ -f $(mkrel .adr-dir) ] then diff --git a/tests/alternative-dir-with-space.expected b/tests/alternative-dir-with-space.expected new file mode 100644 index 0000000..a47e330 --- /dev/null +++ b/tests/alternative-dir-with-space.expected @@ -0,0 +1,12 @@ +mkdir dir\ with\ space +cd dir\ with\ space +adr init alt-dir-with-space +alt-dir-with-space/0001-record-architecture-decisions.md + +ls . +alt-dir-with-space +ls alt-dir-with-space +0001-record-architecture-decisions.md + +adr list +alt-dir-with-space/0001-record-architecture-decisions.md diff --git a/tests/alternative-dir-with-space.sh b/tests/alternative-dir-with-space.sh new file mode 100644 index 0000000..5b6126e --- /dev/null +++ b/tests/alternative-dir-with-space.sh @@ -0,0 +1,8 @@ +mkdir dir\ with\ space +cd dir\ with\ space +adr init alt-dir-with-space + +ls . +ls alt-dir-with-space + +adr list