commit eac1df479eff0a068548f94b188529f0249fd9be from: Stefan Sperling date: Wed Sep 01 11:06:42 2021 UTC make 'got send' heed the branch {} options in got.conf(5); they were ignored ok naddy commit - 3a6b87604592c583079227ea995f50eb3ec74121 commit + eac1df479eff0a068548f94b188529f0249fd9be blob - 1edb356b8da783560a7d0691d12708ca5376fb29 blob + 51bedeed3942da484d0dfe4614307f848dcbd5ed --- got/got.c +++ got/got.c @@ -7751,6 +7751,11 @@ cmd_send(int argc, char *argv[]) goto done; nbranches++; } + } else if (nbranches == 0) { + for (i = 0; i < remote->nsend_branches; i++) { + got_pathlist_append(&branches, + remote->send_branches[i], NULL); + } } if (send_all_tags) { blob - 2c2112b0a45b7a3317cd276452aa270633f87995 blob + ce7b085beed403260f19800f8e25f6d484e5e1d5 --- regress/cmdline/send.sh +++ regress/cmdline/send.sh @@ -1156,8 +1156,84 @@ EOF fi test_done "$testroot" "$ret" +} + +test_send_config() { + local testroot=`test_init send_fetch_conf` + 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" != "0" ]; then + echo "got clone command failed unexpectedly" >&2 + test_done "$testroot" "$ret" + return 1 + fi + + cat > $testroot/repo/.git/got.conf < $testroot/stdout + if [ "$ret" != "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" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + got branch -r $testroot/repo foo + + got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr + ret="$?" + if [ "$ret" != "0" ]; then + echo "got send command failed unexpectedly" >&2 + test_done "$testroot" "$ret" + return 1 + fi + + got ref -l -r $testroot/repo-clone > $testroot/stdout + if [ "$ret" != "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/foo: $commit_id" >> $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" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + fi + test_done "$testroot" "$ret" +} + test_parseargs "$@" run_test test_send_basic run_test test_send_rebase_required @@ -1169,3 +1245,4 @@ run_test test_send_new_branch run_test test_send_all_branches run_test test_send_to_empty_repo run_test test_send_and_fetch_config +run_test test_send_config