From 2023d36676ff568831f56adfe39a39a70dddc70e Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Fri, 2 Nov 2018 04:17:27 -0400 Subject: [PATCH] minimal/do: didn't work correctly with multi-level auto dir creation. If we tried to build target a/b/c/d and a/b/c didn't exist yet, we would correctly name the temp file something like a__b/c__d.tmp. But if a/b didn't exist yet, we named the temp file a/b__c/d.tmp, which didn't work. Instead, name it a/b__c__d.tmp as expected. --- clean.do | 1 + minimal/do | 4 ++-- t/250-makedir/autosubdir/all.do | 10 +++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/clean.do b/clean.do index fa794a7..fa19135 100644 --- a/clean.do +++ b/clean.do @@ -1,3 +1,4 @@ +exec >&2 rm -rf t/.redo redo-sh if [ -e .do_built ]; then while read x; do diff --git a/minimal/do b/minimal/do index a586786..e603cfb 100755 --- a/minimal/do +++ b/minimal/do @@ -322,10 +322,10 @@ _dir_shovel() xdir=$1 xbase=$2 xbasetmp=$2 while [ ! -d "$xdir" -a -n "$xdir" ]; do _dirsplit "${xdir%/}" - xbasetmp=${_dirsplit_base}__$xbase + xbasetmp=${_dirsplit_base}__$xbasetmp xdir=$_dirsplit_dir xbase=$_dirsplit_base/$xbase - _debug "xbasetmp='$xbasetmp'" >&2 done + _debug "xbasetmp='$xbasetmp'" >&2 } diff --git a/t/250-makedir/autosubdir/all.do b/t/250-makedir/autosubdir/all.do index 6f8aeb8..012e448 100644 --- a/t/250-makedir/autosubdir/all.do +++ b/t/250-makedir/autosubdir/all.do @@ -1,3 +1,11 @@ -rm -rf sub.tmp +rm -rf sub.tmp sub2.tmp sub3.tmp + redo-ifchange sub.tmp/test.txt [ -e sub.tmp/test.txt ] || exit 96 + +redo-ifchange sub2.tmp/a/b/c/test.txt +[ -e sub2.tmp/a/b/c/test.txt ] || exit 97 + +mkdir -p sub3.tmp/a +redo-ifchange sub3.tmp/a/b/c/test.txt +[ -e sub2.tmp/a/b/c/test.txt ] || exit 98