commit - 32cda8560bceecc6155bc6011c69e9e9a7c262c0
commit + fb8e08fd0336dfc0bb04096a31ce3e326bf6d1e8
blob - 44aa5f0a6244130706709c0184fc170d90f6fe5c
blob + 69d89b78451413629dc1fc7ede0086ec2236a101
--- lib/send.c
+++ lib/send.c
if (err) {
if (err->code != GOT_ERR_NOT_REF)
goto done;
+ err = NULL;
} else {
err = got_ref_resolve(&their_ids[ntheirs],
repo, ref);
blob - 5053abcc3b14deece4bb33886f4380b7fe2e9bd0
blob + 833f87bb85b0f4cf72b87af23b71df99419de359
--- regress/cmdline/send.sh
+++ regress/cmdline/send.sh
diff -u $testroot/stderr.expected $testroot/stderr
fi
test_done "$testroot" "$ret"
+
+}
+
+test_send_with_unknown_ref_on_server() {
+ local testroot=`test_init send_with_unknown_ref_on_server`
+ local testurl=ssh://127.0.0.1/$testroot
+ local commit_id=`git_show_head $testroot/repo`
+
+ got clone -q $testurl/repo $testroot/repo-clone
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "got clone command failed unexpectedly" >&2
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ # Add a commit on a new branch in the source repo.
+ # To trigger a known bug in 'got send', this branch reference must
+ # alphabetically sort last.
+ git -C $testroot/repo checkout -q -b zzz
+ echo "modified alpha" > $testroot/repo/alpha
+ git -C $testroot/repo rm -q beta
+ (cd $testroot/repo && ln -s epsilon/zeta symlink)
+ git -C $testroot/repo add symlink
+ echo "new file alpha" > $testroot/repo/new
+ git -C $testroot/repo add new
+ git_commit $testroot/repo -m "modified alpha"
+ local commit_id2=`git_show_head $testroot/repo`
+
+ # This would error "got: reference refs/remotes/origin/zzz not found"
+ got send -r $testroot/repo-clone > $testroot/stdout \
+ 2> $testroot/stderr
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "got send command failed unexpectedly" >&2
+ test_done "$testroot" "$ret"
+ 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
+ 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 ref -l -r $testroot/repo > $testroot/stdout
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "got ref command failed unexpectedly" >&2
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ echo "HEAD: refs/heads/zzz" > $testroot/stdout.expected
+ echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
+ echo "refs/heads/zzz: $commit_id2" >> $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 ref -l -r $testroot/repo-clone > $testroot/stdout
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "got ref command failed unexpectedly" >&2
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ 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
+
+ git_fsck "$testroot" "$testroot/repo-clone"
+ ret=$?
+ test_done "$testroot" "$ret"
}
test_parseargs "$@"
run_test test_send_gitconfig no-sha256
run_test test_send_rejected no-sha256
run_test test_send_basic_http no-sha256
+run_test test_send_with_unknown_ref_on_server no-sha256