commit f25e229e88a01c4a65fa80f4d5e35cd34309cbf9 from: Stefan Sperling date: Thu Jun 22 15:15:11 2023 UTC reword user-facing error message which mentions "fast-forward" For user-facing messages it is better to avoid technical jargon like this and instead spell out what the fast-forward situation implies: that one branch is already based on another. ok jamsek commit - 9c8a62dba4cf8662616c66f8fa0c53d1000ecf40 commit + f25e229e88a01c4a65fa80f4d5e35cd34309cbf9 blob - 4c6ca7ff2f76eaa431b055ab0a6912772b492b38 blob + 5348f3e02299f72518fb1fae98ac8eb68f013b85 --- got/got.c +++ got/got.c @@ -13329,9 +13329,11 @@ cmd_merge(int argc, char *argv[]) if (yca_id && got_object_id_cmp(wt_branch_tip, yca_id) == 0) { struct got_pathlist_head paths; if (interrupt_merge) { - error = got_error_msg(GOT_ERR_SAME_BRANCH, - "merge is a fast-forward; this is " - "incompatible with got merge -n"); + error = got_error_fmt(GOT_ERR_BAD_OPTION, + "there are no changes to merge since %s " + "is already based on %s; merge cannot be " + "interrupted for amending; -n", + branch_name, got_ref_get_name(wt_branch)); goto done; } printf("Forwarding %s to %s\n", blob - c7c5ce296704a7d0c3345092eccebd5837fcd453 blob + 6ca6d041c1b17b5198707cc33b19f9fefccf07e0 --- include/got_error.h +++ include/got_error.h @@ -171,7 +171,7 @@ #define GOT_ERR_BAD_TAG_SIGNATURE 154 #define GOT_ERR_VERIFY_TAG_SIGNATURE 155 #define GOT_ERR_SIGNING_TAG 156 -/* 157 is currently unused */ +#define GOT_ERR_BAD_OPTION 157 #define GOT_ERR_BAD_QUERYSTRING 158 #define GOT_ERR_INTEGRATE_BRANCH 159 #define GOT_ERR_BAD_REQUEST 160 blob - 765efe263e09f28dfd6b925eaa64ee0ffe226a3b blob + 14daf3a57c9be57d4f707ce25da1a357e09ada88 --- lib/error.c +++ lib/error.c @@ -217,6 +217,7 @@ static const struct got_error got_errors[] = { { GOT_ERR_BAD_TAG_SIGNATURE, "invalid tag signature" }, { GOT_ERR_VERIFY_TAG_SIGNATURE, "cannot verify signature" }, { GOT_ERR_SIGNING_TAG, "unable to sign tag" }, + { GOT_ERR_BAD_OPTION, "option cannot be used" }, { GOT_ERR_BAD_QUERYSTRING, "invalid query string" }, { GOT_ERR_INTEGRATE_BRANCH, "will not integrate into a reference " "outside the \"refs/heads/\" reference namespace" }, blob - 0531f8b1f57c1f50521b6ec8c350bb9da1bebaf4 blob + b1980ee2c0e36130e8066d6897401ba97642d4a4 --- regress/cmdline/merge.sh +++ regress/cmdline/merge.sh @@ -415,9 +415,16 @@ test_merge_forward() { test_done "$testroot" "1" return 1 fi - echo -n "got: merge is a fast-forward; " > $testroot/stderr.expected - echo "this is incompatible with got merge -n" \ + + echo -n "got: there are no changes to merge since " \ + > $testroot/stderr.expected + echo -n "refs/heads/newbranch is already based on " \ >> $testroot/stderr.expected + echo -n "refs/heads/master; merge cannot be interrupted " \ + >> $testroot/stderr.expected + echo "for amending; -n: option cannot be used" \ + >> $testroot/stderr.expected + cmp -s $testroot/stderr.expected $testroot/stderr ret=$? if [ $ret -ne 0 ]; then