Mercurial > hg
comparison tests/test-split.t @ 41560:66399f2e92aa
commit: if interactive, look elsewhere for whitespace settings (BC)
Previously, when doing `commit -i`, we respected `diff.ignorews` and other
whitespace-related settings, which is probably unexpected. The primary reason
for this is to support hgext.record's commandline options, it's probably
accidental that the `[diff]` settings were also considered. See comments on
issue6042 and D5490. This can cause problems (issue5839, issue6042).
It is assumed by the author that the `[diff]` section is primarily for *viewing*
diffs, and that it is unlikely what people intend when attempting to commit or
revert.
With this change, if a user wants the behavior, they can clone their `[diff]`
settings to `commands.commit.interactive.<setting>`. This is thus a mild BC
change, but one I suspect is not going to be relied on by anyone.
Note: while doing a partial commit/revert, we do not know what command the user
is actually running. This means that the split extension, which ends up calling
into this code, will respect the `commands.commit.interactive.<setting>`
settings, and not a hypothetical `commands.split.interactive.<setting>`. This
*also* means that setting `commands.commit.interactive.ignoreblanklines`, for
example, will still cause issue5839. Considering the highly unlikely chance that
a user actually sets `commands.commit.interactive.<setting>`, the author deems
this risk acceptable.
Differential Revision: https://phab.mercurial-scm.org/D5834
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Thu, 31 Jan 2019 14:47:34 -0800 |
parents | 3a01ce246ece |
children | 7da6307cc07a |
comparison
equal
deleted
inserted
replaced
41559:78b270a55dc6 | 41560:66399f2e92aa |
---|---|
24 > color=no | 24 > color=no |
25 > paginate=never | 25 > paginate=never |
26 > [diff] | 26 > [diff] |
27 > git=1 | 27 > git=1 |
28 > unified=0 | 28 > unified=0 |
29 > [commands] | |
30 > commit.interactive.unified=0 | |
29 > [alias] | 31 > [alias] |
30 > glog=log -G -T '{rev}:{node|short} {desc} {bookmarks}\n' | 32 > glog=log -G -T '{rev}:{node|short} {desc} {bookmarks}\n' |
31 > EOF | 33 > EOF |
32 | 34 |
33 #if obsstore-on | 35 #if obsstore-on |
103 abort: cannot split multiple revisions | 105 abort: cannot split multiple revisions |
104 [255] | 106 [255] |
105 | 107 |
106 This function splits a bit strangely primarily to avoid changing the behavior of | 108 This function splits a bit strangely primarily to avoid changing the behavior of |
107 the test after a bug was fixed with how split/commit --interactive handled | 109 the test after a bug was fixed with how split/commit --interactive handled |
108 `diff.unified=0`: when there were no context lines, it kept only the last diff | 110 `commands.commit.interactive.unified=0`: when there were no context lines, |
109 hunk. When running split, this meant that runsplit was always recording three commits, | 111 it kept only the last diff hunk. When running split, this meant that runsplit |
110 one for each diff hunk, in reverse order (the base commit was the last diff hunk | 112 was always recording three commits, one for each diff hunk, in reverse order |
111 in the file). | 113 (the base commit was the last diff hunk in the file). |
112 $ runsplit() { | 114 $ runsplit() { |
113 > cat > $TESTTMP/messages <<EOF | 115 > cat > $TESTTMP/messages <<EOF |
114 > split 1 | 116 > split 1 |
115 > -- | 117 > -- |
116 > split 2 | 118 > split 2 |