On 6/25/2018 3:38 PM, Junio C Hamano wrote:
Derrick Stolee <stolee@xxxxxxxxx> writes:
+ cat >expect <<- EOF
"<<-\EOF", i.e. make it easy for readers to spot that there is no
funny substitutions happening in the here-doc body.
While I don't use substitutions in this patch, I do use them in later
patches. Here is the final version of this method:
midx_read_expect () {
NUM_PACKS=$1
NUM_OBJECTS=$2
NUM_CHUNKS=$3
OBJECT_DIR=$4
EXTRA_CHUNKS="$5"
cat >expect <<-\EOF
header: 4d494458 1 $NUM_CHUNKS $NUM_PACKS
chunks: pack_names oid_fanout oid_lookup
object_offsets$EXTRA_CHUNKS
num_objects: $NUM_OBJECTS
packs:
EOF
if [ $NUM_PACKS -ge 1 ]
then
ls $OBJECT_DIR/pack/ | grep idx | sort >> expect
fi
printf "object_dir: $OBJECT_DIR\n" >>expect &&
test-tool read-midx $OBJECT_DIR >actual &&
test_cmp expect actual
}
Using <<-\EOF causes these substitutions to fail. Is there a different
way I should construct this method?
Thanks,
-Stolee