commit 6a8e5dbbeb3644d733e5e6acb0f5d19280d1c647 from: Stefan Sperling date: Sun Jun 16 07:39:17 2024 UTC tweak the error message shown by 'got send' when ancestry has diverged The previous message steered users towards rebase; nowadays we also have a merge command and send -f. It's tricky to explain all possibilities of what to do next in a single line, but this is probably better than nothing. commit - 557db725c8ba1e1ed1efd51febd91476b965647b commit + 6a8e5dbbeb3644d733e5e6acb0f5d19280d1c647 blob - 3e65ec158b7f496672f8134c31836cb0f31eb628 blob + 4488d67eb3397d5a19bf9cee109f7081050ef57a --- lib/error.c +++ lib/error.c @@ -192,7 +192,7 @@ static const struct got_error got_errors[] = { { GOT_ERR_SEND_BAD_REF, "reference cannot be sent" }, { GOT_ERR_SEND_FAILED, "could not send pack file" }, { GOT_ERR_SEND_EMPTY, "no references to send" }, - { GOT_ERR_SEND_ANCESTRY, "fetch and rebase required" }, + { GOT_ERR_SEND_ANCESTRY, "branch on server has a different ancestry; either rebase or merge local branch before sending, or ignore ancestry with send -f (can lead to data loss on server)" }, { GOT_ERR_CAPA_DELETE_REFS, "server cannot delete references" }, { GOT_ERR_SEND_DELETE_REF, "reference cannot be deleted" }, { GOT_ERR_SEND_TAG_EXISTS, "tag already exists on server" }, blob - 6e41801df46b386834c2cd1d3bc4d5c039d5f809 blob + 210ee530b5a7d6ed0c4acce42ce8f7a571df8ddf --- regress/cmdline/send.sh +++ regress/cmdline/send.sh @@ -190,8 +190,13 @@ EOF return 1 fi - echo "got: refs/heads/master: fetch and rebase required" \ - > $testroot/stderr.expected + echo -n "got: refs/heads/master: " > $testroot/stderr.expected + echo -n "branch on server has a different ancestry; " \ + >> $testroot/stderr.expected + echo -n "either rebase or merge local branch before sending, or " \ + >> $testroot/stderr.expected + echo "ignore ancestry with send -f (can lead to data loss on server)" \ + >> $testroot/stderr.expected cmp -s $testroot/stderr $testroot/stderr.expected ret=$? if [ $ret -ne 0 ]; then