commit 0619bbce0ebd152fcabc1d9f49833c37137918df from: Stefan Sperling via: Thomas Adam date: Thu Jun 22 17:37:44 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 - 862951558c077adda5fda148c1666216da6d0edf commit + 0619bbce0ebd152fcabc1d9f49833c37137918df blob - 7ee57ef2c0cae82a5074cc265e15fd50297716f6 blob + f20d93aabe7fcfb0733b0fac6d8ff061b6b8aebc --- got/got.c +++ got/got.c @@ -13328,9 +13328,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 - b4ca77c49c18fb141c0860234550c8e9aa0c627e blob + 5172085cd1763a6252b8253a7087531cc037e6a3 --- lib/error.c +++ lib/error.c @@ -225,6 +225,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