From: Christian Weisgerber Subject: Put actions in test_fetch_all into more logical order To: gameoftrees@openbsd.org Date: Sat, 30 Sep 2023 17:25:22 +0200 I'm looking at adding something to test_fetch_all() and the existing code could be clearer. Currently the order of actions in test_fetch_all() is this: (1) clone repo repo-clone (2) change repo (3) verify repo-clone; confusing comment mentions missing change from (2) (4) fetch (5) verify updated repo-clone I would like to put this into a more logical order: (1) clone repo repo-clone (2) verify repo-clone (3) change repo (4) fetch (5) verify updated repo-clone ok? ----------------------------------------------- commit d96af6e3508f99bffc9142351f7712343958d52d (local) from: Christian Weisgerber date: Sat Sep 30 15:12:27 2023 UTC put actions in test_fetch_all into more logical order diff facc323cdf6f7bd3700e89572cccb1a2d959f630 d96af6e3508f99bffc9142351f7712343958d52d commit - facc323cdf6f7bd3700e89572cccb1a2d959f630 commit + d96af6e3508f99bffc9142351f7712343958d52d blob - bdd7571df06f3c7d45127433eabfcdc76e0e94ed blob + 9691b8c6b78c7f1c45800d06ebdf34bbac31399f --- regress/cmdline/fetch.sh +++ regress/cmdline/fetch.sh @@ -425,30 +425,29 @@ test_fetch_all() { return 1 fi + got ref -l -r $testroot/repo-clone > $testroot/stdout + + echo "HEAD: refs/heads/master" > $testroot/stdout.expected + echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected + echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \ + >> $testroot/stdout.expected + echo "refs/remotes/origin/master: $commit_id" \ + >> $testroot/stdout.expected + + cmp -s $testroot/stdout $testroot/stdout.expected + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + got branch -r $testroot/repo -c $commit_id foo got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null local tag_id=`got ref -r $testroot/repo -l \ | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2` - got ref -l -r $testroot/repo-clone > $testroot/stdout - - echo "HEAD: refs/heads/master" > $testroot/stdout.expected - echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected - echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \ - >> $testroot/stdout.expected - echo "refs/remotes/origin/master: $commit_id" \ - >> $testroot/stdout.expected - # refs/hoo/boo/zoo is missing because it is outside of refs/heads - - cmp -s $testroot/stdout $testroot/stdout.expected - ret=$? - if [ $ret -ne 0 ]; then - diff -u $testroot/stdout.expected $testroot/stdout - test_done "$testroot" "$ret" - return 1 - fi - got fetch -q -a -r $testroot/repo-clone ret=$? if [ $ret -ne 0 ]; then -- Christian "naddy" Weisgerber naddy@mips.inka.de