commit - 118a625d39930284f891ea1285efc17fb3848cae
commit + bf1c78e5100932aa445b8ef07ebf9b712500c67e
blob - 8062d38d224c6522d74df4b1b340812e982c72b3
blob + d24224b5bc7fdac0107e60604c32eb162cf6598d
--- regress/cmdline/fetch.sh
+++ regress/cmdline/fetch.sh
git_commit $testroot/repo -m "modified alpha"
local commit_id3=`git_show_head $testroot/repo`
- # foo is now the default HEAD branch in $testroot/repo
- # but got.conf still says to fetch "master"
+ # foo is now the default HEAD branch in $testroot/repo and should be
+ # fetched as the clone's remote HEAD symref target no longer matches
got fetch -q -r $testroot/repo-clone > $testroot/stdout
ret=$?
if [ $ret -ne 0 ]; then
got ref -l -r $testroot/repo-clone > $testroot/stdout
echo "HEAD: refs/heads/master" > $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/master" \
+ 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
got ref -l -r $testroot/repo-clone > $testroot/stdout
echo "HEAD: refs/heads/master" > $testroot/stdout.expected
+ echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
- echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
+ echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
>> $testroot/stdout.expected
+ echo "refs/remotes/origin/foo: $commit_id" \
+ >> $testroot/stdout.expected
echo "refs/remotes/origin/master: $commit_id" \
>> $testroot/stdout.expected
fi
(cd $testroot/repo && git checkout -q boo)
- # from repo: fetch got.conf branch not repo HEAD
- # boo is the default HEAD in $testroot/repo, which is not up-to-date
- # on the clone, but we fetch got.conf "master" which is up-to-date
- got fetch -r $testroot/repo-clone > $testroot/stdout
+ # clone has remote/origin/HEAD symref with "master" as its target
+ # but the repo has changed HEAD to "boo", so we should fetch "boo"
+ echo "HEAD: refs/heads/master" > $testroot/stdout.expected
+ echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
+ echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
+ echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
+ echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
+ echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
+ >> $testroot/stdout.expected
+ echo "refs/remotes/origin/boo: $commit_id2" \
+ >> $testroot/stdout.expected
+ echo "refs/remotes/origin/master: $commit_id" \
+ >> $testroot/stdout.expected
+
+ got fetch -q -r $testroot/repo-clone > $testroot/stdout
ret=$?
if [ $ret -ne 0 ]; then
echo "got fetch command failed unexpectedly" >&2
return 1
fi
- echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo" \
- > $testroot/stdout.expected
- echo "Already up-to-date" >> $testroot/stdout.expected
+ got ref -l -r $testroot/repo-clone > $testroot/stdout
cmp -s $testroot/stdout $testroot/stdout.expected
ret=$?
return 1
fi
- # from repo: fetch -b hoo not got.conf branch or repo HEAD
+ # from repo: fetch -b hoo
got fetch -q -r $testroot/repo-clone -b hoo > $testroot/stdout
ret=$?
if [ $ret -ne 0 ]; then
echo "HEAD: refs/heads/master" > $testroot/stdout.expected
echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
+ echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
- echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
+ echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
>> $testroot/stdout.expected
+ echo "refs/remotes/origin/boo: $commit_id2" \
+ >> $testroot/stdout.expected
echo "refs/remotes/origin/hoo: $commit_id3" \
>> $testroot/stdout.expected
echo "refs/remotes/origin/master: $commit_id" \
return 1
fi
- # from wt: fetch got.conf "master" and wt "boo", not repo HEAD "hoo"
- # change default branch in got.conf from "foo" to "master"
+ # from wt: fetch got.conf "master", wt "boo", and the repo's new HEAD
+ # "hoo" as it no longer matches our remote HEAD symref target "master"
sed -i "s/foo/master/" $testroot/repo-clone/got.conf
echo "modified delta on master" > $testroot/repo/gamma/delta
git_commit $testroot/repo -m "modified delta on master"
>> $testroot/stdout.expected
echo "refs/remotes/origin/boo: $commit_id6" \
>> $testroot/stdout.expected
- echo "refs/remotes/origin/hoo: $commit_id3" \
+ echo "refs/remotes/origin/hoo: $commit_id7" \
>> $testroot/stdout.expected
echo "refs/remotes/origin/master: $commit_id5" \
>> $testroot/stdout.expected