Re: [PATCH 3/3] sha1-name: mark get_oid() error messages for translation
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 30, 2020, 19:16 UTC
- Message-ID
- <xmqqeevgdabm.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20200130071700.GB2189233@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> I think we can do this much more simply, by just using i18ncmp:
>
> diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh
> index c2b5125c12..62085a89e3 100755
> --- a/t/t1506-rev-parse-diagnosis.sh
> +++ b/t/t1506-rev-parse-diagnosis.sh
> @@ -12,7 +12,7 @@ test_did_you_mean ()
> fatal: path '$2$3' $4, but not ${5:-$SQ$3$SQ}
> hint: Did you mean '$1:$2$3'${2:+ aka $SQ$1:./$3$SQ}?
> EOF
> - test_cmp expected error
> + test_i18ncmp expected error
> }Yeah, "what die(_(...)) under POISON says matches /^fatal:/" probably is not worth checking and more importantly not something we would want to rely on.
> HASH_file= > > (we'd still need the s/grep/test_i18ngrep/ in your second hunk).
Yes. The final amend to 3/3 has become like this.
$ git range-diff bc3f657f71..83252ba6f1 HEAD^..HEAD
1: 83252ba6f1 ! 1: b0418303b1 sha1-name: mark get_oid() error messages for translation
@@ t/t1506-rev-parse-diagnosis.sh: exec </dev/null
+ fatal: path '$2$3' $4, but not ${5:-$SQ$3$SQ}
+ hint: Did you mean '$1:$2$3'${2:+ aka $SQ$1:./$3$SQ}?
EOF
- test_cmp expected error
+- test_cmp expected error
++ test_i18ncmp expected error
}
+
+ HASH_file=
@@ t/t1506-rev-parse-diagnosis.sh: test_expect_success 'correct relative file objects (6)' '
test_expect_success 'incorrect revision id' '
@@ t/t1506-rev-parse-diagnosis.sh: test_expect_success 'incorrect file in :path and
'
test_expect_success 'relative path not found' '
+ (
+ cd subdir &&
+ test_must_fail git rev-parse HEAD:./nonexistent.txt 2>error &&
+- grep subdir/nonexistent.txt error
++ test_i18ngrep subdir/nonexistent.txt error
+ )
+ '
+
@@ t/t1506-rev-parse-diagnosis.sh: test_expect_success 'relative path outside worktree' '
test_expect_success 'relative path when cwd is outside worktree' '
test_must_fail git --git-dir=.git --work-tree=subdir rev-parse HEAD:./file.txt >output 2>error &&