commit 0c091d87ab17ea31491f4b716ce8b6f0fbb99001 from: Stefan Sperling date: Thu Feb 02 08:38:41 2023 UTC add test coverage for new 'got fetch' default behaviour commit - ddb2df58a374b7058f0d3044c25b821680bd3345 commit + 0c091d87ab17ea31491f4b716ce8b6f0fbb99001 blob - 8d6881ec92c2a3aff5b101a606dfd3264744dcca blob + 0211785dcc6e7adad10d1a2d594bcda72bf2efa7 --- regress/cmdline/fetch.sh +++ regress/cmdline/fetch.sh @@ -254,6 +254,52 @@ test_fetch_branch() { echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \ >> $testroot/stdout.expected echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected + echo "refs/remotes/origin/master: $commit_id2" \ + >> $testroot/stdout.expected + # refs/hoo/boo/zoo is missing because it is outside of refs/heads + echo "refs/tags/1.0: $tag_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 + + echo "modified beta on foo" > $testroot/repo/beta + git_commit $testroot/repo -m "modified beta" + local commit_id4=`git_show_head $testroot/repo` + + got checkout -b foo $testroot/repo-clone $testroot/wt > /dev/null + + # fetch new commits on branch 'foo', implicitly obtaining the + # branch name from a work tree + (cd $testroot/wt && got fetch -q > $testroot/stdout) + + echo -n > $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 + + wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \ + cut -d ':' -f 2 | tr -d ' ')` + + got ref -l -r $testroot/repo-clone > $testroot/stdout + + echo "HEAD: refs/heads/master" > $testroot/stdout.expected + echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \ + >> $testroot/stdout.expected + echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected + echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected + echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \ + >> $testroot/stdout.expected + echo "refs/remotes/origin/foo: $commit_id4" >> $testroot/stdout.expected echo "refs/remotes/origin/master: $commit_id2" \ >> $testroot/stdout.expected # refs/hoo/boo/zoo is missing because it is outside of refs/heads