Mercurial > hg
diff tests/test-split.t @ 41557:3a01ce246ece
commit: ignore diff whitespace settings when doing `commit -i` (issue5839)
Previously, we respected options like `diff.ignoreblanklines` and
`diff.ignorews`. This can cause problems when the user is attempting to
actually commit the blank line change. Specifically, the split extension can get
into an infinite loop because it detects that the working copy is not clean, but
when we get the diff we don't see the changes, so it just skips popping up the
chunk selection flow, saying there's no changes to record.
These options are primarily meant for viewing diffs; it is highly unlikely that
someone is actually intending to add extraneous whitespace and have it ignored
if they attempt to interactively commit (but *not* ignored if they
non-interactively commit).
Differential Revision: https://phab.mercurial-scm.org/D5744
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Mon, 28 Jan 2019 18:05:05 -0800 |
parents | d1d3094b54f9 |
children | 66399f2e92aa |
line wrap: on
line diff
--- a/tests/test-split.t Mon Feb 04 14:43:26 2019 -0800 +++ b/tests/test-split.t Mon Jan 28 18:05:05 2019 -0800 @@ -599,3 +599,111 @@ a09ad58faae3 draft e704349bd21b draft a61bcde8c529 draft + +`hg split` with ignoreblanklines=1 does not infinite loop + + $ mkdir $TESTTMP/f + $ hg init $TESTTMP/f/a + $ cd $TESTTMP/f/a + $ printf '1\n2\n3\n4\n5\n' > foo + $ cp foo bar + $ hg ci -qAm initial + $ printf '1\n\n2\n3\ntest\n4\n5\n' > bar + $ printf '1\n2\n3\ntest\n4\n5\n' > foo + $ hg ci -qm splitme + $ cat > $TESTTMP/messages <<EOF + > split 1 + > -- + > split 2 + > EOF + $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split + diff --git a/bar b/bar + 2 hunks, 2 lines changed + examine changes to 'bar'? [Ynesfdaq?] f + + diff --git a/foo b/foo + 1 hunks, 1 lines changed + examine changes to 'foo'? [Ynesfdaq?] n + + EDITOR: HG: Splitting dd3c45017cbf. Write commit message for the first split changeset. + EDITOR: splitme + EDITOR: + EDITOR: + EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. + EDITOR: HG: Leave message empty to abort commit. + EDITOR: HG: -- + EDITOR: HG: user: test + EDITOR: HG: branch 'default' + EDITOR: HG: changed bar + created new head + diff --git a/foo b/foo + 1 hunks, 1 lines changed + examine changes to 'foo'? [Ynesfdaq?] f + + EDITOR: HG: Splitting dd3c45017cbf. So far it has been split into: + EDITOR: HG: - f205aea1c624: split 1 + EDITOR: HG: Write commit message for the next split changeset. + EDITOR: splitme + EDITOR: + EDITOR: + EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. + EDITOR: HG: Leave message empty to abort commit. + EDITOR: HG: -- + EDITOR: HG: user: test + EDITOR: HG: branch 'default' + EDITOR: HG: changed foo + saved backup bundle to $TESTTMP/f/a/.hg/strip-backup/dd3c45017cbf-463441b5-split.hg (obsstore-off !) + +Let's try that again, with a slightly different set of patches, to ensure that +the ignoreblanklines thing isn't somehow position dependent. + + $ hg init $TESTTMP/f/b + $ cd $TESTTMP/f/b + $ printf '1\n2\n3\n4\n5\n' > foo + $ cp foo bar + $ hg ci -qAm initial + $ printf '1\n2\n3\ntest\n4\n5\n' > bar + $ printf '1\n2\n3\ntest\n4\n\n5\n' > foo + $ hg ci -qm splitme + $ cat > $TESTTMP/messages <<EOF + > split 1 + > -- + > split 2 + > EOF + $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split + diff --git a/bar b/bar + 1 hunks, 1 lines changed + examine changes to 'bar'? [Ynesfdaq?] f + + diff --git a/foo b/foo + 2 hunks, 2 lines changed + examine changes to 'foo'? [Ynesfdaq?] n + + EDITOR: HG: Splitting 904c80b40a4a. Write commit message for the first split changeset. + EDITOR: splitme + EDITOR: + EDITOR: + EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. + EDITOR: HG: Leave message empty to abort commit. + EDITOR: HG: -- + EDITOR: HG: user: test + EDITOR: HG: branch 'default' + EDITOR: HG: changed bar + created new head + diff --git a/foo b/foo + 2 hunks, 2 lines changed + examine changes to 'foo'? [Ynesfdaq?] f + + EDITOR: HG: Splitting 904c80b40a4a. So far it has been split into: + EDITOR: HG: - ffecf40fa954: split 1 + EDITOR: HG: Write commit message for the next split changeset. + EDITOR: splitme + EDITOR: + EDITOR: + EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. + EDITOR: HG: Leave message empty to abort commit. + EDITOR: HG: -- + EDITOR: HG: user: test + EDITOR: HG: branch 'default' + EDITOR: HG: changed foo + saved backup bundle to $TESTTMP/f/b/.hg/strip-backup/904c80b40a4a-47fb907f-split.hg (obsstore-off !)