@cryptotaxi247 / kubo / commits / a3de9bf3a

sharness: Use sed in a cross-platform safe way

OS X sed is documented as "-i SUFFIX", GNU sed as "-iSUFFIX". The one consistent case seems to be "-iSUFFIX", where suffix cannot empty (or OS X will parse the next argument as the suffix). This used to leave around files named `refsout=` on Linux, and was just confusing. License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>

Tommi Virtanen committed May 11, 2015 at 09:18 UTC a3de9bf3a0ef5fd20eaf361ef03441fc86bb1741
1 file changed +2 -2
test/sharness/t0080-repo.sh
+2 -2
@@ -138,7 +138,7 @@ test_expect_success "adding multiblock random file succeeds" '
138 test_expect_success "'ipfs pin ls --type=indirect' is correct" '
139 ipfs refs "$MBLOCKHASH" >refsout &&
140 ipfs refs -r "$HASH_WELCOME_DOCS" >>refsout &&
141 - sed -i="" "s/\(.*\)/\1 indirect/g" refsout &&
141 + sed -i"~" "s/\(.*\)/\1 indirect/g" refsout &&
142 ipfs pin ls --type=indirect >indirectpins &&
143 test_sort_cmp refsout indirectpins
144 '
@@ -166,7 +166,7 @@ test_expect_success "'ipfs pin ls --type=recursive' is correct" '
166 echo "$HASH_WELCOME_DOCS" >>rp_expected &&
167 echo "$EMPTY_DIR" >>rp_expected &&
168 ipfs refs -r "$HASH_WELCOME_DOCS" >>rp_expected &&
169 - sed -i="" "s/\(.*\)/\1 recursive/g" rp_expected &&
169 + sed -i"~" "s/\(.*\)/\1 recursive/g" rp_expected &&
170 ipfs pin ls --type=recursive >rp_actual &&
171 test_sort_cmp rp_expected rp_actual
172 '