comparison 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
comparison
equal deleted inserted replaced
41556:9f69ddb807f7 41557:3a01ce246ece
597 $ hg log -T '{short(node)} {phase}\n' 597 $ hg log -T '{short(node)} {phase}\n'
598 00eebaf8d2e2 draft 598 00eebaf8d2e2 draft
599 a09ad58faae3 draft 599 a09ad58faae3 draft
600 e704349bd21b draft 600 e704349bd21b draft
601 a61bcde8c529 draft 601 a61bcde8c529 draft
602
603 `hg split` with ignoreblanklines=1 does not infinite loop
604
605 $ mkdir $TESTTMP/f
606 $ hg init $TESTTMP/f/a
607 $ cd $TESTTMP/f/a
608 $ printf '1\n2\n3\n4\n5\n' > foo
609 $ cp foo bar
610 $ hg ci -qAm initial
611 $ printf '1\n\n2\n3\ntest\n4\n5\n' > bar
612 $ printf '1\n2\n3\ntest\n4\n5\n' > foo
613 $ hg ci -qm splitme
614 $ cat > $TESTTMP/messages <<EOF
615 > split 1
616 > --
617 > split 2
618 > EOF
619 $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split
620 diff --git a/bar b/bar
621 2 hunks, 2 lines changed
622 examine changes to 'bar'? [Ynesfdaq?] f
623
624 diff --git a/foo b/foo
625 1 hunks, 1 lines changed
626 examine changes to 'foo'? [Ynesfdaq?] n
627
628 EDITOR: HG: Splitting dd3c45017cbf. Write commit message for the first split changeset.
629 EDITOR: splitme
630 EDITOR:
631 EDITOR:
632 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
633 EDITOR: HG: Leave message empty to abort commit.
634 EDITOR: HG: --
635 EDITOR: HG: user: test
636 EDITOR: HG: branch 'default'
637 EDITOR: HG: changed bar
638 created new head
639 diff --git a/foo b/foo
640 1 hunks, 1 lines changed
641 examine changes to 'foo'? [Ynesfdaq?] f
642
643 EDITOR: HG: Splitting dd3c45017cbf. So far it has been split into:
644 EDITOR: HG: - f205aea1c624: split 1
645 EDITOR: HG: Write commit message for the next split changeset.
646 EDITOR: splitme
647 EDITOR:
648 EDITOR:
649 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
650 EDITOR: HG: Leave message empty to abort commit.
651 EDITOR: HG: --
652 EDITOR: HG: user: test
653 EDITOR: HG: branch 'default'
654 EDITOR: HG: changed foo
655 saved backup bundle to $TESTTMP/f/a/.hg/strip-backup/dd3c45017cbf-463441b5-split.hg (obsstore-off !)
656
657 Let's try that again, with a slightly different set of patches, to ensure that
658 the ignoreblanklines thing isn't somehow position dependent.
659
660 $ hg init $TESTTMP/f/b
661 $ cd $TESTTMP/f/b
662 $ printf '1\n2\n3\n4\n5\n' > foo
663 $ cp foo bar
664 $ hg ci -qAm initial
665 $ printf '1\n2\n3\ntest\n4\n5\n' > bar
666 $ printf '1\n2\n3\ntest\n4\n\n5\n' > foo
667 $ hg ci -qm splitme
668 $ cat > $TESTTMP/messages <<EOF
669 > split 1
670 > --
671 > split 2
672 > EOF
673 $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split
674 diff --git a/bar b/bar
675 1 hunks, 1 lines changed
676 examine changes to 'bar'? [Ynesfdaq?] f
677
678 diff --git a/foo b/foo
679 2 hunks, 2 lines changed
680 examine changes to 'foo'? [Ynesfdaq?] n
681
682 EDITOR: HG: Splitting 904c80b40a4a. Write commit message for the first split changeset.
683 EDITOR: splitme
684 EDITOR:
685 EDITOR:
686 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
687 EDITOR: HG: Leave message empty to abort commit.
688 EDITOR: HG: --
689 EDITOR: HG: user: test
690 EDITOR: HG: branch 'default'
691 EDITOR: HG: changed bar
692 created new head
693 diff --git a/foo b/foo
694 2 hunks, 2 lines changed
695 examine changes to 'foo'? [Ynesfdaq?] f
696
697 EDITOR: HG: Splitting 904c80b40a4a. So far it has been split into:
698 EDITOR: HG: - ffecf40fa954: split 1
699 EDITOR: HG: Write commit message for the next split changeset.
700 EDITOR: splitme
701 EDITOR:
702 EDITOR:
703 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
704 EDITOR: HG: Leave message empty to abort commit.
705 EDITOR: HG: --
706 EDITOR: HG: user: test
707 EDITOR: HG: branch 'default'
708 EDITOR: HG: changed foo
709 saved backup bundle to $TESTTMP/f/b/.hg/strip-backup/904c80b40a4a-47fb907f-split.hg (obsstore-off !)