From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> To: git@vger.kernel.org Cc: Elijah Newren <newren@gmail.com>, Elijah Newren <newren@gmail.com> Subject: [PATCH 1/4] t6038: make tests fail for the right reason Date: Sun, 02 Aug 2020 06:33:03 +0000 Message-ID: <361911817559104672d273e199221e8367e8d595.1596349986.git.gitgitgadget@gmail.com> (raw) In-Reply-To: <pull.825.git.git.1596349986.gitgitgadget@gmail.com> From: Elijah Newren <newren@gmail.com> t6038 had a pair of tests that were expected to fail, but weren't failing for the expected reason. Both were meant to do a merge that could be done cleanly after renormalization, but were supposed to fail for lack of renormalization. Unfortunately, both tests has staged changes, and checkout -m would abort due to the presence of those staged changes before even attempting a merge. Fix this first issue by utilizing git-restore instead of git-checkout, so that the index is left alone and just the working directory gets the changes we want. However, there is a second issue with these tests. Technically, they just wanted to verify that after renormalization, no conflicts would be present. This could have been checked for by grepping for a lack of conflict markers, but the test instead tried to compare the working directory files to an expected result. Unfortunately, the setting of "text=auto" without setting core.eol to any value meant that the content of the file (in particular, the line endings) would be platform-dependent and the tests could only pass on some platforms. Replace the existing comparison with a call to 'git diff --no-index --ignore-cr-at-eol' to verify that the contents, other than possible carriage returns in the file, match the expected results and in particular that the file has no conflicts from the checkout -m operation. Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t6038-merge-text-auto.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/t6038-merge-text-auto.sh b/t/t6038-merge-text-auto.sh index 5e8d5fa50c..27cea15533 100755 --- a/t/t6038-merge-text-auto.sh +++ b/t/t6038-merge-text-auto.sh @@ -168,9 +168,9 @@ test_expect_failure 'checkout -m after setting text=auto' ' git rm -fr . && rm -f .gitattributes && git reset --hard initial && - git checkout a -- . && + git restore --source=a -- . && git checkout -m b && - compare_files expected file + git diff --no-index --ignore-cr-at-eol expected file ' test_expect_failure 'checkout -m addition of text=auto' ' @@ -183,9 +183,9 @@ test_expect_failure 'checkout -m addition of text=auto' ' git rm -fr . && rm -f .gitattributes file && git reset --hard initial && - git checkout b -- . && + git restore --source=b -- . && git checkout -m a && - compare_files expected file + git diff --no-index --ignore-cr-at-eol expected file ' test_expect_failure 'cherry-pick patch from after text=auto was added' ' -- gitgitgadget
next prev parent reply other threads:[~2020-08-02 6:33 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-02 6:33 [PATCH 0/4] Attr fixes Elijah Newren via GitGitGadget 2020-08-02 6:33 ` Elijah Newren via GitGitGadget [this message] 2020-08-02 18:17 ` [PATCH 1/4] t6038: make tests fail for the right reason Junio C Hamano 2020-08-02 19:10 ` Eric Sunshine 2020-08-03 15:06 ` Elijah Newren 2020-08-02 6:33 ` [PATCH 2/4] t6038: fix test with obviously incorrect expectations Elijah Newren via GitGitGadget 2020-08-02 19:57 ` Junio C Hamano 2020-08-03 15:36 ` Elijah Newren 2020-08-03 15:50 ` Junio C Hamano 2020-08-02 6:33 ` [PATCH 3/4] merge: make merge.renormalize work for all uses of merge machinery Elijah Newren via GitGitGadget 2020-08-02 19:23 ` Junio C Hamano 2020-08-03 15:07 ` Elijah Newren 2020-08-02 6:33 ` [PATCH 4/4] checkout: support renormalization with checkout -m <paths> Elijah Newren via GitGitGadget 2020-08-03 18:41 ` [PATCH v2 0/4] Attr fixes Elijah Newren via GitGitGadget 2020-08-03 18:41 ` [PATCH v2 1/4] t6038: make tests fail for the right reason Elijah Newren via GitGitGadget 2020-08-03 18:41 ` [PATCH v2 2/4] t6038: remove problematic test Elijah Newren via GitGitGadget 2020-08-03 18:41 ` [PATCH v2 3/4] merge: make merge.renormalize work for all uses of merge machinery Elijah Newren via GitGitGadget 2020-08-03 18:41 ` [PATCH v2 4/4] checkout: support renormalization with checkout -m <paths> Elijah Newren via GitGitGadget
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 List information: http://vger.kernel.org/majordomo-info.html * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=361911817559104672d273e199221e8367e8d595.1596349986.git.gitgitgadget@gmail.com \ --to=gitgitgadget@gmail.com \ --cc=git@vger.kernel.org \ --cc=newren@gmail.com \ /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
git@vger.kernel.org list mirror (unofficial, one of many) This inbox may be cloned and mirrored by anyone: git clone --mirror http://public-inbox.org/git git clone --mirror http://ou63pmih66umazou.onion/git git clone --mirror http://czquwvybam4bgbro.onion/git git clone --mirror http://hjrcffqmbrq6wope.onion/git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V1 git git/ http://public-inbox.org/git \ git@vger.kernel.org public-inbox-index git Example config snippet for mirrors. Newsgroups are available over NNTP: nntp://news.public-inbox.org/inbox.comp.version-control.git nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git nntp://news.gmane.io/gmane.comp.version-control.git note: .onion URLs require Tor: https://www.torproject.org/ code repositories for the project(s) associated with this inbox: https://80x24.org/mirrors/git.git AGPL code for this site: git clone https://public-inbox.org/public-inbox.git