From: Alex Henrie <alexhenrie24@gmail.com>
To: git@vger.kernel.org, avarab@gmail.com, tao@klerks.biz,
gitster@pobox.com, tboegi@web.de, prohaska@zib.de,
eyvind.bernhardsen@gmail.com
Cc: Alex Henrie <alexhenrie24@gmail.com>
Subject: [PATCH v3] convert: clarify line ending conversion warning
Date: Thu, 7 Apr 2022 22:41:54 -0600 [thread overview]
Message-ID: <20220408044154.9947-1-alexhenrie24@gmail.com> (raw)
In-Reply-To: <20220405053559.1072115-1-alexhenrie24@gmail.com>
The warning about converting line endings is extremely confusing. Its
two sentences each use the word "will" without specifying a timeframe,
which makes it sound like both sentences are referring to the same
timeframe. On top of that, it uses the term "original line endings"
without saying whether "original" means LF or CRLF.
Rephrase the warning to be clear about when the line endings will be
changed and what they will be changed to.
On a platform whose native line endings are not CRLF (e.g. Linux), the
"git add" step in the following sequence triggers the warning in
question:
$ git config core.autocrlf true
$ echo 'Hello world!' >hello.txt
$ git add hello.txt
warning: LF will be replaced by CRLF in hello.txt
The file will have its original line endings in your working directory
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
v3:
- Start the warning with a lowercase letter
- Add the phrase "the working copy of" - hopefully this resolves the
last concerns about clarity
---
convert.c | 12 ++++++------
t/t0027-auto-crlf.sh | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/convert.c b/convert.c
index 8e39731efb..4d153729da 100644
--- a/convert.c
+++ b/convert.c
@@ -195,9 +195,9 @@ static void check_global_conv_flags_eol(const char *path,
if (conv_flags & CONV_EOL_RNDTRP_DIE)
die(_("CRLF would be replaced by LF in %s"), path);
else if (conv_flags & CONV_EOL_RNDTRP_WARN)
- warning(_("CRLF will be replaced by LF in %s.\n"
- "The file will have its original line"
- " endings in your working directory"), path);
+ warning(_("in the working copy of '%s', CRLF will be"
+ " replaced by LF the next time Git touches"
+ " it"), path);
} else if (old_stats->lonelf && !new_stats->lonelf ) {
/*
* CRLFs would be added by checkout
@@ -205,9 +205,9 @@ static void check_global_conv_flags_eol(const char *path,
if (conv_flags & CONV_EOL_RNDTRP_DIE)
die(_("LF would be replaced by CRLF in %s"), path);
else if (conv_flags & CONV_EOL_RNDTRP_WARN)
- warning(_("LF will be replaced by CRLF in %s.\n"
- "The file will have its original line"
- " endings in your working directory"), path);
+ warning(_("in the working copy of '%s', LF will be"
+ " replaced by CRLF the next time Git touches"
+ " it"), path);
}
}
diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh
index 0feb41a23f..7f80f46393 100755
--- a/t/t0027-auto-crlf.sh
+++ b/t/t0027-auto-crlf.sh
@@ -77,12 +77,12 @@ create_NNO_MIX_files () {
check_warning () {
case "$1" in
- LF_CRLF) echo "warning: LF will be replaced by CRLF" >"$2".expect ;;
- CRLF_LF) echo "warning: CRLF will be replaced by LF" >"$2".expect ;;
- '') >"$2".expect ;;
+ LF_CRLF) echo "LF will be replaced by CRLF" >"$2".expect ;;
+ CRLF_LF) echo "CRLF will be replaced by LF" >"$2".expect ;;
+ '') >"$2".expect ;;
*) echo >&2 "Illegal 1": "$1" ; return false ;;
esac
- grep "will be replaced by" "$2" | sed -e "s/\(.*\) in [^ ]*$/\1/" | uniq >"$2".actual
+ sed -e "s/^.* \([^ ]* will be replaced by [^ ]*\) .*$/\1/" "$2" | uniq >"$2".actual
test_cmp "$2".expect "$2".actual
}
--
2.35.1
prev parent reply other threads:[~2022-04-08 4:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 5:35 [PATCH v2] convert: clarify line ending conversion warning Alex Henrie
2022-04-05 8:45 ` Ævar Arnfjörð Bjarmason
2022-04-05 16:44 ` Alex Henrie
2022-04-06 15:29 ` Junio C Hamano
2022-04-06 18:04 ` Torsten Bögershausen
2022-04-06 18:18 ` Tao Klerks
2022-04-06 18:30 ` Alex Henrie
2022-04-06 19:45 ` Junio C Hamano
2022-04-06 19:42 ` Junio C Hamano
2022-04-08 4:41 ` Alex Henrie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220408044154.9947-1-alexhenrie24@gmail.com \
--to=alexhenrie24@gmail.com \
--cc=avarab@gmail.com \
--cc=eyvind.bernhardsen@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=prohaska@zib.de \
--cc=tao@klerks.biz \
--cc=tboegi@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).