From: Mark Jamsek Subject: Re: regress for new got log -d To: Omar Polo Cc: Game of Trees Date: Sun, 8 Jan 2023 00:24:04 +1100 On 23-01-07 02:21PM, Omar Polo wrote: > On 2023/01/07 23:03:53 +1100, Mark Jamsek wrote: > > + echo "modified\nalpha." > $testroot/wt/alpha > > I'm not sure about the portability of using \n with echo. The ksh(1) > builtin (in non-POSIX mode) respects it, /bin/echo doesn't > > % echo 'foo\nbar' > foo > bar > % /bin/echo 'foo\nbar' > foo\nbar > > it's not too important since we're already using non-posix features > (like `local'), but it's also the only place passing \n to echo > (according to grep, could have missed something) and easy to fix. > > ok to switch to printf and heredoc? Yes, definitely. It reads a lot nicer too! ok > diff /home/op/w/got > commit - 8f4e3da96c5f4996c58dc6276417edf32c9589aa > path + /home/op/w/got > blob - 36c40d891f80c07c830e944e477fd259958d981e > file + regress/cmdline/log.sh > --- regress/cmdline/log.sh > +++ regress/cmdline/log.sh > @@ -859,7 +859,7 @@ test_log_diffstat() { > return 1 > fi > > - echo "modified\nalpha." > $testroot/wt/alpha > + printf "modified\nalpha.\n" > $testroot/wt/alpha > (cd $testroot/wt && got commit -m 'log_diffstat mod file' > /dev/null) > > (cd $testroot/wt && got rm beta >/dev/null) > @@ -873,23 +873,25 @@ test_log_diffstat() { > (cd $testroot/wt && got log -d | grep -A2 '^ [MDmA]' | sed '/^--/d' > \ > $testroot/stdout) > > - echo " A new | 1+ 0-" > $testroot/stdout.expected > - echo "\n1 file changed, 1 insertions(+), 0 deletions(-)" >> \ > - $testroot/stdout.expected > - echo " D beta | 0+ 1-" >> $testroot/stdout.expected > - echo " m epsilon/zeta | 0+ 0-" >> $testroot/stdout.expected > - echo "\n2 files changed, 0 insertions(+), 1 deletions(-)" >> \ > - $testroot/stdout.expected > - echo " M alpha | 2+ 1-" >> $testroot/stdout.expected > - echo "\n1 file changed, 2 insertions(+), 1 deletions(-)" >> \ > - $testroot/stdout.expected > - echo " A alpha | 1+ 0-" >> $testroot/stdout.expected > - echo " A beta | 1+ 0-" >> $testroot/stdout.expected > - echo " A epsilon/zeta | 1+ 0-" >> $testroot/stdout.expected > - echo " A gamma/delta | 1+ 0-" >> $testroot/stdout.expected > - echo "\n4 files changed, 4 insertions(+), 0 deletions(-)" >> \ > - $testroot/stdout.expected > + cat <$testroot/stdout.expected > + A new | 1+ 0- > > +1 file changed, 1 insertions(+), 0 deletions(-) > + D beta | 0+ 1- > + m epsilon/zeta | 0+ 0- > + > +2 files changed, 0 insertions(+), 1 deletions(-) > + M alpha | 2+ 1- > + > +1 file changed, 2 insertions(+), 1 deletions(-) > + A alpha | 1+ 0- > + A beta | 1+ 0- > + A epsilon/zeta | 1+ 0- > + A gamma/delta | 1+ 0- > + > +4 files changed, 4 insertions(+), 0 deletions(-) > +EOF > + > cmp -s $testroot/stdout.expected $testroot/stdout > ret=$? > if [ $ret -ne 0 ]; then > -- Mark Jamsek GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68