commit 702e6fa445b6c682ff2f3812fc965dfcb9da83c9 from: Stefan Sperling via: Thomas Adam date: Tue Jun 18 20:20:12 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 - da165977d65c74af18c41b44f93df986324a66fe commit + 702e6fa445b6c682ff2f3812fc965dfcb9da83c9 blob - 27669f7e2444797982b2179fb2951d23802a30d0 blob + cde5665da8ec47a1e913e59d832517954217d59c --- lib/error.c +++ lib/error.c @@ -200,7 +200,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