summaryrefslogtreecommitdiff
path: root/t/t7518-ident-corner-cases.sh
AgeCommit message (Collapse)Author
2023-11-02tests: teach callers of test_i18ngrep to use test_grepJunio C Hamano
They are equivalents and the former still exists, so as long as the only change this commit makes are to rewrite test_i18ngrep to test_grep, there won't be any new bug, even if there still are callers of test_i18ngrep remaining in the tree, or when merged to other topics that add new uses of test_i18ngrep. This patch was produced more or less with git grep -l -e 'test_i18ngrep ' 't/t[0-9][0-9][0-9][0-9]-*.sh' | xargs perl -p -i -e 's/test_i18ngrep /test_grep /' and a good way to sanity check the result yourself is to run the above in a checkout of c4603c1c (test framework: further deprecate test_i18ngrep, 2023-10-31) and compare the resulting working tree contents with the result of applying this patch to the same commit. You'll see that test_i18ngrep in a few t/lib-*.sh files corrected, in addition to the manual reproduction. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-02ident: don't consider '.' a crudbrian m. carlson
When we process a user's name (as in user.name), we strip all leading and trailing crud from it. Right now, we consider a dot a crud character, and strip it off. However, this is unsuitable for many personal names because humans frequently have abbreviated suffixes, such as "Jr." or "Sr." at the end of their names, and this corrupts them. Some other users may wish to use an abbreviated name or initial, which will pose a problem especially in cultures that write the family name first, followed by the personal name. Since the current approach causes lots of practical problems, let's avoid it by no longer considering a dot to be crud. Note that "." in the name forces the entire name to be quoted to please mailers, but stripping "." only at the beginning and the end does not help a name with "." in the middle (like "brian m. carlson") so this change will not make it much worse. A name like "Given Family, Jr." that did not have to be quoted now would need to be, in order to be placed on the e-mail headers, though. This is based on a weather-balloon patch by Jeff King sent in Aug 2021 https://lore.kernel.org/git/YSKm8Q8nyTavQaox@coredump.intra.peff.net/ Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-13leak tests: mark various "generic" tests as passing with SANITIZE=leakÆvar Arnfjörð Bjarmason
Mark various "generic" tests as passing when git is compiled with SANITIZE=leak. These tests were subjectively picked from the lists of passing tests since they're all small, and test some generic feature such as wildmatch(), commonly used environment variables, ident parsing etc. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-30Merge branch 'en/t7518-unflake'Junio C Hamano
Work around flakiness in a test. * en/t7518-unflake: t7518: fix flaky grep invocation
2020-10-18t7518: fix flaky grep invocationElijah Newren
t7518.1 added in commit 862e80a413 ("ident: handle NULL email when complaining of empty name", 2017-02-23), was trying to make sure that the test with an empty ident did not segfault and did not result in glibc quiety translating a NULL pointer into a name of "(null)". It did the latter by ensuring that a grep for "null" didn't appear in the output, but on one automatic CI run I observed the following output: fatal: empty ident name (for <runner@fv-az128-670.gcliasfzo2nullsdbrimjtbyhg.cx.internal.cloudapp.net>) not allowed Note that 'null' appears as a substring of the domain name, found within 'gcliasfzo2nullsdbrimjtbyhg'. Tighten the test by searching for "(null)" rather than "null". Signed-off-by: Elijah Newren <newren@gmail.com> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-08-21ident: say whose identity is missing when giving user.name hintJunio C Hamano
If `user.name` and `user.email` have not been configured and the user invokes: git commit --author=... without specifying the committer identity, then Git errors out with a message asking the user to configure `user.name` and `user.email` but doesn't tell the user which attribution was missing. This can be confusing for a user new to Git who isn't aware of the distinction between user, author, and committer. Give such users a bit more help by extending the error message to also say which attribution is expected. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-23ident: do not ignore empty config name/emailJeff King
When we read user.name and user.email from a config file, they go into strbufs. When a caller asks ident_default_name() for the value, we fallback to auto-detecting if the strbuf is empty. That means that explicitly setting an empty string in the config is identical to not setting it at all. This is potentially confusing, as we usually accept a configured value as the final value. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-23ident: reject all-crud ident nameJeff King
An ident name consisting of only "crud" characters (like whitespace or punctuation) is effectively the same as an empty one, because our strbuf_addstr_without_crud() will remove those characters. We reject an empty name when formatting a strict ident, but don't notice an all-crud one because our check happens before the crud-removal step. We could skip past the crud before checking for an empty name, but let's make it a separate code path, for two reasons. One is that we can give a more specific error message. And two is that unlike a blank name, we probably don't want to kick in the fallback-to-username behavior. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-23ident: handle NULL email when complaining of empty nameJeff King
If we see an empty name, we complain about and mention the matching email in the error message (to give it some context). However, the "email" pointer may be NULL here if we were planning to fill it in later from ident_default_email(). This was broken by 59f929596 (fmt_ident: refactor strictness checks, 2016-02-04). Prior to that commit, we would look up the default name and email before doing any other actions. So one solution would be to go back to that. However, we can't just do so blindly. The logic for handling the "!email" condition has grown since then. In particular, looking up the default email can die if getpwuid() fails, but there are other errors that should take precedence. Commit 734c7789a (ident: check for useConfigOnly before auto-detection of name/email, 2016-03-30) reordered the checks so that we prefer the error message for useConfigOnly. Instead, we can observe that while the name-handling depends on "email" being set, the reverse is not true. So we can simply set up the email variable first. This does mean that if both are bogus, we'll complain about the email before the name. But between the two, there is no reason to prefer one over the other. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>