From: Stefan Sperling Subject: Re: drop 'got commit -A $GOT_AUTHOR' check To: Mark Jamsek Cc: Game of Trees Date: Mon, 13 Feb 2023 15:42:53 +0100 On Tue, Feb 14, 2023 at 01:41:03AM +1100, Mark Jamsek wrote: > As discussed with op on irc: if you have a valid case to change the > author from a previous commit to yourself, you can't! > > Below diff drops the -A $GOT_AUTHOR check: > > diffstat /home/mark/src/got > M got/got.c | 0+ 5- > M include/got_error.h | 1+ 1- > M lib/error.c | 0+ 2- > M regress/cmdline/commit.sh | 0+ 20- > > 4 files changed, 1 insertion(+), 28 deletions(-) Fine with me. In hindsight this check is too strict and does not prevent mistakes with huge consequences. > diff /home/mark/src/got > commit - f72ce919dd6d6c15679c5174c47912ac55be1e18 > path + /home/mark/src/got > blob - 2c1701bd7583e22c83fc62c3bfca5fb2a5492585 > file + got/got.c > --- got/got.c > +++ got/got.c > @@ -9133,11 +9133,6 @@ cmd_commit(int argc, char *argv[]) > if (error) > goto done; > > - if (author != NULL && !strcmp(committer, author)) { > - error = got_error(GOT_ERR_COMMIT_REDUNDANT_AUTHOR); > - goto done; > - } > - > if (author == NULL) > author = committer; > > blob - f6291e8407d22bd8dea75ff94f8f7b88ebafcb78 > file + include/got_error.h > --- include/got_error.h > +++ include/got_error.h > @@ -172,7 +172,7 @@ > #define GOT_ERR_BAD_TAG_SIGNATURE 154 > #define GOT_ERR_VERIFY_TAG_SIGNATURE 155 > #define GOT_ERR_SIGNING_TAG 156 > -#define GOT_ERR_COMMIT_REDUNDANT_AUTHOR 157 > +/* 157 is currently unused */ > #define GOT_ERR_BAD_QUERYSTRING 158 > #define GOT_ERR_INTEGRATE_BRANCH 159 > #define GOT_ERR_BAD_REQUEST 160 > blob - 041a41fbd209cbb7d7131b52327e59668eea4f41 > file + lib/error.c > --- lib/error.c > +++ lib/error.c > @@ -219,8 +219,6 @@ 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_COMMIT_REDUNDANT_AUTHOR, "specified author is equal to the " > - "default one"}, > { GOT_ERR_BAD_QUERYSTRING, "invalid query string" }, > { GOT_ERR_INTEGRATE_BRANCH, "will not integrate into a reference " > "outside the \"refs/heads/\" reference namespace" }, > blob - 6005da9a4302b4e31d5dc9469c9c35b7abef803f > file + regress/cmdline/commit.sh > --- regress/cmdline/commit.sh > +++ regress/cmdline/commit.sh > @@ -764,26 +764,6 @@ test_commit_cmdline_author() { > > echo "modified alpha" > $testroot/wt/alpha > > - # first try with a -A equals to $GOT_AUTHOR > - (cd $testroot/wt && got commit -A "$GOT_AUTHOR" -m 'edit alpha') \ > - > /dev/null 2> $testroot/stderr > - ret=$? > - if [ $ret -eq 0 ]; then > - test_done "$testroot" 1 > - return 1 > - fi > - > - echo 'got: specified author is equal to the default one' \ > - > $testroot/stderr.expected > - cmp -s $testroot/stderr.expected $testroot/stderr > - ret=$? > - if [ $ret -ne 0 ]; then > - diff -u $testroot/stderr.expected $testroot/stderr > - test_done "$testroot" $ret > - return 1 > - fi > - > - # try again with a different author > local author="Foo " > (cd $testroot/wt && got commit -A "$author" -m 'edit alpha') \ > > /dev/null > > -- > Mark Jamsek > GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68 >