2005-05-25 23:00:04 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2005 Junio C Hamano
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='Test mode change diffs.
|
|
|
|
|
|
|
|
'
|
2021-10-30 22:24:19 +00:00
|
|
|
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
2005-05-25 23:00:04 +00:00
|
|
|
. ./test-lib.sh
|
|
|
|
|
2018-05-13 02:24:15 +00:00
|
|
|
sed_script='s/\(:100644 100755\) \('"$OID_REGEX"'\) \2 /\1 X X /'
|
2005-05-25 23:00:04 +00:00
|
|
|
|
2012-05-01 17:10:12 +00:00
|
|
|
test_expect_success 'setup' '
|
|
|
|
echo frotz >rezrov &&
|
|
|
|
git update-index --add rezrov &&
|
2014-04-30 16:22:56 +00:00
|
|
|
tree=$(git write-tree) &&
|
2012-05-01 17:10:12 +00:00
|
|
|
echo $tree
|
|
|
|
'
|
2005-05-25 23:00:04 +00:00
|
|
|
|
2012-05-01 17:10:12 +00:00
|
|
|
test_expect_success 'chmod' '
|
|
|
|
test_chmod +x rezrov &&
|
|
|
|
git diff-index $tree >current &&
|
|
|
|
sed -e "$sed_script" <current >check &&
|
|
|
|
echo ":100644 100755 X X M rezrov" >expected &&
|
|
|
|
test_cmp expected check
|
|
|
|
'
|
2005-05-25 23:00:04 +00:00
|
|
|
|
2012-05-01 17:10:13 +00:00
|
|
|
test_expect_success 'prepare binary file' '
|
2021-05-10 14:19:06 +00:00
|
|
|
git commit -m one &&
|
|
|
|
test_commit --printf two binbin "\00\01\02\03\04\05\06"
|
2012-05-01 17:10:13 +00:00
|
|
|
'
|
|
|
|
|
t4006: resurrect commented-out tests
This set of tests was added by 4434e6ba6c (tests: check --[short]stat
output after chmod, 2012-05-01), and is primarily about the handling of
binary versus text files.
Later, 74faaa16f0 (Fix "git diff --stat" for interesting - but empty -
file changes, 2012-10-17) changed the stat output so that the empty text
file is mentioned rather than omitted. That commit just comments out
these tests. There's no discussion in the commit message, but the
original email[1] says:
NOTE! This does break two of our tests, so we clearly did this on
purpose, or at least tested for it. I just uncommented the subtests
that this makes irrelevant, and changed the output of another one.
I don't think they're irrelevant, though. We should be testing this
"mode change only" case and making sure that it has the post-74faaa16f0
behavior. So this commit brings back those tests, with the current
expected output.
[1] https://public-inbox.org/git/CA+55aFz88GPJcfMSqiyY+u0Cdm48bEyrsTGxHVJbGsYsDg=Q5w@mail.gmail.com/
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-24 12:27:29 +00:00
|
|
|
test_expect_success '--stat output after text chmod' '
|
|
|
|
test_chmod -x rezrov &&
|
|
|
|
cat >expect <<-\EOF &&
|
|
|
|
rezrov | 0
|
|
|
|
1 file changed, 0 insertions(+), 0 deletions(-)
|
|
|
|
EOF
|
|
|
|
git diff HEAD --stat >actual &&
|
2021-02-11 01:53:53 +00:00
|
|
|
test_cmp expect actual
|
t4006: resurrect commented-out tests
This set of tests was added by 4434e6ba6c (tests: check --[short]stat
output after chmod, 2012-05-01), and is primarily about the handling of
binary versus text files.
Later, 74faaa16f0 (Fix "git diff --stat" for interesting - but empty -
file changes, 2012-10-17) changed the stat output so that the empty text
file is mentioned rather than omitted. That commit just comments out
these tests. There's no discussion in the commit message, but the
original email[1] says:
NOTE! This does break two of our tests, so we clearly did this on
purpose, or at least tested for it. I just uncommented the subtests
that this makes irrelevant, and changed the output of another one.
I don't think they're irrelevant, though. We should be testing this
"mode change only" case and making sure that it has the post-74faaa16f0
behavior. So this commit brings back those tests, with the current
expected output.
[1] https://public-inbox.org/git/CA+55aFz88GPJcfMSqiyY+u0Cdm48bEyrsTGxHVJbGsYsDg=Q5w@mail.gmail.com/
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-24 12:27:29 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success '--shortstat output after text chmod' '
|
|
|
|
tail -n 1 <expect >expect.short &&
|
|
|
|
git diff HEAD --shortstat >actual &&
|
2021-02-11 01:53:53 +00:00
|
|
|
test_cmp expect.short actual
|
t4006: resurrect commented-out tests
This set of tests was added by 4434e6ba6c (tests: check --[short]stat
output after chmod, 2012-05-01), and is primarily about the handling of
binary versus text files.
Later, 74faaa16f0 (Fix "git diff --stat" for interesting - but empty -
file changes, 2012-10-17) changed the stat output so that the empty text
file is mentioned rather than omitted. That commit just comments out
these tests. There's no discussion in the commit message, but the
original email[1] says:
NOTE! This does break two of our tests, so we clearly did this on
purpose, or at least tested for it. I just uncommented the subtests
that this makes irrelevant, and changed the output of another one.
I don't think they're irrelevant, though. We should be testing this
"mode change only" case and making sure that it has the post-74faaa16f0
behavior. So this commit brings back those tests, with the current
expected output.
[1] https://public-inbox.org/git/CA+55aFz88GPJcfMSqiyY+u0Cdm48bEyrsTGxHVJbGsYsDg=Q5w@mail.gmail.com/
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-24 12:27:29 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success '--stat output after binary chmod' '
|
|
|
|
test_chmod +x binbin &&
|
|
|
|
cat >expect <<-EOF &&
|
|
|
|
binbin | Bin
|
|
|
|
rezrov | 0
|
|
|
|
2 files changed, 0 insertions(+), 0 deletions(-)
|
|
|
|
EOF
|
|
|
|
git diff HEAD --stat >actual &&
|
2021-02-11 01:53:53 +00:00
|
|
|
test_cmp expect actual
|
t4006: resurrect commented-out tests
This set of tests was added by 4434e6ba6c (tests: check --[short]stat
output after chmod, 2012-05-01), and is primarily about the handling of
binary versus text files.
Later, 74faaa16f0 (Fix "git diff --stat" for interesting - but empty -
file changes, 2012-10-17) changed the stat output so that the empty text
file is mentioned rather than omitted. That commit just comments out
these tests. There's no discussion in the commit message, but the
original email[1] says:
NOTE! This does break two of our tests, so we clearly did this on
purpose, or at least tested for it. I just uncommented the subtests
that this makes irrelevant, and changed the output of another one.
I don't think they're irrelevant, though. We should be testing this
"mode change only" case and making sure that it has the post-74faaa16f0
behavior. So this commit brings back those tests, with the current
expected output.
[1] https://public-inbox.org/git/CA+55aFz88GPJcfMSqiyY+u0Cdm48bEyrsTGxHVJbGsYsDg=Q5w@mail.gmail.com/
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-24 12:27:29 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success '--shortstat output after binary chmod' '
|
|
|
|
tail -n 1 <expect >expect.short &&
|
|
|
|
git diff HEAD --shortstat >actual &&
|
2021-02-11 01:53:53 +00:00
|
|
|
test_cmp expect.short actual
|
t4006: resurrect commented-out tests
This set of tests was added by 4434e6ba6c (tests: check --[short]stat
output after chmod, 2012-05-01), and is primarily about the handling of
binary versus text files.
Later, 74faaa16f0 (Fix "git diff --stat" for interesting - but empty -
file changes, 2012-10-17) changed the stat output so that the empty text
file is mentioned rather than omitted. That commit just comments out
these tests. There's no discussion in the commit message, but the
original email[1] says:
NOTE! This does break two of our tests, so we clearly did this on
purpose, or at least tested for it. I just uncommented the subtests
that this makes irrelevant, and changed the output of another one.
I don't think they're irrelevant, though. We should be testing this
"mode change only" case and making sure that it has the post-74faaa16f0
behavior. So this commit brings back those tests, with the current
expected output.
[1] https://public-inbox.org/git/CA+55aFz88GPJcfMSqiyY+u0Cdm48bEyrsTGxHVJbGsYsDg=Q5w@mail.gmail.com/
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-24 12:27:29 +00:00
|
|
|
'
|
2012-05-01 17:10:13 +00:00
|
|
|
|
2005-05-25 23:00:04 +00:00
|
|
|
test_done
|