2007-11-24 04:14:20 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2008-09-03 08:59:29 +00:00
|
|
|
test_description='core.whitespace rules and git apply'
|
2007-11-24 04:14:20 +00:00
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
prepare_test_file () {
|
|
|
|
|
|
|
|
# A line that has character X is touched iff RULE is in effect:
|
|
|
|
# X RULE
|
|
|
|
# ! trailing-space
|
|
|
|
# @ space-before-tab
|
2010-11-30 08:29:11 +00:00
|
|
|
# # indent-with-non-tab (default tab width 8)
|
|
|
|
# = indent-with-non-tab,tabwidth=16
|
2010-04-02 23:37:37 +00:00
|
|
|
# % tab-in-indent
|
2007-11-24 04:14:20 +00:00
|
|
|
sed -e "s/_/ /g" -e "s/>/ /" <<-\EOF
|
|
|
|
An_SP in an ordinary line>and a HT.
|
2010-04-02 23:37:37 +00:00
|
|
|
>A HT (%).
|
|
|
|
_>A SP and a HT (@%).
|
|
|
|
_>_A SP, a HT and a SP (@%).
|
2007-11-24 04:14:20 +00:00
|
|
|
_______Seven SP.
|
|
|
|
________Eight SP (#).
|
2010-04-02 23:37:37 +00:00
|
|
|
_______>Seven SP and a HT (@%).
|
|
|
|
________>Eight SP and a HT (@#%).
|
|
|
|
_______>_Seven SP, a HT and a SP (@%).
|
|
|
|
________>_Eight SP, a HT and a SP (@#%).
|
2007-11-24 04:14:20 +00:00
|
|
|
_______________Fifteen SP (#).
|
2010-04-02 23:37:37 +00:00
|
|
|
_______________>Fifteen SP and a HT (@#%).
|
2010-11-30 08:29:11 +00:00
|
|
|
________________Sixteen SP (#=).
|
|
|
|
________________>Sixteen SP and a HT (@#%=).
|
2007-11-24 04:14:20 +00:00
|
|
|
_____a__Five SP, a non WS, two SP.
|
|
|
|
A line with a (!) trailing SP_
|
|
|
|
A line with a (!) trailing HT>
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
apply_patch () {
|
2020-01-07 04:53:13 +00:00
|
|
|
cmd_prefix= &&
|
|
|
|
if test "x$1" = 'x!'
|
|
|
|
then
|
|
|
|
cmd_prefix=test_must_fail &&
|
|
|
|
shift
|
|
|
|
fi &&
|
2007-11-24 04:14:20 +00:00
|
|
|
>target &&
|
|
|
|
sed -e "s|\([ab]\)/file|\1/target|" <patch |
|
2020-01-07 04:53:13 +00:00
|
|
|
$cmd_prefix git apply "$@"
|
2007-11-24 04:14:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
test_fix () {
|
|
|
|
# fix should not barf
|
|
|
|
apply_patch --whitespace=fix || return 1
|
|
|
|
|
|
|
|
# find touched lines
|
2010-05-14 09:31:37 +00:00
|
|
|
$DIFF file target | sed -n -e "s/^> //p" >fixed
|
2020-03-26 04:37:37 +00:00
|
|
|
# busybox's diff(1) doesn't output normal format
|
|
|
|
if ! test -s fixed
|
|
|
|
then
|
|
|
|
$DIFF -u file target |
|
|
|
|
grep -v '^+++ target' |
|
|
|
|
sed -ne "/^+/s/+//p" >fixed
|
|
|
|
fi
|
2007-11-24 04:14:20 +00:00
|
|
|
|
2013-04-11 22:36:10 +00:00
|
|
|
# the changed lines are all expected to change
|
2007-11-24 04:14:20 +00:00
|
|
|
fixed_cnt=$(wc -l <fixed)
|
|
|
|
case "$1" in
|
|
|
|
'') expect_cnt=$fixed_cnt ;;
|
|
|
|
?*) expect_cnt=$(grep "[$1]" <fixed | wc -l) ;;
|
|
|
|
esac
|
|
|
|
test $fixed_cnt -eq $expect_cnt || return 1
|
|
|
|
|
|
|
|
# and we are not missing anything
|
|
|
|
case "$1" in
|
|
|
|
'') expect_cnt=0 ;;
|
|
|
|
?*) expect_cnt=$(grep "[$1]" <file | wc -l) ;;
|
|
|
|
esac
|
|
|
|
test $fixed_cnt -eq $expect_cnt || return 1
|
|
|
|
|
|
|
|
# Get the patch actually applied
|
|
|
|
git diff-files -p target >fixed-patch
|
|
|
|
test -s fixed-patch && return 0
|
|
|
|
|
|
|
|
# Make sure it is complaint-free
|
|
|
|
>target
|
|
|
|
git apply --whitespace=error-all <fixed-patch
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
test_expect_success setup '
|
|
|
|
|
|
|
|
>file &&
|
|
|
|
git add file &&
|
|
|
|
prepare_test_file >file &&
|
|
|
|
git diff-files -p >patch &&
|
|
|
|
>target &&
|
|
|
|
git add target
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'whitespace=nowarn, default rule' '
|
|
|
|
|
|
|
|
apply_patch --whitespace=nowarn &&
|
2010-05-14 09:31:37 +00:00
|
|
|
test_cmp file target
|
2007-11-24 04:14:20 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'whitespace=warn, default rule' '
|
|
|
|
|
|
|
|
apply_patch --whitespace=warn &&
|
2010-05-14 09:31:37 +00:00
|
|
|
test_cmp file target
|
2007-11-24 04:14:20 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'whitespace=error-all, default rule' '
|
|
|
|
|
2020-01-07 04:53:13 +00:00
|
|
|
apply_patch ! --whitespace=error-all &&
|
2018-08-19 21:57:22 +00:00
|
|
|
test_must_be_empty target
|
2007-11-24 04:14:20 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'whitespace=error-all, no rule' '
|
|
|
|
|
|
|
|
git config core.whitespace -trailing,-space-before,-indent &&
|
|
|
|
apply_patch --whitespace=error-all &&
|
2010-05-14 09:31:37 +00:00
|
|
|
test_cmp file target
|
2007-11-24 04:14:20 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2007-12-06 08:14:14 +00:00
|
|
|
test_expect_success 'whitespace=error-all, no rule (attribute)' '
|
|
|
|
|
|
|
|
git config --unset core.whitespace &&
|
|
|
|
echo "target -whitespace" >.gitattributes &&
|
|
|
|
apply_patch --whitespace=error-all &&
|
2010-05-14 09:31:37 +00:00
|
|
|
test_cmp file target
|
2007-12-06 08:14:14 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2010-11-30 08:22:04 +00:00
|
|
|
test_expect_success 'spaces inserted by tab-in-indent' '
|
|
|
|
|
|
|
|
git config core.whitespace -trailing,-space,-indent,tab &&
|
|
|
|
rm -f .gitattributes &&
|
|
|
|
test_fix % &&
|
|
|
|
sed -e "s/_/ /g" -e "s/>/ /" <<-\EOF >expect &&
|
|
|
|
An_SP in an ordinary line>and a HT.
|
|
|
|
________A HT (%).
|
|
|
|
________A SP and a HT (@%).
|
|
|
|
_________A SP, a HT and a SP (@%).
|
|
|
|
_______Seven SP.
|
|
|
|
________Eight SP (#).
|
|
|
|
________Seven SP and a HT (@%).
|
|
|
|
________________Eight SP and a HT (@#%).
|
|
|
|
_________Seven SP, a HT and a SP (@%).
|
|
|
|
_________________Eight SP, a HT and a SP (@#%).
|
|
|
|
_______________Fifteen SP (#).
|
|
|
|
________________Fifteen SP and a HT (@#%).
|
2010-11-30 08:29:11 +00:00
|
|
|
________________Sixteen SP (#=).
|
|
|
|
________________________Sixteen SP and a HT (@#%=).
|
2010-11-30 08:22:04 +00:00
|
|
|
_____a__Five SP, a non WS, two SP.
|
|
|
|
A line with a (!) trailing SP_
|
|
|
|
A line with a (!) trailing HT>
|
|
|
|
EOF
|
|
|
|
test_cmp expect target
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2007-11-24 04:14:20 +00:00
|
|
|
for t in - ''
|
|
|
|
do
|
|
|
|
case "$t" in '') tt='!' ;; *) tt= ;; esac
|
|
|
|
for s in - ''
|
|
|
|
do
|
|
|
|
case "$s" in '') ts='@' ;; *) ts= ;; esac
|
|
|
|
for i in - ''
|
|
|
|
do
|
2010-11-30 08:29:11 +00:00
|
|
|
case "$i" in '') ti='#' ti16='=';; *) ti= ti16= ;; esac
|
2010-04-02 23:37:37 +00:00
|
|
|
for h in - ''
|
|
|
|
do
|
|
|
|
[ -z "$h$i" ] && continue
|
|
|
|
case "$h" in '') th='%' ;; *) th= ;; esac
|
|
|
|
rule=${t}trailing,${s}space,${i}indent,${h}tab
|
|
|
|
|
|
|
|
rm -f .gitattributes
|
|
|
|
test_expect_success "rule=$rule" '
|
|
|
|
git config core.whitespace "$rule" &&
|
|
|
|
test_fix "$tt$ts$ti$th"
|
|
|
|
'
|
|
|
|
|
2010-11-30 08:29:11 +00:00
|
|
|
test_expect_success "rule=$rule,tabwidth=16" '
|
|
|
|
git config core.whitespace "$rule,tabwidth=16" &&
|
|
|
|
test_fix "$tt$ts$ti16$th"
|
|
|
|
'
|
|
|
|
|
2010-04-02 23:37:37 +00:00
|
|
|
test_expect_success "rule=$rule (attributes)" '
|
|
|
|
git config --unset core.whitespace &&
|
|
|
|
echo "target whitespace=$rule" >.gitattributes &&
|
|
|
|
test_fix "$tt$ts$ti$th"
|
|
|
|
'
|
|
|
|
|
2010-11-30 08:29:11 +00:00
|
|
|
test_expect_success "rule=$rule,tabwidth=16 (attributes)" '
|
|
|
|
echo "target whitespace=$rule,tabwidth=16" >.gitattributes &&
|
|
|
|
test_fix "$tt$ts$ti16$th"
|
|
|
|
'
|
|
|
|
|
2010-04-02 23:37:37 +00:00
|
|
|
done
|
2007-11-24 04:14:20 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2009-07-23 00:24:38 +00:00
|
|
|
create_patch () {
|
|
|
|
sed -e "s/_/ /" <<-\EOF
|
|
|
|
diff --git a/target b/target
|
|
|
|
index e69de29..8bd6648 100644
|
|
|
|
--- a/target
|
|
|
|
+++ b/target
|
2009-07-25 08:29:20 +00:00
|
|
|
@@ -0,0 +1,3 @@
|
|
|
|
+An empty line follows
|
|
|
|
+
|
2009-07-23 00:24:38 +00:00
|
|
|
+A line with trailing whitespace and no newline_
|
|
|
|
\ No newline at end of file
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
test_expect_success 'trailing whitespace & no newline at the end of file' '
|
|
|
|
>target &&
|
2009-07-25 08:29:20 +00:00
|
|
|
create_patch >patch-file &&
|
|
|
|
git apply --whitespace=fix patch-file &&
|
|
|
|
grep "newline$" target &&
|
|
|
|
grep "^$" target
|
2009-07-23 00:24:38 +00:00
|
|
|
'
|
|
|
|
|
2009-09-04 08:41:47 +00:00
|
|
|
test_expect_success 'blank at EOF with --whitespace=fix (1)' '
|
2010-10-31 07:41:08 +00:00
|
|
|
test_might_fail git config --unset core.whitespace &&
|
|
|
|
rm -f .gitattributes &&
|
2009-09-04 08:41:47 +00:00
|
|
|
|
|
|
|
{ echo a; echo b; echo c; } >one &&
|
|
|
|
git add one &&
|
|
|
|
{ echo a; echo b; echo c; } >expect &&
|
|
|
|
{ cat expect; echo; } >one &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
|
|
|
|
git checkout one &&
|
|
|
|
git apply --whitespace=fix patch &&
|
|
|
|
test_cmp expect one
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'blank at EOF with --whitespace=fix (2)' '
|
|
|
|
{ echo a; echo b; echo c; } >one &&
|
|
|
|
git add one &&
|
|
|
|
{ echo a; echo c; } >expect &&
|
|
|
|
{ cat expect; echo; echo; } >one &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
|
|
|
|
git checkout one &&
|
|
|
|
git apply --whitespace=fix patch &&
|
|
|
|
test_cmp expect one
|
|
|
|
'
|
|
|
|
|
apply --whitespace=fix: detect new blank lines at eof correctly
The command tries to strip blank lines at the end of the file added by a
patch. It is done by first detecting if a hunk in patch has additional
blank lines at the end of itself, and if so checking if such a hunk
applies at the end of file. This patch addresses a bug in the logic to
implement the former (the previous one addressed a bug in the latter).
If the original ends with blank lines, often the patch hunk ends like
this:
@@ -l,5 +m,7 @@$
_context$
_context$
-deleted$
+$
+$
+$
_$
_$
where _ stands for SP and $ shows a end-of-line. This example patch adds
three trailing blank lines, but the code fails to notice it, because it
only pays attention to added blank lines at the very end of the hunk. In
this example, the three added blank lines do not appear textually at the
end in the patch, even though you can see that they are indeed added at
the end, if you rearrange the diff like this:
@@ -l,5 +m,7 @@$
_context$
_context$
-deleted$
_$
_$
+$
+$
+$
The fix is not to reset the number of (candidate) added blank lines at the
end when the loop sees a context line that is empty.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-03 21:08:20 +00:00
|
|
|
test_expect_success 'blank at EOF with --whitespace=fix (3)' '
|
|
|
|
{ echo a; echo b; echo; } >one &&
|
|
|
|
git add one &&
|
|
|
|
{ echo a; echo c; echo; } >expect &&
|
|
|
|
{ cat expect; echo; echo; } >one &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
|
|
|
|
git checkout one &&
|
|
|
|
git apply --whitespace=fix patch &&
|
|
|
|
test_cmp expect one
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'blank at end of hunk, not at EOF with --whitespace=fix' '
|
|
|
|
{ echo a; echo b; echo; echo; echo; echo; echo; echo d; } >one &&
|
|
|
|
git add one &&
|
|
|
|
{ echo a; echo c; echo; echo; echo; echo; echo; echo; echo d; } >expect &&
|
|
|
|
cp expect one &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
|
|
|
|
git checkout one &&
|
|
|
|
git apply --whitespace=fix patch &&
|
|
|
|
test_cmp expect one
|
|
|
|
'
|
|
|
|
|
apply --whitespace=warn/error: diagnose blank at EOF
"git apply" strips new blank lines at EOF under --whitespace=fix option,
but neigher --whitespace=warn nor --whitespace=error paid any attention to
these errors.
Introduce a new whitespace error class, blank-at-eof, to make the
whitespace error handling more consistent.
The patch adds a new "linenr" field to the struct fragment in order to
record which line the hunk started in the input file, but this is needed
solely for reporting purposes. The detection of this class of whitespace
errors cannot be done while parsing a patch like we do for all the other
classes of whitespace errors. It instead has to wait until we find where
to apply the hunk, but at that point, we do not have an access to the
original line number in the input file anymore, hence the new field.
Depending on your point of view, this may be a bugfix that makes warn and
error in line with fix. Or you could call it a new feature. The line
between them is somewhat fuzzy in this case.
Strictly speaking, triggering more errors than before is a change in
behaviour that is not backward compatible, even though the reason for the
change is because the code was not checking for an error that it should
have. People who do not want added blank lines at EOF to trigger an error
can disable the new error class.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-03 23:02:32 +00:00
|
|
|
test_expect_success 'blank at EOF with --whitespace=warn' '
|
|
|
|
{ echo a; echo b; echo c; } >one &&
|
|
|
|
git add one &&
|
|
|
|
echo >>one &&
|
|
|
|
cat one >expect &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
|
|
|
|
git checkout one &&
|
|
|
|
git apply --whitespace=warn patch 2>error &&
|
|
|
|
test_cmp expect one &&
|
|
|
|
grep "new blank line at EOF" error
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'blank at EOF with --whitespace=error' '
|
|
|
|
{ echo a; echo b; echo c; } >one &&
|
|
|
|
git add one &&
|
|
|
|
cat one >expect &&
|
|
|
|
echo >>one &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
|
|
|
|
git checkout one &&
|
|
|
|
test_must_fail git apply --whitespace=error patch 2>error &&
|
|
|
|
test_cmp expect one &&
|
|
|
|
grep "new blank line at EOF" error
|
|
|
|
'
|
|
|
|
|
2009-09-04 09:25:57 +00:00
|
|
|
test_expect_success 'blank but not empty at EOF' '
|
|
|
|
{ echo a; echo b; echo c; } >one &&
|
|
|
|
git add one &&
|
|
|
|
echo " " >>one &&
|
|
|
|
cat one >expect &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
|
|
|
|
git checkout one &&
|
|
|
|
git apply --whitespace=warn patch 2>error &&
|
|
|
|
test_cmp expect one &&
|
|
|
|
grep "new blank line at EOF" error
|
|
|
|
'
|
|
|
|
|
2010-03-06 14:31:04 +00:00
|
|
|
test_expect_success 'applying beyond EOF requires one non-blank context line' '
|
|
|
|
{ echo; echo; echo; echo; } >one &&
|
|
|
|
git add one &&
|
|
|
|
{ echo b; } >>one &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
|
|
|
|
git checkout one &&
|
|
|
|
{ echo a; echo; } >one &&
|
|
|
|
cp one expect &&
|
|
|
|
test_must_fail git apply --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one &&
|
2010-03-06 14:31:04 +00:00
|
|
|
test_must_fail git apply --ignore-space-change --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one
|
2010-03-06 14:31:04 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'tons of blanks at EOF should not apply' '
|
|
|
|
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do
|
|
|
|
echo; echo; echo; echo;
|
|
|
|
done >one &&
|
|
|
|
git add one &&
|
|
|
|
echo a >>one &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
|
|
|
|
>one &&
|
|
|
|
test_must_fail git apply --whitespace=fix patch &&
|
|
|
|
test_must_fail git apply --ignore-space-change --whitespace=fix patch
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'missing blank line at end with --whitespace=fix' '
|
|
|
|
echo a >one &&
|
|
|
|
echo >>one &&
|
|
|
|
git add one &&
|
|
|
|
echo b >>one &&
|
|
|
|
cp one expect &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
echo a >one &&
|
|
|
|
cp one saved-one &&
|
|
|
|
test_must_fail git apply patch &&
|
|
|
|
git apply --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one &&
|
2010-03-06 14:31:04 +00:00
|
|
|
mv saved-one one &&
|
|
|
|
git apply --ignore-space-change --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one
|
2010-03-06 14:31:04 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'two missing blank lines at end with --whitespace=fix' '
|
|
|
|
{ echo a; echo; echo b; echo c; } >one &&
|
|
|
|
cp one no-blank-lines &&
|
|
|
|
{ echo; echo; } >>one &&
|
|
|
|
git add one &&
|
|
|
|
echo d >>one &&
|
|
|
|
cp one expect &&
|
|
|
|
echo >>one &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
cp no-blank-lines one &&
|
|
|
|
test_must_fail git apply patch &&
|
|
|
|
git apply --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one &&
|
2010-03-06 14:31:04 +00:00
|
|
|
mv no-blank-lines one &&
|
|
|
|
test_must_fail git apply patch &&
|
|
|
|
git apply --ignore-space-change --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one
|
2010-03-06 14:31:04 +00:00
|
|
|
'
|
|
|
|
|
2010-04-08 04:14:31 +00:00
|
|
|
test_expect_success 'missing blank line at end, insert before end, --whitespace=fix' '
|
|
|
|
{ echo a; echo; } >one &&
|
|
|
|
git add one &&
|
|
|
|
{ echo b; echo a; echo; } >one &&
|
|
|
|
cp one expect &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
echo a >one &&
|
|
|
|
test_must_fail git apply patch &&
|
|
|
|
git apply --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one
|
2010-04-08 04:14:31 +00:00
|
|
|
'
|
|
|
|
|
2010-03-06 14:31:04 +00:00
|
|
|
test_expect_success 'shrink file with tons of missing blanks at end of file' '
|
|
|
|
{ echo a; echo b; echo c; } >one &&
|
|
|
|
cp one no-blank-lines &&
|
|
|
|
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do
|
|
|
|
echo; echo; echo; echo;
|
|
|
|
done >>one &&
|
|
|
|
git add one &&
|
|
|
|
echo a >one &&
|
|
|
|
cp one expect &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
cp no-blank-lines one &&
|
|
|
|
test_must_fail git apply patch &&
|
|
|
|
git apply --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one &&
|
2010-03-06 14:31:04 +00:00
|
|
|
mv no-blank-lines one &&
|
|
|
|
git apply --ignore-space-change --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one
|
2010-03-06 14:31:04 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'missing blanks at EOF must only match blank lines' '
|
|
|
|
{ echo a; echo b; } >one &&
|
|
|
|
git add one &&
|
|
|
|
{ echo c; echo d; } >>one &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
|
|
|
|
echo a >one &&
|
2010-10-31 07:30:58 +00:00
|
|
|
test_must_fail git apply patch &&
|
2010-03-06 14:31:04 +00:00
|
|
|
test_must_fail git apply --whitespace=fix patch &&
|
|
|
|
test_must_fail git apply --ignore-space-change --whitespace=fix patch
|
|
|
|
'
|
|
|
|
|
|
|
|
sed -e's/Z//' >one <<EOF
|
|
|
|
a
|
|
|
|
b
|
|
|
|
c
|
|
|
|
Z
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'missing blank line should match context line with spaces' '
|
|
|
|
git add one &&
|
|
|
|
echo d >>one &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
{ echo a; echo b; echo c; } >one &&
|
|
|
|
cp one expect &&
|
|
|
|
{ echo; echo d; } >>expect &&
|
|
|
|
git add one &&
|
|
|
|
|
|
|
|
git apply --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one
|
2010-03-06 14:31:04 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
sed -e's/Z//' >one <<EOF
|
|
|
|
a
|
|
|
|
b
|
|
|
|
c
|
|
|
|
Z
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'same, but with the --ignore-space-option' '
|
|
|
|
git add one &&
|
|
|
|
echo d >>one &&
|
|
|
|
cp one expect &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
{ echo a; echo b; echo c; } >one &&
|
|
|
|
git add one &&
|
|
|
|
|
|
|
|
git checkout-index -f one &&
|
|
|
|
git apply --ignore-space-change --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one
|
2010-03-06 14:31:04 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'same, but with CR-LF line endings && cr-at-eol set' '
|
|
|
|
git config core.whitespace cr-at-eol &&
|
|
|
|
printf "a\r\n" >one &&
|
|
|
|
printf "b\r\n" >>one &&
|
|
|
|
printf "c\r\n" >>one &&
|
|
|
|
cp one save-one &&
|
2010-10-31 07:30:58 +00:00
|
|
|
printf " \r\n" >>one &&
|
2010-03-06 14:31:04 +00:00
|
|
|
git add one &&
|
|
|
|
printf "d\r\n" >>one &&
|
|
|
|
cp one expect &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
mv save-one one &&
|
|
|
|
|
|
|
|
git apply --ignore-space-change --whitespace=fix patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one
|
2010-03-06 14:31:04 +00:00
|
|
|
'
|
|
|
|
|
apply: file commited with CRLF should roundtrip diff and apply
When a file had been commited with CRLF but now .gitattributes say
"* text=auto" (or core.autocrlf is true), the following does not
roundtrip, `git apply` fails:
printf "Added line\r\n" >>file &&
git diff >patch &&
git checkout -- . &&
git apply patch
Before applying the patch, the file from working tree is converted
into the index format (clean filter, CRLF conversion, ...). Here,
when commited with CRLF, the line endings should not be converted.
Note that `git apply --index` or `git apply --cache` doesn't call
convert_to_git() because the source material is already in index
format.
Analyze the patch if there is a) any context line with CRLF, or b)
if any line with CRLF is to be removed. In this case the patch file
`patch` has mixed line endings, for a) it looks like this:
diff --git a/one b/one
index 533790e..c30dea8 100644
--- a/one
+++ b/one
@@ -1 +1,2 @@
a\r
+b\r
And for b) it looks like this:
diff --git a/one b/one
index 533790e..485540d 100644
--- a/one
+++ b/one
@@ -1 +1 @@
-a\r
+b\r
If `git apply` detects that the patch itself has CRLF, (look at the
line " a\r" or "-a\r" above), the new flag crlf_in_old is set in
"struct patch" and two things will happen:
- read_old_data() will not convert CRLF into LF by calling
convert_to_git(..., SAFE_CRLF_KEEP_CRLF);
- The WS_CR_AT_EOL bit is set in the "white space rule",
CRLF are no longer treated as white space.
While at there, make it clear that read_old_data() in apply.c knows
what it wants convert_to_git() to do with respect to CRLF. In fact,
this codepath is about applying a patch to a file in the filesystem,
which may not exist in the index, or may exist but may not match
what is recorded in the index, or in the extreme case, we may not
even be in a Git repository. If convert_to_git() peeked at the
index while doing its work, it *would* be a bug.
Pass NULL instead of &the_index to convert_to_git() to make sure we
catch future bugs to clarify this.
Update the test in t4124: split one test case into 3:
- Detect the " a\r" line in the patch
- Detect the "-a\r" line in the patch
- Use LF in repo and CLRF in the worktree.
Reported-by: Anthony Sottile <asottile@umich.edu>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-19 11:28:01 +00:00
|
|
|
test_expect_success 'CR-LF line endings && add line && text=auto' '
|
2010-03-06 14:31:04 +00:00
|
|
|
git config --unset core.whitespace &&
|
|
|
|
printf "a\r\n" >one &&
|
apply: file commited with CRLF should roundtrip diff and apply
When a file had been commited with CRLF but now .gitattributes say
"* text=auto" (or core.autocrlf is true), the following does not
roundtrip, `git apply` fails:
printf "Added line\r\n" >>file &&
git diff >patch &&
git checkout -- . &&
git apply patch
Before applying the patch, the file from working tree is converted
into the index format (clean filter, CRLF conversion, ...). Here,
when commited with CRLF, the line endings should not be converted.
Note that `git apply --index` or `git apply --cache` doesn't call
convert_to_git() because the source material is already in index
format.
Analyze the patch if there is a) any context line with CRLF, or b)
if any line with CRLF is to be removed. In this case the patch file
`patch` has mixed line endings, for a) it looks like this:
diff --git a/one b/one
index 533790e..c30dea8 100644
--- a/one
+++ b/one
@@ -1 +1,2 @@
a\r
+b\r
And for b) it looks like this:
diff --git a/one b/one
index 533790e..485540d 100644
--- a/one
+++ b/one
@@ -1 +1 @@
-a\r
+b\r
If `git apply` detects that the patch itself has CRLF, (look at the
line " a\r" or "-a\r" above), the new flag crlf_in_old is set in
"struct patch" and two things will happen:
- read_old_data() will not convert CRLF into LF by calling
convert_to_git(..., SAFE_CRLF_KEEP_CRLF);
- The WS_CR_AT_EOL bit is set in the "white space rule",
CRLF are no longer treated as white space.
While at there, make it clear that read_old_data() in apply.c knows
what it wants convert_to_git() to do with respect to CRLF. In fact,
this codepath is about applying a patch to a file in the filesystem,
which may not exist in the index, or may exist but may not match
what is recorded in the index, or in the extreme case, we may not
even be in a Git repository. If convert_to_git() peeked at the
index while doing its work, it *would* be a bug.
Pass NULL instead of &the_index to convert_to_git() to make sure we
catch future bugs to clarify this.
Update the test in t4124: split one test case into 3:
- Detect the " a\r" line in the patch
- Detect the "-a\r" line in the patch
- Use LF in repo and CLRF in the worktree.
Reported-by: Anthony Sottile <asottile@umich.edu>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-19 11:28:01 +00:00
|
|
|
cp one save-one &&
|
|
|
|
git add one &&
|
2010-03-06 14:31:04 +00:00
|
|
|
printf "b\r\n" >>one &&
|
apply: file commited with CRLF should roundtrip diff and apply
When a file had been commited with CRLF but now .gitattributes say
"* text=auto" (or core.autocrlf is true), the following does not
roundtrip, `git apply` fails:
printf "Added line\r\n" >>file &&
git diff >patch &&
git checkout -- . &&
git apply patch
Before applying the patch, the file from working tree is converted
into the index format (clean filter, CRLF conversion, ...). Here,
when commited with CRLF, the line endings should not be converted.
Note that `git apply --index` or `git apply --cache` doesn't call
convert_to_git() because the source material is already in index
format.
Analyze the patch if there is a) any context line with CRLF, or b)
if any line with CRLF is to be removed. In this case the patch file
`patch` has mixed line endings, for a) it looks like this:
diff --git a/one b/one
index 533790e..c30dea8 100644
--- a/one
+++ b/one
@@ -1 +1,2 @@
a\r
+b\r
And for b) it looks like this:
diff --git a/one b/one
index 533790e..485540d 100644
--- a/one
+++ b/one
@@ -1 +1 @@
-a\r
+b\r
If `git apply` detects that the patch itself has CRLF, (look at the
line " a\r" or "-a\r" above), the new flag crlf_in_old is set in
"struct patch" and two things will happen:
- read_old_data() will not convert CRLF into LF by calling
convert_to_git(..., SAFE_CRLF_KEEP_CRLF);
- The WS_CR_AT_EOL bit is set in the "white space rule",
CRLF are no longer treated as white space.
While at there, make it clear that read_old_data() in apply.c knows
what it wants convert_to_git() to do with respect to CRLF. In fact,
this codepath is about applying a patch to a file in the filesystem,
which may not exist in the index, or may exist but may not match
what is recorded in the index, or in the extreme case, we may not
even be in a Git repository. If convert_to_git() peeked at the
index while doing its work, it *would* be a bug.
Pass NULL instead of &the_index to convert_to_git() to make sure we
catch future bugs to clarify this.
Update the test in t4124: split one test case into 3:
- Detect the " a\r" line in the patch
- Detect the "-a\r" line in the patch
- Use LF in repo and CLRF in the worktree.
Reported-by: Anthony Sottile <asottile@umich.edu>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-19 11:28:01 +00:00
|
|
|
cp one expect &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
mv save-one one &&
|
|
|
|
echo "one text=auto" >.gitattributes &&
|
|
|
|
git apply patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one
|
apply: file commited with CRLF should roundtrip diff and apply
When a file had been commited with CRLF but now .gitattributes say
"* text=auto" (or core.autocrlf is true), the following does not
roundtrip, `git apply` fails:
printf "Added line\r\n" >>file &&
git diff >patch &&
git checkout -- . &&
git apply patch
Before applying the patch, the file from working tree is converted
into the index format (clean filter, CRLF conversion, ...). Here,
when commited with CRLF, the line endings should not be converted.
Note that `git apply --index` or `git apply --cache` doesn't call
convert_to_git() because the source material is already in index
format.
Analyze the patch if there is a) any context line with CRLF, or b)
if any line with CRLF is to be removed. In this case the patch file
`patch` has mixed line endings, for a) it looks like this:
diff --git a/one b/one
index 533790e..c30dea8 100644
--- a/one
+++ b/one
@@ -1 +1,2 @@
a\r
+b\r
And for b) it looks like this:
diff --git a/one b/one
index 533790e..485540d 100644
--- a/one
+++ b/one
@@ -1 +1 @@
-a\r
+b\r
If `git apply` detects that the patch itself has CRLF, (look at the
line " a\r" or "-a\r" above), the new flag crlf_in_old is set in
"struct patch" and two things will happen:
- read_old_data() will not convert CRLF into LF by calling
convert_to_git(..., SAFE_CRLF_KEEP_CRLF);
- The WS_CR_AT_EOL bit is set in the "white space rule",
CRLF are no longer treated as white space.
While at there, make it clear that read_old_data() in apply.c knows
what it wants convert_to_git() to do with respect to CRLF. In fact,
this codepath is about applying a patch to a file in the filesystem,
which may not exist in the index, or may exist but may not match
what is recorded in the index, or in the extreme case, we may not
even be in a Git repository. If convert_to_git() peeked at the
index while doing its work, it *would* be a bug.
Pass NULL instead of &the_index to convert_to_git() to make sure we
catch future bugs to clarify this.
Update the test in t4124: split one test case into 3:
- Detect the " a\r" line in the patch
- Detect the "-a\r" line in the patch
- Use LF in repo and CLRF in the worktree.
Reported-by: Anthony Sottile <asottile@umich.edu>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-19 11:28:01 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'CR-LF line endings && change line && text=auto' '
|
|
|
|
printf "a\r\n" >one &&
|
2010-03-06 14:31:04 +00:00
|
|
|
cp one save-one &&
|
|
|
|
git add one &&
|
apply: file commited with CRLF should roundtrip diff and apply
When a file had been commited with CRLF but now .gitattributes say
"* text=auto" (or core.autocrlf is true), the following does not
roundtrip, `git apply` fails:
printf "Added line\r\n" >>file &&
git diff >patch &&
git checkout -- . &&
git apply patch
Before applying the patch, the file from working tree is converted
into the index format (clean filter, CRLF conversion, ...). Here,
when commited with CRLF, the line endings should not be converted.
Note that `git apply --index` or `git apply --cache` doesn't call
convert_to_git() because the source material is already in index
format.
Analyze the patch if there is a) any context line with CRLF, or b)
if any line with CRLF is to be removed. In this case the patch file
`patch` has mixed line endings, for a) it looks like this:
diff --git a/one b/one
index 533790e..c30dea8 100644
--- a/one
+++ b/one
@@ -1 +1,2 @@
a\r
+b\r
And for b) it looks like this:
diff --git a/one b/one
index 533790e..485540d 100644
--- a/one
+++ b/one
@@ -1 +1 @@
-a\r
+b\r
If `git apply` detects that the patch itself has CRLF, (look at the
line " a\r" or "-a\r" above), the new flag crlf_in_old is set in
"struct patch" and two things will happen:
- read_old_data() will not convert CRLF into LF by calling
convert_to_git(..., SAFE_CRLF_KEEP_CRLF);
- The WS_CR_AT_EOL bit is set in the "white space rule",
CRLF are no longer treated as white space.
While at there, make it clear that read_old_data() in apply.c knows
what it wants convert_to_git() to do with respect to CRLF. In fact,
this codepath is about applying a patch to a file in the filesystem,
which may not exist in the index, or may exist but may not match
what is recorded in the index, or in the extreme case, we may not
even be in a Git repository. If convert_to_git() peeked at the
index while doing its work, it *would* be a bug.
Pass NULL instead of &the_index to convert_to_git() to make sure we
catch future bugs to clarify this.
Update the test in t4124: split one test case into 3:
- Detect the " a\r" line in the patch
- Detect the "-a\r" line in the patch
- Use LF in repo and CLRF in the worktree.
Reported-by: Anthony Sottile <asottile@umich.edu>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-19 11:28:01 +00:00
|
|
|
printf "b\r\n" >one &&
|
2010-03-06 14:31:04 +00:00
|
|
|
cp one expect &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
mv save-one one &&
|
apply: file commited with CRLF should roundtrip diff and apply
When a file had been commited with CRLF but now .gitattributes say
"* text=auto" (or core.autocrlf is true), the following does not
roundtrip, `git apply` fails:
printf "Added line\r\n" >>file &&
git diff >patch &&
git checkout -- . &&
git apply patch
Before applying the patch, the file from working tree is converted
into the index format (clean filter, CRLF conversion, ...). Here,
when commited with CRLF, the line endings should not be converted.
Note that `git apply --index` or `git apply --cache` doesn't call
convert_to_git() because the source material is already in index
format.
Analyze the patch if there is a) any context line with CRLF, or b)
if any line with CRLF is to be removed. In this case the patch file
`patch` has mixed line endings, for a) it looks like this:
diff --git a/one b/one
index 533790e..c30dea8 100644
--- a/one
+++ b/one
@@ -1 +1,2 @@
a\r
+b\r
And for b) it looks like this:
diff --git a/one b/one
index 533790e..485540d 100644
--- a/one
+++ b/one
@@ -1 +1 @@
-a\r
+b\r
If `git apply` detects that the patch itself has CRLF, (look at the
line " a\r" or "-a\r" above), the new flag crlf_in_old is set in
"struct patch" and two things will happen:
- read_old_data() will not convert CRLF into LF by calling
convert_to_git(..., SAFE_CRLF_KEEP_CRLF);
- The WS_CR_AT_EOL bit is set in the "white space rule",
CRLF are no longer treated as white space.
While at there, make it clear that read_old_data() in apply.c knows
what it wants convert_to_git() to do with respect to CRLF. In fact,
this codepath is about applying a patch to a file in the filesystem,
which may not exist in the index, or may exist but may not match
what is recorded in the index, or in the extreme case, we may not
even be in a Git repository. If convert_to_git() peeked at the
index while doing its work, it *would* be a bug.
Pass NULL instead of &the_index to convert_to_git() to make sure we
catch future bugs to clarify this.
Update the test in t4124: split one test case into 3:
- Detect the " a\r" line in the patch
- Detect the "-a\r" line in the patch
- Use LF in repo and CLRF in the worktree.
Reported-by: Anthony Sottile <asottile@umich.edu>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-19 11:28:01 +00:00
|
|
|
echo "one text=auto" >.gitattributes &&
|
|
|
|
git apply patch &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one
|
apply: file commited with CRLF should roundtrip diff and apply
When a file had been commited with CRLF but now .gitattributes say
"* text=auto" (or core.autocrlf is true), the following does not
roundtrip, `git apply` fails:
printf "Added line\r\n" >>file &&
git diff >patch &&
git checkout -- . &&
git apply patch
Before applying the patch, the file from working tree is converted
into the index format (clean filter, CRLF conversion, ...). Here,
when commited with CRLF, the line endings should not be converted.
Note that `git apply --index` or `git apply --cache` doesn't call
convert_to_git() because the source material is already in index
format.
Analyze the patch if there is a) any context line with CRLF, or b)
if any line with CRLF is to be removed. In this case the patch file
`patch` has mixed line endings, for a) it looks like this:
diff --git a/one b/one
index 533790e..c30dea8 100644
--- a/one
+++ b/one
@@ -1 +1,2 @@
a\r
+b\r
And for b) it looks like this:
diff --git a/one b/one
index 533790e..485540d 100644
--- a/one
+++ b/one
@@ -1 +1 @@
-a\r
+b\r
If `git apply` detects that the patch itself has CRLF, (look at the
line " a\r" or "-a\r" above), the new flag crlf_in_old is set in
"struct patch" and two things will happen:
- read_old_data() will not convert CRLF into LF by calling
convert_to_git(..., SAFE_CRLF_KEEP_CRLF);
- The WS_CR_AT_EOL bit is set in the "white space rule",
CRLF are no longer treated as white space.
While at there, make it clear that read_old_data() in apply.c knows
what it wants convert_to_git() to do with respect to CRLF. In fact,
this codepath is about applying a patch to a file in the filesystem,
which may not exist in the index, or may exist but may not match
what is recorded in the index, or in the extreme case, we may not
even be in a Git repository. If convert_to_git() peeked at the
index while doing its work, it *would* be a bug.
Pass NULL instead of &the_index to convert_to_git() to make sure we
catch future bugs to clarify this.
Update the test in t4124: split one test case into 3:
- Detect the " a\r" line in the patch
- Detect the "-a\r" line in the patch
- Use LF in repo and CLRF in the worktree.
Reported-by: Anthony Sottile <asottile@umich.edu>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-19 11:28:01 +00:00
|
|
|
'
|
2010-03-06 14:31:04 +00:00
|
|
|
|
apply: file commited with CRLF should roundtrip diff and apply
When a file had been commited with CRLF but now .gitattributes say
"* text=auto" (or core.autocrlf is true), the following does not
roundtrip, `git apply` fails:
printf "Added line\r\n" >>file &&
git diff >patch &&
git checkout -- . &&
git apply patch
Before applying the patch, the file from working tree is converted
into the index format (clean filter, CRLF conversion, ...). Here,
when commited with CRLF, the line endings should not be converted.
Note that `git apply --index` or `git apply --cache` doesn't call
convert_to_git() because the source material is already in index
format.
Analyze the patch if there is a) any context line with CRLF, or b)
if any line with CRLF is to be removed. In this case the patch file
`patch` has mixed line endings, for a) it looks like this:
diff --git a/one b/one
index 533790e..c30dea8 100644
--- a/one
+++ b/one
@@ -1 +1,2 @@
a\r
+b\r
And for b) it looks like this:
diff --git a/one b/one
index 533790e..485540d 100644
--- a/one
+++ b/one
@@ -1 +1 @@
-a\r
+b\r
If `git apply` detects that the patch itself has CRLF, (look at the
line " a\r" or "-a\r" above), the new flag crlf_in_old is set in
"struct patch" and two things will happen:
- read_old_data() will not convert CRLF into LF by calling
convert_to_git(..., SAFE_CRLF_KEEP_CRLF);
- The WS_CR_AT_EOL bit is set in the "white space rule",
CRLF are no longer treated as white space.
While at there, make it clear that read_old_data() in apply.c knows
what it wants convert_to_git() to do with respect to CRLF. In fact,
this codepath is about applying a patch to a file in the filesystem,
which may not exist in the index, or may exist but may not match
what is recorded in the index, or in the extreme case, we may not
even be in a Git repository. If convert_to_git() peeked at the
index while doing its work, it *would* be a bug.
Pass NULL instead of &the_index to convert_to_git() to make sure we
catch future bugs to clarify this.
Update the test in t4124: split one test case into 3:
- Detect the " a\r" line in the patch
- Detect the "-a\r" line in the patch
- Use LF in repo and CLRF in the worktree.
Reported-by: Anthony Sottile <asottile@umich.edu>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-19 11:28:01 +00:00
|
|
|
test_expect_success 'LF in repo, CRLF in worktree && change line && text=auto' '
|
|
|
|
printf "a\n" >one &&
|
|
|
|
git add one &&
|
|
|
|
printf "b\r\n" >one &&
|
|
|
|
git diff -- one >patch &&
|
|
|
|
printf "a\r\n" >one &&
|
|
|
|
echo "one text=auto" >.gitattributes &&
|
|
|
|
git -c core.eol=CRLF apply patch &&
|
|
|
|
printf "b\r\n" >expect &&
|
2018-10-05 21:54:04 +00:00
|
|
|
test_cmp expect one
|
2010-03-06 14:31:04 +00:00
|
|
|
'
|
|
|
|
|
2013-03-22 18:10:03 +00:00
|
|
|
test_expect_success 'whitespace=fix to expand' '
|
|
|
|
qz_to_tab_space >preimage <<-\EOF &&
|
|
|
|
QQa
|
|
|
|
QQb
|
|
|
|
QQc
|
|
|
|
ZZZZZZZZZZZZZZZZd
|
|
|
|
QQe
|
|
|
|
QQf
|
|
|
|
QQg
|
|
|
|
EOF
|
|
|
|
qz_to_tab_space >patch <<-\EOF &&
|
|
|
|
diff --git a/preimage b/preimage
|
|
|
|
--- a/preimage
|
|
|
|
+++ b/preimage
|
|
|
|
@@ -1,7 +1,6 @@
|
|
|
|
QQa
|
|
|
|
QQb
|
|
|
|
QQc
|
|
|
|
-QQd
|
|
|
|
QQe
|
|
|
|
QQf
|
|
|
|
QQg
|
|
|
|
EOF
|
|
|
|
git -c core.whitespace=tab-in-indent apply --whitespace=fix patch
|
|
|
|
'
|
|
|
|
|
2014-08-06 20:09:05 +00:00
|
|
|
test_expect_success 'whitespace check skipped for excluded paths' '
|
|
|
|
git config core.whitespace blank-at-eol &&
|
|
|
|
>used &&
|
|
|
|
>unused &&
|
|
|
|
git add used unused &&
|
|
|
|
echo "used" >used &&
|
|
|
|
echo "unused " >unused &&
|
|
|
|
git diff-files -p used unused >patch &&
|
|
|
|
git apply --include=used --stat --whitespace=error <patch
|
|
|
|
'
|
|
|
|
|
2007-11-24 04:14:20 +00:00
|
|
|
test_done
|