summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/README13
-rw-r--r--t/annotate-tests.sh2
-rw-r--r--t/diff-lib.sh2
-rw-r--r--t/diff-lib/COPYING361
-rw-r--r--t/diff-lib/README46
-rwxr-xr-xt/lib-gpg.sh39
-rw-r--r--t/lib-gpg/keyring.gpg142
-rw-r--r--t/lib-gpg/ownertrust4
-rw-r--r--t/lib-gpg/pubring.gpgbin2359 -> 0 bytes
-rw-r--r--t/lib-gpg/random_seedbin600 -> 0 bytes
-rw-r--r--t/lib-gpg/secring.gpgbin3734 -> 0 bytes
-rw-r--r--t/lib-gpg/trustdb.gpgbin1360 -> 0 bytes
-rw-r--r--t/lib-httpd.sh3
-rw-r--r--t/lib-httpd/apache.conf2
-rw-r--r--t/lib-terminal.sh2
-rw-r--r--t/perf/perf-lib.sh2
-rwxr-xr-xt/t0000-basic.sh4
-rwxr-xr-xt/t0001-init.sh7
-rwxr-xr-xt/t0005-signals.sh8
-rwxr-xr-xt/t0006-date.sh3
-rwxr-xr-xt/t0011-hashmap.sh2
-rwxr-xr-xt/t0020-crlf.sh224
-rwxr-xr-xt/t0027-auto-crlf.sh82
-rwxr-xr-xt/t0030-stripspace.sh6
-rwxr-xr-xt/t0040-parse-options.sh12
-rwxr-xr-xt/t0050-filesystem.sh14
-rwxr-xr-xt/t0056-git-C.sh10
-rwxr-xr-xt/t0061-run-command.sh2
-rwxr-xr-xt/t0062-revision-walking.sh2
-rwxr-xr-xt/t0090-cache-tree.sh4
-rwxr-xr-xt/t0201-gettext-fallbacks.sh8
-rwxr-xr-xt/t0300-credentials.sh9
-rwxr-xr-xt/t1002-read-tree-m-u-2way.sh8
-rwxr-xr-xt/t1006-cat-file.sh2
-rwxr-xr-xt/t1014-read-tree-confusing.sh62
-rwxr-xr-xt/t1050-large.sh12
-rwxr-xr-xt/t1300-repo-config.sh4
-rwxr-xr-xt/t1301-shared-repo.sh31
-rwxr-xr-xt/t1307-config-blob.sh9
-rwxr-xr-xt/t1400-update-ref.sh92
-rwxr-xr-xt/t1403-show-ref.sh10
-rwxr-xr-xt/t1410-reflog.sh30
-rwxr-xr-xt/t1450-fsck.sh82
-rwxr-xr-xt/t1509-root-worktree.sh17
-rwxr-xr-xt/t1700-split-index.sh17
-rwxr-xr-xt/t2004-checkout-cache-temp.sh400
-rwxr-xr-xt/t2022-checkout-paths.sh17
-rwxr-xr-xt/t2024-checkout-dwim.sh18
-rwxr-xr-xt/t2107-update-index-basic.sh15
-rwxr-xr-xt/t3001-ls-files-others-exclude.sh2
-rwxr-xr-xt/t3010-ls-files-killed-modified.sh17
-rwxr-xr-xt/t3031-merge-criscross.sh2
-rwxr-xr-xt/t3060-ls-files-with-tree.sh14
-rwxr-xr-xt/t3102-ls-tree-wildcards.sh22
-rwxr-xr-xt/t3200-branch.sh14
-rwxr-xr-xt/t3202-show-branch-octopus.sh2
-rwxr-xr-xt/t3203-branch-output.sh39
-rwxr-xr-xt/t3301-notes.sh1341
-rwxr-xr-xt/t3305-notes-fanout.sh9
-rwxr-xr-xt/t3404-rebase-interactive.sh20
-rwxr-xr-xt/t3405-rebase-malformed.sh4
-rwxr-xr-xt/t3425-rebase-topology-merges.sh4
-rwxr-xr-xt/t3507-cherry-pick-conflict.sh42
-rwxr-xr-xt/t3511-cherry-pick-x.sh28
-rwxr-xr-xt/t3600-rm.sh42
-rwxr-xr-xt/t3700-add.sh8
-rwxr-xr-xt/t3901-i18n-patch.sh8
-rwxr-xr-xt/t4003-diff-rename-1.sh4
-rwxr-xr-xt/t4005-diff-rename-2.sh4
-rwxr-xr-xt/t4007-rename-3.sh2
-rwxr-xr-xt/t4008-diff-break-rewrite.sh292
-rwxr-xr-xt/t4009-diff-rename-4.sh4
-rwxr-xr-xt/t4010-diff-pathspec.sh2
-rw-r--r--t/t4013/diff.log_--decorate_--all2
-rwxr-xr-xt/t4014-format-patch.sh2
-rwxr-xr-xt/t4022-diff-rewrite.sh5
-rwxr-xr-xt/t4023-diff-rename-typechange.sh3
-rwxr-xr-xt/t4024-diff-optimize-common.sh2
-rwxr-xr-xt/t4026-color.sh33
-rwxr-xr-xt/t4035-diff-quiet.sh66
-rwxr-xr-xt/t4041-diff-submodule-option.sh12
-rwxr-xr-xt/t4046-diff-unmerged.sh8
-rwxr-xr-xt/t4047-diff-dirstat.sh16
-rwxr-xr-xt/t4049-diff-stat-count.sh6
-rwxr-xr-xt/t4052-stat-output.sh48
-rwxr-xr-xt/t4053-diff-no-index.sh4
-rwxr-xr-xt/t4054-diff-bogus-tree.sh2
-rwxr-xr-xt/t4058-diff-duplicates.sh79
-rwxr-xr-xt/t4104-apply-boundary.sh32
-rwxr-xr-xt/t4117-apply-reject.sh66
-rwxr-xr-xt/t4122-apply-symlink-inside.sh117
-rwxr-xr-xt/t4124-apply-ws-rule.sh5
-rwxr-xr-xt/t4138-apply-ws-expansion.sh121
-rwxr-xr-xt/t4139-apply-escape.sh141
-rwxr-xr-xt/t4150-am.sh23
-rwxr-xr-xt/t4151-am-abort.sh2
-rwxr-xr-xt/t4202-log.sh51
-rwxr-xr-xt/t4207-log-decoration-colors.sh16
-rwxr-xr-xt/t4212-log-corrupt.sh2
-rwxr-xr-xt/t4255-am-submodule.sh72
-rwxr-xr-xt/t5000-tar-tree.sh2
-rwxr-xr-xt/t5003-archive-zip.sh47
-rwxr-xr-xt/t5004-archive-corner-cases.sh6
-rwxr-xr-xt/t5100-mailinfo.sh4
-rw-r--r--t/t5100/info0012--message-id5
-rw-r--r--t/t5100/msg0012--message-id8
-rw-r--r--t/t5100/patch0012--message-id30
-rwxr-xr-xt/t5304-prune.sh8
-rwxr-xr-xt/t5312-prune-corruption.sh114
-rwxr-xr-xt/t5400-send-pack.sh16
-rwxr-xr-xt/t5500-fetch-pack.sh53
-rwxr-xr-xt/t5503-tagfollow.sh4
-rwxr-xr-xt/t5505-remote.sh13
-rwxr-xr-xt/t5510-fetch.sh4
-rwxr-xr-xt/t5512-ls-remote.sh6
-rwxr-xr-xt/t5514-fetch-multiple.sh4
-rwxr-xr-xt/t5516-fetch-push.sh182
-rwxr-xr-xt/t5526-fetch-submodules.sh10
-rwxr-xr-xt/t5527-fetch-odd-refs.sh33
-rwxr-xr-xt/t5528-push-default.sh32
-rwxr-xr-xt/t5531-deep-submodule-push.sh2
-rwxr-xr-xt/t5533-push-cas.sh6
-rwxr-xr-xt/t5540-http-push-webdav.sh2
-rwxr-xr-xt/t5541-http-push-smart.sh8
-rwxr-xr-xt/t5543-atomic-push.sh194
-rwxr-xr-xt/t5550-http-fetch-dumb.sh66
-rwxr-xr-xt/t5551-http-fetch-smart.sh36
-rwxr-xr-xt/t5570-git-daemon.sh27
-rwxr-xr-xt/t5601-clone.sh59
-rwxr-xr-xt/t5700-clone-reference.sh17
-rwxr-xr-xt/t5709-clone-refspec.sh2
-rwxr-xr-xt/t5801-remote-helpers.sh24
-rwxr-xr-xt/t6000-rev-list-misc.sh8
-rwxr-xr-xt/t6006-rev-list-format.sh7
-rwxr-xr-xt/t6012-rev-list-simplify.sh10
-rwxr-xr-xt/t6014-rev-list-all.sh4
-rwxr-xr-xt/t6022-merge-rename.sh6
-rwxr-xr-xt/t6023-merge-file.sh3
-rwxr-xr-xt/t6026-merge-attr.sh6
-rwxr-xr-xt/t6028-merge-up-to-date.sh2
-rwxr-xr-xt/t6030-bisect-porcelain.sh100
-rwxr-xr-xt/t6032-merge-large-rename.sh6
-rwxr-xr-xt/t6034-merge-rename-nocruft.sh66
-rwxr-xr-xt/t6036-recursive-corner-cases.sh11
-rwxr-xr-xt/t6039-merge-ignorecase.sh2
-rwxr-xr-xt/t6040-tracking-info.sh7
-rwxr-xr-xt/t6111-rev-list-treesame.sh7
-rwxr-xr-xt/t6132-pathspec-exclude.sh28
-rwxr-xr-xt/t6200-fmt-merge-msg.sh2
-rwxr-xr-xt/t6300-for-each-ref.sh13
-rwxr-xr-xt/t7001-mv.sh5
-rwxr-xr-xt/t7004-tag.sh46
-rwxr-xr-xt/t7006-pager.sh2
-rwxr-xr-xt/t7007-show.sh4
-rwxr-xr-xt/t7009-filter-branch-null-sha1.sh2
-rwxr-xr-xt/t7201-co.sh21
-rwxr-xr-xt/t7300-clean.sh10
-rwxr-xr-xt/t7400-submodule-basic.sh21
-rwxr-xr-xt/t7406-submodule-update.sh2
-rwxr-xr-xt/t7508-status.sh113
-rwxr-xr-xt/t7510-signed-commit.sh6
-rwxr-xr-xt/t7513-interpret-trailers.sh34
-rwxr-xr-xt/t7516-commit-races.sh30
-rwxr-xr-xt/t7600-merge.sh2
-rwxr-xr-xt/t7612-merge-verify-signatures.sh2
-rwxr-xr-xt/t7701-repack-unpack-unreachable.sh2
-rwxr-xr-xt/t8003-blame-corner-cases.sh8
-rwxr-xr-xt/t8008-blame-formats.sh2
-rwxr-xr-xt/t9001-send-email.sh679
-rwxr-xr-xt/t9104-git-svn-follow-parent.sh10
-rwxr-xr-xt/t9148-git-svn-propset.sh95
-rwxr-xr-xt/t9158-git-svn-mergeinfo.sh4
-rwxr-xr-xt/t9161-git-svn-mergeinfo-push.sh10
-rwxr-xr-xt/t9300-fast-import.sh15
-rwxr-xr-xt/t9500-gitweb-standalone-no-errors.sh7
-rwxr-xr-xt/t9502-gitweb-standalone-parse-output.sh10
-rwxr-xr-xt/t9603-cvsimport-patchsets.sh2
-rwxr-xr-xt/t9604-cvsimport-timestamps.sh4
-rwxr-xr-xt/t9817-git-p4-exclude.sh71
-rwxr-xr-xt/t9902-completion.sh21
-rwxr-xr-xt/t9903-bash-prompt.sh119
-rw-r--r--t/test-lib-functions.sh4
-rw-r--r--t/test-lib.sh159
183 files changed, 5152 insertions, 2385 deletions
diff --git a/t/README b/t/README
index 9952261..35438bc 100644
--- a/t/README
+++ b/t/README
@@ -168,6 +168,16 @@ appropriately before running "make".
Using this option with a RAM-based filesystem (such as tmpfs)
can massively speed up the test suite.
+--chain-lint::
+--no-chain-lint::
+ If --chain-lint is enabled, the test harness will check each
+ test to make sure that it properly "&&-chains" all commands (so
+ that a failure in the middle does not go unnoticed by the final
+ exit code of the test). This check is performed in addition to
+ running the tests themselves. You may also enable or disable
+ this feature by setting the GIT_TEST_CHAIN_LINT environment
+ variable to "1" or "0", respectively.
+
You can also set the GIT_TEST_INSTALLED environment variable to
the bindir of an existing git installation to test that installation.
You still need to have built this git sandbox, from which various
@@ -418,7 +428,8 @@ Don't:
dies in an unexpected way (e.g. segfault).
On the other hand, don't use test_must_fail for running regular
- platform commands; just use '! cmd'.
+ platform commands; just use '! cmd'. We are not in the business
+ of verifying that the world given to us sanely works.
- use perl without spelling it as "$PERL_PATH". This is to help our
friends on Windows where the platform Perl often adds CR before
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index 071e4d7..f5c0175 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -405,7 +405,7 @@ test_expect_success 'setup -L :regex' '
mv hello.c hello.orig &&
echo "#include <stdio.h>" >hello.c &&
cat hello.orig >>hello.c &&
- tr Q "\\t" >>hello.c <<-\EOF
+ tr Q "\\t" >>hello.c <<-\EOF &&
void mail()
{
Qputs("mail");
diff --git a/t/diff-lib.sh b/t/diff-lib.sh
index 75a35fc..c211dc4 100644
--- a/t/diff-lib.sh
+++ b/t/diff-lib.sh
@@ -1,6 +1,6 @@
:
-sanitize_diff_raw='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]* / X X \1# /'
+sanitize_diff_raw='/^:/s/ '"\($_x40\)"' '"\($_x40\)"' \([A-Z]\)[0-9]* / \1 \2 \3# /'
compare_diff_raw () {
# When heuristics are improved, the score numbers would change.
# Ignore them while comparing.
diff --git a/t/diff-lib/COPYING b/t/diff-lib/COPYING
new file mode 100644
index 0000000..6ff87c4
--- /dev/null
+++ b/t/diff-lib/COPYING
@@ -0,0 +1,361 @@
+
+ Note that the only valid version of the GPL as far as this project
+ is concerned is _this_ particular version of the license (ie v2, not
+ v2.2 or v3.x or whatever), unless explicitly otherwise stated.
+
+ HOWEVER, in order to allow a migration to GPLv3 if that seems like
+ a good idea, I also ask that people involved with the project make
+ their preferences known. In particular, if you trust me to make that
+ decision, you might note so in your copyright message, ie something
+ like
+
+ This file is licensed under the GPL v2, or a later version
+ at the discretion of Linus.
+
+ might avoid issues. But we can also just decide to synchronize and
+ contact all copyright holders on record if/when the occasion arises.
+
+ Linus Torvalds
+
+----------------------------------------
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/t/diff-lib/README b/t/diff-lib/README
new file mode 100644
index 0000000..548142c
--- /dev/null
+++ b/t/diff-lib/README
@@ -0,0 +1,46 @@
+////////////////////////////////////////////////////////////////
+
+ GIT - the stupid content tracker
+
+////////////////////////////////////////////////////////////////
+
+"git" can mean anything, depending on your mood.
+
+ - random three-letter combination that is pronounceable, and not
+ actually used by any common UNIX command. The fact that it is a
+ mispronunciation of "get" may or may not be relevant.
+ - stupid. contemptible and despicable. simple. Take your pick from the
+ dictionary of slang.
+ - "global information tracker": you're in a good mood, and it actually
+ works for you. Angels sing, and a light suddenly fills the room.
+ - "goddamn idiotic truckload of sh*t": when it breaks
+
+Git is a fast, scalable, distributed revision control system with an
+unusually rich command set that provides both high-level operations
+and full access to internals.
+
+Git is an Open Source project covered by the GNU General Public License.
+It was originally written by Linus Torvalds with help of a group of
+hackers around the net. It is currently maintained by Junio C Hamano.
+
+Please read the file INSTALL for installation instructions.
+See Documentation/tutorial.txt to get started, then see
+Documentation/everyday.txt for a useful minimum set of commands,
+and "man git-commandname" for documentation of each command.
+CVS users may also want to read Documentation/cvs-migration.txt.
+
+Many Git online resources are accessible from http://git.or.cz/
+including full documentation and Git related tools.
+
+The user discussion and development of Git take place on the Git
+mailing list -- everyone is welcome to post bug reports, feature
+requests, comments and patches to git@vger.kernel.org. To subscribe
+to the list, send an email with just "subscribe git" in the body to
+majordomo@vger.kernel.org. The mailing list archives are available at
+http://marc.theaimsgroup.com/?l=git and other archival sites.
+
+The messages titled "A note from the maintainer", "What's in
+git.git (stable)" and "What's cooking in git.git (topics)" and
+the discussion following them on the mailing list give a good
+reference for project status, development direction and
+remaining tasks.
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index cd2baef..db2ef22 100755
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -12,20 +12,43 @@ else
say "Your version of gpg (1.0.6) is too buggy for testing"
;;
*)
- # key generation info: gpg --homedir t/lib-gpg --gen-key
- # Type DSA and Elgamal, size 2048 bits, no expiration date.
- # Name and email: C O Mitter <committer@example.com>
+ # Available key info:
+ # * Type DSA and Elgamal, size 2048 bits, no expiration date,
+ # name and email: C O Mitter <committer@example.com>
+ # * Type RSA, size 2048 bits, no expiration date,
+ # name and email: Eris Discordia <discord@example.net>
# No password given, to enable non-interactive operation.
- cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
- chmod 0700 gpghome
- chmod 0600 gpghome/*
- GNUPGHOME="$(pwd)/gpghome"
- export GNUPGHOME
+ # To generate new key:
+ # gpg --homedir /tmp/gpghome --gen-key
+ # To write armored exported key to keyring:
+ # gpg --homedir /tmp/gpghome --export-secret-keys \
+ # --armor 0xDEADBEEF >> lib-gpg/keyring.gpg
+ # gpg --homedir /tmp/gpghome --export \
+ # --armor 0xDEADBEEF >> lib-gpg/keyring.gpg
+ # To export ownertrust:
+ # gpg --homedir /tmp/gpghome --export-ownertrust \
+ # > lib-gpg/ownertrust
+ mkdir ./gpghome &&
+ chmod 0700 ./gpghome &&
+ GNUPGHOME="$(pwd)/gpghome" &&
+ export GNUPGHOME &&
+ gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \
+ "$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
+ gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \
+ "$TEST_DIRECTORY"/lib-gpg/ownertrust &&
+ gpg --homedir "${GNUPGHOME}" </dev/null >/dev/null 2>&1 \
+ --sign -u committer@example.com &&
test_set_prereq GPG
;;
esac
fi
+if test_have_prereq GPG &&
+ echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
+then
+ test_set_prereq RFC1991
+fi
+
sanitize_pgp() {
perl -ne '
/^-----END PGP/ and $in_pgp = 0;
diff --git a/t/lib-gpg/keyring.gpg b/t/lib-gpg/keyring.gpg
new file mode 100644
index 0000000..d4754a1
--- /dev/null
+++ b/t/lib-gpg/keyring.gpg
@@ -0,0 +1,142 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+Version: GnuPG v1
+
+lQG7BEZnyykRBACzCPjIpTYNL7Y2tQqlEGTTDlvZcWNLjF5f7ZzuyOqNOidLUgFD
+36qch1LZLSZkShdR3Gae+bsolyjxrlFuFP0eXRPMtqK20aLw7WZvPFpEV1ThMne+
+PRJjYrvghWw3L0VVIAIZ8GXwrVBuU99uEjHEI0ojYloOvFc2jVPgSaoBvwCg48Tj
+fol2foSoJa7XUu9yAL8szg8D/RUsTzNF+I9hSRHl7MYKFMYoKEY9BDgrgAujp7YY
+8qdGsiUb0Ggyzp2kRjZFt4lpcvKhGfHn5GEjmtk+fRbD5qPfMqKFW+T0NPfYlYmL
+JJ4fs4qZ8Lx7x6iG6X51u+YNwsQuIGjMCC3CeNi3F7or651kkNYASbaQ1NROkCIN
+NudyA/0aasvoZUoNJAc2cP5Ifs6WhXMWLfMR2p2XbfKwKNYneec60usnSComcKqh
+sJVk0Gytvr3FOYVhRkXnKAbx+0W2urFP8OFVBTEKO6Ts2VygWGgneQYoHnqzwlUE
+yjOjlr+lyf7u2s/KAxpKA6jnttEdRZAmzWkhuox1wwAUkr27/QAAn3TEzKR1pxxR
++R3dHuFpnnfatMIDC5O0IkMgTyBNaXR0ZXIgPGNvbW1pdHRlckBleGFtcGxlLmNv
+bT6IXgQTEQIAHgUCRmfLKQIbAwYLCQgHAwIDFQIDAxYCAQIeAQIXgAAKCRATtvUe
+zd5DDXQdAKC92f+wOrTkbmPEf+u+qA/Gv6BxQwCfQ128JXCi3MpMB8tI2Kmo15tY
+gnmdAj0ERmfLThAIAM65eT9T6+gg0fJn+Qxhs3FFDPjxK6AOBS3SieWWmXO6stZZ
+plvb7r2+sXYp8HMHntnOX3TRPolIx1dsdkv3W3w8yUzf9Lmo2XMPsZ3/isWdEbOI
+A0rO3B1xwbQO7vEoWHeB7uyYIF6YsIH0pMqxkImciwB1tnJPB9OxqPHlD/HyyHr2
+voj6nmEGaPQWj8/dkfyenXm6XmNZUZL/slk6tRhNwv4cW3QQLh39nbiz9rqvZMKF
+XX8wkY4FdQkJjCGwqzG+7yJcyHvem29/iq//jRLZgdiN8BwV3MCTJyDp8/Wb/d9y
+jZcUm1RdtwRiwfhfQ+zmpyspm7OxINfH65rf7f8ABA0IALRiMRs/eOD59jrYXmPS
+ZQUbiALlbJJtuP2c9N3WZ5OgrhDiAW+SDIN+hgDynJ9b7C2dE3xNaud4zaXAAF44
+J4J0bAo2ZtZoJajw+GXwaZfh4Z7nPNHwEcbFD4/uXPCj9jPkcLOJqGmUY1aXdygo
+t3Hn5U/zo8JxPQ83YbJQhkzAOZ/HGowLNqKgGkLLHn1X9qay0CxlfTQeEN5RZyl3
+b4qRzGgGALFvoheyZIUw1TbjRpbn3kqlJooEQY02VwXFXfLI/LwzglilH6sSckvs
+0WHKLZ+0L6b3CgJHN2RsZ7QxwCBi1aemsvr65FeEXp/AYxaG5duUbsugG8PgoJ06
+bsEAAVQNQO3cXWpuiJ/nNLLnWuPunBKJUlurkBdf2GD+m+muF0VpwDchhqqbTO4e
+FqOISQQYEQIACQUCRmfLTgIbDAAKCRATtvUezd5DDcHsAKDQcoAtDWJFupVRqleB
+Cezx4Q2khACcCs+/LtE8Lb9hC+2cvr3uH5p82AI=
+=aEiU
+-----END PGP PRIVATE KEY BLOCK-----
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+Version: GnuPG v1
+
+lQOYBFFMlkcBCADJi/xnAF8yI34PHilSCbM7VtOFO17oFMkpu4cgN2QpPuM5MVjy
+cvrzKSguZFvPCDLzeAFJW1uPxL4SHaHSkisCrFhijH7OJWcOPNPSFCwu+inAoAsv
+Hm4ns6pfDZyRjVTHSY4rdMISqKFRozaXu8vHeBRzIhFnubBCepKZW07oKPnrnELV
+TVUSUVI+6el8JFmJIWxxLNLhfRRSPF0v4MDXPF//iCWiZDI+J1pLvQ5V/f7YtfsD
+GV0oPY66J72BFJG555eKBttnNY901LmI3ocn5P5iVnXDaqMElw7FKpnANXucgY3H
+4kLyNkI3s3J0CGbXI7b3MBWtjctuhWv1q2G5ABEBAAEAB/wLiuza/qEfv1Cfj7FQ
+ytAXpz1YoAcrcM/53TeRQhrbvIee5ZNGhLdCkyot81QeuJrSaXO0E9CxRynrjQQ7
+ibYqN7Hy0uu1kAbQQJjmVdQXTKnKJ7Wm7oM4hYhNsVCKNXc+1+5AfDYGg4nZob36
+qqgHtc+Ardl5VfUg7uF+eZrnSMynjZANgikKbPtE09DKVtVOtUE4xTD9ijkpgn65
+glsZDqb7J4QVgTeEiCDKJsQvin3SwrPBqBxBRULF2TIaMbOwe6dHiiaI85rsvAWS
+VGzonUB3IU1470P2SDIVczbXYUK/nDSGx6ZZ0wLu9ZcCyUPvxVEykuh2P4UWHla+
+nHLRBADMLavcfjsCI5CRUsdurYpgE8Y3bEbcDpvzAu5jT5D25p3YPDODOXD3AKTt
+PzVMARVtv8twkbgAyWaoDevJz8OtmoSwsWjdFo4YvsYw9jV7Yf3GwzD3Ya1ZnW32
+JWQr6cX8qcK0AukAD7UZkVyhU2KBvB02t8lKHLbScHXTYVqrywQA/LNUXwmHji+6
+osnSQAC8X9ggMOEs9dGo7Qlk4JgfGAH17CFI3S3ubsaVEdxz3YwzOkD8SNmEbLyW
+a7CZ/RnpdAZU0nB7kSfbfZl7ajhPbgKBMsaV2yvaDdJeor4m5eKdXffRk0SksxjL
+Z/4P1tTIuL8WzetGB/aDcWDFgseSAAsEALzmf579ptlSmDyGRAKQqub+mj4V3EUZ
+1GVGcfBY86w3BZVDsaRiCtcNjk/lcP4AZ1Vbb42RM6jk8nLsENRc7rf2xa7ZPf0T
+6n5F6W+vk7EG76RoFhKVtGZngGKiDGVavxk3FT/yf8lKrT3wYiT03SZDuZ0pWvku
+FiJGEyesAC8WRz60JEVyaXMgRGlzY29yZGlhIDxkaXNjb3JkQGV4YW1wbGUubmV0
+PokBOAQTAQIAIgUCUUyWRwIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQ
+YQkuhbcicYlYowf7B+f+FDcLVfw8XzGlKku1F6PI1yGCt7AMO2/JkmO4LlgHuIgF
+pqe5b/XjKl0IsRcbVLitqiIokc8u+7H8yYU67DDliq7t1gqBy+qThSHcgn6WMKTa
+qCqOE2jzHyqulIAzQsJQ+c5SRofEZAKT4Qa2Dy+nsqWDpIE78aJd0Vnkk9U6H2Vu
+ABvUeN/IMgvxPr525o+rBD7LU4J3CtOzfV+sO6+33da+Bm9UhkR4tC4H/n1dDN1J
+YuxBQbgxTq/h8mKe4/7/Yvy+5WsYd96ZRLE2ZFWeWXtKkwmYbQ42G3SZUXaZ8R8O
+tbTyUrjbFKipO4wvXwhyju1l9cxAsrca6xbSCJ0DmARRTJZHAQgAqTtPFcTXqM+U
+o7bOoo+dcHi8XDf/8XSEmZfMKc/U5pSTBk7h1gSKuGzjF2n3wQm6A8+101vTLaQ6
+PoFDFW8uQB00mjymGrRDYFgz8bjhnaekZnA4XThr1ROjffgMhs3uTpCebdV+lL8K
+0oJTHc39TPLTg23DFcRSDN+3ARJJS7+CRBIbt9L5gObpgA4HUap/o6N7O04rQOPU
+83MAqnwo2JTO/Ded0zoad0Vo31Nmk4F+KvEE52ftGHbd7yqIUGKBt2SeTAh850ac
+LeNZP+V1Y7atBCr7/zm+JpHWq9OH7/NomlEIkxL8WDt8GfAKoqZgqefL+ACEnLbA
+t1du3f0FswARAQABAAf8DclaIQDfPM5kYo3y+YVPoykC11RskmQWpVibdlCLHJm/
+/ISSm1fVYT7lpTOpzl0XfVX/jw9s/cviPtNS/r0G/Iwki+gi9Av5bTDiUm/oWWqd
+1waPYPDGwB4QdKOviY/fOSFI9tOsszt5Czs4wDXWy90AZDWd7fkHYisbgofV1sjK
+Q8bYQPabcepcZ2JyET+EpZBEmUHHqQ76bTiqjN+Vz6k1OFlsEBzGkE+WIakAhkQ2
+57oUrRgFe+h6Ch7meB/v6vVfIRSsLpZe183uc4SigqtfsgjbG9PqOcAJOqovDncB
+Scg3qvpWFOAkTA3Re+yBPUd2HHl9WF/TPa2kBDCT2QQAxcJZeUCuUgDgCizqEgfs
+Kzm6dy4G/OJdW0q9m9psHqD1XWLd7ZLE4+eTS1cxktJiGcGNdGoZD0EtgxkV09uM
+12QYCOBErFJzv4/4oledHeEhTaRR/mFFGRp+kWTz2Ai/zNqUd3D++DYUe8g4mVQJ
+6JP014XhvoRnaCfT8cH9Zd0EANsSL70WGdifcVoWKA9jFJhahc0sSG6IZvMOc7bs
+cSbhBqLEnheObkarBP+A+zgllqIf+sbCassMXjcV52mnl9th3J5RWr7scrQLJ9ZX
+Ivz3uoP85vwlUI98dI9roYK0OpKmG4hNFppAcgiCVNVjnQlhuQ/HoexRHxRmnmcb
+38jPA/sEHPCFbLCGOSB+HQNKx/5Wf6VpFX/4oBNbIUiYoxcRl0jpYT7Lc0zbc8So
+HthjPfWhXhKzYvEDC5YgASEy1cNbGMUJcGyuAInwIQjq44FSwRMkI3ISSHnbv1iH
+0wBVJUzpluMebEAesdZUz1DcZWVf6eVJD0dhZxD6DoG7Xj1m9ThUiQEfBBgBAgAJ
+BQJRTJZHAhsMAAoJEGEJLoW3InGJ7HEIAMXkMf4cOWmnAuvvcSm3KpLghuWik9dy
+fn1sY/IG5atoKK+ypmV/TlBlMZqFQzuPIJQT8VLbmxtLlDhJG04LbI6c8axIZxOO
+ZKLy5nTTSy16ztqEeS7eifHLPZg1UFFyEEIQ1XW0CNDAeuWKh90ERjyl4Cg7PnWS
+Z9Ei+zj6JD5Pcdi3BJhQo9WOLOVEJ0NHmewTYqk9QVXH/0v1Hdl4LMJtgcbdbDWk
+4UTkXbg9pn3umCgkNJ3Vs8fWnIWO9Izdr2/wrFY2JvUT7Yvl+wsNIWatvOEzGy7n
+BOW78WUxzhu0YJTLKy+iKCjg5HS5dx6OC+e4aEEgfhNPCMkbvDsJjtQ=
+=hieJ
+-----END PGP PRIVATE KEY BLOCK-----
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1
+
+mQGiBEZnyykRBACzCPjIpTYNL7Y2tQqlEGTTDlvZcWNLjF5f7ZzuyOqNOidLUgFD
+36qch1LZLSZkShdR3Gae+bsolyjxrlFuFP0eXRPMtqK20aLw7WZvPFpEV1ThMne+
+PRJjYrvghWw3L0VVIAIZ8GXwrVBuU99uEjHEI0ojYloOvFc2jVPgSaoBvwCg48Tj
+fol2foSoJa7XUu9yAL8szg8D/RUsTzNF+I9hSRHl7MYKFMYoKEY9BDgrgAujp7YY
+8qdGsiUb0Ggyzp2kRjZFt4lpcvKhGfHn5GEjmtk+fRbD5qPfMqKFW+T0NPfYlYmL
+JJ4fs4qZ8Lx7x6iG6X51u+YNwsQuIGjMCC3CeNi3F7or651kkNYASbaQ1NROkCIN
+NudyA/0aasvoZUoNJAc2cP5Ifs6WhXMWLfMR2p2XbfKwKNYneec60usnSComcKqh
+sJVk0Gytvr3FOYVhRkXnKAbx+0W2urFP8OFVBTEKO6Ts2VygWGgneQYoHnqzwlUE
+yjOjlr+lyf7u2s/KAxpKA6jnttEdRZAmzWkhuox1wwAUkr27/bQiQyBPIE1pdHRl
+ciA8Y29tbWl0dGVyQGV4YW1wbGUuY29tPoheBBMRAgAeBQJGZ8spAhsDBgsJCAcD
+AgMVAgMDFgIBAh4BAheAAAoJEBO29R7N3kMNdB0AoL3Z/7A6tORuY8R/676oD8a/
+oHFDAJ9DXbwlcKLcykwHy0jYqajXm1iCebkCDQRGZ8tOEAgAzrl5P1Pr6CDR8mf5
+DGGzcUUM+PEroA4FLdKJ5ZaZc7qy1lmmW9vuvb6xdinwcwee2c5fdNE+iUjHV2x2
+S/dbfDzJTN/0uajZcw+xnf+KxZ0Rs4gDSs7cHXHBtA7u8ShYd4Hu7JggXpiwgfSk
+yrGQiZyLAHW2ck8H07Go8eUP8fLIeva+iPqeYQZo9BaPz92R/J6debpeY1lRkv+y
+WTq1GE3C/hxbdBAuHf2duLP2uq9kwoVdfzCRjgV1CQmMIbCrMb7vIlzIe96bb3+K
+r/+NEtmB2I3wHBXcwJMnIOnz9Zv933KNlxSbVF23BGLB+F9D7OanKymbs7Eg18fr
+mt/t/wAEDQgAtGIxGz944Pn2OtheY9JlBRuIAuVskm24/Zz03dZnk6CuEOIBb5IM
+g36GAPKcn1vsLZ0TfE1q53jNpcAAXjgngnRsCjZm1mglqPD4ZfBpl+Hhnuc80fAR
+xsUPj+5c8KP2M+Rws4moaZRjVpd3KCi3ceflT/OjwnE9DzdhslCGTMA5n8cajAs2
+oqAaQssefVf2prLQLGV9NB4Q3lFnKXdvipHMaAYAsW+iF7JkhTDVNuNGlufeSqUm
+igRBjTZXBcVd8sj8vDOCWKUfqxJyS+zRYcotn7QvpvcKAkc3ZGxntDHAIGLVp6ay
++vrkV4Ren8BjFobl25Ruy6Abw+CgnTpuwYhJBBgRAgAJBQJGZ8tOAhsMAAoJEBO2
+9R7N3kMNwewAoNBygC0NYkW6lVGqV4EJ7PHhDaSEAJwKz78u0Twtv2EL7Zy+ve4f
+mnzYApkBDQRRTJZHAQgAyYv8ZwBfMiN+Dx4pUgmzO1bThTte6BTJKbuHIDdkKT7j
+OTFY8nL68ykoLmRbzwgy83gBSVtbj8S+Eh2h0pIrAqxYYox+ziVnDjzT0hQsLvop
+wKALLx5uJ7OqXw2ckY1Ux0mOK3TCEqihUaM2l7vLx3gUcyIRZ7mwQnqSmVtO6Cj5
+65xC1U1VElFSPunpfCRZiSFscSzS4X0UUjxdL+DA1zxf/4glomQyPidaS70OVf3+
+2LX7AxldKD2Ouie9gRSRueeXigbbZzWPdNS5iN6HJ+T+YlZ1w2qjBJcOxSqZwDV7
+nIGNx+JC8jZCN7NydAhm1yO29zAVrY3LboVr9athuQARAQABtCRFcmlzIERpc2Nv
+cmRpYSA8ZGlzY29yZEBleGFtcGxlLm5ldD6JATgEEwECACIFAlFMlkcCGwMGCwkI
+BwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEGEJLoW3InGJWKMH+wfn/hQ3C1X8PF8x
+pSpLtRejyNchgrewDDtvyZJjuC5YB7iIBaanuW/14ypdCLEXG1S4raoiKJHPLvux
+/MmFOuww5Yqu7dYKgcvqk4Uh3IJ+ljCk2qgqjhNo8x8qrpSAM0LCUPnOUkaHxGQC
+k+EGtg8vp7Klg6SBO/GiXdFZ5JPVOh9lbgAb1HjfyDIL8T6+duaPqwQ+y1OCdwrT
+s31frDuvt93WvgZvVIZEeLQuB/59XQzdSWLsQUG4MU6v4fJinuP+/2L8vuVrGHfe
+mUSxNmRVnll7SpMJmG0ONht0mVF2mfEfDrW08lK42xSoqTuML18Ico7tZfXMQLK3
+GusW0gi5AQ0EUUyWRwEIAKk7TxXE16jPlKO2zqKPnXB4vFw3//F0hJmXzCnP1OaU
+kwZO4dYEirhs4xdp98EJugPPtdNb0y2kOj6BQxVvLkAdNJo8phq0Q2BYM/G44Z2n
+pGZwOF04a9UTo334DIbN7k6Qnm3VfpS/CtKCUx3N/Uzy04NtwxXEUgzftwESSUu/
+gkQSG7fS+YDm6YAOB1Gqf6OjeztOK0Dj1PNzAKp8KNiUzvw3ndM6GndFaN9TZpOB
+firxBOdn7Rh23e8qiFBigbdknkwIfOdGnC3jWT/ldWO2rQQq+/85viaR1qvTh+/z
+aJpRCJMS/Fg7fBnwCqKmYKnny/gAhJy2wLdXbt39BbMAEQEAAYkBHwQYAQIACQUC
+UUyWRwIbDAAKCRBhCS6FtyJxiexxCADF5DH+HDlppwLr73EptyqS4IblopPXcn59
+bGPyBuWraCivsqZlf05QZTGahUM7jyCUE/FS25sbS5Q4SRtOC2yOnPGsSGcTjmSi
+8uZ000stes7ahHku3onxyz2YNVBRchBCENV1tAjQwHrliofdBEY8peAoOz51kmfR
+Ivs4+iQ+T3HYtwSYUKPVjizlRCdDR5nsE2KpPUFVx/9L9R3ZeCzCbYHG3Ww1pOFE
+5F24PaZ97pgoJDSd1bPH1pyFjvSM3a9v8KxWNib1E+2L5fsLDSFmrbzhMxsu5wTl
+u/FlMc4btGCUyysvoigo4OR0uXcejgvnuGhBIH4TTwjJG7w7CY7U
+=iYv/
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/t/lib-gpg/ownertrust b/t/lib-gpg/ownertrust
new file mode 100644
index 0000000..b3e3c4f
--- /dev/null
+++ b/t/lib-gpg/ownertrust
@@ -0,0 +1,4 @@
+# List of assigned trustvalues, created Thu 11 Dec 2014 01:26:28 PM CET
+# (Use "gpg --import-ownertrust" to restore them)
+73D758744BE721698EC54E8713B6F51ECDDE430D:6:
+D4BE22311AD3131E5EDA29A461092E85B7227189:3:
diff --git a/t/lib-gpg/pubring.gpg b/t/lib-gpg/pubring.gpg
deleted file mode 100644
index 1a3c2d4..0000000
--- a/t/lib-gpg/pubring.gpg
+++ /dev/null
Binary files differ
diff --git a/t/lib-gpg/random_seed b/t/lib-gpg/random_seed
deleted file mode 100644
index 95d249f..0000000
--- a/t/lib-gpg/random_seed
+++ /dev/null
Binary files differ
diff --git a/t/lib-gpg/secring.gpg b/t/lib-gpg/secring.gpg
deleted file mode 100644
index 82dca8f..0000000
--- a/t/lib-gpg/secring.gpg
+++ /dev/null
Binary files differ
diff --git a/t/lib-gpg/trustdb.gpg b/t/lib-gpg/trustdb.gpg
deleted file mode 100644
index 4879ae9..0000000
--- a/t/lib-gpg/trustdb.gpg
+++ /dev/null
Binary files differ
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index fd53b57..e6adf2f 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -37,7 +37,7 @@ then
test_done
fi
-if ! test_have_prereq SANITY; then
+if ! test_have_prereq NOT_ROOT; then
test_skip_or_die $GIT_TEST_HTTPD \
"Cannot run httpd tests as root"
fi
@@ -79,6 +79,7 @@ HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www
# hack to suppress apache PassEnv warnings
GIT_VALGRIND=$GIT_VALGRIND; export GIT_VALGRIND
GIT_VALGRIND_OPTIONS=$GIT_VALGRIND_OPTIONS; export GIT_VALGRIND_OPTIONS
+GIT_TRACE=$GIT_TRACE; export GIT_TRACE
if ! test -x "$LIB_HTTPD_PATH"
then
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 7713dd2..0b81a00 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -69,6 +69,8 @@ LockFile accept.lock
PassEnv GIT_VALGRIND
PassEnv GIT_VALGRIND_OPTIONS
PassEnv GNUPGHOME
+PassEnv ASAN_OPTIONS
+PassEnv GIT_TRACE
Alias /dumb/ www/
Alias /auth/dumb/ www/auth/dumb/
diff --git a/t/lib-terminal.sh b/t/lib-terminal.sh
index 5184549..cd220e3 100644
--- a/t/lib-terminal.sh
+++ b/t/lib-terminal.sh
@@ -1,7 +1,7 @@
# Helpers for terminal output tests.
# Catch tests which should depend on TTY but forgot to. There's no need
-# to aditionally check that the TTY prereq is set here. If the test declared
+# to additionally check that the TTY prereq is set here. If the test declared
# it and we are running the test, then it must have been set.
test_terminal () {
if ! test_declared_prereq TTY
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index a8c9574..5cf74ed 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -91,7 +91,7 @@ test_perf_create_repo_from () {
*/objects|*/hooks|*/config)
;;
*)
- cp -R "$stuff" . || break
+ cp -R "$stuff" . || exit 1
;;
esac
done &&
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index f10ba4a..79b9074 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -253,7 +253,7 @@ test_expect_success 'test --verbose' '
test_expect_success "failing test" false
test_done
EOF
- mv test-verbose/out test-verbose/out+
+ mv test-verbose/out test-verbose/out+ &&
grep -v "^Initialized empty" test-verbose/out+ >test-verbose/out &&
check_sub_test_lib_test test-verbose <<-\EOF
> expecting success: true
@@ -974,7 +974,7 @@ test_expect_success 'writing this tree with --missing-ok' '
################################################################
test_expect_success 'git read-tree followed by write-tree should be idempotent' '
- rm -f .git/index
+ rm -f .git/index &&
git read-tree $tree &&
test -f .git/index &&
newtree=$(git write-tree) &&
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index e62c0ff..7de8d85 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -12,6 +12,13 @@ check_config () {
echo "expected a directory $1, a file $1/config and $1/refs"
return 1
fi
+
+ if test_have_prereq POSIXPERM && test -x "$1/config"
+ then
+ echo "$1/config is executable?"
+ return 1
+ fi
+
bare=$(cd "$1" && git config --bool core.bare)
worktree=$(cd "$1" && git config core.worktree) ||
worktree=unset
diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
index aeea50c..e7f27eb 100755
--- a/t/t0005-signals.sh
+++ b/t/t0005-signals.sh
@@ -10,8 +10,8 @@ one
EOF
test_expect_success 'sigchain works' '
- test-sigchain >actual
- case "$?" in
+ { test-sigchain >actual; ret=$?; } &&
+ case "$ret" in
143) true ;; # POSIX w/ SIGTERM=15
271) true ;; # ksh w/ SIGTERM=15
3) true ;; # Windows
@@ -40,12 +40,12 @@ test_expect_success 'create blob' '
'
test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '
- OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 )
+ OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
test "$OUT" -eq 141
'
test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '
- OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 )
+ OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 ) &&
test "$OUT" -eq 141
'
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index e53cf6d..fac0986 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -82,4 +82,7 @@ check_approxidate 'Jun 6, 5AM' '2009-06-06 05:00:00'
check_approxidate '5AM Jun 6' '2009-06-06 05:00:00'
check_approxidate '6AM, June 7, 2009' '2009-06-07 06:00:00'
+check_approxidate '2008-12-01' '2008-12-01 19:20:00'
+check_approxidate '2009-12-01' '2009-12-01 19:20:00'
+
test_done
diff --git a/t/t0011-hashmap.sh b/t/t0011-hashmap.sh
index f97c805..9c217d9 100755
--- a/t/t0011-hashmap.sh
+++ b/t/t0011-hashmap.sh
@@ -218,7 +218,7 @@ test_expect_success 'grow / shrink' '
echo size >> in &&
echo 64 51 >> expect &&
echo put key52 value52 >> in &&
- echo NULL >> expect
+ echo NULL >> expect &&
echo size >> in &&
echo 256 52 >> expect &&
for n in $(test_seq 12)
diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh
index d2e51a8..f94120a 100755
--- a/t/t0020-crlf.sh
+++ b/t/t0020-crlf.sh
@@ -8,6 +8,13 @@ has_cr() {
tr '\015' Q <"$1" | grep Q >/dev/null
}
+# add or remove CRs to disk file in-place
+# usage: munge_cr <append|remove> <file>
+munge_cr () {
+ "${1}_cr" <"$2" >tmp &&
+ mv tmp "$2"
+}
+
test_expect_success setup '
git config core.autocrlf false &&
@@ -28,9 +35,7 @@ test_expect_success setup '
for w in Some extra lines here; do echo $w; done >>one &&
git diff >patch.file &&
patched=$(git hash-object --stdin <one) &&
- git read-tree --reset -u HEAD &&
-
- echo happy.
+ git read-tree --reset -u HEAD
'
test_expect_success 'safecrlf: autocrlf=input, all CRLF' '
@@ -100,22 +105,11 @@ test_expect_success 'update with autocrlf=input' '
rm -f tmp one dir/two three &&
git read-tree --reset -u HEAD &&
git config core.autocrlf input &&
-
- for f in one dir/two
- do
- append_cr <$f >tmp && mv -f tmp $f &&
- git update-index -- $f || {
- echo Oops
- false
- break
- }
- done &&
-
+ munge_cr append one &&
+ munge_cr append dir/two &&
+ git update-index -- one dir/two &&
differs=$(git diff-index --cached HEAD) &&
- test -z "$differs" || {
- echo Oops "$differs"
- false
- }
+ verbose test -z "$differs"
'
@@ -124,22 +118,11 @@ test_expect_success 'update with autocrlf=true' '
rm -f tmp one dir/two three &&
git read-tree --reset -u HEAD &&
git config core.autocrlf true &&
-
- for f in one dir/two
- do
- append_cr <$f >tmp && mv -f tmp $f &&
- git update-index -- $f || {
- echo "Oops $f"
- false
- break
- }
- done &&
-
+ munge_cr append one &&
+ munge_cr append dir/two &&
+ git update-index -- one dir/two &&
differs=$(git diff-index --cached HEAD) &&
- test -z "$differs" || {
- echo Oops "$differs"
- false
- }
+ verbose test -z "$differs"
'
@@ -148,23 +131,13 @@ test_expect_success 'checkout with autocrlf=true' '
rm -f tmp one dir/two three &&
git config core.autocrlf true &&
git read-tree --reset -u HEAD &&
-
- for f in one dir/two
- do
- remove_cr <"$f" >tmp && mv -f tmp $f &&
- git update-index -- $f || {
- echo "Eh? $f"
- false
- break
- }
- done &&
+ munge_cr remove one &&
+ munge_cr remove dir/two &&
+ git update-index -- one dir/two &&
test "$one" = $(git hash-object --stdin <one) &&
test "$two" = $(git hash-object --stdin <dir/two) &&
differs=$(git diff-index --cached HEAD) &&
- test -z "$differs" || {
- echo Oops "$differs"
- false
- }
+ verbose test -z "$differs"
'
test_expect_success 'checkout with autocrlf=input' '
@@ -172,25 +145,13 @@ test_expect_success 'checkout with autocrlf=input' '
rm -f tmp one dir/two three &&
git config core.autocrlf input &&
git read-tree --reset -u HEAD &&
-
- for f in one dir/two
- do
- if has_cr "$f"
- then
- echo "Eh? $f"
- false
- break
- else
- git update-index -- $f
- fi
- done &&
+ test_must_fail has_cr one &&
+ test_must_fail has_cr two &&
+ git update-index -- one dir/two &&
test "$one" = $(git hash-object --stdin <one) &&
test "$two" = $(git hash-object --stdin <dir/two) &&
differs=$(git diff-index --cached HEAD) &&
- test -z "$differs" || {
- echo Oops "$differs"
- false
- }
+ verbose test -z "$differs"
'
test_expect_success 'apply patch (autocrlf=input)' '
@@ -200,10 +161,7 @@ test_expect_success 'apply patch (autocrlf=input)' '
git read-tree --reset -u HEAD &&
git apply patch.file &&
- test "$patched" = "$(git hash-object --stdin <one)" || {
- echo "Eh? apply without index"
- false
- }
+ verbose test "$patched" = "$(git hash-object --stdin <one)"
'
test_expect_success 'apply patch --cached (autocrlf=input)' '
@@ -213,10 +171,7 @@ test_expect_success 'apply patch --cached (autocrlf=input)' '
git read-tree --reset -u HEAD &&
git apply --cached patch.file &&
- test "$patched" = $(git rev-parse :one) || {
- echo "Eh? apply with --cached"
- false
- }
+ verbose test "$patched" = $(git rev-parse :one)
'
test_expect_success 'apply patch --index (autocrlf=input)' '
@@ -226,11 +181,8 @@ test_expect_success 'apply patch --index (autocrlf=input)' '
git read-tree --reset -u HEAD &&
git apply --index patch.file &&
- test "$patched" = $(git rev-parse :one) &&
- test "$patched" = $(git hash-object --stdin <one) || {
- echo "Eh? apply with --index"
- false
- }
+ verbose test "$patched" = $(git rev-parse :one) &&
+ verbose test "$patched" = $(git hash-object --stdin <one)
'
test_expect_success 'apply patch (autocrlf=true)' '
@@ -240,10 +192,7 @@ test_expect_success 'apply patch (autocrlf=true)' '
git read-tree --reset -u HEAD &&
git apply patch.file &&
- test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || {
- echo "Eh? apply without index"
- false
- }
+ verbose test "$patched" = "$(remove_cr <one | git hash-object --stdin)"
'
test_expect_success 'apply patch --cached (autocrlf=true)' '
@@ -253,10 +202,7 @@ test_expect_success 'apply patch --cached (autocrlf=true)' '
git read-tree --reset -u HEAD &&
git apply --cached patch.file &&
- test "$patched" = $(git rev-parse :one) || {
- echo "Eh? apply without index"
- false
- }
+ verbose test "$patched" = $(git rev-parse :one)
'
test_expect_success 'apply patch --index (autocrlf=true)' '
@@ -266,11 +212,8 @@ test_expect_success 'apply patch --index (autocrlf=true)' '
git read-tree --reset -u HEAD &&
git apply --index patch.file &&
- test "$patched" = $(git rev-parse :one) &&
- test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || {
- echo "Eh? apply with --index"
- false
- }
+ verbose test "$patched" = $(git rev-parse :one) &&
+ verbose test "$patched" = "$(remove_cr <one | git hash-object --stdin)"
'
test_expect_success '.gitattributes says two is binary' '
@@ -280,29 +223,9 @@ test_expect_success '.gitattributes says two is binary' '
git config core.autocrlf true &&
git read-tree --reset -u HEAD &&
- if has_cr dir/two
- then
- echo "Huh?"
- false
- else
- : happy
- fi &&
-
- if has_cr one
- then
- : happy
- else
- echo "Huh?"
- false
- fi &&
-
- if has_cr three
- then
- echo "Huh?"
- false
- else
- : happy
- fi
+ test_must_fail has_cr dir/two &&
+ verbose has_cr one &&
+ test_must_fail has_cr three
'
test_expect_success '.gitattributes says two is input' '
@@ -311,13 +234,7 @@ test_expect_success '.gitattributes says two is input' '
echo "two crlf=input" >.gitattributes &&
git read-tree --reset -u HEAD &&
- if has_cr dir/two
- then
- echo "Huh?"
- false
- else
- : happy
- fi
+ test_must_fail has_cr dir/two
'
test_expect_success '.gitattributes says two and three are text' '
@@ -326,21 +243,8 @@ test_expect_success '.gitattributes says two and three are text' '
echo "t* crlf" >.gitattributes &&
git read-tree --reset -u HEAD &&
- if has_cr dir/two
- then
- : happy
- else
- echo "Huh?"
- false
- fi &&
-
- if has_cr three
- then
- : happy
- else
- echo "Huh?"
- false
- fi
+ verbose has_cr dir/two &&
+ verbose has_cr three
'
test_expect_success 'in-tree .gitattributes (1)' '
@@ -352,17 +256,8 @@ test_expect_success 'in-tree .gitattributes (1)' '
rm -rf tmp one dir .gitattributes patch.file three &&
git read-tree --reset -u HEAD &&
- if has_cr one
- then
- echo "Eh? one should not have CRLF"
- false
- else
- : happy
- fi &&
- has_cr three || {
- echo "Eh? three should still have CRLF"
- false
- }
+ test_must_fail has_cr one &&
+ verbose has_cr three
'
test_expect_success 'in-tree .gitattributes (2)' '
@@ -371,17 +266,8 @@ test_expect_success 'in-tree .gitattributes (2)' '
git read-tree --reset HEAD &&
git checkout-index -f -q -u -a &&
- if has_cr one
- then
- echo "Eh? one should not have CRLF"
- false
- else
- : happy
- fi &&
- has_cr three || {
- echo "Eh? three should still have CRLF"
- false
- }
+ test_must_fail has_cr one &&
+ verbose has_cr three
'
test_expect_success 'in-tree .gitattributes (3)' '
@@ -391,17 +277,8 @@ test_expect_success 'in-tree .gitattributes (3)' '
git checkout-index -u .gitattributes &&
git checkout-index -u one dir/two three &&
- if has_cr one
- then
- echo "Eh? one should not have CRLF"
- false
- else
- : happy
- fi &&
- has_cr three || {
- echo "Eh? three should still have CRLF"
- false
- }
+ test_must_fail has_cr one &&
+ verbose has_cr three
'
test_expect_success 'in-tree .gitattributes (4)' '
@@ -411,17 +288,8 @@ test_expect_success 'in-tree .gitattributes (4)' '
git checkout-index -u one dir/two three &&
git checkout-index -u .gitattributes &&
- if has_cr one
- then
- echo "Eh? one should not have CRLF"
- false
- else
- : happy
- fi &&
- has_cr three || {
- echo "Eh? three should still have CRLF"
- false
- }
+ test_must_fail has_cr one &&
+ verbose has_cr three
'
test_expect_success 'checkout with existing .gitattributes' '
diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh
index 2a4a6c1..452320d 100755
--- a/t/t0027-auto-crlf.sh
+++ b/t/t0027-auto-crlf.sh
@@ -55,16 +55,41 @@ create_gitattributes () {
esac
}
+check_warning () {
+ case "$1" in
+ LF_CRLF) grep "LF will be replaced by CRLF" $2;;
+ CRLF_LF) grep "CRLF will be replaced by LF" $2;;
+ '')
+ >expect
+ grep "will be replaced by" $2 >actual
+ test_cmp expect actual
+ ;;
+ *) false ;;
+ esac
+}
+
create_file_in_repo () {
crlf=$1
attr=$2
+ lfname=$3
+ crlfname=$4
+ lfmixcrlf=$5
+ lfmixcr=$6
+ crlfnul=$7
create_gitattributes "$attr" &&
+ pfx=crlf_${crlf}_attr_${attr}
for f in LF CRLF LF_mix_CR CRLF_mix_LF CRLF_nul
do
- pfx=crlf_${crlf}_attr_${attr}_$f.txt &&
- cp $f $pfx && git -c core.autocrlf=$crlf add $pfx
+ fname=${pfx}_$f.txt &&
+ cp $f $fname &&
+ git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err"
done &&
- git commit -m "core.autocrlf $crlf"
+ git commit -m "core.autocrlf $crlf" &&
+ check_warning "$lfname" ${pfx}_LF.err &&
+ check_warning "$crlfname" ${pfx}_CRLF.err &&
+ check_warning "$lfmixcrlf" ${pfx}_CRLF_mix_LF.err &&
+ check_warning "$lfmixcr" ${pfx}_LF_mix_CR.err &&
+ check_warning "$crlfnul" ${pfx}_CRLF_nul.err
}
check_files_in_repo () {
@@ -140,22 +165,47 @@ test_expect_success 'setup master' '
'
-test_expect_success 'create files' '
- create_file_in_repo false "" &&
- create_file_in_repo true "" &&
- create_file_in_repo input "" &&
- create_file_in_repo false "auto" &&
- create_file_in_repo true "auto" &&
- create_file_in_repo input "auto" &&
+warn_LF_CRLF="LF will be replaced by CRLF"
+warn_CRLF_LF="CRLF will be replaced by LF"
+
+test_expect_success 'add files empty attr' '
+ create_file_in_repo false "" "" "" "" "" "" &&
+ create_file_in_repo true "" "LF_CRLF" "" "LF_CRLF" "" "" &&
+ create_file_in_repo input "" "" "CRLF_LF" "CRLF_LF" "" ""
+'
+
+test_expect_success 'add files attr=auto' '
+ create_file_in_repo false "auto" "" "CRLF_LF" "CRLF_LF" "" "" &&
+ create_file_in_repo true "auto" "LF_CRLF" "" "LF_CRLF" "" "" &&
+ create_file_in_repo input "auto" "" "CRLF_LF" "CRLF_LF" "" ""
+'
+
+test_expect_success 'add files attr=text' '
+ create_file_in_repo false "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
+ create_file_in_repo true "text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
+ create_file_in_repo input "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
+'
+
+test_expect_success 'add files attr=-text' '
+ create_file_in_repo false "-text" "" "" "" "" "" &&
+ create_file_in_repo true "-text" "" "" "" "" "" &&
+ create_file_in_repo input "-text" "" "" "" "" ""
+'
+
+test_expect_success 'add files attr=lf' '
+ create_file_in_repo false "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
+ create_file_in_repo true "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
+ create_file_in_repo input "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
+'
- create_file_in_repo false "text" &&
- create_file_in_repo true "text" &&
- create_file_in_repo input "text" &&
+test_expect_success 'add files attr=crlf' '
+ create_file_in_repo false "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
+ create_file_in_repo true "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
+ create_file_in_repo input "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
+'
- create_file_in_repo false "-text" &&
- create_file_in_repo true "-text" &&
- create_file_in_repo input "-text" &&
+test_expect_success 'create files cleanup' '
rm -f *.txt &&
git reset --hard
'
diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh
index 0333dd9..29e91d8 100755
--- a/t/t0030-stripspace.sh
+++ b/t/t0030-stripspace.sh
@@ -432,4 +432,10 @@ test_expect_success '-c with changed comment char' '
test_cmp expect actual
'
+test_expect_success 'avoid SP-HT sequence in commented line' '
+ printf "#\tone\n#\n# two\n" >expect &&
+ printf "\tone\n\ntwo\n" | git stripspace -c >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index a90c86b..b044785 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -172,12 +172,9 @@ test_expect_success 'long options' '
'
test_expect_success 'missing required value' '
- test-parse-options -s;
- test $? = 129 &&
- test-parse-options --string;
- test $? = 129 &&
- test-parse-options --file;
- test $? = 129
+ test_expect_code 129 test-parse-options -s &&
+ test_expect_code 129 test-parse-options --string &&
+ test_expect_code 129 test-parse-options --file
'
cat > expect << EOF
@@ -227,8 +224,7 @@ test_expect_success 'unambiguously abbreviated option with "="' '
'
test_expect_success 'ambiguously abbreviated option' '
- test-parse-options --strin 123;
- test $? = 129
+ test_expect_code 129 test-parse-options --strin 123
'
cat > expect << EOF
diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
index 6b3cedc..b29d749 100755
--- a/t/t0050-filesystem.sh
+++ b/t/t0050-filesystem.sh
@@ -33,16 +33,20 @@ test_expect_success "detection of case insensitive filesystem during repo init"
'
else
test_expect_success "detection of case insensitive filesystem during repo init" '
- test_must_fail git config --bool core.ignorecase >/dev/null ||
- test $(git config --bool core.ignorecase) = false
+ {
+ test_must_fail git config --bool core.ignorecase >/dev/null ||
+ test $(git config --bool core.ignorecase) = false
+ }
'
fi
if test_have_prereq SYMLINKS
then
test_expect_success "detection of filesystem w/o symlink support during repo init" '
- test_must_fail git config --bool core.symlinks ||
- test "$(git config --bool core.symlinks)" = true
+ {
+ test_must_fail git config --bool core.symlinks ||
+ test "$(git config --bool core.symlinks)" = true
+ }
'
else
test_expect_success "detection of filesystem w/o symlink support during repo init" '
@@ -64,7 +68,7 @@ test_expect_success "setup case tests" '
git checkout -f master
'
-$test_case 'rename (case change)' '
+test_expect_success 'rename (case change)' '
git mv camelcase CamelCase &&
git commit -m "rename"
'
diff --git a/t/t0056-git-C.sh b/t/t0056-git-C.sh
index 99c0377..2630e75 100755
--- a/t/t0056-git-C.sh
+++ b/t/t0056-git-C.sh
@@ -14,6 +14,16 @@ test_expect_success '"git -C <path>" runs git from the directory <path>' '
test_cmp expected actual
'
+test_expect_success '"git -C <path>" with an empty <path> is a no-op' '
+ (
+ mkdir -p dir1/subdir &&
+ cd dir1/subdir &&
+ git -C "" rev-parse --show-prefix >actual &&
+ echo subdir/ >expect &&
+ test_cmp expect actual
+ )
+'
+
test_expect_success 'Multiple -C options: "-C dir1 -C dir2" is equivalent to "-C dir1/dir2"' '
test_create_repo dir1/dir2 &&
echo 1 >dir1/dir2/b.txt &&
diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh
index 17e969d..9acf628 100755
--- a/t/t0061-run-command.sh
+++ b/t/t0061-run-command.sh
@@ -34,7 +34,7 @@ test_expect_success POSIXPERM 'run_command reports EACCES' '
grep "fatal: cannot exec.*hello.sh" err
'
-test_expect_success POSIXPERM 'unreadable directory in PATH' '
+test_expect_success POSIXPERM,SANITY 'unreadable directory in PATH' '
mkdir local-command &&
test_when_finished "chmod u+rwx local-command && rm -fr local-command" &&
git config alias.nitfol "!echo frotz" &&
diff --git a/t/t0062-revision-walking.sh b/t/t0062-revision-walking.sh
index 3d98eb8..113c728 100755
--- a/t/t0062-revision-walking.sh
+++ b/t/t0062-revision-walking.sh
@@ -26,7 +26,7 @@ test_expect_success 'setup' '
'
test_expect_success 'revision walking can be done twice' '
- test-revision-walking run-twice > run_twice_actual
+ test-revision-walking run-twice >run_twice_actual &&
test_cmp run_twice_expected run_twice_actual
'
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index 158cf4f..601d02d 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -22,7 +22,7 @@ generate_expected_cache_tree_rec () {
# ls-files might have foo/bar, foo/bar/baz, and foo/bar/quux
# We want to count only foo because it's the only direct child
subtrees=$(git ls-files|grep /|cut -d / -f 1|uniq) &&
- subtree_count=$(echo "$subtrees"|awk -v c=0 '$1 {++c} END {print c}') &&
+ subtree_count=$(echo "$subtrees"|awk -v c=0 '$1 != "" {++c} END {print c}') &&
entries=$(git ls-files|wc -l) &&
printf "SHA $dir (%d entries, %d subtrees)\n" "$entries" "$subtree_count" &&
for subtree in $subtrees
@@ -131,7 +131,7 @@ test_expect_success 'second commit has cache-tree' '
test_cache_tree
'
-test_expect_success 'commit --interactive gives cache-tree on partial commit' '
+test_expect_success PERL 'commit --interactive gives cache-tree on partial commit' '
cat <<-\EOT >foo.c &&
int foo()
{
diff --git a/t/t0201-gettext-fallbacks.sh b/t/t0201-gettext-fallbacks.sh
index 5d80a98..90da1c7 100755
--- a/t/t0201-gettext-fallbacks.sh
+++ b/t/t0201-gettext-fallbacks.sh
@@ -50,17 +50,17 @@ test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate v
test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces' '
cmdline="git am" &&
- export cmdline;
+ export cmdline &&
printf "When you have resolved this problem, run git am --resolved." >expect &&
- eval_gettext "When you have resolved this problem, run \$cmdline --resolved." >actual
+ eval_gettext "When you have resolved this problem, run \$cmdline --resolved." >actual &&
test_i18ncmp expect actual
'
test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces and quotes' '
cmdline="git am" &&
- export cmdline;
+ export cmdline &&
printf "When you have resolved this problem, run \"git am --resolved\"." >expect &&
- eval_gettext "When you have resolved this problem, run \"\$cmdline --resolved\"." >actual
+ eval_gettext "When you have resolved this problem, run \"\$cmdline --resolved\"." >actual &&
test_i18ncmp expect actual
'
diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh
index 57ea5a1..d7ef44b 100755
--- a/t/t0300-credentials.sh
+++ b/t/t0300-credentials.sh
@@ -289,4 +289,13 @@ test_expect_success 'http paths can be part of context' '
EOF
'
+test_expect_success 'helpers can abort the process' '
+ test_must_fail git \
+ -c credential.helper="!f() { echo quit=1; }; f" \
+ -c credential.helper="verbatim foo bar" \
+ credential fill >stdout &&
+ >expect &&
+ test_cmp expect stdout
+'
+
test_done
diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh
index fed877b..e3bf821 100755
--- a/t/t1002-read-tree-m-u-2way.sh
+++ b/t/t1002-read-tree-m-u-2way.sh
@@ -75,8 +75,8 @@ test_expect_success \
echo yomin >yomin &&
git update-index --add yomin &&
read_tree_u_must_succeed -m -u $treeH $treeM &&
- git ls-files --stage >4.out || return 1
- git diff -U0 --no-index M.out 4.out >4diff.out
+ git ls-files --stage >4.out &&
+ test_might_fail git diff -U0 --no-index M.out 4.out >4diff.out &&
compare_change 4diff.out expected &&
check_cache_at yomin clean &&
sum bozbar frotz nitfol >actual4.sum &&
@@ -94,8 +94,8 @@ test_expect_success \
git update-index --add yomin &&
echo yomin yomin >yomin &&
read_tree_u_must_succeed -m -u $treeH $treeM &&
- git ls-files --stage >5.out || return 1
- git diff -U0 --no-index M.out 5.out >5diff.out
+ git ls-files --stage >5.out &&
+ test_might_fail git diff -U0 --no-index M.out 5.out >5diff.out &&
compare_change 5diff.out expected &&
check_cache_at yomin dirty &&
sum bozbar frotz nitfol >actual5.sum &&
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index a72e700..ab36b1e 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -274,7 +274,7 @@ test_expect_success 'setup blobs which are likely to delta' '
'
test_expect_success 'confirm that neither loose blob is a delta' '
- cat >expect <<-EOF
+ cat >expect <<-EOF &&
$_z40
$_z40
EOF
diff --git a/t/t1014-read-tree-confusing.sh b/t/t1014-read-tree-confusing.sh
new file mode 100755
index 0000000..2f5a25d
--- /dev/null
+++ b/t/t1014-read-tree-confusing.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+test_description='check that read-tree rejects confusing paths'
+. ./test-lib.sh
+
+test_expect_success 'create base tree' '
+ echo content >file &&
+ git add file &&
+ git commit -m base &&
+ blob=$(git rev-parse HEAD:file) &&
+ tree=$(git rev-parse HEAD^{tree})
+'
+
+test_expect_success 'enable core.protectHFS for rejection tests' '
+ git config core.protectHFS true
+'
+
+test_expect_success 'enable core.protectNTFS for rejection tests' '
+ git config core.protectNTFS true
+'
+
+while read path pretty; do
+ : ${pretty:=$path}
+ case "$path" in
+ *SPACE)
+ path="${path%SPACE} "
+ ;;
+ esac
+ test_expect_success "reject $pretty at end of path" '
+ printf "100644 blob %s\t%s" "$blob" "$path" >tree &&
+ bogus=$(git mktree <tree) &&
+ test_must_fail git read-tree $bogus
+ '
+
+ test_expect_success "reject $pretty as subtree" '
+ printf "040000 tree %s\t%s" "$tree" "$path" >tree &&
+ bogus=$(git mktree <tree) &&
+ test_must_fail git read-tree $bogus
+ '
+done <<-EOF
+.
+..
+.git
+.GIT
+${u200c}.Git {u200c}.Git
+.gI${u200c}T .gI{u200c}T
+.GiT${u200c} .GiT{u200c}
+git~1
+.git.SPACE .git.{space}
+.\\\\.GIT\\\\foobar backslashes
+.git\\\\foobar backslashes2
+EOF
+
+test_expect_success 'utf-8 paths allowed with core.protectHFS off' '
+ test_when_finished "git read-tree HEAD" &&
+ test_config core.protectHFS false &&
+ printf "100644 blob %s\t%s" "$blob" ".gi${u200c}t" >tree &&
+ ok=$(git mktree <tree) &&
+ git read-tree $ok
+'
+
+test_done
diff --git a/t/t1050-large.sh b/t/t1050-large.sh
index f5a9119..f9f3d13 100755
--- a/t/t1050-large.sh
+++ b/t/t1050-large.sh
@@ -9,10 +9,10 @@ test_expect_success setup '
# clone does not allow us to pass core.bigfilethreshold to
# new repos, so set core.bigfilethreshold globally
git config --global core.bigfilethreshold 200k &&
- echo X | dd of=large1 bs=1k seek=2000 &&
- echo X | dd of=large2 bs=1k seek=2000 &&
- echo X | dd of=large3 bs=1k seek=2000 &&
- echo Y | dd of=huge bs=1k seek=2500 &&
+ printf "%2000000s" X >large1 &&
+ cp large1 large2 &&
+ cp large1 large3 &&
+ printf "%2500000s" Y >huge &&
GIT_ALLOC_LIMIT=1500k &&
export GIT_ALLOC_LIMIT
'
@@ -61,7 +61,7 @@ test_expect_success 'checkout a large file' '
large1=$(git rev-parse :large1) &&
git update-index --add --cacheinfo 100644 $large1 another &&
git checkout another &&
- cmp large1 another ;# this must not be test_cmp
+ test_cmp large1 another
'
test_expect_success 'packsize limit' '
@@ -162,7 +162,7 @@ test_expect_success 'pack-objects with large loose object' '
test_create_repo packed &&
mv pack-* packed/.git/objects/pack &&
GIT_DIR=packed/.git git cat-file blob $SHA1 >actual &&
- cmp huge actual
+ test_cmp huge actual
'
test_expect_success 'tar achiving' '
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 938fc8b..66dd286 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -677,7 +677,7 @@ test_expect_success 'invalid unit' '
echo 1auto >expect &&
git config aninvalid.unit >actual &&
test_cmp expect actual &&
- cat >expect <<-\EOF
+ cat >expect <<-\EOF &&
fatal: bad numeric config value '\''1auto'\'' for '\''aninvalid.unit'\'' in .git/config: invalid unit
EOF
test_must_fail git config --int --get aninvalid.unit 2>actual &&
@@ -1165,7 +1165,7 @@ test_expect_failure 'adding a key into an empty section reuses header' '
Qkey = value
EOF
- git config section.key value
+ git config section.key value &&
test_cmp expect .git/config
'
diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh
index de42d21..ac10875 100755
--- a/t/t1301-shared-repo.sh
+++ b/t/t1301-shared-repo.sh
@@ -12,12 +12,11 @@ setfacl -k . 2>/dev/null
# User must have read permissions to the repo -> failure on --shared=0400
test_expect_success 'shared = 0400 (faulty permission u-w)' '
+ test_when_finished "rm -rf sub" &&
mkdir sub && (
- cd sub && git init --shared=0400
+ cd sub &&
+ test_must_fail git init --shared=0400
)
- ret="$?"
- rm -rf sub
- test $ret != "0"
'
modebits () {
@@ -33,7 +32,7 @@ do
git init --shared=1 &&
test 1 = "$(git config core.sharedrepository)"
) &&
- actual=$(ls -l sub/.git/HEAD)
+ actual=$(ls -l sub/.git/HEAD) &&
case "$actual" in
-rw-rw-r--*)
: happy
@@ -90,10 +89,8 @@ do
rm -f .git/info/refs &&
git update-server-info &&
actual="$(modebits .git/info/refs)" &&
- test "x$actual" = "x-$y" || {
- ls -lt .git/info
- false
- }
+ verbose test "x$actual" = "x-$y"
+
'
umask 077 &&
@@ -102,16 +99,24 @@ do
rm -f .git/info/refs &&
git update-server-info &&
actual="$(modebits .git/info/refs)" &&
- test "x$actual" = "x-$x" || {
- ls -lt .git/info
- false
- }
+ verbose test "x$actual" = "x-$x"
'
done
+test_expect_success POSIXPERM 'info/refs respects umask in unshared repo' '
+ rm -f .git/info/refs &&
+ test_unconfig core.sharedrepository &&
+ umask 002 &&
+ git update-server-info &&
+ echo "-rw-rw-r--" >expect &&
+ modebits .git/info/refs >actual &&
+ test_cmp expect actual
+'
+
test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' '
+ umask 077 &&
git config core.sharedRepository group &&
git reflog expire --all &&
actual="$(ls -l .git/logs/refs/heads/master)" &&
diff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh
index fdc257e..3c6791e 100755
--- a/t/t1307-config-blob.sh
+++ b/t/t1307-config-blob.sh
@@ -67,4 +67,13 @@ test_expect_success 'parse errors in blobs are properly attributed' '
grep "HEAD:config" err
'
+test_expect_success 'can parse blob ending with CR' '
+ printf "[some]key = value\\r" >config &&
+ git add config &&
+ git commit -m CR &&
+ echo value >expect &&
+ git config --blob=HEAD:config some.key >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 7b4707b..6805b9e 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -619,6 +619,52 @@ test_expect_success 'stdin update/create/verify combination works' '
test_must_fail git rev-parse --verify -q $c
'
+test_expect_success 'stdin verify succeeds for correct value' '
+ git rev-parse $m >expect &&
+ echo "verify $m $m" >stdin &&
+ git update-ref --stdin <stdin &&
+ git rev-parse $m >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'stdin verify succeeds for missing reference' '
+ echo "verify refs/heads/missing $Z" >stdin &&
+ git update-ref --stdin <stdin &&
+ test_must_fail git rev-parse --verify -q refs/heads/missing
+'
+
+test_expect_success 'stdin verify treats no value as missing' '
+ echo "verify refs/heads/missing" >stdin &&
+ git update-ref --stdin <stdin &&
+ test_must_fail git rev-parse --verify -q refs/heads/missing
+'
+
+test_expect_success 'stdin verify fails for wrong value' '
+ git rev-parse $m >expect &&
+ echo "verify $m $m~1" >stdin &&
+ test_must_fail git update-ref --stdin <stdin &&
+ git rev-parse $m >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'stdin verify fails for mistaken null value' '
+ git rev-parse $m >expect &&
+ echo "verify $m $Z" >stdin &&
+ test_must_fail git update-ref --stdin <stdin &&
+ git rev-parse $m >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'stdin verify fails for mistaken empty value' '
+ M=$(git rev-parse $m) &&
+ test_when_finished "git update-ref $m $M" &&
+ git rev-parse $m >expect &&
+ echo "verify $m" >stdin &&
+ test_must_fail git update-ref --stdin <stdin &&
+ git rev-parse $m >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'stdin update refs works with identity updates' '
cat >stdin <<-EOF &&
update $a $m $m
@@ -938,6 +984,52 @@ test_expect_success 'stdin -z update/create/verify combination works' '
test_must_fail git rev-parse --verify -q $c
'
+test_expect_success 'stdin -z verify succeeds for correct value' '
+ git rev-parse $m >expect &&
+ printf $F "verify $m" "$m" >stdin &&
+ git update-ref -z --stdin <stdin &&
+ git rev-parse $m >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'stdin -z verify succeeds for missing reference' '
+ printf $F "verify refs/heads/missing" "$Z" >stdin &&
+ git update-ref -z --stdin <stdin &&
+ test_must_fail git rev-parse --verify -q refs/heads/missing
+'
+
+test_expect_success 'stdin -z verify treats no value as missing' '
+ printf $F "verify refs/heads/missing" "" >stdin &&
+ git update-ref -z --stdin <stdin &&
+ test_must_fail git rev-parse --verify -q refs/heads/missing
+'
+
+test_expect_success 'stdin -z verify fails for wrong value' '
+ git rev-parse $m >expect &&
+ printf $F "verify $m" "$m~1" >stdin &&
+ test_must_fail git update-ref -z --stdin <stdin &&
+ git rev-parse $m >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'stdin -z verify fails for mistaken null value' '
+ git rev-parse $m >expect &&
+ printf $F "verify $m" "$Z" >stdin &&
+ test_must_fail git update-ref -z --stdin <stdin &&
+ git rev-parse $m >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'stdin -z verify fails for mistaken empty value' '
+ M=$(git rev-parse $m) &&
+ test_when_finished "git update-ref $m $M" &&
+ git rev-parse $m >expect &&
+ printf $F "verify $m" "" >stdin &&
+ test_must_fail git update-ref -z --stdin <stdin &&
+ git rev-parse $m >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'stdin -z update refs works with identity updates' '
printf $F "update $a" "$m" "$m" "update $b" "$m" "$m" "update $c" "$Z" "" >stdin &&
git update-ref -z --stdin <stdin &&
diff --git a/t/t1403-show-ref.sh b/t/t1403-show-ref.sh
index 3e500ed..7e10bcf 100755
--- a/t/t1403-show-ref.sh
+++ b/t/t1403-show-ref.sh
@@ -28,7 +28,7 @@ test_expect_success 'show-ref' '
>expect &&
- test_must_fail git show-ref D >actual
+ test_must_fail git show-ref D >actual &&
test_cmp expect actual
'
@@ -62,7 +62,7 @@ test_expect_success 'show-ref --verify' '
test_must_fail git show-ref --verify tags/A >actual &&
test_cmp expect actual &&
- test_must_fail git show-ref --verify D >actual
+ test_must_fail git show-ref --verify D >actual &&
test_cmp expect actual
'
@@ -78,7 +78,7 @@ test_expect_success 'show-ref --verify -q' '
test_must_fail git show-ref --verify -q tags/A >actual &&
test_cmp expect actual &&
- test_must_fail git show-ref --verify -q D >actual
+ test_must_fail git show-ref --verify -q D >actual &&
test_cmp expect actual
'
@@ -105,10 +105,10 @@ test_expect_success 'show-ref -d' '
test_cmp expect actual &&
git show-ref -d refs/heads/master >actual &&
- test_cmp expect actual
+ test_cmp expect actual &&
git show-ref -d --verify refs/heads/master >actual &&
- test_cmp expect actual
+ test_cmp expect actual &&
>expect &&
diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index 8cf4461..779d4e3 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -287,4 +287,34 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' '
test_cmp expect actual
'
+# Triggering the bug detected by this test requires a newline to fall
+# exactly BUFSIZ-1 bytes from the end of the file. We don't know
+# what that value is, since it's platform dependent. However, if
+# we choose some value N, we also catch any D which divides N evenly
+# (since we will read backwards in chunks of D). So we choose 8K,
+# which catches glibc (with an 8K BUFSIZ) and *BSD (1K).
+#
+# Each line is 114 characters, so we need 75 to still have a few before the
+# last 8K. The 89-character padding on the final entry lines up our
+# newline exactly.
+test_expect_success 'parsing reverse reflogs at BUFSIZ boundaries' '
+ git checkout -b reflogskip &&
+ z38=00000000000000000000000000000000000000 &&
+ ident="abc <xyz> 0000000001 +0000" &&
+ for i in $(test_seq 1 75); do
+ printf "$z38%02d $z38%02d %s\t" $i $(($i+1)) "$ident" &&
+ if test $i = 75; then
+ for j in $(test_seq 1 89); do
+ printf X
+ done
+ else
+ printf X
+ fi &&
+ printf "\n"
+ done >.git/logs/refs/heads/reflogskip &&
+ git rev-parse reflogskip@{73} >actual &&
+ echo ${z38}03 >expect &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 019fddd..cfb32b6 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -229,8 +229,12 @@ test_expect_success 'tag with incorrect tag name & missing tagger' '
echo $tag >.git/refs/tags/wrong &&
test_when_finished "git update-ref -d refs/tags/wrong" &&
git fsck --tags 2>out &&
- grep "invalid .tag. name" out &&
- grep "expected .tagger. line" out
+
+ cat >expect <<-EOF &&
+ warning in tag $tag: invalid '\''tag'\'' name: wrong name format
+ warning in tag $tag: invalid format - expected '\''tagger'\'' line
+ EOF
+ test_cmp expect out
'
test_expect_success 'tag with bad tagger' '
@@ -309,34 +313,54 @@ test_expect_success 'fsck notices submodule entry pointing to null sha1' '
)
'
-test_expect_success 'fsck notices "." and ".." in trees' '
- (
- git init dots &&
- cd dots &&
- blob=$(echo foo | git hash-object -w --stdin) &&
- tab=$(printf "\\t") &&
- git mktree <<-EOF &&
- 100644 blob $blob$tab.
- 100644 blob $blob$tab..
- EOF
- git fsck 2>out &&
- cat out &&
- grep "warning.*\\." out
- )
-'
-
-test_expect_success 'fsck notices ".git" in trees' '
+while read name path pretty; do
+ while read mode type; do
+ : ${pretty:=$path}
+ test_expect_success "fsck notices $pretty as $type" '
+ (
+ git init $name-$type &&
+ cd $name-$type &&
+ echo content >file &&
+ git add file &&
+ git commit -m base &&
+ blob=$(git rev-parse :file) &&
+ tree=$(git rev-parse HEAD^{tree}) &&
+ value=$(eval "echo \$$type") &&
+ printf "$mode $type %s\t%s" "$value" "$path" >bad &&
+ bad_tree=$(git mktree <bad) &&
+ git fsck 2>out &&
+ cat out &&
+ grep "warning.*tree $bad_tree" out
+ )'
+ done <<-\EOF
+ 100644 blob
+ 040000 tree
+ EOF
+done <<-EOF
+dot .
+dotdot ..
+dotgit .git
+dotgit-case .GIT
+dotgit-unicode .gI${u200c}T .gI{u200c}T
+dotgit-case2 .Git
+git-tilde1 git~1
+dotgitdot .git.
+dot-backslash-case .\\\\.GIT\\\\foobar
+dotgit-case-backslash .git\\\\foobar
+EOF
+
+test_expect_success 'fsck allows .Ňit' '
(
- git init dotgit &&
- cd dotgit &&
- blob=$(echo foo | git hash-object -w --stdin) &&
- tab=$(printf "\\t") &&
- git mktree <<-EOF &&
- 100644 blob $blob$tab.git
- EOF
- git fsck 2>out &&
- cat out &&
- grep "warning.*\\.git" out
+ git init not-dotgit &&
+ cd not-dotgit &&
+ echo content >file &&
+ git add file &&
+ git commit -m base &&
+ blob=$(git rev-parse :file) &&
+ printf "100644 blob $blob\t.\\305\\207it" >tree &&
+ tree=$(git mktree <tree) &&
+ git fsck 2>err &&
+ test_line_count = 0 err
)
'
diff --git a/t/t1509-root-worktree.sh b/t/t1509-root-worktree.sh
index 335420f..b6977d4 100755
--- a/t/t1509-root-worktree.sh
+++ b/t/t1509-root-worktree.sh
@@ -98,8 +98,16 @@ test_foobar_foobar() {
'
}
-if ! test_have_prereq POSIXPERM || ! [ -w / ]; then
- skip_all="Dangerous test skipped. Read this test if you want to execute it"
+if ! test -w /
+then
+ skip_all="Test requiring writable / skipped. Read this test if you want to run it"
+ test_done
+fi
+
+if test -e /refs || test -e /objects || test -e /info || test -e /hooks ||
+ test -e /.git || test -e /foo || test -e /me
+then
+ skip_all="Skip test that clobbers existing files in /"
test_done
fi
@@ -108,8 +116,9 @@ if [ "$IKNOWWHATIAMDOING" != "YES" ]; then
test_done
fi
-if [ "$UID" = 0 ]; then
- skip_all="No you can't run this with root"
+if ! test_have_prereq NOT_ROOT
+then
+ skip_all="No you can't run this as root"
test_done
fi
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index 94fb473..193d55c 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -10,9 +10,18 @@ sane_unset GIT_TEST_SPLIT_INDEX
test_expect_success 'enable split index' '
git update-index --split-index &&
test-dump-split-index .git/index >actual &&
+ indexversion=$(test-index-version <.git/index) &&
+ if test "$indexversion" = "4"
+ then
+ own=432ef4b63f32193984f339431fd50ca796493569
+ base=508851a7f0dfa8691e9f69c7f055865389012491
+ else
+ own=8299b0bcd1ac364e5f1d7768efb62fa2da79a339
+ base=39d890139ee5356c7ef572216cebcd27aa41f9df
+ fi &&
cat >expect <<EOF &&
-own 8299b0bcd1ac364e5f1d7768efb62fa2da79a339
-base 39d890139ee5356c7ef572216cebcd27aa41f9df
+own $own
+base $base
replacements:
deletions:
EOF
@@ -30,7 +39,7 @@ EOF
test-dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<EOF &&
-base 39d890139ee5356c7ef572216cebcd27aa41f9df
+base $base
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 one
replacements:
deletions:
@@ -182,7 +191,7 @@ test_expect_success 'unify index, two files remain' '
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 one
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 two
EOF
- test_cmp ls-files.expect ls-files.actual
+ test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<EOF &&
diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh
index f171a55..a12afe9 100755
--- a/t/t2004-checkout-cache-temp.sh
+++ b/t/t2004-checkout-cache-temp.sh
@@ -10,202 +10,212 @@ rather than the tracked path.'
. ./test-lib.sh
-test_expect_success \
-'preparation' '
-mkdir asubdir &&
-echo tree1path0 >path0 &&
-echo tree1path1 >path1 &&
-echo tree1path3 >path3 &&
-echo tree1path4 >path4 &&
-echo tree1asubdir/path5 >asubdir/path5 &&
-git update-index --add path0 path1 path3 path4 asubdir/path5 &&
-t1=$(git write-tree) &&
-rm -f path* .merge_* out .git/index &&
-echo tree2path0 >path0 &&
-echo tree2path1 >path1 &&
-echo tree2path2 >path2 &&
-echo tree2path4 >path4 &&
-git update-index --add path0 path1 path2 path4 &&
-t2=$(git write-tree) &&
-rm -f path* .merge_* out .git/index &&
-echo tree2path0 >path0 &&
-echo tree3path1 >path1 &&
-echo tree3path2 >path2 &&
-echo tree3path3 >path3 &&
-git update-index --add path0 path1 path2 path3 &&
-t3=$(git write-tree)'
-
-test_expect_success \
-'checkout one stage 0 to temporary file' '
-rm -f path* .merge_* out .git/index &&
-git read-tree $t1 &&
-git checkout-index --temp -- path1 >out &&
-test_line_count = 1 out &&
-test $(cut "-d " -f2 out) = path1 &&
-p=$(cut "-d " -f1 out) &&
-test -f $p &&
-test $(cat $p) = tree1path1'
-
-test_expect_success \
-'checkout all stage 0 to temporary files' '
-rm -f path* .merge_* out .git/index &&
-git read-tree $t1 &&
-git checkout-index -a --temp >out &&
-test_line_count = 5 out &&
-for f in path0 path1 path3 path4 asubdir/path5
-do
- test $(grep $f out | cut "-d " -f2) = $f &&
- p=$(grep $f out | cut "-d " -f1) &&
+test_expect_success 'setup' '
+ mkdir asubdir &&
+ echo tree1path0 >path0 &&
+ echo tree1path1 >path1 &&
+ echo tree1path3 >path3 &&
+ echo tree1path4 >path4 &&
+ echo tree1asubdir/path5 >asubdir/path5 &&
+ git update-index --add path0 path1 path3 path4 asubdir/path5 &&
+ t1=$(git write-tree) &&
+ rm -f path* .merge_* actual .git/index &&
+ echo tree2path0 >path0 &&
+ echo tree2path1 >path1 &&
+ echo tree2path2 >path2 &&
+ echo tree2path4 >path4 &&
+ git update-index --add path0 path1 path2 path4 &&
+ t2=$(git write-tree) &&
+ rm -f path* .merge_* actual .git/index &&
+ echo tree2path0 >path0 &&
+ echo tree3path1 >path1 &&
+ echo tree3path2 >path2 &&
+ echo tree3path3 >path3 &&
+ git update-index --add path0 path1 path2 path3 &&
+ t3=$(git write-tree)
+'
+
+test_expect_success 'checkout one stage 0 to temporary file' '
+ rm -f path* .merge_* actual .git/index &&
+ git read-tree $t1 &&
+ git checkout-index --temp -- path1 >actual &&
+ test_line_count = 1 actual &&
+ test $(cut "-d " -f2 actual) = path1 &&
+ p=$(cut "-d " -f1 actual) &&
test -f $p &&
- test $(cat $p) = tree1$f
-done'
-
-test_expect_success \
-'prepare 3-way merge' '
-rm -f path* .merge_* out .git/index &&
-git read-tree -m $t1 $t2 $t3'
-
-test_expect_success \
-'checkout one stage 2 to temporary file' '
-rm -f path* .merge_* out &&
-git checkout-index --stage=2 --temp -- path1 >out &&
-test_line_count = 1 out &&
-test $(cut "-d " -f2 out) = path1 &&
-p=$(cut "-d " -f1 out) &&
-test -f $p &&
-test $(cat $p) = tree2path1'
-
-test_expect_success \
-'checkout all stage 2 to temporary files' '
-rm -f path* .merge_* out &&
-git checkout-index --all --stage=2 --temp >out &&
-test_line_count = 3 out &&
-for f in path1 path2 path4
-do
- test $(grep $f out | cut "-d " -f2) = $f &&
- p=$(grep $f out | cut "-d " -f1) &&
+ test $(cat $p) = tree1path1
+'
+
+test_expect_success 'checkout all stage 0 to temporary files' '
+ rm -f path* .merge_* actual .git/index &&
+ git read-tree $t1 &&
+ git checkout-index -a --temp >actual &&
+ test_line_count = 5 actual &&
+ for f in path0 path1 path3 path4 asubdir/path5
+ do
+ test $(grep $f actual | cut "-d " -f2) = $f &&
+ p=$(grep $f actual | cut "-d " -f1) &&
+ test -f $p &&
+ test $(cat $p) = tree1$f
+ done
+'
+
+test_expect_success 'setup 3-way merge' '
+ rm -f path* .merge_* actual .git/index &&
+ git read-tree -m $t1 $t2 $t3
+'
+
+test_expect_success 'checkout one stage 2 to temporary file' '
+ rm -f path* .merge_* actual &&
+ git checkout-index --stage=2 --temp -- path1 >actual &&
+ test_line_count = 1 actual &&
+ test $(cut "-d " -f2 actual) = path1 &&
+ p=$(cut "-d " -f1 actual) &&
test -f $p &&
- test $(cat $p) = tree2$f
-done'
-
-test_expect_success \
-'checkout all stages/one file to nothing' '
-rm -f path* .merge_* out &&
-git checkout-index --stage=all --temp -- path0 >out &&
-test_line_count = 0 out'
-
-test_expect_success \
-'checkout all stages/one file to temporary files' '
-rm -f path* .merge_* out &&
-git checkout-index --stage=all --temp -- path1 >out &&
-test_line_count = 1 out &&
-test $(cut "-d " -f2 out) = path1 &&
-cut "-d " -f1 out | (read s1 s2 s3 &&
-test -f $s1 &&
-test -f $s2 &&
-test -f $s3 &&
-test $(cat $s1) = tree1path1 &&
-test $(cat $s2) = tree2path1 &&
-test $(cat $s3) = tree3path1)'
-
-test_expect_success \
-'checkout some stages/one file to temporary files' '
-rm -f path* .merge_* out &&
-git checkout-index --stage=all --temp -- path2 >out &&
-test_line_count = 1 out &&
-test $(cut "-d " -f2 out) = path2 &&
-cut "-d " -f1 out | (read s1 s2 s3 &&
-test $s1 = . &&
-test -f $s2 &&
-test -f $s3 &&
-test $(cat $s2) = tree2path2 &&
-test $(cat $s3) = tree3path2)'
-
-test_expect_success \
-'checkout all stages/all files to temporary files' '
-rm -f path* .merge_* out &&
-git checkout-index -a --stage=all --temp >out &&
-test_line_count = 5 out'
-
-test_expect_success \
-'-- path0: no entry' '
-test x$(grep path0 out | cut "-d " -f2) = x'
-
-test_expect_success \
-'-- path1: all 3 stages' '
-test $(grep path1 out | cut "-d " -f2) = path1 &&
-grep path1 out | cut "-d " -f1 | (read s1 s2 s3 &&
-test -f $s1 &&
-test -f $s2 &&
-test -f $s3 &&
-test $(cat $s1) = tree1path1 &&
-test $(cat $s2) = tree2path1 &&
-test $(cat $s3) = tree3path1)'
-
-test_expect_success \
-'-- path2: no stage 1, have stage 2 and 3' '
-test $(grep path2 out | cut "-d " -f2) = path2 &&
-grep path2 out | cut "-d " -f1 | (read s1 s2 s3 &&
-test $s1 = . &&
-test -f $s2 &&
-test -f $s3 &&
-test $(cat $s2) = tree2path2 &&
-test $(cat $s3) = tree3path2)'
-
-test_expect_success \
-'-- path3: no stage 2, have stage 1 and 3' '
-test $(grep path3 out | cut "-d " -f2) = path3 &&
-grep path3 out | cut "-d " -f1 | (read s1 s2 s3 &&
-test -f $s1 &&
-test $s2 = . &&
-test -f $s3 &&
-test $(cat $s1) = tree1path3 &&
-test $(cat $s3) = tree3path3)'
-
-test_expect_success \
-'-- path4: no stage 3, have stage 1 and 3' '
-test $(grep path4 out | cut "-d " -f2) = path4 &&
-grep path4 out | cut "-d " -f1 | (read s1 s2 s3 &&
-test -f $s1 &&
-test -f $s2 &&
-test $s3 = . &&
-test $(cat $s1) = tree1path4 &&
-test $(cat $s2) = tree2path4)'
-
-test_expect_success \
-'-- asubdir/path5: no stage 2 and 3 have stage 1' '
-test $(grep asubdir/path5 out | cut "-d " -f2) = asubdir/path5 &&
-grep asubdir/path5 out | cut "-d " -f1 | (read s1 s2 s3 &&
-test -f $s1 &&
-test $s2 = . &&
-test $s3 = . &&
-test $(cat $s1) = tree1asubdir/path5)'
-
-test_expect_success \
-'checkout --temp within subdir' '
-(cd asubdir &&
- git checkout-index -a --stage=all >out &&
- test_line_count = 1 out &&
- test $(grep path5 out | cut "-d " -f2) = path5 &&
- grep path5 out | cut "-d " -f1 | (read s1 s2 s3 &&
- test -f ../$s1 &&
- test $s2 = . &&
- test $s3 = . &&
- test $(cat ../$s1) = tree1asubdir/path5)
-)'
-
-test_expect_success \
-'checkout --temp symlink' '
-rm -f path* .merge_* out .git/index &&
-test_ln_s_add b a &&
-t4=$(git write-tree) &&
-rm -f .git/index &&
-git read-tree $t4 &&
-git checkout-index --temp -a >out &&
-test_line_count = 1 out &&
-test $(cut "-d " -f2 out) = a &&
-p=$(cut "-d " -f1 out) &&
-test -f $p &&
-test $(cat $p) = b'
+ test $(cat $p) = tree2path1
+'
+
+test_expect_success 'checkout all stage 2 to temporary files' '
+ rm -f path* .merge_* actual &&
+ git checkout-index --all --stage=2 --temp >actual &&
+ test_line_count = 3 actual &&
+ for f in path1 path2 path4
+ do
+ test $(grep $f actual | cut "-d " -f2) = $f &&
+ p=$(grep $f actual | cut "-d " -f1) &&
+ test -f $p &&
+ test $(cat $p) = tree2$f
+ done
+'
+
+test_expect_success 'checkout all stages/one file to nothing' '
+ rm -f path* .merge_* actual &&
+ git checkout-index --stage=all --temp -- path0 >actual &&
+ test_line_count = 0 actual
+'
+
+test_expect_success 'checkout all stages/one file to temporary files' '
+ rm -f path* .merge_* actual &&
+ git checkout-index --stage=all --temp -- path1 >actual &&
+ test_line_count = 1 actual &&
+ test $(cut "-d " -f2 actual) = path1 &&
+ cut "-d " -f1 actual | (read s1 s2 s3 &&
+ test -f $s1 &&
+ test -f $s2 &&
+ test -f $s3 &&
+ test $(cat $s1) = tree1path1 &&
+ test $(cat $s2) = tree2path1 &&
+ test $(cat $s3) = tree3path1)
+'
+
+test_expect_success 'checkout some stages/one file to temporary files' '
+ rm -f path* .merge_* actual &&
+ git checkout-index --stage=all --temp -- path2 >actual &&
+ test_line_count = 1 actual &&
+ test $(cut "-d " -f2 actual) = path2 &&
+ cut "-d " -f1 actual | (read s1 s2 s3 &&
+ test $s1 = . &&
+ test -f $s2 &&
+ test -f $s3 &&
+ test $(cat $s2) = tree2path2 &&
+ test $(cat $s3) = tree3path2)
+'
+
+test_expect_success 'checkout all stages/all files to temporary files' '
+ rm -f path* .merge_* actual &&
+ git checkout-index -a --stage=all --temp >actual &&
+ test_line_count = 5 actual
+'
+
+test_expect_success '-- path0: no entry' '
+ test x$(grep path0 actual | cut "-d " -f2) = x
+'
+
+test_expect_success '-- path1: all 3 stages' '
+ test $(grep path1 actual | cut "-d " -f2) = path1 &&
+ grep path1 actual | cut "-d " -f1 | (read s1 s2 s3 &&
+ test -f $s1 &&
+ test -f $s2 &&
+ test -f $s3 &&
+ test $(cat $s1) = tree1path1 &&
+ test $(cat $s2) = tree2path1 &&
+ test $(cat $s3) = tree3path1)
+'
+
+test_expect_success '-- path2: no stage 1, have stage 2 and 3' '
+ test $(grep path2 actual | cut "-d " -f2) = path2 &&
+ grep path2 actual | cut "-d " -f1 | (read s1 s2 s3 &&
+ test $s1 = . &&
+ test -f $s2 &&
+ test -f $s3 &&
+ test $(cat $s2) = tree2path2 &&
+ test $(cat $s3) = tree3path2)
+'
+
+test_expect_success '-- path3: no stage 2, have stage 1 and 3' '
+ test $(grep path3 actual | cut "-d " -f2) = path3 &&
+ grep path3 actual | cut "-d " -f1 | (read s1 s2 s3 &&
+ test -f $s1 &&
+ test $s2 = . &&
+ test -f $s3 &&
+ test $(cat $s1) = tree1path3 &&
+ test $(cat $s3) = tree3path3)
+'
+
+test_expect_success '-- path4: no stage 3, have stage 1 and 3' '
+ test $(grep path4 actual | cut "-d " -f2) = path4 &&
+ grep path4 actual | cut "-d " -f1 | (read s1 s2 s3 &&
+ test -f $s1 &&
+ test -f $s2 &&
+ test $s3 = . &&
+ test $(cat $s1) = tree1path4 &&
+ test $(cat $s2) = tree2path4)
+'
+
+test_expect_success '-- asubdir/path5: no stage 2 and 3 have stage 1' '
+ test $(grep asubdir/path5 actual | cut "-d " -f2) = asubdir/path5 &&
+ grep asubdir/path5 actual | cut "-d " -f1 | (read s1 s2 s3 &&
+ test -f $s1 &&
+ test $s2 = . &&
+ test $s3 = . &&
+ test $(cat $s1) = tree1asubdir/path5)
+'
+
+test_expect_success 'checkout --temp within subdir' '
+ (
+ cd asubdir &&
+ git checkout-index -a --stage=all >actual &&
+ test_line_count = 1 actual &&
+ test $(grep path5 actual | cut "-d " -f2) = path5 &&
+ grep path5 actual | cut "-d " -f1 | (read s1 s2 s3 &&
+ test -f ../$s1 &&
+ test $s2 = . &&
+ test $s3 = . &&
+ test $(cat ../$s1) = tree1asubdir/path5)
+ )
+'
+
+test_expect_success 'checkout --temp symlink' '
+ rm -f path* .merge_* actual .git/index &&
+ test_ln_s_add path7 path6 &&
+ git checkout-index --temp -a >actual &&
+ test_line_count = 1 actual &&
+ test $(cut "-d " -f2 actual) = path6 &&
+ p=$(cut "-d " -f1 actual) &&
+ test -f $p &&
+ test $(cat $p) = path7
+'
+
+test_expect_success 'emit well-formed relative path' '
+ rm -f path* .merge_* actual .git/index &&
+ >path0123456789 &&
+ git update-index --add path0123456789 &&
+ (
+ cd asubdir &&
+ git checkout-index --temp -- ../path0123456789 >actual &&
+ test_line_count = 1 actual &&
+ test $(cut "-d " -f2 actual) = ../path0123456789
+ )
+'
test_done
diff --git a/t/t2022-checkout-paths.sh b/t/t2022-checkout-paths.sh
index 8e3545d..f46d049 100755
--- a/t/t2022-checkout-paths.sh
+++ b/t/t2022-checkout-paths.sh
@@ -61,4 +61,21 @@ test_expect_success 'do not touch unmerged entries matching $path but not in $tr
test_cmp expect.next0 actual.next0
'
+test_expect_success 'do not touch files that are already up-to-date' '
+ git reset --hard &&
+ echo one >file1 &&
+ echo two >file2 &&
+ git add file1 file2 &&
+ git commit -m base &&
+ echo modified >file1 &&
+ test-chmtime =1000000000 file2 &&
+ git update-index -q --refresh &&
+ git checkout HEAD -- file1 file2 &&
+ echo one >expect &&
+ test_cmp expect file1 &&
+ echo "1000000000 file2" >expect &&
+ test-chmtime -v +0 file2 >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t2024-checkout-dwim.sh b/t/t2024-checkout-dwim.sh
index 6ecb559..468a000 100755
--- a/t/t2024-checkout-dwim.sh
+++ b/t/t2024-checkout-dwim.sh
@@ -185,4 +185,22 @@ test_expect_success 'checkout <branch> -- succeeds, even if a file with the same
test_branch_upstream spam repo_c spam
'
+test_expect_success 'loosely defined local base branch is reported correctly' '
+
+ git checkout master &&
+ git branch strict &&
+ git branch loose &&
+ git commit --allow-empty -m "a bit more" &&
+
+ test_config branch.strict.remote . &&
+ test_config branch.loose.remote . &&
+ test_config branch.strict.merge refs/heads/master &&
+ test_config branch.loose.merge master &&
+
+ git checkout strict | sed -e "s/strict/BRANCHNAME/g" >expect &&
+ git checkout loose | sed -e "s/loose/BRANCHNAME/g" >actual &&
+
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t2107-update-index-basic.sh b/t/t2107-update-index-basic.sh
index 1bafb90..dfe02f4 100755
--- a/t/t2107-update-index-basic.sh
+++ b/t/t2107-update-index-basic.sh
@@ -65,4 +65,19 @@ test_expect_success '--cacheinfo mode,sha1,path (new syntax)' '
test_cmp expect actual
'
+test_expect_success '.lock files cleaned up' '
+ mkdir cleanup &&
+ (
+ cd cleanup &&
+ mkdir worktree &&
+ git init repo &&
+ cd repo &&
+ git config core.worktree ../../worktree &&
+ # --refresh triggers late setup_work_tree,
+ # active_cache_changed is zero, rollback_lock_file fails
+ git update-index --refresh &&
+ ! test -f .git/index.lock
+ )
+'
+
test_done
diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh
index b2798fe..3fc484e 100755
--- a/t/t3001-ls-files-others-exclude.sh
+++ b/t/t3001-ls-files-others-exclude.sh
@@ -294,7 +294,7 @@ one/a.1
one/two/a.1
three/a.1
EOF
- git ls-files -o -i --exclude "**/a.1" >actual
+ git ls-files -o -i --exclude "**/a.1" >actual &&
test_cmp expect actual
'
diff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh
index 6d3b828..580e158 100755
--- a/t/t3010-ls-files-killed-modified.sh
+++ b/t/t3010-ls-files-killed-modified.sh
@@ -55,14 +55,11 @@ test_expect_success 'git update-index --add to add various paths.' '
: >path9 &&
date >path10 &&
git update-index --add -- path0 path?/file? pathx/ju path7 path8 path9 path10 &&
- for i in 1 2
- do
- git init submod$i &&
- (
- cd submod$i && git commit --allow-empty -m "empty $i"
- ) || break
- done &&
- git update-index --add submod[12]
+ git init submod1 &&
+ git -C submod1 commit --allow-empty -m "empty 1" &&
+ git init submod2 &&
+ git -C submod2 commit --allow-empty -m "empty 2" &&
+ git update-index --add submod[12] &&
(
cd submod1 &&
git commit --allow-empty -m "empty 1 (updated)"
@@ -99,12 +96,12 @@ test_expect_success 'git ls-files -k to show killed files.' '
'
test_expect_success 'git ls-files -k output (w/o icase)' '
- git ls-files -k >.output
+ git ls-files -k >.output &&
test_cmp .expected .output
'
test_expect_success 'git ls-files -k output (w/ icase)' '
- git -c core.ignorecase=true ls-files -k >.output
+ git -c core.ignorecase=true ls-files -k >.output &&
test_cmp .expected .output
'
diff --git a/t/t3031-merge-criscross.sh b/t/t3031-merge-criscross.sh
index 7f41607..e59b0a3 100755
--- a/t/t3031-merge-criscross.sh
+++ b/t/t3031-merge-criscross.sh
@@ -32,7 +32,7 @@ test_expect_success 'setup repo with criss-cross history' '
do
echo $n > data/$n &&
n=$(($n+1)) ||
- break
+ return 1
done &&
# check them in
diff --git a/t/t3060-ls-files-with-tree.sh b/t/t3060-ls-files-with-tree.sh
index 61c1f53..44f378c 100755
--- a/t/t3060-ls-files-with-tree.sh
+++ b/t/t3060-ls-files-with-tree.sh
@@ -18,22 +18,16 @@ test_expect_success setup '
echo file >expected &&
mkdir sub &&
- bad= &&
for n in 0 1 2 3 4 5
do
for m in 0 1 2 3 4 5 6 7 8 9
do
num=00$n$m &&
>sub/file-$num &&
- echo file-$num >>expected || {
- bad=t
- break
- }
- done && test -z "$bad" || {
- bad=t
- break
- }
- done && test -z "$bad" &&
+ echo file-$num >>expected ||
+ return 1
+ done
+ done &&
git add . &&
git commit -m "add a bunch of files" &&
diff --git a/t/t3102-ls-tree-wildcards.sh b/t/t3102-ls-tree-wildcards.sh
index c286854..4d4b02e 100755
--- a/t/t3102-ls-tree-wildcards.sh
+++ b/t/t3102-ls-tree-wildcards.sh
@@ -12,11 +12,25 @@ test_expect_success 'setup' '
'
test_expect_success 'ls-tree a[a] matches literally' '
- cat >expected <<EOF &&
-100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 a[a]/three
-EOF
+ cat >expect <<-\EOF &&
+ 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 a[a]/three
+ EOF
git ls-tree -r HEAD "a[a]" >actual &&
- test_cmp expected actual
+ test_cmp expect actual
+'
+
+test_expect_success 'ls-tree outside prefix' '
+ cat >expect <<-\EOF &&
+ 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 ../a[a]/three
+ EOF
+ ( cd aa && git ls-tree -r HEAD "../a[a]"; ) >actual &&
+ test_cmp expect actual
+'
+
+test_expect_failure 'ls-tree does not yet support negated pathspec' '
+ git ls-files ":(exclude)a" "a*" >expect &&
+ git ls-tree --name-only -r HEAD ":(exclude)a" "a*" >actual &&
+ test_cmp expect actual
'
test_done
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 432921b..ddea498 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -97,6 +97,20 @@ test_expect_success 'git branch -m o/o o should fail when o/p exists' '
test_must_fail git branch -m o/o o
'
+test_expect_success 'git branch -m o/q o/p should fail when o/p exists' '
+ git branch o/q &&
+ test_must_fail git branch -m o/q o/p
+'
+
+test_expect_success 'git branch -M o/q o/p should work when o/p exists' '
+ git branch -M o/q o/p
+'
+
+test_expect_success 'git branch -m -f o/q o/p should work when o/p exists' '
+ git branch o/q &&
+ git branch -m -f o/q o/p
+'
+
test_expect_success 'git branch -m q r/q should fail when r exists' '
git branch q &&
git branch r &&
diff --git a/t/t3202-show-branch-octopus.sh b/t/t3202-show-branch-octopus.sh
index 0a5d5e6..6adf478 100755
--- a/t/t3202-show-branch-octopus.sh
+++ b/t/t3202-show-branch-octopus.sh
@@ -19,7 +19,7 @@ test_expect_success 'setup' '
> file$i &&
git add file$i &&
test_tick &&
- git commit -m branch$i || break
+ git commit -m branch$i || return 1
done
'
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index ba4f98e..f51d0f3 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -96,7 +96,7 @@ test_expect_success 'git branch -v pattern does not show branch summaries' '
test_expect_success 'git branch shows detached HEAD properly' '
cat >expect <<EOF &&
-* (detached from $(git rev-parse --short HEAD^0))
+* (HEAD detached at $(git rev-parse --short HEAD^0))
branch-one
branch-two
master
@@ -106,4 +106,41 @@ EOF
test_i18ncmp expect actual
'
+test_expect_success 'git branch shows detached HEAD properly after moving' '
+ cat >expect <<EOF &&
+* (HEAD detached from $(git rev-parse --short HEAD))
+ branch-one
+ branch-two
+ master
+EOF
+ git reset --hard HEAD^1 &&
+ git branch >actual &&
+ test_i18ncmp expect actual
+'
+
+test_expect_success 'git branch shows detached HEAD properly from tag' '
+ cat >expect <<EOF &&
+* (HEAD detached at fromtag)
+ branch-one
+ branch-two
+ master
+EOF
+ git tag fromtag master &&
+ git checkout fromtag &&
+ git branch >actual &&
+ test_i18ncmp expect actual
+'
+
+test_expect_success 'git branch shows detached HEAD properly after moving from tag' '
+ cat >expect <<EOF &&
+* (HEAD detached from fromtag)
+ branch-one
+ branch-two
+ master
+EOF
+ git reset --hard HEAD^1 &&
+ git branch >actual &&
+ test_i18ncmp expect actual
+'
+
test_done
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index cfd67ff..8cffd35 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -7,28 +7,22 @@ test_description='Test commit notes'
. ./test-lib.sh
-cat > fake_editor.sh << \EOF
-#!/bin/sh
-echo "$MSG" > "$1"
-echo "$MSG" >& 2
+write_script fake_editor <<\EOF
+echo "$MSG" >"$1"
+echo "$MSG" >&2
EOF
-chmod a+x fake_editor.sh
-GIT_EDITOR=./fake_editor.sh
+GIT_EDITOR=./fake_editor
export GIT_EDITOR
+indent=" "
+
test_expect_success 'cannot annotate non-existing HEAD' '
test_must_fail env MSG=3 git notes add
'
-test_expect_success setup '
- : > a1 &&
- git add a1 &&
- test_tick &&
- git commit -m 1st &&
- : > a2 &&
- git add a2 &&
- test_tick &&
- git commit -m 2nd
+test_expect_success 'setup' '
+ test_commit 1st &&
+ test_commit 2nd
'
test_expect_success 'need valid notes ref' '
@@ -50,206 +44,186 @@ test_expect_success 'handle empty notes gracefully' '
'
test_expect_success 'show non-existent notes entry with %N' '
- for l in A B
- do
- echo "$l"
- done >expect &&
- git show -s --format='A%n%NB' >output &&
- test_cmp expect output
+ test_write_lines A B >expect &&
+ git show -s --format="A%n%NB" >actual &&
+ test_cmp expect actual
'
test_expect_success 'create notes' '
- git config core.notesRef refs/notes/commits &&
MSG=b4 git notes add &&
- test ! -f .git/NOTES_EDITMSG &&
- test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
- test b4 = $(git notes show) &&
+ test_path_is_missing .git/NOTES_EDITMSG &&
+ git ls-tree -r refs/notes/commits >actual &&
+ test_line_count = 1 actual &&
+ test "b4" = "$(git notes show)" &&
git show HEAD^ &&
test_must_fail git notes show HEAD^
'
test_expect_success 'show notes entry with %N' '
- for l in A b4 B
- do
- echo "$l"
- done >expect &&
- git show -s --format='A%n%NB' >output &&
- test_cmp expect output
+ test_write_lines A b4 B >expect &&
+ git show -s --format="A%n%NB" >actual &&
+ test_cmp expect actual
'
-cat >expect <<EOF
-d423f8c refs/notes/commits@{0}: notes: Notes added by 'git notes add'
-EOF
-
test_expect_success 'create reflog entry' '
- git reflog show refs/notes/commits >output &&
- test_cmp expect output
+ cat <<-EOF >expect &&
+ a1d8fa6 refs/notes/commits@{0}: notes: Notes added by '\''git notes add'\''
+ EOF
+ git reflog show refs/notes/commits >actual &&
+ test_cmp expect actual
'
test_expect_success 'edit existing notes' '
MSG=b3 git notes edit &&
- test ! -f .git/NOTES_EDITMSG &&
- test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
- test b3 = $(git notes show) &&
+ test_path_is_missing .git/NOTES_EDITMSG &&
+ git ls-tree -r refs/notes/commits >actual &&
+ test_line_count = 1 actual &&
+ test "b3" = "$(git notes show)" &&
git show HEAD^ &&
test_must_fail git notes show HEAD^
'
test_expect_success 'cannot "git notes add -m" where notes already exists' '
test_must_fail git notes add -m "b2" &&
- test ! -f .git/NOTES_EDITMSG &&
- test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
- test b3 = $(git notes show) &&
+ test_path_is_missing .git/NOTES_EDITMSG &&
+ git ls-tree -r refs/notes/commits >actual &&
+ test_line_count = 1 actual &&
+ test "b3" = "$(git notes show)" &&
git show HEAD^ &&
test_must_fail git notes show HEAD^
'
test_expect_success 'can overwrite existing note with "git notes add -f -m"' '
git notes add -f -m "b1" &&
- test ! -f .git/NOTES_EDITMSG &&
- test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
- test b1 = $(git notes show) &&
+ test_path_is_missing .git/NOTES_EDITMSG &&
+ git ls-tree -r refs/notes/commits >actual &&
+ test_line_count = 1 actual &&
+ test "b1" = "$(git notes show)" &&
git show HEAD^ &&
test_must_fail git notes show HEAD^
'
test_expect_success 'add w/no options on existing note morphs into edit' '
MSG=b2 git notes add &&
- test ! -f .git/NOTES_EDITMSG &&
- test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
- test b2 = $(git notes show) &&
+ test_path_is_missing .git/NOTES_EDITMSG &&
+ git ls-tree -r refs/notes/commits >actual &&
+ test_line_count = 1 actual &&
+ test "b2" = "$(git notes show)" &&
git show HEAD^ &&
test_must_fail git notes show HEAD^
'
test_expect_success 'can overwrite existing note with "git notes add -f"' '
MSG=b1 git notes add -f &&
- test ! -f .git/NOTES_EDITMSG &&
- test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
- test b1 = $(git notes show) &&
+ test_path_is_missing .git/NOTES_EDITMSG &&
+ git ls-tree -r refs/notes/commits >actual &&
+ test_line_count = 1 actual &&
+ test "b1" = "$(git notes show)" &&
git show HEAD^ &&
test_must_fail git notes show HEAD^
'
-cat > expect << EOF
-commit 268048bfb8a1fb38e703baceb8ab235421bf80c5
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:14:13 2005 -0700
-
- 2nd
+test_expect_success 'show notes' '
+ cat >expect <<-EOF &&
+ commit 7a4ca6ee52a974a66cbaa78e33214535dff1d691
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:14:13 2005 -0700
-Notes:
- b1
-EOF
+ ${indent}2nd
-test_expect_success 'show notes' '
+ Notes:
+ ${indent}b1
+ EOF
! (git cat-file commit HEAD | grep b1) &&
- git log -1 > output &&
- test_cmp expect output
-'
-
-test_expect_success 'create multi-line notes (setup)' '
- : > a3 &&
- git add a3 &&
- test_tick &&
- git commit -m 3rd &&
- MSG="b3
-c3c3c3c3
-d3d3d3" git notes add
+ git log -1 >actual &&
+ test_cmp expect actual
'
-cat > expect-multiline << EOF
-commit 1584215f1d29c65e99c6c6848626553fdd07fd75
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:15:13 2005 -0700
-
- 3rd
+test_expect_success 'show multi-line notes' '
+ test_commit 3rd &&
+ MSG="b3${LF}c3c3c3c3${LF}d3d3d3" git notes add &&
+ cat >expect-multiline <<-EOF &&
+ commit d07d62e5208f22eb5695e7eb47667dc8b9860290
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:15:13 2005 -0700
-Notes:
- b3
- c3c3c3c3
- d3d3d3
-EOF
+ ${indent}3rd
-printf "\n" >> expect-multiline
-cat expect >> expect-multiline
+ Notes:
+ ${indent}b3
+ ${indent}c3c3c3c3
+ ${indent}d3d3d3
-test_expect_success 'show multi-line notes' '
- git log -2 > output &&
- test_cmp expect-multiline output
-'
-test_expect_success 'create -F notes (setup)' '
- : > a4 &&
- git add a4 &&
- test_tick &&
- git commit -m 4th &&
- echo "xyzzy" > note5 &&
- git notes add -F note5
+ EOF
+ cat expect >>expect-multiline &&
+ git log -2 >actual &&
+ test_cmp expect-multiline actual
'
-cat > expect-F << EOF
-commit 15023535574ded8b1a89052b32673f84cf9582b8
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:16:13 2005 -0700
+test_expect_success 'show -F notes' '
+ test_commit 4th &&
+ echo "xyzzy" >note5 &&
+ git notes add -F note5 &&
+ cat >expect-F <<-EOF &&
+ commit 0f7aa3ec6325aeb88b910453bb3eb37c49d75c11
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:16:13 2005 -0700
- 4th
+ ${indent}4th
-Notes:
- xyzzy
-EOF
+ Notes:
+ ${indent}xyzzy
-printf "\n" >> expect-F
-cat expect-multiline >> expect-F
-
-test_expect_success 'show -F notes' '
- git log -3 > output &&
- test_cmp expect-F output
+ EOF
+ cat expect-multiline >>expect-F &&
+ git log -3 >actual &&
+ test_cmp expect-F actual
'
test_expect_success 'Re-adding -F notes without -f fails' '
- echo "zyxxy" > note5 &&
+ echo "zyxxy" >note5 &&
test_must_fail git notes add -F note5 &&
- git log -3 > output &&
- test_cmp expect-F output
+ git log -3 >actual &&
+ test_cmp expect-F actual
'
-cat >expect << EOF
-commit 15023535574ded8b1a89052b32673f84cf9582b8
-tree e070e3af51011e47b183c33adf9736736a525709
-parent 1584215f1d29c65e99c6c6848626553fdd07fd75
-author A U Thor <author@example.com> 1112912173 -0700
-committer C O Mitter <committer@example.com> 1112912173 -0700
-
- 4th
-EOF
test_expect_success 'git log --pretty=raw does not show notes' '
- git log -1 --pretty=raw >output &&
- test_cmp expect output
+ cat >expect <<-EOF &&
+ commit 0f7aa3ec6325aeb88b910453bb3eb37c49d75c11
+ tree 05ac65288c4c4b3b709a020ae94b2ece2f2201ae
+ parent d07d62e5208f22eb5695e7eb47667dc8b9860290
+ author A U Thor <author@example.com> 1112912173 -0700
+ committer C O Mitter <committer@example.com> 1112912173 -0700
+
+ ${indent}4th
+ EOF
+ git log -1 --pretty=raw >actual &&
+ test_cmp expect actual
'
-cat >>expect <<EOF
-
-Notes:
- xyzzy
-EOF
test_expect_success 'git log --show-notes' '
- git log -1 --pretty=raw --show-notes >output &&
- test_cmp expect output
+ cat >>expect <<-EOF &&
+
+ Notes:
+ ${indent}xyzzy
+ EOF
+ git log -1 --pretty=raw --show-notes >actual &&
+ test_cmp expect actual
'
test_expect_success 'git log --no-notes' '
- git log -1 --no-notes >output &&
- ! grep xyzzy output
+ git log -1 --no-notes >actual &&
+ ! grep xyzzy actual
'
test_expect_success 'git format-patch does not show notes' '
- git format-patch -1 --stdout >output &&
- ! grep xyzzy output
+ git format-patch -1 --stdout >actual &&
+ ! grep xyzzy actual
'
test_expect_success 'git format-patch --show-notes does show notes' '
- git format-patch --show-notes -1 --stdout >output &&
- grep xyzzy output
+ git format-patch --show-notes -1 --stdout >actual &&
+ grep xyzzy actual
'
for pretty in \
@@ -261,8 +235,8 @@ do
?*) p="$pretty" not=" not" negate="!" ;;
esac
test_expect_success "git show $pretty does$not show notes" '
- git show $p >output &&
- eval "$negate grep xyzzy output"
+ git show $p >actual &&
+ eval "$negate grep xyzzy actual"
'
done
@@ -271,161 +245,131 @@ test_expect_success 'setup alternate notes ref' '
'
test_expect_success 'git log --notes shows default notes' '
- git log -1 --notes >output &&
- grep xyzzy output &&
- ! grep alternate output
+ git log -1 --notes >actual &&
+ grep xyzzy actual &&
+ ! grep alternate actual
'
test_expect_success 'git log --notes=X shows only X' '
- git log -1 --notes=alternate >output &&
- ! grep xyzzy output &&
- grep alternate output
+ git log -1 --notes=alternate >actual &&
+ ! grep xyzzy actual &&
+ grep alternate actual
'
test_expect_success 'git log --notes --notes=X shows both' '
- git log -1 --notes --notes=alternate >output &&
- grep xyzzy output &&
- grep alternate output
+ git log -1 --notes --notes=alternate >actual &&
+ grep xyzzy actual &&
+ grep alternate actual
'
test_expect_success 'git log --no-notes resets default state' '
git log -1 --notes --notes=alternate \
--no-notes --notes=alternate \
- >output &&
- ! grep xyzzy output &&
- grep alternate output
+ >actual &&
+ ! grep xyzzy actual &&
+ grep alternate actual
'
test_expect_success 'git log --no-notes resets ref list' '
git log -1 --notes --notes=alternate \
--no-notes --notes \
- >output &&
- grep xyzzy output &&
- ! grep alternate output
-'
-
-test_expect_success 'create -m notes (setup)' '
- : > a5 &&
- git add a5 &&
- test_tick &&
- git commit -m 5th &&
- git notes add -m spam -m "foo
-bar
-baz"
-'
-
-whitespace=" "
-cat > expect-m << EOF
-commit bd1753200303d0a0344be813e504253b3d98e74d
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:17:13 2005 -0700
-
- 5th
-
-Notes:
- spam
-$whitespace
- foo
- bar
- baz
-EOF
-
-printf "\n" >> expect-m
-cat expect-F >> expect-m
-
-test_expect_success 'show -m notes' '
- git log -4 > output &&
- test_cmp expect-m output
+ >actual &&
+ grep xyzzy actual &&
+ ! grep alternate actual
'
-test_expect_success 'remove note with add -f -F /dev/null (setup)' '
- git notes add -f -F /dev/null
-'
-
-cat > expect-rm-F << EOF
-commit bd1753200303d0a0344be813e504253b3d98e74d
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:17:13 2005 -0700
-
- 5th
-EOF
-
-printf "\n" >> expect-rm-F
-cat expect-F >> expect-rm-F
-
-test_expect_success 'verify note removal with -F /dev/null' '
- git log -4 > output &&
- test_cmp expect-rm-F output &&
+test_expect_success 'show -m notes' '
+ test_commit 5th &&
+ git notes add -m spam -m "foo${LF}bar${LF}baz" &&
+ cat >expect-m <<-EOF &&
+ commit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:17:13 2005 -0700
+
+ ${indent}5th
+
+ Notes:
+ ${indent}spam
+ ${indent}
+ ${indent}foo
+ ${indent}bar
+ ${indent}baz
+
+ EOF
+ cat expect-F >>expect-m &&
+ git log -4 >actual &&
+ test_cmp expect-m actual
+'
+
+test_expect_success 'remove note with add -f -F /dev/null' '
+ git notes add -f -F /dev/null &&
+ cat >expect-rm-F <<-EOF &&
+ commit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:17:13 2005 -0700
+
+ ${indent}5th
+
+ EOF
+ cat expect-F >>expect-rm-F &&
+ git log -4 >actual &&
+ test_cmp expect-rm-F actual &&
test_must_fail git notes show
'
-test_expect_success 'do not create empty note with -m "" (setup)' '
- git notes add -m ""
-'
-
-test_expect_success 'verify non-creation of note with -m ""' '
- git log -4 > output &&
- test_cmp expect-rm-F output &&
+test_expect_success 'do not create empty note with -m ""' '
+ git notes add -m "" &&
+ git log -4 >actual &&
+ test_cmp expect-rm-F actual &&
test_must_fail git notes show
'
-cat > expect-combine_m_and_F << EOF
-foo
-
-xyzzy
+test_expect_success 'create note with combination of -m and -F' '
+ cat >expect-combine_m_and_F <<-EOF &&
+ foo
-bar
+ xyzzy
-zyxxy
+ bar
-baz
-EOF
+ zyxxy
-test_expect_success 'create note with combination of -m and -F' '
- echo "xyzzy" > note_a &&
- echo "zyxxy" > note_b &&
+ baz
+ EOF
+ echo "xyzzy" >note_a &&
+ echo "zyxxy" >note_b &&
git notes add -m "foo" -F note_a -m "bar" -F note_b -m "baz" &&
- git notes show > output &&
- test_cmp expect-combine_m_and_F output
+ git notes show >actual &&
+ test_cmp expect-combine_m_and_F actual
'
-test_expect_success 'remove note with "git notes remove" (setup)' '
+test_expect_success 'remove note with "git notes remove"' '
git notes remove HEAD^ &&
- git notes remove
-'
-
-cat > expect-rm-remove << EOF
-commit bd1753200303d0a0344be813e504253b3d98e74d
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:17:13 2005 -0700
+ git notes remove &&
+ cat >expect-rm-remove <<-EOF &&
+ commit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:17:13 2005 -0700
- 5th
+ ${indent}5th
-commit 15023535574ded8b1a89052b32673f84cf9582b8
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:16:13 2005 -0700
+ commit 0f7aa3ec6325aeb88b910453bb3eb37c49d75c11
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:16:13 2005 -0700
- 4th
-EOF
-
-printf "\n" >> expect-rm-remove
-cat expect-multiline >> expect-rm-remove
+ ${indent}4th
-test_expect_success 'verify note removal with "git notes remove"' '
- git log -4 > output &&
- test_cmp expect-rm-remove output &&
+ EOF
+ cat expect-multiline >>expect-rm-remove &&
+ git log -4 >actual &&
+ test_cmp expect-rm-remove actual &&
test_must_fail git notes show HEAD^
'
-cat > expect << EOF
-c18dc024e14f08d18d14eea0d747ff692d66d6a3 1584215f1d29c65e99c6c6848626553fdd07fd75
-c9c6af7f78bc47490dbf3e822cf2f3c24d4b9061 268048bfb8a1fb38e703baceb8ab235421bf80c5
-EOF
-
test_expect_success 'removing non-existing note should not create new commit' '
- git rev-parse --verify refs/notes/commits > before_commit &&
+ git rev-parse --verify refs/notes/commits >before_commit &&
test_must_fail git notes remove HEAD^ &&
- git rev-parse --verify refs/notes/commits > after_commit &&
+ git rev-parse --verify refs/notes/commits >after_commit &&
test_cmp before_commit after_commit
'
@@ -505,70 +449,68 @@ test_expect_success 'removing with --stdin --ignore-missing' '
'
test_expect_success 'list notes with "git notes list"' '
- git notes list > output &&
- test_cmp expect output
+ cat >expect <<-EOF &&
+ c9c6af7f78bc47490dbf3e822cf2f3c24d4b9061 7a4ca6ee52a974a66cbaa78e33214535dff1d691
+ c18dc024e14f08d18d14eea0d747ff692d66d6a3 d07d62e5208f22eb5695e7eb47667dc8b9860290
+ EOF
+ git notes list >actual &&
+ test_cmp expect actual
'
test_expect_success 'list notes with "git notes"' '
- git notes > output &&
- test_cmp expect output
+ git notes >actual &&
+ test_cmp expect actual
'
-cat > expect << EOF
-c18dc024e14f08d18d14eea0d747ff692d66d6a3
-EOF
-
test_expect_success 'list specific note with "git notes list <object>"' '
- git notes list HEAD^^ > output &&
- test_cmp expect output
+ cat >expect <<-EOF &&
+ c18dc024e14f08d18d14eea0d747ff692d66d6a3
+ EOF
+ git notes list HEAD^^ >actual &&
+ test_cmp expect actual
'
-cat > expect << EOF
-EOF
-
test_expect_success 'listing non-existing notes fails' '
- test_must_fail git notes list HEAD > output &&
- test_cmp expect output
+ cat >expect <<-EOF &&
+ EOF
+ test_must_fail git notes list HEAD >actual &&
+ test_cmp expect actual
'
-cat > expect << EOF
-Initial set of notes
-
-More notes appended with git notes append
-EOF
-
test_expect_success 'append to existing note with "git notes append"' '
+ cat >expect <<-EOF &&
+ Initial set of notes
+
+ More notes appended with git notes append
+ EOF
git notes add -m "Initial set of notes" &&
git notes append -m "More notes appended with git notes append" &&
- git notes show > output &&
- test_cmp expect output
+ git notes show >actual &&
+ test_cmp expect actual
'
-cat > expect_list << EOF
-c18dc024e14f08d18d14eea0d747ff692d66d6a3 1584215f1d29c65e99c6c6848626553fdd07fd75
-c9c6af7f78bc47490dbf3e822cf2f3c24d4b9061 268048bfb8a1fb38e703baceb8ab235421bf80c5
-4b6ad22357cc8a1296720574b8d2fbc22fab0671 bd1753200303d0a0344be813e504253b3d98e74d
-EOF
-
test_expect_success '"git notes list" does not expand to "git notes list HEAD"' '
- git notes list > output &&
- test_cmp expect_list output
+ cat >expect_list <<-EOF &&
+ c9c6af7f78bc47490dbf3e822cf2f3c24d4b9061 7a4ca6ee52a974a66cbaa78e33214535dff1d691
+ 4b6ad22357cc8a1296720574b8d2fbc22fab0671 7f9ad8836c775acb134c0a055fc55fb4cd1ba361
+ c18dc024e14f08d18d14eea0d747ff692d66d6a3 d07d62e5208f22eb5695e7eb47667dc8b9860290
+ EOF
+ git notes list >actual &&
+ test_cmp expect_list actual
'
test_expect_success 'appending empty string does not change existing note' '
git notes append -m "" &&
- git notes show > output &&
- test_cmp expect output
+ git notes show >actual &&
+ test_cmp expect actual
'
test_expect_success 'git notes append == add when there is no existing note' '
git notes remove HEAD &&
test_must_fail git notes list HEAD &&
- git notes append -m "Initial set of notes
-
-More notes appended with git notes append" &&
- git notes show > output &&
- test_cmp expect output
+ git notes append -m "Initial set of notes${LF}${LF}More notes appended with git notes append" &&
+ git notes show >actual &&
+ test_cmp expect actual
'
test_expect_success 'appending empty string to non-existing note does not create note' '
@@ -579,229 +521,208 @@ test_expect_success 'appending empty string to non-existing note does not create
'
test_expect_success 'create other note on a different notes ref (setup)' '
- : > a6 &&
- git add a6 &&
- test_tick &&
- git commit -m 6th &&
- GIT_NOTES_REF="refs/notes/other" git notes add -m "other note"
-'
+ test_commit 6th &&
+ GIT_NOTES_REF="refs/notes/other" git notes add -m "other note" &&
+ cat >expect-not-other <<-EOF &&
+ commit 2c125331118caba0ff8238b7f4958ac6e93fe39c
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:18:13 2005 -0700
-cat > expect-other << EOF
-commit 387a89921c73d7ed72cd94d179c1c7048ca47756
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:18:13 2005 -0700
-
- 6th
-
-Notes (other):
- other note
-EOF
+ ${indent}6th
+ EOF
+ cp expect-not-other expect-other &&
+ cat >>expect-other <<-EOF
-cat > expect-not-other << EOF
-commit 387a89921c73d7ed72cd94d179c1c7048ca47756
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:18:13 2005 -0700
-
- 6th
-EOF
+ Notes (other):
+ ${indent}other note
+ EOF
+'
test_expect_success 'Do not show note on other ref by default' '
- git log -1 > output &&
- test_cmp expect-not-other output
+ git log -1 >actual &&
+ test_cmp expect-not-other actual
'
test_expect_success 'Do show note when ref is given in GIT_NOTES_REF' '
- GIT_NOTES_REF="refs/notes/other" git log -1 > output &&
- test_cmp expect-other output
+ GIT_NOTES_REF="refs/notes/other" git log -1 >actual &&
+ test_cmp expect-other actual
'
test_expect_success 'Do show note when ref is given in core.notesRef config' '
- git config core.notesRef "refs/notes/other" &&
- git log -1 > output &&
- test_cmp expect-other output
+ test_config core.notesRef "refs/notes/other" &&
+ git log -1 >actual &&
+ test_cmp expect-other actual
'
test_expect_success 'Do not show note when core.notesRef is overridden' '
- GIT_NOTES_REF="refs/notes/wrong" git log -1 > output &&
- test_cmp expect-not-other output
+ test_config core.notesRef "refs/notes/other" &&
+ GIT_NOTES_REF="refs/notes/wrong" git log -1 >actual &&
+ test_cmp expect-not-other actual
'
-cat > expect-both << EOF
-commit 387a89921c73d7ed72cd94d179c1c7048ca47756
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:18:13 2005 -0700
-
- 6th
+test_expect_success 'Show all notes when notes.displayRef=refs/notes/*' '
+ cat >expect-both <<-EOF &&
+ commit 2c125331118caba0ff8238b7f4958ac6e93fe39c
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:18:13 2005 -0700
-Notes:
- order test
+ ${indent}6th
-Notes (other):
- other note
+ Notes:
+ ${indent}order test
-commit bd1753200303d0a0344be813e504253b3d98e74d
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:17:13 2005 -0700
+ Notes (other):
+ ${indent}other note
- 5th
+ commit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:17:13 2005 -0700
-Notes:
- replacement for deleted note
-EOF
+ ${indent}5th
-test_expect_success 'Show all notes when notes.displayRef=refs/notes/*' '
+ Notes:
+ ${indent}replacement for deleted note
+ EOF
GIT_NOTES_REF=refs/notes/commits git notes add \
-m"replacement for deleted note" HEAD^ &&
GIT_NOTES_REF=refs/notes/commits git notes add -m"order test" &&
- git config --unset core.notesRef &&
- git config notes.displayRef "refs/notes/*" &&
- git log -2 > output &&
- test_cmp expect-both output
+ test_unconfig core.notesRef &&
+ test_config notes.displayRef "refs/notes/*" &&
+ git log -2 >actual &&
+ test_cmp expect-both actual
'
test_expect_success 'core.notesRef is implicitly in notes.displayRef' '
- git config core.notesRef refs/notes/commits &&
- git config notes.displayRef refs/notes/other &&
- git log -2 > output &&
- test_cmp expect-both output
+ test_config core.notesRef refs/notes/commits &&
+ test_config notes.displayRef refs/notes/other &&
+ git log -2 >actual &&
+ test_cmp expect-both actual
'
test_expect_success 'notes.displayRef can be given more than once' '
- git config --unset core.notesRef &&
- git config notes.displayRef refs/notes/commits &&
+ test_unconfig core.notesRef &&
+ test_config notes.displayRef refs/notes/commits &&
git config --add notes.displayRef refs/notes/other &&
- git log -2 > output &&
- test_cmp expect-both output
+ git log -2 >actual &&
+ test_cmp expect-both actual
'
-cat > expect-both-reversed << EOF
-commit 387a89921c73d7ed72cd94d179c1c7048ca47756
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:18:13 2005 -0700
-
- 6th
+test_expect_success 'notes.displayRef respects order' '
+ cat >expect-both-reversed <<-EOF &&
+ commit 2c125331118caba0ff8238b7f4958ac6e93fe39c
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:18:13 2005 -0700
-Notes (other):
- other note
+ ${indent}6th
-Notes:
- order test
-EOF
+ Notes (other):
+ ${indent}other note
-test_expect_success 'notes.displayRef respects order' '
- git config core.notesRef refs/notes/other &&
- git config --unset-all notes.displayRef &&
- git config notes.displayRef refs/notes/commits &&
- git log -1 > output &&
- test_cmp expect-both-reversed output
+ Notes:
+ ${indent}order test
+ EOF
+ test_config core.notesRef refs/notes/other &&
+ test_config notes.displayRef refs/notes/commits &&
+ git log -1 >actual &&
+ test_cmp expect-both-reversed actual
'
test_expect_success 'GIT_NOTES_DISPLAY_REF works' '
- git config --unset-all core.notesRef &&
- git config --unset-all notes.displayRef &&
GIT_NOTES_DISPLAY_REF=refs/notes/commits:refs/notes/other \
- git log -2 > output &&
- test_cmp expect-both output
+ git log -2 >actual &&
+ test_cmp expect-both actual
'
-cat > expect-none << EOF
-commit 387a89921c73d7ed72cd94d179c1c7048ca47756
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:18:13 2005 -0700
-
- 6th
+test_expect_success 'GIT_NOTES_DISPLAY_REF overrides config' '
+ cat >expect-none <<-EOF &&
+ commit 2c125331118caba0ff8238b7f4958ac6e93fe39c
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:18:13 2005 -0700
-commit bd1753200303d0a0344be813e504253b3d98e74d
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:17:13 2005 -0700
+ ${indent}6th
- 5th
-EOF
+ commit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:17:13 2005 -0700
-test_expect_success 'GIT_NOTES_DISPLAY_REF overrides config' '
- git config notes.displayRef "refs/notes/*" &&
- GIT_NOTES_REF= GIT_NOTES_DISPLAY_REF= git log -2 > output &&
- test_cmp expect-none output
+ ${indent}5th
+ EOF
+ test_config notes.displayRef "refs/notes/*" &&
+ GIT_NOTES_REF= GIT_NOTES_DISPLAY_REF= git log -2 >actual &&
+ test_cmp expect-none actual
'
test_expect_success '--show-notes=* adds to GIT_NOTES_DISPLAY_REF' '
- GIT_NOTES_REF= GIT_NOTES_DISPLAY_REF= git log --show-notes=* -2 > output &&
- test_cmp expect-both output
+ GIT_NOTES_REF= GIT_NOTES_DISPLAY_REF= git log --show-notes=* -2 >actual &&
+ test_cmp expect-both actual
'
-cat > expect-commits << EOF
-commit 387a89921c73d7ed72cd94d179c1c7048ca47756
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:18:13 2005 -0700
-
- 6th
+test_expect_success '--no-standard-notes' '
+ cat >expect-commits <<-EOF &&
+ commit 2c125331118caba0ff8238b7f4958ac6e93fe39c
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:18:13 2005 -0700
-Notes:
- order test
-EOF
+ ${indent}6th
-test_expect_success '--no-standard-notes' '
- git log --no-standard-notes --show-notes=commits -1 > output &&
- test_cmp expect-commits output
+ Notes:
+ ${indent}order test
+ EOF
+ git log --no-standard-notes --show-notes=commits -1 >actual &&
+ test_cmp expect-commits actual
'
test_expect_success '--standard-notes' '
+ test_config notes.displayRef "refs/notes/*" &&
git log --no-standard-notes --show-notes=commits \
- --standard-notes -2 > output &&
- test_cmp expect-both output
+ --standard-notes -2 >actual &&
+ test_cmp expect-both actual
'
test_expect_success '--show-notes=ref accumulates' '
git log --show-notes=other --show-notes=commits \
- --no-standard-notes -1 > output &&
- test_cmp expect-both-reversed output
+ --no-standard-notes -1 >actual &&
+ test_cmp expect-both-reversed actual
'
test_expect_success 'Allow notes on non-commits (trees, blobs, tags)' '
- git config core.notesRef refs/notes/other &&
- echo "Note on a tree" > expect &&
+ test_config core.notesRef refs/notes/other &&
+ echo "Note on a tree" >expect &&
git notes add -m "Note on a tree" HEAD: &&
- git notes show HEAD: > actual &&
+ git notes show HEAD: >actual &&
test_cmp expect actual &&
- echo "Note on a blob" > expect &&
+ echo "Note on a blob" >expect &&
filename=$(git ls-tree --name-only HEAD | head -n1) &&
git notes add -m "Note on a blob" HEAD:$filename &&
- git notes show HEAD:$filename > actual &&
+ git notes show HEAD:$filename >actual &&
test_cmp expect actual &&
- echo "Note on a tag" > expect &&
+ echo "Note on a tag" >expect &&
git tag -a -m "This is an annotated tag" foobar HEAD^ &&
git notes add -m "Note on a tag" foobar &&
- git notes show foobar > actual &&
+ git notes show foobar >actual &&
test_cmp expect actual
'
-cat > expect << EOF
-commit 2ede89468182a62d0bde2583c736089bcf7d7e92
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:19:13 2005 -0700
-
- 7th
+test_expect_success 'create note from other note with "git notes add -C"' '
+ cat >expect <<-EOF &&
+ commit fb01e0ca8c33b6cc0c6451dde747f97df567cb5c
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:19:13 2005 -0700
-Notes (other):
- other note
-EOF
+ ${indent}7th
-test_expect_success 'create note from other note with "git notes add -C"' '
- : > a7 &&
- git add a7 &&
- test_tick &&
- git commit -m 7th &&
+ Notes:
+ ${indent}order test
+ EOF
+ test_commit 7th &&
git notes add -C $(git notes list HEAD^) &&
- git log -1 > actual &&
+ git log -1 >actual &&
test_cmp expect actual &&
test "$(git notes list HEAD)" = "$(git notes list HEAD^)"
'
test_expect_success 'create note from non-existing note with "git notes add -C" fails' '
- : > a8 &&
- git add a8 &&
- test_tick &&
- git commit -m 8th &&
+ test_commit 8th &&
test_must_fail git notes add -C deadbeef &&
test_must_fail git notes list HEAD
'
@@ -814,405 +735,386 @@ test_expect_success 'create note from non-blob with "git notes add -C" fails' '
test_must_fail git notes list HEAD
'
-cat > expect << EOF
-commit 80d796defacd5db327b7a4e50099663902fbdc5c
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:20:13 2005 -0700
-
- 8th
+test_expect_success 'create note from blob with "git notes add -C" reuses blob id' '
+ cat >expect <<-EOF &&
+ commit 9a4c31c7f722b5d517e92c64e932dd751e1413bf
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:20:13 2005 -0700
-Notes (other):
- This is a blob object
-EOF
+ ${indent}8th
-test_expect_success 'create note from blob with "git notes add -C" reuses blob id' '
+ Notes:
+ ${indent}This is a blob object
+ EOF
blob=$(echo "This is a blob object" | git hash-object -w --stdin) &&
git notes add -C $blob &&
- git log -1 > actual &&
+ git log -1 >actual &&
test_cmp expect actual &&
test "$(git notes list HEAD)" = "$blob"
'
-cat > expect << EOF
-commit 016e982bad97eacdbda0fcbd7ce5b0ba87c81f1b
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:21:13 2005 -0700
-
- 9th
+test_expect_success 'create note from other note with "git notes add -c"' '
+ cat >expect <<-EOF &&
+ commit 2e0db4bc649e174d667a1cde19e725cf897a5bd2
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:21:13 2005 -0700
-Notes (other):
- yet another note
-EOF
+ ${indent}9th
-test_expect_success 'create note from other note with "git notes add -c"' '
- : > a9 &&
- git add a9 &&
- test_tick &&
- git commit -m 9th &&
+ Notes:
+ ${indent}yet another note
+ EOF
+ test_commit 9th &&
MSG="yet another note" git notes add -c $(git notes list HEAD^^) &&
- git log -1 > actual &&
+ git log -1 >actual &&
test_cmp expect actual
'
test_expect_success 'create note from non-existing note with "git notes add -c" fails' '
- : > a10 &&
- git add a10 &&
- test_tick &&
- git commit -m 10th &&
+ test_commit 10th &&
test_must_fail env MSG="yet another note" git notes add -c deadbeef &&
test_must_fail git notes list HEAD
'
-cat > expect << EOF
-commit 016e982bad97eacdbda0fcbd7ce5b0ba87c81f1b
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:21:13 2005 -0700
-
- 9th
-
-Notes (other):
- yet another note
-$whitespace
- yet another note
-EOF
-
test_expect_success 'append to note from other note with "git notes append -C"' '
+ cat >expect <<-EOF &&
+ commit 2e0db4bc649e174d667a1cde19e725cf897a5bd2
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:21:13 2005 -0700
+
+ ${indent}9th
+
+ Notes:
+ ${indent}yet another note
+ ${indent}
+ ${indent}yet another note
+ EOF
git notes append -C $(git notes list HEAD^) HEAD^ &&
- git log -1 HEAD^ > actual &&
+ git log -1 HEAD^ >actual &&
test_cmp expect actual
'
-cat > expect << EOF
-commit ffed603236bfa3891c49644257a83598afe8ae5a
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:22:13 2005 -0700
+test_expect_success 'create note from other note with "git notes append -c"' '
+ cat >expect <<-EOF &&
+ commit 7c3b87ab368f81e11b1ea87b2ab99a71ccd25406
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:22:13 2005 -0700
- 10th
+ ${indent}10th
-Notes (other):
- other note
-EOF
-
-test_expect_success 'create note from other note with "git notes append -c"' '
+ Notes:
+ ${indent}other note
+ EOF
MSG="other note" git notes append -c $(git notes list HEAD^) &&
- git log -1 > actual &&
+ git log -1 >actual &&
test_cmp expect actual
'
-cat > expect << EOF
-commit ffed603236bfa3891c49644257a83598afe8ae5a
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:22:13 2005 -0700
-
- 10th
-
-Notes (other):
- other note
-$whitespace
- yet another note
-EOF
-
test_expect_success 'append to note from other note with "git notes append -c"' '
+ cat >expect <<-EOF &&
+ commit 7c3b87ab368f81e11b1ea87b2ab99a71ccd25406
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:22:13 2005 -0700
+
+ ${indent}10th
+
+ Notes:
+ ${indent}other note
+ ${indent}
+ ${indent}yet another note
+ EOF
MSG="yet another note" git notes append -c $(git notes list HEAD) &&
- git log -1 > actual &&
+ git log -1 >actual &&
test_cmp expect actual
'
-cat > expect << EOF
-commit 6352c5e33dbcab725fe0579be16aa2ba8eb369be
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:23:13 2005 -0700
-
- 11th
-
-Notes (other):
- other note
-$whitespace
- yet another note
-EOF
-
test_expect_success 'copy note with "git notes copy"' '
- : > a11 &&
- git add a11 &&
- test_tick &&
- git commit -m 11th &&
+ cat >expect <<-EOF &&
+ commit a446fff8777efdc6eb8f4b7c8a5ff699484df0d5
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:23:13 2005 -0700
+
+ ${indent}11th
+
+ Notes:
+ ${indent}other note
+ ${indent}
+ ${indent}yet another note
+ EOF
+ test_commit 11th &&
git notes copy HEAD^ HEAD &&
- git log -1 > actual &&
+ git log -1 >actual &&
test_cmp expect actual &&
test "$(git notes list HEAD)" = "$(git notes list HEAD^)"
'
test_expect_success 'prevent overwrite with "git notes copy"' '
test_must_fail git notes copy HEAD~2 HEAD &&
- git log -1 > actual &&
+ git log -1 >actual &&
test_cmp expect actual &&
test "$(git notes list HEAD)" = "$(git notes list HEAD^)"
'
-cat > expect << EOF
-commit 6352c5e33dbcab725fe0579be16aa2ba8eb369be
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:23:13 2005 -0700
-
- 11th
-
-Notes (other):
- yet another note
-$whitespace
- yet another note
-EOF
-
test_expect_success 'allow overwrite with "git notes copy -f"' '
+ cat >expect <<-EOF &&
+ commit a446fff8777efdc6eb8f4b7c8a5ff699484df0d5
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:23:13 2005 -0700
+
+ ${indent}11th
+
+ Notes:
+ ${indent}yet another note
+ ${indent}
+ ${indent}yet another note
+ EOF
git notes copy -f HEAD~2 HEAD &&
- git log -1 > actual &&
+ git log -1 >actual &&
test_cmp expect actual &&
test "$(git notes list HEAD)" = "$(git notes list HEAD~2)"
'
test_expect_success 'cannot copy note from object without notes' '
- : > a12 &&
- git add a12 &&
- test_tick &&
- git commit -m 12th &&
- : > a13 &&
- git add a13 &&
- test_tick &&
- git commit -m 13th &&
+ test_commit 12th &&
+ test_commit 13th &&
test_must_fail git notes copy HEAD^ HEAD
'
-cat > expect << EOF
-commit e5d4fb5698d564ab8c73551538ecaf2b0c666185
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:25:13 2005 -0700
-
- 13th
+test_expect_success 'git notes copy --stdin' '
+ cat >expect <<-EOF &&
+ commit e871aa61182b1d95d0a6fb75445d891722863b6b
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:25:13 2005 -0700
-Notes (other):
- yet another note
-$whitespace
- yet another note
+ ${indent}13th
-commit 7038787dfe22a14c3867ce816dbba39845359719
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:24:13 2005 -0700
+ Notes:
+ ${indent}yet another note
+ ${indent}
+ ${indent}yet another note
- 12th
+ commit 65e263ded02ae4e8839bc151095113737579dc12
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:24:13 2005 -0700
-Notes (other):
- other note
-$whitespace
- yet another note
-EOF
+ ${indent}12th
-test_expect_success 'git notes copy --stdin' '
+ Notes:
+ ${indent}other note
+ ${indent}
+ ${indent}yet another note
+ EOF
(echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^); \
echo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) |
git notes copy --stdin &&
- git log -2 > output &&
- test_cmp expect output &&
+ git log -2 >actual &&
+ test_cmp expect actual &&
test "$(git notes list HEAD)" = "$(git notes list HEAD~2)" &&
test "$(git notes list HEAD^)" = "$(git notes list HEAD~3)"
'
-cat > expect << EOF
-commit 37a0d4cba38afef96ba54a3ea567e6dac575700b
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:27:13 2005 -0700
-
- 15th
+test_expect_success 'git notes copy --for-rewrite (unconfigured)' '
+ cat >expect <<-EOF &&
+ commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:27:13 2005 -0700
-commit be28d8b4d9951ad940d229ee3b0b9ee3b1ec273d
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:26:13 2005 -0700
+ ${indent}15th
- 14th
-EOF
+ commit 07c85d77059393ed0154b8c96906547a59dfcddd
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:26:13 2005 -0700
-test_expect_success 'git notes copy --for-rewrite (unconfigured)' '
+ ${indent}14th
+ EOF
test_commit 14th &&
test_commit 15th &&
(echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^); \
echo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) |
git notes copy --for-rewrite=foo &&
- git log -2 > output &&
- test_cmp expect output
+ git log -2 >actual &&
+ test_cmp expect actual
'
-cat > expect << EOF
-commit 37a0d4cba38afef96ba54a3ea567e6dac575700b
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:27:13 2005 -0700
-
- 15th
-
-Notes (other):
- yet another note
-$whitespace
- yet another note
-
-commit be28d8b4d9951ad940d229ee3b0b9ee3b1ec273d
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:26:13 2005 -0700
-
- 14th
-
-Notes (other):
- other note
-$whitespace
- yet another note
-EOF
-
test_expect_success 'git notes copy --for-rewrite (enabled)' '
- git config notes.rewriteMode overwrite &&
- git config notes.rewriteRef "refs/notes/*" &&
+ cat >expect <<-EOF &&
+ commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:27:13 2005 -0700
+
+ ${indent}15th
+
+ Notes:
+ ${indent}yet another note
+ ${indent}
+ ${indent}yet another note
+
+ commit 07c85d77059393ed0154b8c96906547a59dfcddd
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:26:13 2005 -0700
+
+ ${indent}14th
+
+ Notes:
+ ${indent}other note
+ ${indent}
+ ${indent}yet another note
+ EOF
+ test_config notes.rewriteMode overwrite &&
+ test_config notes.rewriteRef "refs/notes/*" &&
(echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^); \
echo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) |
git notes copy --for-rewrite=foo &&
- git log -2 > output &&
- test_cmp expect output
+ git log -2 >actual &&
+ test_cmp expect actual
'
test_expect_success 'git notes copy --for-rewrite (disabled)' '
- git config notes.rewrite.bar false &&
+ test_config notes.rewrite.bar false &&
echo $(git rev-parse HEAD~3) $(git rev-parse HEAD) |
git notes copy --for-rewrite=bar &&
- git log -2 > output &&
- test_cmp expect output
+ git log -2 >actual &&
+ test_cmp expect actual
'
-cat > expect << EOF
-commit 37a0d4cba38afef96ba54a3ea567e6dac575700b
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:27:13 2005 -0700
-
- 15th
+test_expect_success 'git notes copy --for-rewrite (overwrite)' '
+ cat >expect <<-EOF &&
+ commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:27:13 2005 -0700
-Notes (other):
- a fresh note
-EOF
+ ${indent}15th
-test_expect_success 'git notes copy --for-rewrite (overwrite)' '
+ Notes:
+ ${indent}a fresh note
+ EOF
git notes add -f -m"a fresh note" HEAD^ &&
+ test_config notes.rewriteMode overwrite &&
+ test_config notes.rewriteRef "refs/notes/*" &&
echo $(git rev-parse HEAD^) $(git rev-parse HEAD) |
git notes copy --for-rewrite=foo &&
- git log -1 > output &&
- test_cmp expect output
+ git log -1 >actual &&
+ test_cmp expect actual
'
test_expect_success 'git notes copy --for-rewrite (ignore)' '
- git config notes.rewriteMode ignore &&
+ test_config notes.rewriteMode ignore &&
+ test_config notes.rewriteRef "refs/notes/*" &&
echo $(git rev-parse HEAD^) $(git rev-parse HEAD) |
git notes copy --for-rewrite=foo &&
- git log -1 > output &&
- test_cmp expect output
+ git log -1 >actual &&
+ test_cmp expect actual
'
-cat > expect << EOF
-commit 37a0d4cba38afef96ba54a3ea567e6dac575700b
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:27:13 2005 -0700
-
- 15th
-
-Notes (other):
- a fresh note
-$whitespace
- another fresh note
-EOF
-
test_expect_success 'git notes copy --for-rewrite (append)' '
+ cat >expect <<-EOF &&
+ commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:27:13 2005 -0700
+
+ ${indent}15th
+
+ Notes:
+ ${indent}a fresh note
+ ${indent}
+ ${indent}another fresh note
+ EOF
git notes add -f -m"another fresh note" HEAD^ &&
- git config notes.rewriteMode concatenate &&
+ test_config notes.rewriteMode concatenate &&
+ test_config notes.rewriteRef "refs/notes/*" &&
echo $(git rev-parse HEAD^) $(git rev-parse HEAD) |
git notes copy --for-rewrite=foo &&
- git log -1 > output &&
- test_cmp expect output
+ git log -1 >actual &&
+ test_cmp expect actual
'
-cat > expect << EOF
-commit 37a0d4cba38afef96ba54a3ea567e6dac575700b
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:27:13 2005 -0700
-
- 15th
-
-Notes (other):
- a fresh note
-$whitespace
- another fresh note
-$whitespace
- append 1
-$whitespace
- append 2
-EOF
-
test_expect_success 'git notes copy --for-rewrite (append two to one)' '
+ cat >expect <<-EOF &&
+ commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:27:13 2005 -0700
+
+ ${indent}15th
+
+ Notes:
+ ${indent}a fresh note
+ ${indent}
+ ${indent}another fresh note
+ ${indent}
+ ${indent}append 1
+ ${indent}
+ ${indent}append 2
+ EOF
git notes add -f -m"append 1" HEAD^ &&
git notes add -f -m"append 2" HEAD^^ &&
+ test_config notes.rewriteMode concatenate &&
+ test_config notes.rewriteRef "refs/notes/*" &&
(echo $(git rev-parse HEAD^) $(git rev-parse HEAD);
echo $(git rev-parse HEAD^^) $(git rev-parse HEAD)) |
git notes copy --for-rewrite=foo &&
- git log -1 > output &&
- test_cmp expect output
+ git log -1 >actual &&
+ test_cmp expect actual
'
test_expect_success 'git notes copy --for-rewrite (append empty)' '
git notes remove HEAD^ &&
+ test_config notes.rewriteMode concatenate &&
+ test_config notes.rewriteRef "refs/notes/*" &&
echo $(git rev-parse HEAD^) $(git rev-parse HEAD) |
git notes copy --for-rewrite=foo &&
- git log -1 > output &&
- test_cmp expect output
+ git log -1 >actual &&
+ test_cmp expect actual
'
-cat > expect << EOF
-commit 37a0d4cba38afef96ba54a3ea567e6dac575700b
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:27:13 2005 -0700
-
- 15th
-
-Notes (other):
- replacement note 1
-EOF
-
test_expect_success 'GIT_NOTES_REWRITE_MODE works' '
+ cat >expect <<-EOF &&
+ commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:27:13 2005 -0700
+
+ ${indent}15th
+
+ Notes:
+ ${indent}replacement note 1
+ EOF
+ test_config notes.rewriteMode concatenate &&
+ test_config notes.rewriteRef "refs/notes/*" &&
git notes add -f -m"replacement note 1" HEAD^ &&
echo $(git rev-parse HEAD^) $(git rev-parse HEAD) |
GIT_NOTES_REWRITE_MODE=overwrite git notes copy --for-rewrite=foo &&
- git log -1 > output &&
- test_cmp expect output
+ git log -1 >actual &&
+ test_cmp expect actual
'
-cat > expect << EOF
-commit 37a0d4cba38afef96ba54a3ea567e6dac575700b
-Author: A U Thor <author@example.com>
-Date: Thu Apr 7 15:27:13 2005 -0700
+test_expect_success 'GIT_NOTES_REWRITE_REF works' '
+ cat >expect <<-EOF &&
+ commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89
+ Author: A U Thor <author@example.com>
+ Date: Thu Apr 7 15:27:13 2005 -0700
- 15th
+ ${indent}15th
-Notes (other):
- replacement note 2
-EOF
-
-test_expect_success 'GIT_NOTES_REWRITE_REF works' '
- git config notes.rewriteMode overwrite &&
+ Notes:
+ ${indent}replacement note 2
+ EOF
git notes add -f -m"replacement note 2" HEAD^ &&
- git config --unset-all notes.rewriteRef &&
+ test_config notes.rewriteMode overwrite &&
+ test_unconfig notes.rewriteRef &&
echo $(git rev-parse HEAD^) $(git rev-parse HEAD) |
GIT_NOTES_REWRITE_REF=refs/notes/commits:refs/notes/other \
git notes copy --for-rewrite=foo &&
- git log -1 > output &&
- test_cmp expect output
+ git log -1 >actual &&
+ test_cmp expect actual
'
test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' '
- git config notes.rewriteRef refs/notes/other &&
git notes add -f -m"replacement note 3" HEAD^ &&
+ test_config notes.rewriteMode overwrite &&
+ test_config notes.rewriteRef refs/notes/other &&
echo $(git rev-parse HEAD^) $(git rev-parse HEAD) |
GIT_NOTES_REWRITE_REF= git notes copy --for-rewrite=foo &&
- git log -1 > output &&
- test_cmp expect output
+ git log -1 >actual &&
+ test_cmp expect actual
'
test_expect_success 'git notes copy diagnoses too many or too few parameters' '
@@ -1221,13 +1123,13 @@ test_expect_success 'git notes copy diagnoses too many or too few parameters' '
'
test_expect_success 'git notes get-ref (no overrides)' '
- git config --unset core.notesRef &&
+ test_unconfig core.notesRef &&
sane_unset GIT_NOTES_REF &&
test "$(git notes get-ref)" = "refs/notes/commits"
'
test_expect_success 'git notes get-ref (core.notesRef)' '
- git config core.notesRef refs/notes/foo &&
+ test_config core.notesRef refs/notes/foo &&
test "$(git notes get-ref)" = "refs/notes/foo"
'
@@ -1239,4 +1141,51 @@ test_expect_success 'git notes get-ref (--ref)' '
test "$(GIT_NOTES_REF=refs/notes/bar git notes --ref=baz get-ref)" = "refs/notes/baz"
'
+test_expect_success 'setup testing of empty notes' '
+ test_unconfig core.notesRef &&
+ test_commit 16th &&
+ empty_blob=$(git hash-object -w /dev/null) &&
+ echo "$empty_blob" >expect_empty
+'
+
+while read cmd
+do
+ test_expect_success "'git notes $cmd' removes empty note" "
+ test_might_fail git notes remove HEAD &&
+ MSG= git notes $cmd &&
+ test_must_fail git notes list HEAD
+ "
+
+ test_expect_success "'git notes $cmd --allow-empty' stores empty note" "
+ test_might_fail git notes remove HEAD &&
+ MSG= git notes $cmd --allow-empty &&
+ git notes list HEAD >actual &&
+ test_cmp expect_empty actual
+ "
+done <<\EOF
+add
+add -F /dev/null
+add -m ""
+add -c "$empty_blob"
+add -C "$empty_blob"
+append
+append -F /dev/null
+append -m ""
+append -c "$empty_blob"
+append -C "$empty_blob"
+edit
+EOF
+
+test_expect_success 'empty notes are displayed by git log' '
+ test_commit 17th &&
+ git log -1 >expect &&
+ cat >>expect <<-EOF &&
+
+ Notes:
+ EOF
+ git notes add -C "$empty_blob" --allow-empty &&
+ git log -1 >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t3305-notes-fanout.sh b/t/t3305-notes-fanout.sh
index b1ea64b..54460be 100755
--- a/t/t3305-notes-fanout.sh
+++ b/t/t3305-notes-fanout.sh
@@ -51,15 +51,12 @@ test_expect_success 'deleting most notes with git-notes' '
num_notes=250 &&
i=0 &&
git rev-list HEAD |
- while read sha1
+ while test $i -lt $num_notes && read sha1
do
i=$(($i + 1)) &&
- if test $i -gt $num_notes
- then
- break
- fi &&
test_tick &&
- git notes remove "$sha1"
+ git notes remove "$sha1" ||
+ exit 1
done
'
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 8197ed2..eed76cc 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -950,7 +950,7 @@ test_expect_success 'rebase --edit-todo can be used to modify todo' '
set_fake_editor &&
FAKE_LINES="edit 1 2 3" git rebase -i HEAD~3 &&
FAKE_LINES="2 1" git rebase --edit-todo &&
- git rebase --continue
+ git rebase --continue &&
test M = $(git cat-file commit HEAD^ | sed -ne \$p) &&
test L = $(git cat-file commit HEAD | sed -ne \$p)
'
@@ -1007,7 +1007,7 @@ test_expect_success 'rebase -i with --strategy and -X' '
'
test_expect_success 'rebase -i error on commits with \ in message' '
- current_head=$(git rev-parse HEAD)
+ current_head=$(git rev-parse HEAD) &&
test_when_finished "git rebase --abort; git reset --hard $current_head; rm -f error" &&
test_commit TO-REMOVE will-conflict old-content &&
test_commit "\temp" will-conflict new-content dummy &&
@@ -1039,4 +1039,20 @@ test_expect_success 'short SHA-1 collide' '
)
'
+test_expect_success 'respect core.abbrev' '
+ git config core.abbrev 12 &&
+ set_cat_todo_editor &&
+ test_must_fail git rebase -i HEAD~4 >todo-list &&
+ test 4 = $(grep -c "pick [0-9a-f]\{12,\}" todo-list)
+'
+
+test_expect_success 'todo count' '
+ write_script dump-raw.sh <<-\EOF &&
+ cat "$1"
+ EOF
+ test_set_editor "$(pwd)/dump-raw.sh" &&
+ git rebase -i HEAD~4 >actual &&
+ grep "^# Rebase ..* onto ..* ([0-9]" actual
+'
+
test_done
diff --git a/t/t3405-rebase-malformed.sh b/t/t3405-rebase-malformed.sh
index 19eddad..ff8c360 100755
--- a/t/t3405-rebase-malformed.sh
+++ b/t/t3405-rebase-malformed.sh
@@ -24,7 +24,7 @@ test_expect_success setup '
git add file1 file2 &&
test_tick &&
git commit -m "Initial commit" &&
- git branch diff-in-message
+ git branch diff-in-message &&
git checkout -b multi-line-subject &&
cat F >file2 &&
@@ -36,7 +36,7 @@ test_expect_success setup '
git checkout diff-in-message &&
echo "commit log message containing a diff" >G &&
- echo "" >>G
+ echo "" >>G &&
cat G >file2 &&
git add file2 &&
git diff --cached >>G &&
diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh
index 1d195fb..846f85c 100755
--- a/t/t3425-rebase-topology-merges.sh
+++ b/t/t3425-rebase-topology-merges.sh
@@ -24,7 +24,7 @@ test_expect_success 'setup of non-linear-history' '
test_commit c &&
git checkout b &&
test_commit d &&
- test_commit e
+ test_commit e &&
git checkout c &&
test_commit g &&
@@ -33,7 +33,7 @@ test_expect_success 'setup of non-linear-history' '
cherry_pick gp g &&
test_commit i &&
git checkout b &&
- test_commit f
+ test_commit f &&
git checkout d &&
test_commit n &&
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index 223b984..7c5ad08 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -351,19 +351,45 @@ test_expect_success 'commit after failed cherry-pick does not add duplicated -s'
test_expect_success 'commit after failed cherry-pick adds -s at the right place' '
pristine_detach initial &&
test_must_fail git cherry-pick picked &&
+
git commit -a -s &&
- pwd &&
- cat <<EOF > expected &&
-picked
-Signed-off-by: C O Mitter <committer@example.com>
+ # Do S-o-b and Conflicts appear in the right order?
+ cat <<-\EOF >expect &&
+ Signed-off-by: C O Mitter <committer@example.com>
+ # Conflicts:
+ EOF
+ grep -e "^# Conflicts:" -e '^Signed-off-by' <.git/COMMIT_EDITMSG >actual &&
+ test_cmp expect actual &&
+
+ cat <<-\EOF >expected &&
+ picked
-Conflicts:
- foo
-EOF
+ Signed-off-by: C O Mitter <committer@example.com>
+ EOF
- git show -s --pretty=format:%B > actual &&
+ git show -s --pretty=format:%B >actual &&
test_cmp expected actual
'
+test_expect_success 'commit --amend -s places the sign-off at the right place' '
+ pristine_detach initial &&
+ test_must_fail git cherry-pick picked &&
+
+ # emulate old-style conflicts block
+ mv .git/MERGE_MSG .git/MERGE_MSG+ &&
+ sed -e "/^# Conflicts:/,\$s/^# *//" <.git/MERGE_MSG+ >.git/MERGE_MSG &&
+
+ git commit -a &&
+ git commit --amend -s &&
+
+ # Do S-o-b and Conflicts appear in the right order?
+ cat <<-\EOF >expect &&
+ Signed-off-by: C O Mitter <committer@example.com>
+ Conflicts:
+ EOF
+ grep -e "^Conflicts:" -e '^Signed-off-by' <.git/COMMIT_EDITMSG >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t3511-cherry-pick-x.sh b/t/t3511-cherry-pick-x.sh
index f977279..b7dff09 100755
--- a/t/t3511-cherry-pick-x.sh
+++ b/t/t3511-cherry-pick-x.sh
@@ -36,6 +36,20 @@ mesg_with_cherry_footer="$mesg_with_footer_sob
(cherry picked from commit da39a3ee5e6b4b0d3255bfef95601890afd80709)
Tested-by: C.U. Thor <cuthor@example.com>"
+mesg_unclean="$mesg_one_line
+
+
+leading empty lines
+
+
+consecutive empty lines
+
+# hash tag comment
+
+trailing empty lines
+
+
+"
test_expect_success setup '
git config advice.detachedhead false &&
@@ -53,6 +67,10 @@ test_expect_success setup '
test_commit "$mesg_with_footer_sob" foo b mesg-with-footer-sob &&
git reset --hard initial &&
test_commit "$mesg_with_cherry_footer" foo b mesg-with-cherry-footer &&
+ git reset --hard initial &&
+ test_config commit.cleanup verbatim &&
+ test_commit "$mesg_unclean" foo b mesg-unclean &&
+ test_unconfig commit.cleanup &&
pristine_detach initial &&
test_commit conflicting unrelated
'
@@ -216,4 +234,14 @@ test_expect_success 'cherry-pick -x -s treats "(cherry picked from..." line as p
test_cmp expect actual
'
+test_expect_success 'cherry-pick preserves commit message' '
+ pristine_detach initial &&
+ printf "$mesg_unclean" >expect &&
+ git log -1 --pretty=format:%B mesg-unclean >actual &&
+ test_cmp expect actual &&
+ git cherry-pick mesg-unclean &&
+ git log -1 --pretty=format:%B >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index e00d7d2..9d90d2c 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -38,37 +38,37 @@ test_expect_success \
test_expect_success \
'Test that git rm --cached foo succeeds if the index matches the file' \
- 'echo content > foo
- git add foo
+ 'echo content >foo &&
+ git add foo &&
git rm --cached foo'
test_expect_success \
'Test that git rm --cached foo succeeds if the index matches the file' \
- 'echo content > foo
- git add foo
- git commit -m foo
- echo "other content" > foo
+ 'echo content >foo &&
+ git add foo &&
+ git commit -m foo &&
+ echo "other content" >foo &&
git rm --cached foo'
test_expect_success \
'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' '
- echo content > foo
- git add foo
- git commit -m foo
- echo "other content" > foo
- git add foo
- echo "yet another content" > foo
+ echo content >foo &&
+ git add foo &&
+ git commit -m foo --allow-empty &&
+ echo "other content" >foo &&
+ git add foo &&
+ echo "yet another content" >foo &&
test_must_fail git rm --cached foo
'
test_expect_success \
'Test that git rm --cached -f foo works in case where --cached only did not' \
- 'echo content > foo
- git add foo
- git commit -m foo
- echo "other content" > foo
- git add foo
- echo "yet another content" > foo
+ 'echo content >foo &&
+ git add foo &&
+ git commit -m foo --allow-empty &&
+ echo "other content" >foo &&
+ git add foo &&
+ echo "yet another content" >foo &&
git rm --cached -f foo'
test_expect_success \
@@ -170,7 +170,7 @@ test_expect_success 'but with -f it should work.' '
git rm -f foo baz &&
test ! -f foo &&
test ! -f baz &&
- test_must_fail git ls-files --error-unmatch foo
+ test_must_fail git ls-files --error-unmatch foo &&
test_must_fail git ls-files --error-unmatch baz
'
@@ -183,7 +183,7 @@ test_expect_success 'refuse to remove cached empty file with modifications' '
test_expect_success 'remove intent-to-add file without --force' '
echo content >intent-to-add &&
- git add -N intent-to-add
+ git add -N intent-to-add &&
git rm --cached intent-to-add
'
@@ -201,7 +201,7 @@ test_expect_success 'Recursive without -r fails' '
'
test_expect_success 'Recursive with -r but dirty' '
- echo qfwfq >>frotz/nitfol
+ echo qfwfq >>frotz/nitfol &&
test_must_fail git rm -r frotz &&
test -d frotz &&
test -f frotz/nitfol
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index fe274e2..f7ff1f5 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -91,6 +91,13 @@ test_expect_success 'error out when attempting to add ignored ones without -f' '
! (git ls-files | grep "\\.ig")
'
+test_expect_success 'error out when attempting to add ignored ones but add others' '
+ touch a.if &&
+ test_must_fail git add a.?? &&
+ ! (git ls-files | grep "\\.ig") &&
+ (git ls-files | grep a.if)
+'
+
test_expect_success 'add ignored ones with -f' '
git add -f a.?? &&
git ls-files --error-unmatch a.ig
@@ -311,7 +318,6 @@ cat >expect.err <<\EOF
The following paths are ignored by one of your .gitignore files:
ignored-file
Use -f if you really want to add them.
-fatal: no files added
EOF
cat >expect.out <<\EOF
add 'track-this'
diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh
index a392f3d..75cf3ff 100755
--- a/t/t3901-i18n-patch.sh
+++ b/t/t3901-i18n-patch.sh
@@ -9,7 +9,7 @@ test_description='i18n settings and format-patch | am pipe'
check_encoding () {
# Make sure characters are not corrupted
- cnt="$1" header="$2" i=1 j=0 bad=0
+ cnt="$1" header="$2" i=1 j=0
while test "$i" -le $cnt
do
git format-patch --encoding=UTF-8 --stdout HEAD~$i..HEAD~$j |
@@ -20,14 +20,10 @@ check_encoding () {
grep "^encoding ISO8859-1" ;;
*)
grep "^encoding ISO8859-1"; test "$?" != 0 ;;
- esac || {
- bad=1
- break
- }
+ esac || return 1
j=$i
i=$(($i+1))
done
- (exit $bad)
}
test_expect_success setup '
diff --git a/t/t4003-diff-rename-1.sh b/t/t4003-diff-rename-1.sh
index bfa8835..df2accb 100755
--- a/t/t4003-diff-rename-1.sh
+++ b/t/t4003-diff-rename-1.sh
@@ -11,7 +11,7 @@ test_description='More rename detection
test_expect_success \
'prepare reference tree' \
- 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
+ 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
echo frotz >rezrov &&
git update-index --add COPYING rezrov &&
tree=$(git write-tree) &&
@@ -99,7 +99,7 @@ test_expect_success \
test_expect_success \
'prepare work tree once again' \
- 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
+ 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
git update-index --add --remove COPYING COPYING.1'
# tree has COPYING and rezrov. work tree has COPYING and COPYING.1,
diff --git a/t/t4005-diff-rename-2.sh b/t/t4005-diff-rename-2.sh
index 7d2c6e1..135addb 100755
--- a/t/t4005-diff-rename-2.sh
+++ b/t/t4005-diff-rename-2.sh
@@ -11,7 +11,7 @@ test_description='Same rename detection as t4003 but testing diff-raw.
test_expect_success \
'prepare reference tree' \
- 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
+ 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
echo frotz >rezrov &&
git update-index --add COPYING rezrov &&
tree=$(git write-tree) &&
@@ -71,7 +71,7 @@ test_expect_success \
test_expect_success \
'prepare work tree once again' \
- 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
+ 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
git update-index --add --remove COPYING COPYING.1'
git diff-index -C --find-copies-harder $tree >current
diff --git a/t/t4007-rename-3.sh b/t/t4007-rename-3.sh
index 11502b7..dae327f 100755
--- a/t/t4007-rename-3.sh
+++ b/t/t4007-rename-3.sh
@@ -11,7 +11,7 @@ test_description='Rename interaction with pathspec.
test_expect_success 'prepare reference tree' '
mkdir path0 path1 &&
- cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+ cp "$TEST_DIRECTORY"/diff-lib/COPYING path0/COPYING &&
git update-index --add path0/COPYING &&
tree=$(git write-tree) &&
echo $tree
diff --git a/t/t4008-diff-break-rewrite.sh b/t/t4008-diff-break-rewrite.sh
index 27e98a8..9dd1bc5 100755
--- a/t/t4008-diff-break-rewrite.sh
+++ b/t/t4008-diff-break-rewrite.sh
@@ -10,179 +10,145 @@ We have two very different files, file0 and file1, registered in a tree.
We update file1 so drastically that it is more similar to file0, and
then remove file0. With -B, changes to file1 should be broken into
separate delete and create, resulting in removal of file0, removal of
-original file1 and creation of completely rewritten file1.
+original file1 and creation of completely rewritten file1. The latter
+two are then merged back into a single "complete rewrite".
Further, with -B and -M together, these three modifications should
turn into rename-edit of file0 into file1.
Starting from the same two files in the tree, we swap file0 and file1.
-With -B, this should be detected as two complete rewrites, resulting in
-four changes in total.
+With -B, this should be detected as two complete rewrites.
Further, with -B and -M together, these should turn into two renames.
'
. ./test-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
-test_expect_success \
- setup \
- 'cat "$TEST_DIRECTORY"/../README >file0 &&
- cat "$TEST_DIRECTORY"/../COPYING >file1 &&
- git update-index --add file0 file1 &&
- tree=$(git write-tree) &&
- echo "$tree"'
-
-test_expect_success \
- 'change file1 with copy-edit of file0 and remove file0' \
- 'sed -e "s/git/GIT/" file0 >file1 &&
- rm -f file0 &&
- git update-index --remove file0 file1'
-
-test_expect_success \
- 'run diff with -B' \
- 'git diff-index -B --cached "$tree" >current'
-
-cat >expected <<\EOF
-:100644 000000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 0000000000000000000000000000000000000000 D file0
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 11e331465a89c394dc25c780de230043750c1ec8 M100 file1
-EOF
-
-test_expect_success \
- 'validate result of -B (#1)' \
- 'compare_diff_raw expected current'
-
-test_expect_success \
- 'run diff with -B and -M' \
- 'git diff-index -B -M "$tree" >current'
-
-cat >expected <<\EOF
-:100644 100644 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 08bb2fb671deff4c03a4d4a0a1315dff98d5732c R100 file0 file1
-EOF
-
-test_expect_success \
- 'validate result of -B -M (#2)' \
- 'compare_diff_raw expected current'
-
-test_expect_success \
- 'swap file0 and file1' \
- 'rm -f file0 file1 &&
- git read-tree -m $tree &&
- git checkout-index -f -u -a &&
- mv file0 tmp &&
- mv file1 file0 &&
- mv tmp file1 &&
- git update-index file0 file1'
-
-test_expect_success \
- 'run diff with -B' \
- 'git diff-index -B "$tree" >current'
-
-cat >expected <<\EOF
-:100644 100644 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 6ff87c4664981e4397625791c8ea3bbb5f2279a3 M100 file0
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 M100 file1
-EOF
-
-test_expect_success \
- 'validate result of -B (#3)' \
- 'compare_diff_raw expected current'
-
-test_expect_success \
- 'run diff with -B and -M' \
- 'git diff-index -B -M "$tree" >current'
-
-cat >expected <<\EOF
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100 file1 file0
-:100644 100644 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 R100 file0 file1
-EOF
-
-test_expect_success \
- 'validate result of -B -M (#4)' \
- 'compare_diff_raw expected current'
-
-test_expect_success \
- 'make file0 into something completely different' \
- 'rm -f file0 &&
- test_ln_s_add frotz file0 &&
- git update-index file1'
-
-test_expect_success \
- 'run diff with -B' \
- 'git diff-index -B "$tree" >current'
-
-cat >expected <<\EOF
-:100644 120000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 67be421f88824578857624f7b3dc75e99a8a1481 T file0
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 M100 file1
-EOF
-
-test_expect_success \
- 'validate result of -B (#5)' \
- 'compare_diff_raw expected current'
-
-test_expect_success \
- 'run diff with -B -M' \
- 'git diff-index -B -M "$tree" >current'
-
-# file0 changed from regular to symlink. file1 is very close to the preimage of file0.
-# because we break file0, file1 can become a rename of it.
-cat >expected <<\EOF
-:100644 120000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 67be421f88824578857624f7b3dc75e99a8a1481 T file0
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 R file0 file1
-EOF
-
-test_expect_success \
- 'validate result of -B -M (#6)' \
- 'compare_diff_raw expected current'
-
-test_expect_success \
- 'run diff with -M' \
- 'git diff-index -M "$tree" >current'
-
-# This should not mistake file0 as the copy source of new file1
-# due to type differences.
-cat >expected <<\EOF
-:100644 120000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 67be421f88824578857624f7b3dc75e99a8a1481 T file0
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 M file1
-EOF
-
-test_expect_success \
- 'validate result of -M (#7)' \
- 'compare_diff_raw expected current'
-
-test_expect_success \
- 'file1 edited to look like file0 and file0 rename-edited to file2' \
- 'rm -f file0 file1 &&
- git read-tree -m $tree &&
- git checkout-index -f -u -a &&
- sed -e "s/git/GIT/" file0 >file1 &&
- sed -e "s/git/GET/" file0 >file2 &&
- rm -f file0 &&
- git update-index --add --remove file0 file1 file2'
-
-test_expect_success \
- 'run diff with -B' \
- 'git diff-index -B "$tree" >current'
-
-cat >expected <<\EOF
-:100644 000000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 0000000000000000000000000000000000000000 D file0
-:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 08bb2fb671deff4c03a4d4a0a1315dff98d5732c M100 file1
-:000000 100644 0000000000000000000000000000000000000000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 A file2
-EOF
-
-test_expect_success \
- 'validate result of -B (#8)' \
- 'compare_diff_raw expected current'
-
-test_expect_success \
- 'run diff with -B -C' \
- 'git diff-index -B -C "$tree" >current'
-
-cat >expected <<\EOF
-:100644 100644 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 08bb2fb671deff4c03a4d4a0a1315dff98d5732c C095 file0 file1
-:100644 100644 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 59f832e5c8b3f7e486be15ad0cd3e95ba9af8998 R095 file0 file2
-EOF
-
-test_expect_success \
- 'validate result of -B -M (#9)' \
- 'compare_diff_raw expected current'
+test_expect_success setup '
+ cat "$TEST_DIRECTORY"/diff-lib/README >file0 &&
+ cat "$TEST_DIRECTORY"/diff-lib/COPYING >file1 &&
+ git update-index --add file0 file1 &&
+ git tag reference $(git write-tree)
+'
+
+test_expect_success 'change file1 with copy-edit of file0 and remove file0' '
+ sed -e "s/git/GIT/" file0 >file1 &&
+ rm -f file0 &&
+ git update-index --remove file0 file1
+'
+
+test_expect_success 'run diff with -B (#1)' '
+ git diff-index -B --cached reference >current &&
+ cat >expect <<-\EOF &&
+ :100644 000000 548142c327a6790ff8821d67c2ee1eff7a656b52 0000000000000000000000000000000000000000 D file0
+ :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec M100 file1
+ EOF
+ compare_diff_raw expect current
+'
+
+test_expect_success 'run diff with -B and -M (#2)' '
+ git diff-index -B -M reference >current &&
+ cat >expect <<-\EOF &&
+ :100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec R100 file0 file1
+ EOF
+ compare_diff_raw expect current
+'
+
+test_expect_success 'swap file0 and file1' '
+ rm -f file0 file1 &&
+ git read-tree -m reference &&
+ git checkout-index -f -u -a &&
+ mv file0 tmp &&
+ mv file1 file0 &&
+ mv tmp file1 &&
+ git update-index file0 file1
+'
+
+test_expect_success 'run diff with -B (#3)' '
+ git diff-index -B reference >current &&
+ cat >expect <<-\EOF &&
+ :100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 6ff87c4664981e4397625791c8ea3bbb5f2279a3 M100 file0
+ :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M100 file1
+ EOF
+ compare_diff_raw expect current
+'
+
+test_expect_success 'run diff with -B and -M (#4)' '
+ git diff-index -B -M reference >current &&
+ cat >expect <<-\EOF &&
+ :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100 file1 file0
+ :100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 548142c327a6790ff8821d67c2ee1eff7a656b52 R100 file0 file1
+ EOF
+ compare_diff_raw expect current
+'
+
+test_expect_success 'make file0 into something completely different' '
+ rm -f file0 &&
+ test_ln_s_add frotz file0 &&
+ git update-index file1
+'
+
+test_expect_success 'run diff with -B (#5)' '
+ git diff-index -B reference >current &&
+ cat >expect <<-\EOF &&
+ :100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T file0
+ :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M100 file1
+ EOF
+ compare_diff_raw expect current
+'
+
+test_expect_success 'run diff with -B -M (#6)' '
+ git diff-index -B -M reference >current &&
+
+ # file0 changed from regular to symlink. file1 is the same as the preimage
+ # of file0. Because the change does not make file0 disappear, file1 is
+ # denoted as a copy of file0
+ cat >expect <<-\EOF &&
+ :100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T file0
+ :100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 548142c327a6790ff8821d67c2ee1eff7a656b52 C file0 file1
+ EOF
+ compare_diff_raw expect current
+'
+
+test_expect_success 'run diff with -M (#7)' '
+ git diff-index -M reference >current &&
+
+ # This should not mistake file0 as the copy source of new file1
+ # due to type differences.
+ cat >expect <<-\EOF &&
+ :100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T file0
+ :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M file1
+ EOF
+ compare_diff_raw expect current
+'
+
+test_expect_success 'file1 edited to look like file0 and file0 rename-edited to file2' '
+ rm -f file0 file1 &&
+ git read-tree -m reference &&
+ git checkout-index -f -u -a &&
+ sed -e "s/git/GIT/" file0 >file1 &&
+ sed -e "s/git/GET/" file0 >file2 &&
+ rm -f file0 &&
+ git update-index --add --remove file0 file1 file2
+'
+
+test_expect_success 'run diff with -B (#8)' '
+ git diff-index -B reference >current &&
+ cat >expect <<-\EOF &&
+ :100644 000000 548142c327a6790ff8821d67c2ee1eff7a656b52 0000000000000000000000000000000000000000 D file0
+ :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec M100 file1
+ :000000 100644 0000000000000000000000000000000000000000 69a939f651686f56322566e2fd76715947a24162 A file2
+ EOF
+ compare_diff_raw expect current
+'
+
+test_expect_success 'run diff with -B -C (#9)' '
+ git diff-index -B -C reference >current &&
+ cat >expect <<-\EOF &&
+ :100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec C095 file0 file1
+ :100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 69a939f651686f56322566e2fd76715947a24162 R095 file0 file2
+ EOF
+ compare_diff_raw expect current
+'
test_done
diff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh
index 57c094f..3641fd8 100755
--- a/t/t4009-diff-rename-4.sh
+++ b/t/t4009-diff-rename-4.sh
@@ -11,7 +11,7 @@ test_description='Same rename detection as t4003 but testing diff-raw -z.
test_expect_success \
'prepare reference tree' \
- 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
+ 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
echo frotz >rezrov &&
git update-index --add COPYING rezrov &&
tree=$(git write-tree) &&
@@ -78,7 +78,7 @@ test_expect_success \
test_expect_success \
'prepare work tree once again' \
- 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
+ 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
git update-index --add --remove COPYING COPYING.1'
git diff-index -z -C --find-copies-harder $tree >current
diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh
index bf07841..43c488b 100755
--- a/t/t4010-diff-pathspec.sh
+++ b/t/t4010-diff-pathspec.sh
@@ -56,7 +56,7 @@ test_expect_success \
compare_diff_raw current expected'
cat >expected <<\EOF
-:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M file0
+:100644 100644 8e4020bb5a8d8c873b25de15933e75cc0fc275df dca6b92303befc93086aa025d90a5facd7eb2812 M file0
EOF
test_expect_success \
'limit to file0 should show file0' \
diff --git a/t/t4013/diff.log_--decorate_--all b/t/t4013/diff.log_--decorate_--all
index 27d3eab..3aa16a9 100644
--- a/t/t4013/diff.log_--decorate_--all
+++ b/t/t4013/diff.log_--decorate_--all
@@ -5,7 +5,7 @@ Date: Mon Jun 26 00:06:00 2006 +0000
Rearranged lines in dir/sub
-commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD, master)
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> master)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 256affc..c39e500 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -802,7 +802,7 @@ test_expect_success '--no-signature suppresses format.signaturefile ' '
'
test_expect_success '--signature-file overrides format.signaturefile' '
- cat >other-mail-signature <<-\EOF
+ cat >other-mail-signature <<-\EOF &&
Use this other signature instead of mail-signature.
EOF
test_config format.signaturefile mail-signature &&
diff --git a/t/t4022-diff-rewrite.sh b/t/t4022-diff-rewrite.sh
index 2d030a4..cb51d9f 100755
--- a/t/t4022-diff-rewrite.sh
+++ b/t/t4022-diff-rewrite.sh
@@ -20,10 +20,7 @@ test_expect_success setup '
test_expect_success 'detect rewrite' '
actual=$(git diff-files -B --summary test) &&
- expr "$actual" : " rewrite test ([0-9]*%)$" || {
- echo "Eh? <<$actual>>"
- false
- }
+ verbose expr "$actual" : " rewrite test ([0-9]*%)$"
'
diff --git a/t/t4023-diff-rename-typechange.sh b/t/t4023-diff-rename-typechange.sh
index 55d549f..8c98237 100755
--- a/t/t4023-diff-rename-typechange.sh
+++ b/t/t4023-diff-rename-typechange.sh
@@ -76,7 +76,8 @@ test_expect_success 'moves and renames' '
git diff-tree three four -r --name-status -B -M | sort >actual &&
{
- echo "R100 foo bar"
+ # see -B -M (#6) in t4008
+ echo "C100 foo bar"
echo "T100 foo"
} | sort >expect &&
test_cmp expect actual
diff --git a/t/t4024-diff-optimize-common.sh b/t/t4024-diff-optimize-common.sh
index c4d733f..7e76018 100755
--- a/t/t4024-diff-optimize-common.sh
+++ b/t/t4024-diff-optimize-common.sh
@@ -139,7 +139,7 @@ test_expect_success setup '
( printf C; zs $n ) >file-c$n &&
( echo D; zs $n ) >file-d$n &&
- expect_pattern $n || break
+ expect_pattern $n || return 1
done >expect
'
diff --git a/t/t4026-color.sh b/t/t4026-color.sh
index 3726a0e..2b32c4f 100755
--- a/t/t4026-color.sh
+++ b/t/t4026-color.sh
@@ -45,14 +45,41 @@ test_expect_success 'fg bg attr...' '
color "blue bold dim ul blink reverse" "[1;2;4;5;7;34m"
'
+# note that nobold and nodim are the same code (22)
+test_expect_success 'attr negation' '
+ color "nobold nodim noul noblink noreverse" "[22;24;25;27m"
+'
+
test_expect_success 'long color specification' '
color "254 255 bold dim ul blink reverse" "[1;2;4;5;7;38;5;254;48;5;255m"
'
+test_expect_success 'absurdly long color specification' '
+ color \
+ "#ffffff #ffffff bold nobold dim nodim ul noul blink noblink reverse noreverse" \
+ "[1;2;4;5;7;22;24;25;27;38;2;255;255;255;48;2;255;255;255m"
+'
+
+test_expect_success '0-7 are aliases for basic ANSI color names' '
+ color "0 7" "[30;47m"
+'
+
test_expect_success '256 colors' '
color "254 bold 255" "[1;38;5;254;48;5;255m"
'
+test_expect_success '24-bit colors' '
+ color "#ff00ff black" "[38;2;255;0;255;40m"
+'
+
+test_expect_success '"normal" yields no color at all"' '
+ color "normal black" "[40m"
+'
+
+test_expect_success '-1 is a synonym for "normal"' '
+ color "-1 black" "[40m"
+'
+
test_expect_success 'color too small' '
invalid_color "-2"
'
@@ -84,9 +111,9 @@ test_expect_success 'unknown color slots are ignored (branch)' '
'
test_expect_success 'unknown color slots are ignored (status)' '
- git config color.status.nosuchslotwilleverbedefined white || exit
- git status
- case $? in 0|1) : ok ;; *) false ;; esac
+ git config color.status.nosuchslotwilleverbedefined white &&
+ { git status; ret=$?; } &&
+ case $ret in 0|1) : ok ;; *) false ;; esac
'
test_done
diff --git a/t/t4035-diff-quiet.sh b/t/t4035-diff-quiet.sh
index e8ae2a0..461f4bb 100755
--- a/t/t4035-diff-quiet.sh
+++ b/t/t4035-diff-quiet.sh
@@ -29,67 +29,65 @@ test_expect_success 'setup' '
'
test_expect_success 'git diff-tree HEAD^ HEAD' '
- git diff-tree --quiet HEAD^ HEAD >cnt
- test $? = 1 && test_line_count = 0 cnt
+ test_expect_code 1 git diff-tree --quiet HEAD^ HEAD >cnt &&
+ test_line_count = 0 cnt
'
test_expect_success 'git diff-tree HEAD^ HEAD -- a' '
- git diff-tree --quiet HEAD^ HEAD -- a >cnt
- test $? = 0 && test_line_count = 0 cnt
+ test_expect_code 0 git diff-tree --quiet HEAD^ HEAD -- a >cnt &&
+ test_line_count = 0 cnt
'
test_expect_success 'git diff-tree HEAD^ HEAD -- b' '
- git diff-tree --quiet HEAD^ HEAD -- b >cnt
- test $? = 1 && test_line_count = 0 cnt
+ test_expect_code 1 git diff-tree --quiet HEAD^ HEAD -- b >cnt &&
+ test_line_count = 0 cnt
'
# this diff outputs one line: sha1 of the given head
test_expect_success 'echo HEAD | git diff-tree --stdin' '
- echo $(git rev-parse HEAD) | git diff-tree --quiet --stdin >cnt
- test $? = 1 && test_line_count = 1 cnt
+ echo $(git rev-parse HEAD) |
+ test_expect_code 1 git diff-tree --quiet --stdin >cnt &&
+ test_line_count = 1 cnt
'
test_expect_success 'git diff-tree HEAD HEAD' '
- git diff-tree --quiet HEAD HEAD >cnt
- test $? = 0 && test_line_count = 0 cnt
+ test_expect_code 0 git diff-tree --quiet HEAD HEAD >cnt &&
+ test_line_count = 0 cnt
'
test_expect_success 'git diff-files' '
- git diff-files --quiet >cnt
- test $? = 0 && test_line_count = 0 cnt
+ test_expect_code 0 git diff-files --quiet >cnt &&
+ test_line_count = 0 cnt
'
test_expect_success 'git diff-index --cached HEAD' '
- git diff-index --quiet --cached HEAD >cnt
- test $? = 0 && test_line_count = 0 cnt
+ test_expect_code 0 git diff-index --quiet --cached HEAD >cnt &&
+ test_line_count = 0 cnt
'
test_expect_success 'git diff-index --cached HEAD^' '
- git diff-index --quiet --cached HEAD^ >cnt
- test $? = 1 && test_line_count = 0 cnt
+ test_expect_code 1 git diff-index --quiet --cached HEAD^ >cnt &&
+ test_line_count = 0 cnt
'
test_expect_success 'git diff-index --cached HEAD^' '
echo text >>b &&
echo 3 >c &&
- git add . && {
- git diff-index --quiet --cached HEAD^ >cnt
- test $? = 1 && test_line_count = 0 cnt
- }
+ git add . &&
+ test_expect_code 1 git diff-index --quiet --cached HEAD^ >cnt &&
+ test_line_count = 0 cnt
'
test_expect_success 'git diff-tree -Stext HEAD^ HEAD -- b' '
- git commit -m "text in b" && {
- git diff-tree --quiet -Stext HEAD^ HEAD -- b >cnt
- test $? = 1 && test_line_count = 0 cnt
- }
+ git commit -m "text in b" &&
+ test_expect_code 1 git diff-tree --quiet -Stext HEAD^ HEAD -- b >cnt &&
+ test_line_count = 0 cnt
'
test_expect_success 'git diff-tree -Snot-found HEAD^ HEAD -- b' '
- git diff-tree --quiet -Snot-found HEAD^ HEAD -- b >cnt
- test $? = 0 && test_line_count = 0 cnt
+ test_expect_code 0 git diff-tree --quiet -Snot-found HEAD^ HEAD -- b >cnt &&
+ test_line_count = 0 cnt
'
test_expect_success 'git diff-files' '
- echo 3 >>c && {
- git diff-files --quiet >cnt
- test $? = 1 && test_line_count = 0 cnt
- }
+ echo 3 >>c &&
+ test_expect_code 1 git diff-files --quiet >cnt &&
+ test_line_count = 0 cnt
'
+
test_expect_success 'git diff-index --cached HEAD' '
- git update-index c && {
- git diff-index --quiet --cached HEAD >cnt
- test $? = 1 && test_line_count = 0 cnt
- }
+ git update-index c &&
+ test_expect_code 1 git diff-index --quiet --cached HEAD >cnt &&
+ test_line_count = 0 cnt
'
test_expect_success 'git diff, one file outside repo' '
diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index e432896..2d9731b 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -528,10 +528,12 @@ test_expect_success 'diff --submodule with objects referenced by alternates' '
sha1_before=$(git rev-parse --short HEAD)
echo b >b &&
git add b &&
- git commit -m b
- sha1_after=$(git rev-parse --short HEAD)
- echo "Submodule sub $sha1_before..$sha1_after:
- > b" >../expected
+ git commit -m b &&
+ sha1_after=$(git rev-parse --short HEAD) &&
+ {
+ echo "Submodule sub $sha1_before..$sha1_after:" &&
+ echo " > b"
+ } >../expected
) &&
(cd super &&
(cd sub &&
@@ -539,7 +541,7 @@ test_expect_success 'diff --submodule with objects referenced by alternates' '
git checkout origin/master
) &&
git diff --submodule > ../actual
- )
+ ) &&
test_cmp expected actual
'
diff --git a/t/t4046-diff-unmerged.sh b/t/t4046-diff-unmerged.sh
index 25d50a6..d0f1447 100755
--- a/t/t4046-diff-unmerged.sh
+++ b/t/t4046-diff-unmerged.sh
@@ -8,7 +8,7 @@ test_expect_success setup '
do
blob=$(echo $i | git hash-object --stdin) &&
eval "blob$i=$blob" &&
- eval "m$i=\"100644 \$blob$i $i\"" || break
+ eval "m$i=\"100644 \$blob$i $i\"" || return 1
done &&
paths= &&
for b in o x
@@ -24,9 +24,9 @@ test_expect_success setup '
case "$b" in x) echo "$m1$p" ;; esac &&
case "$o" in x) echo "$m2$p" ;; esac &&
case "$t" in x) echo "$m3$p" ;; esac ||
- break
- done || break
- done || break
+ return 1
+ done
+ done
done >ls-files-s.expect &&
git update-index --index-info <ls-files-s.expect &&
git ls-files -s >ls-files-s.actual &&
diff --git a/t/t4047-diff-dirstat.sh b/t/t4047-diff-dirstat.sh
index ed7e093..3b8b792 100755
--- a/t/t4047-diff-dirstat.sh
+++ b/t/t4047-diff-dirstat.sh
@@ -374,7 +374,7 @@ test_expect_success 'later options override earlier options:' '
git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
- test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
+ test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC &&
git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
@@ -973,4 +973,18 @@ test_expect_success 'diff.dirstat=future_param,0,lines should warn, but still wo
test_i18ngrep -q "diff\\.dirstat" actual_error
'
+test_expect_success '--shortstat --dirstat should output only one dirstat' '
+ git diff --shortstat --dirstat=changes HEAD^..HEAD >out &&
+ grep " dst/copy/changed/$" out >actual_diff_shortstat_dirstat_changes &&
+ test_line_count = 1 actual_diff_shortstat_dirstat_changes &&
+
+ git diff --shortstat --dirstat=lines HEAD^..HEAD >out &&
+ grep " dst/copy/changed/$" out >actual_diff_shortstat_dirstat_lines &&
+ test_line_count = 1 actual_diff_shortstat_dirstat_lines &&
+
+ git diff --shortstat --dirstat=files HEAD^..HEAD >out &&
+ grep " dst/copy/changed/$" out >actual_diff_shortstat_dirstat_files &&
+ test_line_count = 1 actual_diff_shortstat_dirstat_files
+'
+
test_done
diff --git a/t/t4049-diff-stat-count.sh b/t/t4049-diff-stat-count.sh
index 5b594e8..a341217 100755
--- a/t/t4049-diff-stat-count.sh
+++ b/t/t4049-diff-stat-count.sh
@@ -18,7 +18,7 @@ test_expect_success 'mode-only change show as a 0-line change' '
test_chmod +x b d &&
echo a >a &&
echo c >c &&
- cat >expect <<-\EOF
+ cat >expect <<-\EOF &&
a | 1 +
b | 0
...
@@ -33,7 +33,7 @@ test_expect_success 'binary changes do not count in lines' '
echo a >a &&
echo c >c &&
cat "$TEST_DIRECTORY"/test-binary-1.png >d &&
- cat >expect <<-\EOF
+ cat >expect <<-\EOF &&
a | 1 +
c | 1 +
...
@@ -55,7 +55,7 @@ test_expect_success 'exclude unmerged entries from total file count' '
done |
git update-index --index-info &&
echo d >d &&
- cat >expect <<-\EOF
+ cat >expect <<-\EOF &&
a | 1 +
b | 1 +
...
diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh
index b68afef..9f563db 100755
--- a/t/t4052-stat-output.sh
+++ b/t/t4052-stat-output.sh
@@ -94,15 +94,15 @@ EOF
while read verb expect cmd args
do
test_expect_success "$cmd $verb COLUMNS (big change)" '
- COLUMNS=200 git $cmd $args >output
+ COLUMNS=200 git $cmd $args >output &&
grep " | " output >actual &&
test_cmp "$expect" actual
'
- test "$cmd" != diff || continue
+ case "$cmd" in diff|show) continue;; esac
test_expect_success "$cmd --graph $verb COLUMNS (big change)" '
- COLUMNS=200 git $cmd $args --graph >output
+ COLUMNS=200 git $cmd $args --graph >output &&
grep " | " output >actual &&
test_cmp "$expect-graph" actual
'
@@ -122,15 +122,15 @@ EOF
while read verb expect cmd args
do
test_expect_success "$cmd $verb not enough COLUMNS (big change)" '
- COLUMNS=40 git $cmd $args >output
+ COLUMNS=40 git $cmd $args >output &&
grep " | " output >actual &&
test_cmp "$expect" actual
'
- test "$cmd" != diff || continue
+ case "$cmd" in diff|show) continue;; esac
test_expect_success "$cmd --graph $verb not enough COLUMNS (big change)" '
- COLUMNS=40 git $cmd $args --graph >output
+ COLUMNS=40 git $cmd $args --graph >output &&
grep " | " output >actual &&
test_cmp "$expect-graph" actual
'
@@ -150,15 +150,15 @@ EOF
while read verb expect cmd args
do
test_expect_success "$cmd $verb statGraphWidth config" '
- git -c diff.statGraphWidth=26 $cmd $args >output
+ git -c diff.statGraphWidth=26 $cmd $args >output &&
grep " | " output >actual &&
test_cmp "$expect" actual
'
- test "$cmd" != diff || continue
+ case "$cmd" in diff|show) continue;; esac
test_expect_success "$cmd --graph $verb statGraphWidth config" '
- git -c diff.statGraphWidth=26 $cmd $args --graph >output
+ git -c diff.statGraphWidth=26 $cmd $args --graph >output &&
grep " | " output >actual &&
test_cmp "$expect-graph" actual
'
@@ -179,33 +179,33 @@ EOF
while read cmd args
do
test_expect_success "$cmd --stat=width with big change" '
- git $cmd $args --stat=40 >output
+ git $cmd $args --stat=40 >output &&
grep " | " output >actual &&
test_cmp expect actual
'
test_expect_success "$cmd --stat-width=width with big change" '
- git $cmd $args --stat-width=40 >output
+ git $cmd $args --stat-width=40 >output &&
grep " | " output >actual &&
test_cmp expect actual
'
test_expect_success "$cmd --stat-graph-width with big change" '
- git $cmd $args --stat-graph-width=26 >output
+ git $cmd $args --stat-graph-width=26 >output &&
grep " | " output >actual &&
test_cmp expect actual
'
- test "$cmd" != diff || continue
+ case "$cmd" in diff|show) continue;; esac
test_expect_success "$cmd --stat-width=width --graph with big change" '
- git $cmd $args --stat-width=40 --graph >output
+ git $cmd $args --stat-width=40 --graph >output &&
grep " | " output >actual &&
test_cmp expect-graph actual
'
test_expect_success "$cmd --stat-graph-width --graph with big change" '
- git $cmd $args --stat-graph-width=26 --graph >output
+ git $cmd $args --stat-graph-width=26 --graph >output &&
grep " | " output >actual &&
test_cmp expect-graph actual
'
@@ -236,7 +236,7 @@ do
test_cmp expect actual
'
- test "$cmd" != diff || continue
+ case "$cmd" in diff|show) continue;; esac
test_expect_success "$cmd --stat=width --graph with big change is balanced" '
git $cmd $args --stat-width=60 --graph >output &&
@@ -265,15 +265,15 @@ EOF
while read verb expect cmd args
do
test_expect_success "$cmd $verb COLUMNS (long filename)" '
- COLUMNS=200 git $cmd $args >output
+ COLUMNS=200 git $cmd $args >output &&
grep " | " output >actual &&
test_cmp "$expect" actual
'
- test "$cmd" != diff || continue
+ case "$cmd" in diff|show) continue;; esac
test_expect_success "$cmd --graph $verb COLUMNS (long filename)" '
- COLUMNS=200 git $cmd $args --graph >output
+ COLUMNS=200 git $cmd $args --graph >output &&
grep " | " output >actual &&
test_cmp "$expect-graph" actual
'
@@ -294,16 +294,16 @@ while read verb expect cmd args
do
test_expect_success COLUMNS_CAN_BE_1 \
"$cmd $verb prefix greater than COLUMNS (big change)" '
- COLUMNS=1 git $cmd $args >output
+ COLUMNS=1 git $cmd $args >output &&
grep " | " output >actual &&
test_cmp "$expect" actual
'
- test "$cmd" != diff || continue
+ case "$cmd" in diff|show) continue;; esac
test_expect_success COLUMNS_CAN_BE_1 \
"$cmd --graph $verb prefix greater than COLUMNS (big change)" '
- COLUMNS=1 git $cmd $args --graph >output
+ COLUMNS=1 git $cmd $args --graph >output &&
grep " | " output >actual &&
test_cmp "$expect-graph" actual
'
@@ -320,7 +320,7 @@ EOF
test_expect_success 'merge --stat respects COLUMNS (big change)' '
git checkout -b branch HEAD^^ &&
COLUMNS=100 git merge --stat --no-ff master^ >output &&
- grep " | " output >actual
+ grep " | " output >actual &&
test_cmp expect actual
'
@@ -329,7 +329,7 @@ cat >expect <<'EOF'
EOF
test_expect_success 'merge --stat respects COLUMNS (long filename)' '
COLUMNS=100 git merge --stat --no-ff master >output &&
- grep " | " output >actual
+ grep " | " output >actual &&
test_cmp expect actual
'
diff --git a/t/t4053-diff-no-index.sh b/t/t4053-diff-no-index.sh
index 2ab3c48..075ece6 100755
--- a/t/t4053-diff-no-index.sh
+++ b/t/t4053-diff-no-index.sh
@@ -17,8 +17,8 @@ test_expect_success 'setup' '
'
test_expect_success 'git diff --no-index directories' '
- git diff --no-index a b >cnt
- test $? = 1 && test_line_count = 14 cnt
+ test_expect_code 1 git diff --no-index a b >cnt &&
+ test_line_count = 14 cnt
'
test_expect_success 'git diff --no-index relative path outside repo' '
diff --git a/t/t4054-diff-bogus-tree.sh b/t/t4054-diff-bogus-tree.sh
index 0843c87..1d6efab 100755
--- a/t/t4054-diff-bogus-tree.sh
+++ b/t/t4054-diff-bogus-tree.sh
@@ -16,7 +16,7 @@ test_expect_success 'create bogus tree' '
test_expect_success 'create tree with matching file' '
echo bar >foo &&
git add foo &&
- good_tree=$(git write-tree)
+ good_tree=$(git write-tree) &&
blob=$(git rev-parse :foo)
'
diff --git a/t/t4058-diff-duplicates.sh b/t/t4058-diff-duplicates.sh
new file mode 100755
index 0000000..0a23242
--- /dev/null
+++ b/t/t4058-diff-duplicates.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+test_description='test tree diff when trees have duplicate entries'
+. ./test-lib.sh
+
+# make_tree_entry <mode> <mode> <sha1>
+#
+# We have to rely on perl here because not all printfs understand
+# hex escapes (only octal), and xxd is not portable.
+make_tree_entry () {
+ printf '%s %s\0' "$1" "$2" &&
+ perl -e 'print chr(hex($_)) for ($ARGV[0] =~ /../g)' "$3"
+}
+
+# Like git-mktree, but without all of the pesky sanity checking.
+# Arguments come in groups of three, each group specifying a single
+# tree entry (see make_tree_entry above).
+make_tree () {
+ while test $# -gt 2; do
+ make_tree_entry "$1" "$2" "$3"
+ shift; shift; shift
+ done |
+ git hash-object -w -t tree --stdin
+}
+
+# this is kind of a convoluted setup, but matches
+# a real-world case. Each tree contains four entries
+# for the given path, one with one sha1, and three with
+# the other. The first tree has them split across
+# two subtrees (which are themselves duplicate entries in
+# the root tree), and the second has them all in a single subtree.
+test_expect_success 'create trees with duplicate entries' '
+ blob_one=$(echo one | git hash-object -w --stdin) &&
+ blob_two=$(echo two | git hash-object -w --stdin) &&
+ inner_one_a=$(make_tree \
+ 100644 inner $blob_one
+ ) &&
+ inner_one_b=$(make_tree \
+ 100644 inner $blob_two \
+ 100644 inner $blob_two \
+ 100644 inner $blob_two
+ ) &&
+ outer_one=$(make_tree \
+ 040000 outer $inner_one_a \
+ 040000 outer $inner_one_b
+ ) &&
+ inner_two=$(make_tree \
+ 100644 inner $blob_one \
+ 100644 inner $blob_two \
+ 100644 inner $blob_two \
+ 100644 inner $blob_two
+ ) &&
+ outer_two=$(make_tree \
+ 040000 outer $inner_two
+ ) &&
+ git tag one $outer_one &&
+ git tag two $outer_two
+'
+
+test_expect_success 'diff-tree between trees' '
+ {
+ printf ":000000 100644 $_z40 $blob_two A\touter/inner\n" &&
+ printf ":000000 100644 $_z40 $blob_two A\touter/inner\n" &&
+ printf ":000000 100644 $_z40 $blob_two A\touter/inner\n" &&
+ printf ":100644 000000 $blob_two $_z40 D\touter/inner\n" &&
+ printf ":100644 000000 $blob_two $_z40 D\touter/inner\n" &&
+ printf ":100644 000000 $blob_two $_z40 D\touter/inner\n"
+ } >expect &&
+ git diff-tree -r --no-abbrev one two >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'diff-tree with renames' '
+ # same expectation as above, since we disable rename detection
+ git diff-tree -M -r --no-abbrev one two >actual &&
+ test_cmp expect actual
+'
+
+test_done
diff --git a/t/t4104-apply-boundary.sh b/t/t4104-apply-boundary.sh
index c617c2a..32e3b0e 100755
--- a/t/t4104-apply-boundary.sh
+++ b/t/t4104-apply-boundary.sh
@@ -18,7 +18,7 @@ test_expect_success setup '
cat victim >original &&
git update-index --add victim &&
- : add to the head
+ # add to the head
for i in a b '"$L"' y
do
echo $i
@@ -27,7 +27,7 @@ test_expect_success setup '
git diff victim >add-a-patch.with &&
git diff --unified=0 >add-a-patch.without &&
- : insert at line two
+ # insert at line two
for i in b a '"$L"' y
do
echo $i
@@ -36,7 +36,7 @@ test_expect_success setup '
git diff victim >insert-a-patch.with &&
git diff --unified=0 >insert-a-patch.without &&
- : modify at the head
+ # modify at the head
for i in a '"$L"' y
do
echo $i
@@ -45,16 +45,16 @@ test_expect_success setup '
git diff victim >mod-a-patch.with &&
git diff --unified=0 >mod-a-patch.without &&
- : remove from the head
+ # remove from the head
for i in '"$L"' y
do
echo $i
done >victim &&
cat victim >del-a-expect &&
- git diff victim >del-a-patch.with
+ git diff victim >del-a-patch.with &&
git diff --unified=0 >del-a-patch.without &&
- : add to the tail
+ # add to the tail
for i in b '"$L"' y z
do
echo $i
@@ -63,7 +63,7 @@ test_expect_success setup '
git diff victim >add-z-patch.with &&
git diff --unified=0 >add-z-patch.without &&
- : modify at the tail
+ # modify at the tail
for i in b '"$L"' z
do
echo $i
@@ -72,16 +72,16 @@ test_expect_success setup '
git diff victim >mod-z-patch.with &&
git diff --unified=0 >mod-z-patch.without &&
- : remove from the tail
+ # remove from the tail
for i in b '"$L"'
do
echo $i
done >victim &&
cat victim >del-z-expect &&
- git diff victim >del-z-patch.with
- git diff --unified=0 >del-z-patch.without &&
+ git diff victim >del-z-patch.with &&
+ git diff --unified=0 >del-z-patch.without
- : done
+ # done
'
for with in with without
@@ -95,10 +95,7 @@ do
test_expect_success "apply $kind-patch $with context" '
cat original >victim &&
git update-index victim &&
- git apply --index '"$u$kind-patch.$with"' || {
- cat '"$kind-patch.$with"'
- (exit 1)
- } &&
+ git apply --index '"$u$kind-patch.$with"' &&
test_cmp '"$kind"'-expect victim
'
done
@@ -113,10 +110,7 @@ do
test_expect_success "apply non-git $kind-patch without context" '
cat original >victim &&
git update-index victim &&
- git apply --unidiff-zero --index '"$kind-ng.without"' || {
- cat '"$kind-ng.without"'
- (exit 1)
- } &&
+ git apply --unidiff-zero --index '"$kind-ng.without"' &&
test_cmp '"$kind"'-expect victim
'
done
diff --git a/t/t4117-apply-reject.sh b/t/t4117-apply-reject.sh
index 8e15ecb..d80187d 100755
--- a/t/t4117-apply-reject.sh
+++ b/t/t4117-apply-reject.sh
@@ -56,23 +56,13 @@ test_expect_success 'apply --reject is incompatible with --3way' '
test_expect_success 'apply without --reject should fail' '
- if git apply patch.1
- then
- echo "Eh? Why?"
- exit 1
- fi
-
+ test_must_fail git apply patch.1 &&
test_cmp file1 saved.file1
'
test_expect_success 'apply without --reject should fail' '
- if git apply --verbose patch.1
- then
- echo "Eh? Why?"
- exit 1
- fi
-
+ test_must_fail git apply --verbose patch.1 &&
test_cmp file1 saved.file1
'
@@ -81,21 +71,11 @@ test_expect_success 'apply with --reject should fail but update the file' '
cat saved.file1 >file1 &&
rm -f file1.rej file2.rej &&
- if git apply --reject patch.1
- then
- echo "succeeds with --reject?"
- exit 1
- fi
-
+ test_must_fail git apply --reject patch.1 &&
test_cmp file1 expected &&
cat file1.rej &&
-
- if test -f file2.rej
- then
- echo "file2 should not have been touched"
- exit 1
- fi
+ test_path_is_missing file2.rej
'
test_expect_success 'apply with --reject should fail but update the file' '
@@ -103,25 +83,12 @@ test_expect_success 'apply with --reject should fail but update the file' '
cat saved.file1 >file1 &&
rm -f file1.rej file2.rej file2 &&
- if git apply --reject patch.2 >rejects
- then
- echo "succeeds with --reject?"
- exit 1
- fi
-
- test -f file1 && {
- echo "file1 still exists?"
- exit 1
- }
+ test_must_fail git apply --reject patch.2 >rejects &&
+ test_path_is_missing file1 &&
test_cmp file2 expected &&
cat file2.rej &&
-
- if test -f file1.rej
- then
- echo "file2 should not have been touched"
- exit 1
- fi
+ test_path_is_missing file1.rej
'
@@ -130,25 +97,12 @@ test_expect_success 'the same test with --verbose' '
cat saved.file1 >file1 &&
rm -f file1.rej file2.rej file2 &&
- if git apply --reject --verbose patch.2 >rejects
- then
- echo "succeeds with --reject?"
- exit 1
- fi
-
- test -f file1 && {
- echo "file1 still exists?"
- exit 1
- }
+ test_must_fail git apply --reject --verbose patch.2 >rejects &&
+ test_path_is_missing file1 &&
test_cmp file2 expected &&
cat file2.rej &&
-
- if test -f file1.rej
- then
- echo "file2 should not have been touched"
- exit 1
- fi
+ test_path_is_missing file1.rej
'
diff --git a/t/t4122-apply-symlink-inside.sh b/t/t4122-apply-symlink-inside.sh
index 70b3a06..4acb3f3 100755
--- a/t/t4122-apply-symlink-inside.sh
+++ b/t/t4122-apply-symlink-inside.sh
@@ -3,17 +3,10 @@
test_description='apply to deeper directory without getting fooled with symlink'
. ./test-lib.sh
-lecho () {
- for l_
- do
- echo "$l_"
- done
-}
-
test_expect_success setup '
mkdir -p arch/i386/boot arch/x86_64 &&
- lecho 1 2 3 4 5 >arch/i386/boot/Makefile &&
+ test_write_lines 1 2 3 4 5 >arch/i386/boot/Makefile &&
test_ln_s_add ../i386/boot arch/x86_64/boot &&
git add . &&
test_tick &&
@@ -22,7 +15,7 @@ test_expect_success setup '
rm arch/x86_64/boot &&
mkdir arch/x86_64/boot &&
- lecho 2 3 4 5 6 >arch/x86_64/boot/Makefile &&
+ test_write_lines 2 3 4 5 6 >arch/x86_64/boot/Makefile &&
git add . &&
test_tick &&
git commit -a -m second &&
@@ -52,4 +45,110 @@ test_expect_success 'check result' '
'
+test_expect_success SYMLINKS 'do not read from beyond symbolic link' '
+ git reset --hard &&
+ mkdir -p arch/x86_64/dir &&
+ >arch/x86_64/dir/file &&
+ git add arch/x86_64/dir/file &&
+ echo line >arch/x86_64/dir/file &&
+ git diff >patch &&
+ git reset --hard &&
+
+ mkdir arch/i386/dir &&
+ >arch/i386/dir/file &&
+ ln -s ../i386/dir arch/x86_64/dir &&
+
+ test_must_fail git apply patch &&
+ test_must_fail git apply --cached patch &&
+ test_must_fail git apply --index patch
+
+'
+
+test_expect_success SYMLINKS 'do not follow symbolic link (setup)' '
+
+ rm -rf arch/i386/dir arch/x86_64/dir &&
+ git reset --hard &&
+ ln -s ../i386/dir arch/x86_64/dir &&
+ git add arch/x86_64/dir &&
+ git diff HEAD >add_symlink.patch &&
+ git reset --hard &&
+
+ mkdir arch/x86_64/dir &&
+ >arch/x86_64/dir/file &&
+ git add arch/x86_64/dir/file &&
+ git diff HEAD >add_file.patch &&
+ git diff -R HEAD >del_file.patch &&
+ git reset --hard &&
+ rm -fr arch/x86_64/dir &&
+
+ cat add_symlink.patch add_file.patch >patch &&
+ cat add_symlink.patch del_file.patch >tricky_del &&
+
+ mkdir arch/i386/dir
+'
+
+test_expect_success SYMLINKS 'do not follow symbolic link (same input)' '
+
+ # same input creates a confusing symbolic link
+ test_must_fail git apply patch 2>error-wt &&
+ test_i18ngrep "beyond a symbolic link" error-wt &&
+ test_path_is_missing arch/x86_64/dir &&
+ test_path_is_missing arch/i386/dir/file &&
+
+ test_must_fail git apply --index patch 2>error-ix &&
+ test_i18ngrep "beyond a symbolic link" error-ix &&
+ test_path_is_missing arch/x86_64/dir &&
+ test_path_is_missing arch/i386/dir/file &&
+ test_must_fail git ls-files --error-unmatch arch/x86_64/dir &&
+ test_must_fail git ls-files --error-unmatch arch/i386/dir &&
+
+ test_must_fail git apply --cached patch 2>error-ct &&
+ test_i18ngrep "beyond a symbolic link" error-ct &&
+ test_must_fail git ls-files --error-unmatch arch/x86_64/dir &&
+ test_must_fail git ls-files --error-unmatch arch/i386/dir &&
+
+ >arch/i386/dir/file &&
+ git add arch/i386/dir/file &&
+
+ test_must_fail git apply tricky_del &&
+ test_path_is_file arch/i386/dir/file &&
+
+ test_must_fail git apply --index tricky_del &&
+ test_path_is_file arch/i386/dir/file &&
+ test_must_fail git ls-files --error-unmatch arch/x86_64/dir &&
+ git ls-files --error-unmatch arch/i386/dir &&
+
+ test_must_fail git apply --cached tricky_del &&
+ test_must_fail git ls-files --error-unmatch arch/x86_64/dir &&
+ git ls-files --error-unmatch arch/i386/dir
+'
+
+test_expect_success SYMLINKS 'do not follow symbolic link (existing)' '
+
+ # existing symbolic link
+ git reset --hard &&
+ ln -s ../i386/dir arch/x86_64/dir &&
+ git add arch/x86_64/dir &&
+
+ test_must_fail git apply add_file.patch 2>error-wt-add &&
+ test_i18ngrep "beyond a symbolic link" error-wt-add &&
+ test_path_is_missing arch/i386/dir/file &&
+
+ mkdir arch/i386/dir &&
+ >arch/i386/dir/file &&
+ test_must_fail git apply del_file.patch 2>error-wt-del &&
+ test_i18ngrep "beyond a symbolic link" error-wt-del &&
+ test_path_is_file arch/i386/dir/file &&
+ rm arch/i386/dir/file &&
+
+ test_must_fail git apply --index add_file.patch 2>error-ix-add &&
+ test_i18ngrep "beyond a symbolic link" error-ix-add &&
+ test_path_is_missing arch/i386/dir/file &&
+ test_must_fail git ls-files --error-unmatch arch/i386/dir &&
+
+ test_must_fail git apply --cached add_file.patch 2>error-ct-file &&
+ test_i18ngrep "beyond a symbolic link" error-ct-file &&
+ test_must_fail git ls-files --error-unmatch arch/i386/dir
+'
+
test_done
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index c6474de..d350065 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -99,9 +99,8 @@ test_expect_success 'whitespace=warn, default rule' '
test_expect_success 'whitespace=error-all, default rule' '
- apply_patch --whitespace=error-all && return 1
- test -s target && return 1
- : happy
+ test_must_fail apply_patch --whitespace=error-all &&
+ ! test -s target
'
diff --git a/t/t4138-apply-ws-expansion.sh b/t/t4138-apply-ws-expansion.sh
new file mode 100755
index 0000000..0ffe33f
--- /dev/null
+++ b/t/t4138-apply-ws-expansion.sh
@@ -0,0 +1,121 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 Kyle J. McKay
+#
+
+test_description='git apply test patches with whitespace expansion.'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ #
+ ## create test-N, patchN.patch, expect-N files
+ #
+
+ # test 1
+ printf "\t%s\n" 1 2 3 4 5 6 >before &&
+ printf "\t%s\n" 1 2 3 >after &&
+ printf "%64s\n" a b c >>after &&
+ printf "\t%s\n" 4 5 6 >>after &&
+ git diff --no-index before after |
+ sed -e "s/before/test-1/" -e "s/after/test-1/" >patch1.patch &&
+ printf "%64s\n" 1 2 3 4 5 6 >test-1 &&
+ printf "%64s\n" 1 2 3 a b c 4 5 6 >expect-1 &&
+
+ # test 2
+ printf "\t%s\n" a b c d e f >before &&
+ printf "\t%s\n" a b c >after &&
+ n=10 &&
+ x=1 &&
+ while test $x -lt $n
+ do
+ printf "%63s%d\n" "" $x >>after
+ x=$(( $x + 1 ))
+ done &&
+ printf "\t%s\n" d e f >>after &&
+ git diff --no-index before after |
+ sed -e "s/before/test-2/" -e "s/after/test-2/" >patch2.patch &&
+ printf "%64s\n" a b c d e f >test-2 &&
+ printf "%64s\n" a b c >expect-2 &&
+ x=1 &&
+ while test $x -lt $n
+ do
+ printf "%63s%d\n" "" $x >>expect-2
+ x=$(( $x + 1 ))
+ done &&
+ printf "%64s\n" d e f >>expect-2 &&
+
+ # test 3
+ printf "\t%s\n" a b c d e f >before &&
+ printf "\t%s\n" a b c >after &&
+ n=100 &&
+ x=0 &&
+ while test $x -lt $n
+ do
+ printf "%63s%02d\n" "" $x >>after
+ x=$(( $x + 1 ))
+ done &&
+ printf "\t%s\n" d e f >>after &&
+ git diff --no-index before after |
+ sed -e "s/before/test-3/" -e "s/after/test-3/" >patch3.patch &&
+ printf "%64s\n" a b c d e f >test-3 &&
+ printf "%64s\n" a b c >expect-3 &&
+ x=0 &&
+ while test $x -lt $n
+ do
+ printf "%63s%02d\n" "" $x >>expect-3
+ x=$(( $x + 1 ))
+ done &&
+ printf "%64s\n" d e f >>expect-3 &&
+
+ # test 4
+ >before &&
+ x=0 &&
+ while test $x -lt 50
+ do
+ printf "\t%02d\n" $x >>before
+ x=$(( $x + 1 ))
+ done &&
+ cat before >after &&
+ printf "%64s\n" a b c >>after &&
+ while test $x -lt 100
+ do
+ printf "\t%02d\n" $x >>before
+ printf "\t%02d\n" $x >>after
+ x=$(( $x + 1 ))
+ done &&
+ git diff --no-index before after |
+ sed -e "s/before/test-4/" -e "s/after/test-4/" >patch4.patch &&
+ >test-4 &&
+ x=0 &&
+ while test $x -lt 50
+ do
+ printf "%63s%02d\n" "" $x >>test-4
+ x=$(( $x + 1 ))
+ done &&
+ cat test-4 >expect-4 &&
+ printf "%64s\n" a b c >>expect-4 &&
+ while test $x -lt 100
+ do
+ printf "%63s%02d\n" "" $x >>test-4
+ printf "%63s%02d\n" "" $x >>expect-4
+ x=$(( $x + 1 ))
+ done &&
+
+ git config core.whitespace tab-in-indent,tabwidth=63 &&
+ git config apply.whitespace fix
+
+'
+
+# Note that `patch` can successfully apply all patches when run
+# with the --ignore-whitespace option.
+
+for t in 1 2 3 4
+do
+ test_expect_success 'apply with ws expansion (t=$t)' '
+ git apply patch$t.patch &&
+ test_cmp test-$t expect-$t
+ '
+done
+
+test_done
diff --git a/t/t4139-apply-escape.sh b/t/t4139-apply-escape.sh
new file mode 100755
index 0000000..45b5660
--- /dev/null
+++ b/t/t4139-apply-escape.sh
@@ -0,0 +1,141 @@
+#!/bin/sh
+
+test_description='paths written by git-apply cannot escape the working tree'
+. ./test-lib.sh
+
+# tests will try to write to ../foo, and we do not
+# want them to escape the trash directory when they
+# fail
+test_expect_success 'bump git repo one level down' '
+ mkdir inside &&
+ mv .git inside/ &&
+ cd inside
+'
+
+# $1 = name of file
+# $2 = current path to file (if different)
+mkpatch_add () {
+ rm -f "${2:-$1}" &&
+ cat <<-EOF
+ diff --git a/$1 b/$1
+ new file mode 100644
+ index 0000000..53c74cd
+ --- /dev/null
+ +++ b/$1
+ @@ -0,0 +1 @@
+ +evil
+ EOF
+}
+
+mkpatch_del () {
+ echo evil >"${2:-$1}" &&
+ cat <<-EOF
+ diff --git a/$1 b/$1
+ deleted file mode 100644
+ index 53c74cd..0000000
+ --- a/$1
+ +++ /dev/null
+ @@ -1 +0,0 @@
+ -evil
+ EOF
+}
+
+# $1 = name of file
+# $2 = content of symlink
+mkpatch_symlink () {
+ rm -f "$1" &&
+ cat <<-EOF
+ diff --git a/$1 b/$1
+ new file mode 120000
+ index 0000000..$(printf "%s" "$2" | git hash-object --stdin)
+ --- /dev/null
+ +++ b/$1
+ @@ -0,0 +1 @@
+ +$2
+ \ No newline at end of file
+ EOF
+}
+
+test_expect_success 'cannot create file containing ..' '
+ mkpatch_add ../foo >patch &&
+ test_must_fail git apply patch &&
+ test_path_is_missing ../foo
+'
+
+test_expect_success 'can create file containing .. with --unsafe-paths' '
+ mkpatch_add ../foo >patch &&
+ git apply --unsafe-paths patch &&
+ test_path_is_file ../foo
+'
+
+test_expect_success 'cannot create file containing .. (index)' '
+ mkpatch_add ../foo >patch &&
+ test_must_fail git apply --index patch &&
+ test_path_is_missing ../foo
+'
+
+test_expect_success 'cannot create file containing .. with --unsafe-paths (index)' '
+ mkpatch_add ../foo >patch &&
+ test_must_fail git apply --index --unsafe-paths patch &&
+ test_path_is_missing ../foo
+'
+
+test_expect_success 'cannot delete file containing ..' '
+ mkpatch_del ../foo >patch &&
+ test_must_fail git apply patch &&
+ test_path_is_file ../foo
+'
+
+test_expect_success 'can delete file containing .. with --unsafe-paths' '
+ mkpatch_del ../foo >patch &&
+ git apply --unsafe-paths patch &&
+ test_path_is_missing ../foo
+'
+
+test_expect_success 'cannot delete file containing .. (index)' '
+ mkpatch_del ../foo >patch &&
+ test_must_fail git apply --index patch &&
+ test_path_is_file ../foo
+'
+
+test_expect_success SYMLINKS 'symlink escape via ..' '
+ {
+ mkpatch_symlink tmp .. &&
+ mkpatch_add tmp/foo ../foo
+ } >patch &&
+ test_must_fail git apply patch &&
+ test_path_is_missing tmp &&
+ test_path_is_missing ../foo
+'
+
+test_expect_success SYMLINKS 'symlink escape via .. (index)' '
+ {
+ mkpatch_symlink tmp .. &&
+ mkpatch_add tmp/foo ../foo
+ } >patch &&
+ test_must_fail git apply --index patch &&
+ test_path_is_missing tmp &&
+ test_path_is_missing ../foo
+'
+
+test_expect_success SYMLINKS 'symlink escape via absolute path' '
+ {
+ mkpatch_symlink tmp "$(pwd)" &&
+ mkpatch_add tmp/foo ../foo
+ } >patch &&
+ test_must_fail git apply patch &&
+ test_path_is_missing tmp &&
+ test_path_is_missing ../foo
+'
+
+test_expect_success SYMLINKS 'symlink escape via absolute path (index)' '
+ {
+ mkpatch_symlink tmp "$(pwd)" &&
+ mkpatch_add tmp/foo ../foo
+ } >patch &&
+ test_must_fail git apply --index patch &&
+ test_path_is_missing tmp &&
+ test_path_is_missing ../foo
+'
+
+test_done
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 5edb79a..306e6f3 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -85,6 +85,7 @@ test_expect_success setup '
git format-patch --stdout first >patch1 &&
{
+ echo "Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>" &&
echo "X-Fake-Field: Line One" &&
echo "X-Fake-Field: Line Two" &&
echo "X-Fake-Field: Line Three" &&
@@ -536,4 +537,26 @@ test_expect_success 'am empty-file does not infloop' '
test_i18ncmp expected actual
'
+test_expect_success 'am --message-id really adds the message id' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout HEAD^ &&
+ git am --message-id patch1.eml &&
+ test_path_is_missing .git/rebase-apply &&
+ git cat-file commit HEAD | tail -n1 >actual &&
+ grep Message-Id patch1.eml >expected &&
+ test_cmp expected actual
+'
+
+test_expect_success 'am --message-id -s signs off after the message id' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout HEAD^ &&
+ git am -s --message-id patch1.eml &&
+ test_path_is_missing .git/rebase-apply &&
+ git cat-file commit HEAD | tail -n2 | head -n1 >actual &&
+ grep Message-Id patch1.eml >expected &&
+ test_cmp expected actual
+'
+
test_done
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index 1176bcc..8d90634 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -20,7 +20,7 @@ test_expect_success setup '
echo $i >otherfile-$i &&
git add otherfile-$i &&
test_tick &&
- git commit -a -m $i || break
+ git commit -a -m $i || return 1
done &&
git format-patch --no-numbered initial &&
git checkout -b side initial &&
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 99ab7ca..1b2e981 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -113,11 +113,7 @@ test_expect_success 'diff-filter=M' '
actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
expect=$(echo second) &&
- test "$actual" = "$expect" || {
- echo Oops
- echo "Actual: $actual"
- false
- }
+ verbose test "$actual" = "$expect"
'
@@ -125,11 +121,7 @@ test_expect_success 'diff-filter=D' '
actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
expect=$(echo sixth ; echo third) &&
- test "$actual" = "$expect" || {
- echo Oops
- echo "Actual: $actual"
- false
- }
+ verbose test "$actual" = "$expect"
'
@@ -137,11 +129,7 @@ test_expect_success 'diff-filter=R' '
actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
expect=$(echo third) &&
- test "$actual" = "$expect" || {
- echo Oops
- echo "Actual: $actual"
- false
- }
+ verbose test "$actual" = "$expect"
'
@@ -149,11 +137,7 @@ test_expect_success 'diff-filter=C' '
actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
expect=$(echo fourth) &&
- test "$actual" = "$expect" || {
- echo Oops
- echo "Actual: $actual"
- false
- }
+ verbose test "$actual" = "$expect"
'
@@ -161,11 +145,7 @@ test_expect_success 'git log --follow' '
actual=$(git log --follow --pretty="format:%s" ichi) &&
expect=$(echo third ; echo second ; echo initial) &&
- test "$actual" = "$expect" || {
- echo Oops
- echo "Actual: $actual"
- false
- }
+ verbose test "$actual" = "$expect"
'
@@ -212,6 +192,21 @@ test_expect_success 'log --grep' '
test_cmp expect actual
'
+cat > expect << EOF
+second
+initial
+EOF
+test_expect_success 'log --invert-grep --grep' '
+ git log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'log --invert-grep --grep -i' '
+ echo initial >expect &&
+ git log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'log --grep option parsing' '
echo second >expect &&
git log -1 --pretty="tformat:%s" --grep sec >actual &&
@@ -466,7 +461,7 @@ test_expect_success 'log.decorate configuration' '
git log --oneline --no-decorate >actual &&
test_cmp expect.none actual &&
git log --oneline --decorate >actual &&
- test_cmp expect.short actual
+ test_cmp expect.short actual &&
test_unconfig log.decorate &&
git log --pretty=raw >expect.raw &&
@@ -872,4 +867,8 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '
grep "^| | gpg: Good signature" actual
'
+test_expect_success 'log --graph --no-walk is forbidden' '
+ test_must_fail git log --graph --no-walk
+'
+
test_done
diff --git a/t/t4207-log-decoration-colors.sh b/t/t4207-log-decoration-colors.sh
index 925f577..f8008b6 100755
--- a/t/t4207-log-decoration-colors.sh
+++ b/t/t4207-log-decoration-colors.sh
@@ -44,15 +44,15 @@ test_expect_success setup '
'
cat >expected <<EOF
-${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_HEAD}HEAD${c_reset}${c_commit},\
- ${c_tag}tag: v1.0${c_reset}${c_commit},\
- ${c_tag}tag: B${c_reset}${c_commit},\
- ${c_branch}master${c_reset}${c_commit})${c_reset} B
-${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_tag}tag: A1${c_reset}${c_commit},\
- ${c_remoteBranch}other/master${c_reset}${c_commit})${c_reset} A1
-${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_stash}refs/stash${c_reset}${c_commit})${c_reset}\
+${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD${c_reset}${c_commit} ->\
+ ${c_reset}${c_branch}master${c_reset}${c_commit},\
+ ${c_reset}${c_tag}tag: v1.0${c_reset}${c_commit},\
+ ${c_reset}${c_tag}tag: B${c_reset}${c_commit})${c_reset} B
+${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A1${c_reset}${c_commit},\
+ ${c_reset}${c_remoteBranch}other/master${c_reset}${c_commit})${c_reset} A1
+${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_stash}refs/stash${c_reset}${c_commit})${c_reset}\
On master: Changes to A.t
-${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_tag}tag: A${c_reset}${c_commit})${c_reset} A
+${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A${c_reset}${c_commit})${c_reset} A
EOF
# We want log to show all, but the second parent to refs/stash is irrelevant
diff --git a/t/t4212-log-corrupt.sh b/t/t4212-log-corrupt.sh
index 67bd8ec..22aa8b7 100755
--- a/t/t4212-log-corrupt.sh
+++ b/t/t4212-log-corrupt.sh
@@ -61,7 +61,7 @@ test_expect_success 'unparsable dates produce sentinel value' '
test_expect_success 'unparsable dates produce sentinel value (%ad)' '
commit=$(munge_author_date HEAD totally_bogus) &&
echo >expect &&
- git log -1 --format=%ad $commit >actual
+ git log -1 --format=%ad $commit >actual &&
test_cmp expect actual
'
diff --git a/t/t4255-am-submodule.sh b/t/t4255-am-submodule.sh
index 8bde7db..0ba8194 100755
--- a/t/t4255-am-submodule.sh
+++ b/t/t4255-am-submodule.sh
@@ -18,4 +18,76 @@ am_3way () {
KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
test_submodule_switch "am_3way"
+test_expect_success 'setup diff.submodule' '
+ test_commit one &&
+ INITIAL=$(git rev-parse HEAD) &&
+
+ git init submodule &&
+ (
+ cd submodule &&
+ test_commit two &&
+ git rev-parse HEAD >../initial-submodule
+ ) &&
+ git submodule add ./submodule &&
+ git commit -m first &&
+
+ (
+ cd submodule &&
+ test_commit three &&
+ git rev-parse HEAD >../first-submodule
+ ) &&
+ git add submodule &&
+ git commit -m second &&
+ SECOND=$(git rev-parse HEAD) &&
+
+ (
+ cd submodule &&
+ git mv two.t four.t &&
+ git commit -m "second submodule" &&
+ git rev-parse HEAD >../second-submodule
+ ) &&
+ test_commit four &&
+ git add submodule &&
+ git commit --amend --no-edit &&
+ THIRD=$(git rev-parse HEAD) &&
+ git submodule update --init
+'
+
+run_test() {
+ START_COMMIT=$1 &&
+ EXPECT=$2 &&
+ # Abort any merges in progress: the previous
+ # test may have failed, and we should clean up.
+ test_might_fail git am --abort &&
+ git reset --hard $START_COMMIT &&
+ rm -f *.patch &&
+ git format-patch -1 &&
+ git reset --hard $START_COMMIT^ &&
+ git submodule update &&
+ git am *.patch &&
+ git submodule update &&
+ git -C submodule rev-parse HEAD >actual &&
+ test_cmp $EXPECT actual
+}
+
+test_expect_success 'diff.submodule unset' '
+ test_unconfig diff.submodule &&
+ run_test $SECOND first-submodule
+'
+
+test_expect_success 'diff.submodule unset with extra file' '
+ test_unconfig diff.submodule &&
+ run_test $THIRD second-submodule
+'
+
+test_expect_success 'diff.submodule=log' '
+ test_config diff.submodule log &&
+ run_test $SECOND first-submodule
+'
+
+test_expect_success 'diff.submodule=log with extra file' '
+ test_config diff.submodule log &&
+ run_test $THIRD second-submodule
+'
+
test_done
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index d01bbdc..4b68bba 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -101,7 +101,7 @@ test_expect_success \
ten=0123456789 && hundred=$ten$ten$ten$ten$ten$ten$ten$ten$ten$ten &&
echo long filename >a/four$hundred &&
mkdir a/bin &&
- cp /bin/sh a/bin &&
+ test-genrandom "frotz" 500000 >a/bin/sh &&
printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
printf "A not substituted O" >a/substfile2 &&
if test_have_prereq SYMLINKS; then
diff --git a/t/t5003-archive-zip.sh b/t/t5003-archive-zip.sh
index c929db5..14744b2 100755
--- a/t/t5003-archive-zip.sh
+++ b/t/t5003-archive-zip.sh
@@ -33,6 +33,37 @@ check_zip() {
test_expect_success UNZIP " validate file contents" "
diff -r a ${dir_with_prefix}a
"
+
+ dir=eol_$1
+ dir_with_prefix=$dir/$2
+ extracted=${dir_with_prefix}a
+ original=a
+
+ test_expect_success UNZIP " extract ZIP archive with EOL conversion" '
+ (mkdir $dir && cd $dir && "$GIT_UNZIP" -a ../$zipfile)
+ '
+
+ test_expect_success UNZIP " validate that text files are converted" "
+ test_cmp_bin $extracted/text.cr $extracted/text.crlf &&
+ test_cmp_bin $extracted/text.cr $extracted/text.lf
+ "
+
+ test_expect_success UNZIP " validate that binary files are unchanged" "
+ test_cmp_bin $original/binary.cr $extracted/binary.cr &&
+ test_cmp_bin $original/binary.crlf $extracted/binary.crlf &&
+ test_cmp_bin $original/binary.lf $extracted/binary.lf
+ "
+
+ test_expect_success UNZIP " validate that diff files are converted" "
+ test_cmp_bin $extracted/diff.cr $extracted/diff.crlf &&
+ test_cmp_bin $extracted/diff.cr $extracted/diff.lf
+ "
+
+ test_expect_success UNZIP " validate that -diff files are unchanged" "
+ test_cmp_bin $original/nodiff.cr $extracted/nodiff.cr &&
+ test_cmp_bin $original/nodiff.crlf $extracted/nodiff.crlf &&
+ test_cmp_bin $original/nodiff.lf $extracted/nodiff.lf
+ "
}
test_expect_success \
@@ -41,6 +72,18 @@ test_expect_success \
echo simple textfile >a/a &&
mkdir a/bin &&
cp /bin/sh a/bin &&
+ printf "text\r" >a/text.cr &&
+ printf "text\r\n" >a/text.crlf &&
+ printf "text\n" >a/text.lf &&
+ printf "text\r" >a/nodiff.cr &&
+ printf "text\r\n" >a/nodiff.crlf &&
+ printf "text\n" >a/nodiff.lf &&
+ printf "\0\r" >a/binary.cr &&
+ printf "\0\r\n" >a/binary.crlf &&
+ printf "\0\n" >a/binary.lf &&
+ printf "\0\r" >a/diff.cr &&
+ printf "\0\r\n" >a/diff.crlf &&
+ printf "\0\n" >a/diff.lf &&
printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
printf "A not substituted O" >a/substfile2 &&
(p=long_path_to_a_file && cd a &&
@@ -66,7 +109,9 @@ test_expect_success 'add files to repository' '
GIT_COMMITTER_DATE="2005-05-27 22:00" git commit -m initial
'
-test_expect_success 'setup export-subst' '
+test_expect_success 'setup export-subst and diff attributes' '
+ echo "a/nodiff.* -diff" >>.git/info/attributes &&
+ echo "a/diff.* diff" >>.git/info/attributes &&
echo "substfile?" export-subst >>.git/info/attributes &&
git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
>a/substfile1
diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh
index 305bcac..654adda 100755
--- a/t/t5004-archive-corner-cases.sh
+++ b/t/t5004-archive-corner-cases.sh
@@ -66,8 +66,10 @@ test_expect_success UNZIP 'zip archive of empty tree is empty' '
# handle the empty repo at all, making our later check of its exit code
# a no-op). But we cannot do anything reasonable except skip the test
# on such platforms anyway, and this is the moral equivalent.
- "$GIT_UNZIP" "$TEST_DIRECTORY"/t5004/empty.zip
- expect_code=$?
+ {
+ "$GIT_UNZIP" "$TEST_DIRECTORY"/t5004/empty.zip
+ expect_code=$?
+ } &&
git archive --format=zip HEAD >empty.zip &&
make_dir extract &&
diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh
index 9e1ad1c..e97cfb2 100755
--- a/t/t5100-mailinfo.sh
+++ b/t/t5100-mailinfo.sh
@@ -34,6 +34,10 @@ do
if test -f "$TEST_DIRECTORY"/t5100/msg$mail--no-inbody-headers
then
check_mailinfo $mail --no-inbody-headers
+ fi &&
+ if test -f "$TEST_DIRECTORY"/t5100/msg$mail--message-id
+ then
+ check_mailinfo $mail --message-id
fi
'
done
diff --git a/t/t5100/info0012--message-id b/t/t5100/info0012--message-id
new file mode 100644
index 0000000..ac1216f
--- /dev/null
+++ b/t/t5100/info0012--message-id
@@ -0,0 +1,5 @@
+Author: Dmitriy Blinov
+Email: bda@mnsspb.ru
+Subject: Изменён список пакетов необходимых для сборки
+Date: Wed, 12 Nov 2008 17:54:41 +0300
+
diff --git a/t/t5100/msg0012--message-id b/t/t5100/msg0012--message-id
new file mode 100644
index 0000000..376e26e
--- /dev/null
+++ b/t/t5100/msg0012--message-id
@@ -0,0 +1,8 @@
+textlive-* исправлены на texlive-*
+docutils заменён на python-docutils
+
+Действительно, оказалось, что rest2web вытягивает за собой
+python-docutils. В то время как сам rest2web не нужен.
+
+Signed-off-by: Dmitriy Blinov <bda@mnsspb.ru>
+Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
diff --git a/t/t5100/patch0012--message-id b/t/t5100/patch0012--message-id
new file mode 100644
index 0000000..36a0b68
--- /dev/null
+++ b/t/t5100/patch0012--message-id
@@ -0,0 +1,30 @@
+---
+ howto/build_navy.txt | 6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/howto/build_navy.txt b/howto/build_navy.txt
+index 3fd3afb..0ee807e 100644
+--- a/howto/build_navy.txt
++++ b/howto/build_navy.txt
+@@ -119,8 +119,8 @@
+ - libxv-dev
+ - libusplash-dev
+ - latex-make
+- - textlive-lang-cyrillic
+- - textlive-latex-extra
++ - texlive-lang-cyrillic
++ - texlive-latex-extra
+ - dia
+ - python-pyrex
+ - libtool
+@@ -128,7 +128,7 @@
+ - sox
+ - cython
+ - imagemagick
+- - docutils
++ - python-docutils
+
+ #. на машине dinar: добавить свой открытый ssh-ключ в authorized_keys2 пользователя ddev
+ #. на своей машине: отредактировать /etc/sudoers (команда ``visudo``) примерно следующим образом::
+--
+1.5.6.5
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index e32e46d..0794d33 100755
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
@@ -253,4 +253,12 @@ test_expect_success 'prune .git/shallow' '
test_path_is_missing .git/shallow
'
+test_expect_success 'prune: handle alternate object database' '
+ test_create_repo A &&
+ git -C A commit --allow-empty -m "initial commit" &&
+ git clone --shared A B &&
+ git -C B commit --allow-empty -m "next commit" &&
+ git -C B prune
+'
+
test_done
diff --git a/t/t5312-prune-corruption.sh b/t/t5312-prune-corruption.sh
new file mode 100755
index 0000000..8e98b44
--- /dev/null
+++ b/t/t5312-prune-corruption.sh
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+test_description='
+Test pruning of repositories with minor corruptions. The goal
+here is that we should always be erring on the side of safety. So
+if we see, for example, a ref with a bogus name, it is OK either to
+bail out or to proceed using it as a reachable tip, but it is _not_
+OK to proceed as if it did not exist. Otherwise we might silently
+delete objects that cannot be recovered.
+'
+. ./test-lib.sh
+
+test_expect_success 'disable reflogs' '
+ git config core.logallrefupdates false &&
+ rm -rf .git/logs
+'
+
+test_expect_success 'create history reachable only from a bogus-named ref' '
+ test_tick && git commit --allow-empty -m master &&
+ base=$(git rev-parse HEAD) &&
+ test_tick && git commit --allow-empty -m bogus &&
+ bogus=$(git rev-parse HEAD) &&
+ git cat-file commit $bogus >saved &&
+ echo $bogus >.git/refs/heads/bogus..name &&
+ git reset --hard HEAD^
+'
+
+test_expect_success 'pruning does not drop bogus object' '
+ test_when_finished "git hash-object -w -t commit saved" &&
+ test_might_fail git prune --expire=now &&
+ verbose git cat-file -e $bogus
+'
+
+test_expect_success 'put bogus object into pack' '
+ git tag reachable $bogus &&
+ git repack -ad &&
+ git tag -d reachable &&
+ verbose git cat-file -e $bogus
+'
+
+test_expect_success 'destructive repack keeps packed object' '
+ test_might_fail git repack -Ad --unpack-unreachable=now &&
+ verbose git cat-file -e $bogus &&
+ test_might_fail git repack -ad &&
+ verbose git cat-file -e $bogus
+'
+
+# subsequent tests will have different corruptions
+test_expect_success 'clean up bogus ref' '
+ rm .git/refs/heads/bogus..name
+'
+
+# We create two new objects here, "one" and "two". Our
+# master branch points to "two", which is deleted,
+# corrupting the repository. But we'd like to make sure
+# that the otherwise unreachable "one" is not pruned
+# (since it is the user's best bet for recovering
+# from the corruption).
+#
+# Note that we also point HEAD somewhere besides "two",
+# as we want to make sure we test the case where we
+# pick up the reference to "two" by iterating the refs,
+# not by resolving HEAD.
+test_expect_success 'create history with missing tip commit' '
+ test_tick && git commit --allow-empty -m one &&
+ recoverable=$(git rev-parse HEAD) &&
+ git cat-file commit $recoverable >saved &&
+ test_tick && git commit --allow-empty -m two &&
+ missing=$(git rev-parse HEAD) &&
+ git checkout --detach $base &&
+ rm .git/objects/$(echo $missing | sed "s,..,&/,") &&
+ test_must_fail git cat-file -e $missing
+'
+
+test_expect_success 'pruning with a corrupted tip does not drop history' '
+ test_when_finished "git hash-object -w -t commit saved" &&
+ test_might_fail git prune --expire=now &&
+ verbose git cat-file -e $recoverable
+'
+
+test_expect_success 'pack-refs does not silently delete broken loose ref' '
+ git pack-refs --all --prune &&
+ echo $missing >expect &&
+ git rev-parse refs/heads/master >actual &&
+ test_cmp expect actual
+'
+
+# we do not want to count on running pack-refs to
+# actually pack it, as it is perfectly reasonable to
+# skip processing a broken ref
+test_expect_success 'create packed-refs file with broken ref' '
+ rm -f .git/refs/heads/master &&
+ cat >.git/packed-refs <<-EOF &&
+ $missing refs/heads/master
+ $recoverable refs/heads/other
+ EOF
+ echo $missing >expect &&
+ git rev-parse refs/heads/master >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'pack-refs does not silently delete broken packed ref' '
+ git pack-refs --all --prune &&
+ git rev-parse refs/heads/master >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'pack-refs does not drop broken refs during deletion' '
+ git update-ref -d refs/heads/other &&
+ git rev-parse refs/heads/master >actual &&
+ test_cmp expect actual
+'
+
+test_done
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index 0736bcb..04cea97 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -76,8 +76,7 @@ test_expect_success 'refuse pushing rewound head without --force' '
test "$victim_head" = "$pushed_head"
'
-test_expect_success \
- 'push can be used to delete a ref' '
+test_expect_success 'push can be used to delete a ref' '
( cd victim && git branch extra master ) &&
git send-pack ./victim :extra master &&
( cd victim &&
@@ -196,19 +195,6 @@ rewound_push_setup() {
)
}
-rewound_push_succeeded() {
- cmp ../parent/.git/refs/heads/master .git/refs/heads/master
-}
-
-rewound_push_failed() {
- if rewound_push_succeeded
- then
- false
- else
- true
- fi
-}
-
test_expect_success 'pushing explicit refspecs respects forcing' '
rewound_push_setup &&
parent_orig=$(cd parent && git rev-parse --verify master) &&
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 5b2b1c2..692d717 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -414,7 +414,7 @@ test_expect_success 'setup tests for the --stdin parameter' '
do
git tag $head $head
done &&
- cat >input <<-\EOF
+ cat >input <<-\EOF &&
refs/heads/C
refs/heads/A
refs/heads/D
@@ -541,13 +541,30 @@ check_prot_path () {
test_cmp expected actual
}
-check_prot_host_path () {
- cat >expected <<-EOF &&
+check_prot_host_port_path () {
+ local diagport
+ case "$2" in
+ *ssh*)
+ pp=ssh
+ uah=userandhost
+ ehost=$(echo $3 | tr -d "[]")
+ diagport="Diag: port=$4"
+ ;;
+ *)
+ pp=$p
+ uah=hostandport
+ ehost=$(echo $3$4 | sed -e "s/22$/:22/" -e "s/NONE//")
+ diagport=""
+ ;;
+ esac
+ cat >exp <<-EOF &&
Diag: url=$1
- Diag: protocol=$2
- Diag: hostandport=$3
- Diag: path=$4
+ Diag: protocol=$pp
+ Diag: $uah=$ehost
+ $diagport
+ Diag: path=$5
EOF
+ grep -v "^$" exp >expected
git fetch-pack --diag-url "$1" >actual &&
test_cmp expected actual
}
@@ -557,22 +574,20 @@ do
# git or ssh with scheme
for p in "ssh+git" "git+ssh" git ssh
do
- for h in host host:12 [::1] [::1]:23
+ for h in host user@host user@[::1] user@::1
do
- case "$p" in
- *ssh*)
- pp=ssh
- ;;
- *)
- pp=$p
- ;;
- esac
test_expect_success "fetch-pack --diag-url $p://$h/$r" '
- check_prot_host_path $p://$h/$r $pp "$h" "/$r"
+ check_prot_host_port_path $p://$h/$r $p "$h" NONE "/$r"
'
# "/~" -> "~" conversion
test_expect_success "fetch-pack --diag-url $p://$h/~$r" '
- check_prot_host_path $p://$h/~$r $pp "$h" "~$r"
+ check_prot_host_port_path $p://$h/~$r $p "$h" NONE "~$r"
+ '
+ done
+ for h in host User@host User@[::1]
+ do
+ test_expect_success "fetch-pack --diag-url $p://$h:22/$r" '
+ check_prot_host_port_path $p://$h:22/$r $p "$h" 22 "/$r"
'
done
done
@@ -603,11 +618,11 @@ do
for h in host [::1]
do
test_expect_success "fetch-pack --diag-url $h:$r" '
- check_prot_path $h:$r $p "$r"
+ check_prot_host_port_path $h:$r $p "$h" NONE "$r"
'
# Do "/~" -> "~" conversion
test_expect_success "fetch-pack --diag-url $h:/~$r" '
- check_prot_host_path $h:/~$r $p "$h" "~$r"
+ check_prot_host_port_path $h:/~$r $p "$h" NONE "~$r"
'
done
done
diff --git a/t/t5503-tagfollow.sh b/t/t5503-tagfollow.sh
index f30c038..4ca48f0 100755
--- a/t/t5503-tagfollow.sh
+++ b/t/t5503-tagfollow.sh
@@ -139,8 +139,8 @@ EOF
'
test_expect_success 'new clone fetch master and tags' '
- git branch -D cat
- rm -f $U
+ test_might_fail git branch -D cat &&
+ rm -f $U &&
(
mkdir clone2 &&
cd clone2 &&
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index ac79dd9..7a8499c 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -579,7 +579,7 @@ test_expect_success 'update with arguments' '
cd one &&
for b in $(git branch -r)
do
- git branch -r -d $b || break
+ git branch -r -d $b || exit 1
done &&
git remote add manduca ../mirror &&
git remote add megaloprepus ../mirror &&
@@ -622,7 +622,7 @@ test_expect_success 'update default' '
cd one &&
for b in $(git branch -r)
do
- git branch -r -d $b || break
+ git branch -r -d $b || exit 1
done &&
git config remote.drosophila.skipDefaultUpdate true &&
git remote update default &&
@@ -642,7 +642,7 @@ test_expect_success 'update default (overridden, with funny whitespace)' '
cd one &&
for b in $(git branch -r)
do
- git branch -r -d $b || break
+ git branch -r -d $b || exit 1
done &&
git config remotes.default "$(printf "\t drosophila \n")" &&
git remote update default &&
@@ -656,7 +656,7 @@ test_expect_success 'update (with remotes.default defined)' '
cd one &&
for b in $(git branch -r)
do
- git branch -r -d $b || break
+ git branch -r -d $b || exit 1
done &&
git config remotes.default "drosophila" &&
git remote update &&
@@ -1113,4 +1113,9 @@ test_extra_arg set-url origin newurl oldurl
# prune takes any number of args
# update takes any number of args
+test_expect_success 'add remote matching the "insteadOf" URL' '
+ git config url.xyz@example.com.insteadOf backup &&
+ git remote add backup xyz@example.com
+'
+
test_done
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index d78f320..0ba9db0 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -124,7 +124,7 @@ test_expect_success 'fetch --prune handles overlapping refspecs' '
git rev-parse origin/master &&
git rev-parse origin/pr/42 &&
- git config --unset-all remote.origin.fetch
+ git config --unset-all remote.origin.fetch &&
git config remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* &&
git config --add remote.origin.fetch refs/heads/*:refs/remotes/origin/* &&
@@ -596,7 +596,7 @@ test_configured_prune () {
test_unconfig remote.origin.prune &&
git fetch &&
git rev-parse --verify refs/remotes/origin/newbranch
- )
+ ) &&
# now remove it
git branch -d newbranch &&
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index 321c3e5..3bd9759 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -103,8 +103,10 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
'
test_expect_success 'die with non-2 for wrong repository even with --exit-code' '
- git ls-remote --exit-code ./no-such-repository ;# not &&
- status=$? &&
+ {
+ git ls-remote --exit-code ./no-such-repository
+ status=$?
+ } &&
test $status != 2 && test $status != 0
'
diff --git a/t/t5514-fetch-multiple.sh b/t/t5514-fetch-multiple.sh
index 0f81409..4b4b667 100755
--- a/t/t5514-fetch-multiple.sh
+++ b/t/t5514-fetch-multiple.sh
@@ -120,7 +120,7 @@ test_expect_success 'git fetch --all (skipFetchAll)' '
(cd test4 &&
for b in $(git branch -r)
do
- git branch -r -d $b || break
+ git branch -r -d $b || exit 1
done &&
git remote add three ../three &&
git config remote.three.skipFetchAll true &&
@@ -144,7 +144,7 @@ test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' '
(cd test4 &&
for b in $(git branch -r)
do
- git branch -r -d $b || break
+ git branch -r -d $b || exit 1
done &&
git fetch --multiple one two three &&
git branch -r > output &&
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index f4da20a..5e04d64 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -238,7 +238,7 @@ test_expect_success 'push with pushInsteadOf' '
test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf should not rewrite)' '
mk_empty testrepo &&
test_config "url.trash2/.pushInsteadOf" testrepo/ &&
- test_config "url.trash3/.pusnInsteadOf" trash/wrong &&
+ test_config "url.trash3/.pushInsteadOf" trash/wrong &&
test_config remote.r.url trash/wrong &&
test_config remote.r.pushurl "testrepo/" &&
git push r refs/heads/master:refs/remotes/origin/master &&
@@ -1107,9 +1107,16 @@ test_expect_success 'fetch exact SHA1' '
git config uploadpack.allowtipsha1inwant true
) &&
- git fetch -v ../testrepo $the_commit:refs/heads/copy &&
- result=$(git rev-parse --verify refs/heads/copy) &&
- test "$the_commit" = "$result"
+ git fetch -v ../testrepo $the_commit:refs/heads/copy master:refs/heads/extra &&
+ cat >expect <<-EOF &&
+ $the_commit
+ $the_first_commit
+ EOF
+ {
+ git rev-parse --verify refs/heads/copy &&
+ git rev-parse --verify refs/heads/extra
+ } >actual &&
+ test_cmp expect actual
)
'
@@ -1330,4 +1337,171 @@ test_expect_success 'fetch into bare respects core.logallrefupdates' '
)
'
+test_expect_success 'receive.denyCurrentBranch = updateInstead' '
+ git push testrepo master &&
+ (
+ cd testrepo &&
+ git reset --hard &&
+ git config receive.denyCurrentBranch updateInstead
+ ) &&
+ test_commit third path2 &&
+
+ # Try pushing into a repository with pristine working tree
+ git push testrepo master &&
+ (
+ cd testrepo &&
+ git update-index -q --refresh &&
+ git diff-files --quiet -- &&
+ git diff-index --quiet --cached HEAD -- &&
+ test third = "$(cat path2)" &&
+ test $(git -C .. rev-parse HEAD) = $(git rev-parse HEAD)
+ ) &&
+
+ # Try pushing into a repository with working tree needing a refresh
+ (
+ cd testrepo &&
+ git reset --hard HEAD^ &&
+ test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) &&
+ test-chmtime +100 path1
+ ) &&
+ git push testrepo master &&
+ (
+ cd testrepo &&
+ git update-index -q --refresh &&
+ git diff-files --quiet -- &&
+ git diff-index --quiet --cached HEAD -- &&
+ test_cmp ../path1 path1 &&
+ test third = "$(cat path2)" &&
+ test $(git -C .. rev-parse HEAD) = $(git rev-parse HEAD)
+ ) &&
+
+ # Update what is to be pushed
+ test_commit fourth path2 &&
+
+ # Try pushing into a repository with a dirty working tree
+ # (1) the working tree updated
+ (
+ cd testrepo &&
+ echo changed >path1
+ ) &&
+ test_must_fail git push testrepo master &&
+ (
+ cd testrepo &&
+ test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) &&
+ git diff --quiet --cached &&
+ test changed = "$(cat path1)"
+ ) &&
+
+ # (2) the index updated
+ (
+ cd testrepo &&
+ echo changed >path1 &&
+ git add path1
+ ) &&
+ test_must_fail git push testrepo master &&
+ (
+ cd testrepo &&
+ test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) &&
+ git diff --quiet &&
+ test changed = "$(cat path1)"
+ ) &&
+
+ # Introduce a new file in the update
+ test_commit fifth path3 &&
+
+ # (3) the working tree has an untracked file that would interfere
+ (
+ cd testrepo &&
+ git reset --hard &&
+ echo changed >path3
+ ) &&
+ test_must_fail git push testrepo master &&
+ (
+ cd testrepo &&
+ test $(git -C .. rev-parse HEAD^^) = $(git rev-parse HEAD) &&
+ git diff --quiet &&
+ git diff --quiet --cached &&
+ test changed = "$(cat path3)"
+ ) &&
+
+ # (4) the target changes to what gets pushed but it still is a change
+ (
+ cd testrepo &&
+ git reset --hard &&
+ echo fifth >path3 &&
+ git add path3
+ ) &&
+ test_must_fail git push testrepo master &&
+ (
+ cd testrepo &&
+ test $(git -C .. rev-parse HEAD^^) = $(git rev-parse HEAD) &&
+ git diff --quiet &&
+ test fifth = "$(cat path3)"
+ )
+
+'
+
+test_expect_success 'updateInstead with push-to-checkout hook' '
+ rm -fr testrepo &&
+ git init testrepo &&
+ (
+ cd testrepo &&
+ git pull .. master &&
+ git reset --hard HEAD^^ &&
+ git tag initial &&
+ git config receive.denyCurrentBranch updateInstead &&
+ write_script .git/hooks/push-to-checkout <<-\EOF
+ echo >&2 updating from $(git rev-parse HEAD)
+ echo >&2 updating to "$1"
+
+ git update-index -q --refresh &&
+ git read-tree -u -m HEAD "$1" || {
+ status=$?
+ echo >&2 read-tree failed
+ exit $status
+ }
+ EOF
+ ) &&
+
+ # Try pushing into a pristine
+ git push testrepo master &&
+ (
+ cd testrepo &&
+ git diff --quiet &&
+ git diff HEAD --quiet &&
+ test $(git -C .. rev-parse HEAD) = $(git rev-parse HEAD)
+ ) &&
+
+ # Try pushing into a repository with conflicting change
+ (
+ cd testrepo &&
+ git reset --hard initial &&
+ echo conflicting >path2
+ ) &&
+ test_must_fail git push testrepo master &&
+ (
+ cd testrepo &&
+ test $(git rev-parse initial) = $(git rev-parse HEAD) &&
+ test conflicting = "$(cat path2)" &&
+ git diff-index --quiet --cached HEAD
+ ) &&
+
+ # Try pushing into a repository with unrelated change
+ (
+ cd testrepo &&
+ git reset --hard initial &&
+ echo unrelated >path1 &&
+ echo irrelevant >path5 &&
+ git add path5
+ ) &&
+ git push testrepo master &&
+ (
+ cd testrepo &&
+ test "$(cat path1)" = unrelated &&
+ test "$(cat path5)" = irrelevant &&
+ test "$(git diff --name-only --cached HEAD)" = path5 &&
+ test $(git -C .. rev-parse HEAD) = $(git rev-parse HEAD)
+ )
+'
+
test_done
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index ca5b027..a4532b0 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -216,7 +216,7 @@ test_expect_success "Recursion stops when no new submodule commits are fetched"
head2=$(git rev-parse --short HEAD) &&
echo "Fetching submodule submodule" > expect.out.sub &&
echo "From $pwd/." > expect.err.sub &&
- echo " $head1..$head2 master -> origin/master" >> expect.err.sub
+ echo " $head1..$head2 master -> origin/master" >>expect.err.sub &&
head -2 expect.err >> expect.err.sub &&
(
cd downstream &&
@@ -315,7 +315,7 @@ test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no ne
) &&
head1=$(git rev-parse --short HEAD^) &&
git add subdir/deepsubmodule &&
- git commit -m "new deepsubmodule"
+ git commit -m "new deepsubmodule" &&
head2=$(git rev-parse --short HEAD) &&
echo "From $pwd/submodule" > ../expect.err.sub &&
echo " $head1..$head2 master -> origin/master" >> ../expect.err.sub
@@ -337,7 +337,7 @@ test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necess
head2=$(git rev-parse --short HEAD) &&
tail -2 expect.err > expect.err.deepsub &&
echo "From $pwd/." > expect.err &&
- echo " $head1..$head2 master -> origin/master" >> expect.err
+ echo " $head1..$head2 master -> origin/master" >>expect.err &&
cat expect.err.sub >> expect.err &&
cat expect.err.deepsub >> expect.err &&
(
@@ -387,7 +387,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config
git commit -m "new submodule" &&
head2=$(git rev-parse --short HEAD) &&
echo "From $pwd/." > expect.err.2 &&
- echo " $head1..$head2 master -> origin/master" >> expect.err.2
+ echo " $head1..$head2 master -> origin/master" >>expect.err.2 &&
head -2 expect.err >> expect.err.2 &&
(
cd downstream &&
@@ -415,7 +415,7 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override
git commit -m "new submodule" &&
head2=$(git rev-parse --short HEAD) &&
echo "From $pwd/." > expect.err.2 &&
- echo " $head1..$head2 master -> origin/master" >> expect.err.2
+ echo " $head1..$head2 master -> origin/master" >>expect.err.2 &&
head -2 expect.err >> expect.err.2 &&
(
cd downstream &&
diff --git a/t/t5527-fetch-odd-refs.sh b/t/t5527-fetch-odd-refs.sh
index edea9f9..207899a 100755
--- a/t/t5527-fetch-odd-refs.sh
+++ b/t/t5527-fetch-odd-refs.sh
@@ -26,4 +26,37 @@ test_expect_success 'suffix ref is ignored during fetch' '
test_cmp expect actual
'
+test_expect_success 'try to create repo with absurdly long refname' '
+ ref240=$_z40/$_z40/$_z40/$_z40/$_z40/$_z40 &&
+ ref1440=$ref240/$ref240/$ref240/$ref240/$ref240/$ref240 &&
+ git init long &&
+ (
+ cd long &&
+ test_commit long &&
+ test_commit master
+ ) &&
+ if git -C long update-ref refs/heads/$ref1440 long; then
+ test_set_prereq LONG_REF
+ else
+ echo >&2 "long refs not supported"
+ fi
+'
+
+test_expect_success LONG_REF 'fetch handles extremely long refname' '
+ git fetch long refs/heads/*:refs/remotes/long/* &&
+ cat >expect <<-\EOF &&
+ long
+ master
+ EOF
+ git for-each-ref --format="%(subject)" refs/remotes/long >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success LONG_REF 'push handles extremely long refname' '
+ git push long :refs/heads/$ref1440 &&
+ git -C long for-each-ref --format="%(subject)" refs/heads >actual &&
+ echo master >expect &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh
index 6a5ac3a..73f4bb6 100755
--- a/t/t5528-push-default.sh
+++ b/t/t5528-push-default.sh
@@ -26,7 +26,7 @@ check_pushed_commit () {
# $2 = expected target branch for the push
# $3 = [optional] repo to check for actual output (repo1 by default)
test_push_success () {
- git -c push.default="$1" push &&
+ git ${1:+-c} ${1:+push.default="$1"} push &&
check_pushed_commit HEAD "$2" "$3"
}
@@ -34,7 +34,7 @@ test_push_success () {
# check that push fails and does not modify any remote branch
test_push_failure () {
git --git-dir=repo1 log --no-walk --format='%h %s' --all >expect &&
- test_must_fail git -c push.default="$1" push &&
+ test_must_fail git ${1:+-c} ${1:+push.default="$1"} push &&
git --git-dir=repo1 log --no-walk --format='%h %s' --all >actual &&
test_cmp expect actual
}
@@ -172,4 +172,32 @@ test_pushdefault_workflow success simple master triangular
# master is updated (parent2 does not have foo)
test_pushdefault_workflow success matching master triangular
+# default tests, when no push-default is specified. This
+# should behave the same as "simple" in non-triangular
+# settings, and as "current" otherwise.
+
+test_expect_success 'default behavior allows "simple" push' '
+ test_config branch.master.remote parent1 &&
+ test_config branch.master.merge refs/heads/master &&
+ test_config remote.pushdefault parent1 &&
+ test_commit default-master-master &&
+ test_push_success "" master
+'
+
+test_expect_success 'default behavior rejects non-simple push' '
+ test_config branch.master.remote parent1 &&
+ test_config branch.master.merge refs/heads/foo &&
+ test_config remote.pushdefault parent1 &&
+ test_commit default-master-foo &&
+ test_push_failure ""
+'
+
+test_expect_success 'default triangular behavior acts like "current"' '
+ test_config branch.master.remote parent1 &&
+ test_config branch.master.merge refs/heads/foo &&
+ test_config remote.pushdefault parent2 &&
+ test_commit default-triangular &&
+ test_push_success "" master repo2
+'
+
test_done
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 445bb5f..6507487 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -104,7 +104,7 @@ test_expect_success 'push fails when commit on multiple branches if one branch h
'
test_expect_success 'push succeeds if submodule has no remote and is on the first superproject commit' '
- git init --bare a
+ git init --bare a &&
git clone a a1 &&
(
cd a1 &&
diff --git a/t/t5533-push-cas.sh b/t/t5533-push-cas.sh
index ba20d83..c402d8d 100755
--- a/t/t5533-push-cas.sh
+++ b/t/t5533-push-cas.sh
@@ -14,7 +14,7 @@ setup_srcdst_basic () {
}
test_expect_success setup '
- : create template repository
+ # create template repository
test_commit A &&
test_commit B &&
test_commit C
@@ -159,7 +159,7 @@ test_expect_success 'cover everything with default force-with-lease (protected)'
(
cd src &&
git branch naster master^
- )
+ ) &&
git ls-remote src refs/heads/\* >expect &&
(
cd dst &&
@@ -174,7 +174,7 @@ test_expect_success 'cover everything with default force-with-lease (allowed)' '
(
cd src &&
git branch naster master^
- )
+ ) &&
(
cd dst &&
git fetch &&
diff --git a/t/t5540-http-push-webdav.sh b/t/t5540-http-push-webdav.sh
index 8d7b3c5..88ff5a4 100755
--- a/t/t5540-http-push-webdav.sh
+++ b/t/t5540-http-push-webdav.sh
@@ -169,7 +169,7 @@ test_expect_failure 'push to password-protected repository (no user in URL)' '
test_commit pw-nouser &&
set_askpass user@host pass@host &&
git push "$HTTPD_URL/auth/dumb/test_repo.git" HEAD &&
- expect_askpass both user@host
+ expect_askpass both user@host &&
git rev-parse --verify HEAD >expect &&
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git" \
rev-parse --verify HEAD >actual &&
diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
index d2c681e..9cf27e8 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -158,7 +158,7 @@ test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' '
# create a dissimilarly-named remote ref so that git is unable to match the
# two refs (viz. local, remote) unless an explicit refspec is provided.
- git push origin master:retsam
+ git push origin master:retsam &&
echo "change changed" > path2 &&
git commit -a -m path2 --amend &&
@@ -324,12 +324,6 @@ test_expect_success 'push into half-auth-complete requires password' '
test_cmp expect actual
'
-run_with_limited_cmdline () {
- (ulimit -s 128 && "$@")
-}
-
-test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'
-
test_expect_success CMDLINE_LIMIT 'push 2000 tags over http' '
sha1=$(git rev-parse HEAD) &&
test_seq 2000 |
diff --git a/t/t5543-atomic-push.sh b/t/t5543-atomic-push.sh
new file mode 100755
index 0000000..3480b33
--- /dev/null
+++ b/t/t5543-atomic-push.sh
@@ -0,0 +1,194 @@
+#!/bin/sh
+
+test_description='pushing to a repository using the atomic push option'
+
+. ./test-lib.sh
+
+mk_repo_pair () {
+ rm -rf workbench upstream &&
+ test_create_repo upstream &&
+ test_create_repo workbench &&
+ (
+ cd upstream &&
+ git config receive.denyCurrentBranch warn
+ ) &&
+ (
+ cd workbench &&
+ git remote add up ../upstream
+ )
+}
+
+# Compare the ref ($1) in upstream with a ref value from workbench ($2)
+# i.e. test_refs second HEAD@{2}
+test_refs () {
+ test $# = 2 &&
+ git -C upstream rev-parse --verify "$1" >expect &&
+ git -C workbench rev-parse --verify "$2" >actual &&
+ test_cmp expect actual
+}
+
+test_expect_success 'atomic push works for a single branch' '
+ mk_repo_pair &&
+ (
+ cd workbench &&
+ test_commit one &&
+ git push --mirror up &&
+ test_commit two &&
+ git push --atomic up master
+ ) &&
+ test_refs master master
+'
+
+test_expect_success 'atomic push works for two branches' '
+ mk_repo_pair &&
+ (
+ cd workbench &&
+ test_commit one &&
+ git branch second &&
+ git push --mirror up &&
+ test_commit two &&
+ git checkout second &&
+ test_commit three &&
+ git push --atomic up master second
+ ) &&
+ test_refs master master &&
+ test_refs second second
+'
+
+test_expect_success 'atomic push works in combination with --mirror' '
+ mk_repo_pair &&
+ (
+ cd workbench &&
+ test_commit one &&
+ git checkout -b second &&
+ test_commit two &&
+ git push --atomic --mirror up
+ ) &&
+ test_refs master master &&
+ test_refs second second
+'
+
+test_expect_success 'atomic push works in combination with --force' '
+ mk_repo_pair &&
+ (
+ cd workbench &&
+ test_commit one &&
+ git branch second master &&
+ test_commit two_a &&
+ git checkout second &&
+ test_commit two_b &&
+ test_commit three_b &&
+ test_commit four &&
+ git push --mirror up &&
+ # The actual test is below
+ git checkout master &&
+ test_commit three_a &&
+ git checkout second &&
+ git reset --hard HEAD^ &&
+ git push --force --atomic up master second
+ ) &&
+ test_refs master master &&
+ test_refs second second
+'
+
+# set up two branches where master can be pushed but second can not
+# (non-fast-forward). Since second can not be pushed the whole operation
+# will fail and leave master untouched.
+test_expect_success 'atomic push fails if one branch fails' '
+ mk_repo_pair &&
+ (
+ cd workbench &&
+ test_commit one &&
+ git checkout -b second master &&
+ test_commit two &&
+ test_commit three &&
+ test_commit four &&
+ git push --mirror up &&
+ git reset --hard HEAD~2 &&
+ test_commit five &&
+ git checkout master &&
+ test_commit six &&
+ test_must_fail git push --atomic --all up
+ ) &&
+ test_refs master HEAD@{7} &&
+ test_refs second HEAD@{4}
+'
+
+test_expect_success 'atomic push fails if one tag fails remotely' '
+ # prepare the repo
+ mk_repo_pair &&
+ (
+ cd workbench &&
+ test_commit one &&
+ git checkout -b second master &&
+ test_commit two &&
+ git push --mirror up
+ ) &&
+ # a third party modifies the server side:
+ (
+ cd upstream &&
+ git checkout second &&
+ git tag test_tag second
+ ) &&
+ # see if we can now push both branches.
+ (
+ cd workbench &&
+ git checkout master &&
+ test_commit three &&
+ git checkout second &&
+ test_commit four &&
+ git tag test_tag &&
+ test_must_fail git push --tags --atomic up master second
+ ) &&
+ test_refs master HEAD@{3} &&
+ test_refs second HEAD@{1}
+'
+
+test_expect_success 'atomic push obeys update hook preventing a branch to be pushed' '
+ mk_repo_pair &&
+ (
+ cd workbench &&
+ test_commit one &&
+ git checkout -b second master &&
+ test_commit two &&
+ git push --mirror up
+ ) &&
+ (
+ cd upstream &&
+ HOOKDIR="$(git rev-parse --git-dir)/hooks" &&
+ HOOK="$HOOKDIR/update" &&
+ mkdir -p "$HOOKDIR" &&
+ write_script "$HOOK" <<-\EOF
+ # only allow update to master from now on
+ test "$1" = "refs/heads/master"
+ EOF
+ ) &&
+ (
+ cd workbench &&
+ git checkout master &&
+ test_commit three &&
+ git checkout second &&
+ test_commit four &&
+ test_must_fail git push --atomic up master second
+ ) &&
+ test_refs master HEAD@{3} &&
+ test_refs second HEAD@{1}
+'
+
+test_expect_success 'atomic push is not advertised if configured' '
+ mk_repo_pair &&
+ (
+ cd upstream
+ git config receive.advertiseatomic 0
+ ) &&
+ (
+ cd workbench &&
+ test_commit one &&
+ git push --mirror up &&
+ test_commit two &&
+ test_must_fail git push --atomic up master
+ ) &&
+ test_refs master HEAD@{1}
+'
+
+test_done
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index ac71418..3d11b7a 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -15,7 +15,7 @@ test_expect_success 'setup repository' '
git config push.default matching &&
echo content1 >file &&
git add file &&
- git commit -m one
+ git commit -m one &&
echo content2 >file &&
git add file &&
git commit -m two
@@ -165,9 +165,27 @@ test_expect_success 'fetch notices corrupt idx' '
)
'
+test_expect_success 'fetch can handle previously-fetched .idx files' '
+ git checkout --orphan branch1 &&
+ echo base >file &&
+ git add file &&
+ git commit -m base &&
+ git --bare init "$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git &&
+ git push "$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git branch1 &&
+ git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git repack -d &&
+ git checkout -b branch2 branch1 &&
+ echo b2 >>file &&
+ git commit -a -m b2 &&
+ git push "$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git branch2 &&
+ git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git repack -d &&
+ git --bare init clone_packed_branches.git &&
+ git --git-dir=clone_packed_branches.git fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch1:branch1 &&
+ git --git-dir=clone_packed_branches.git fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch2:branch2
+'
+
test_expect_success 'did not use upload-pack service' '
- grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act
- : >exp
+ test_might_fail grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act &&
+ : >exp &&
test_cmp exp act
'
@@ -196,5 +214,47 @@ test_expect_success 'reencoding is robust to whitespace oddities' '
grep "this is the error message" stderr
'
+check_language () {
+ case "$2" in
+ '')
+ >expect
+ ;;
+ ?*)
+ echo "Accept-Language: $1" >expect
+ ;;
+ esac &&
+ GIT_CURL_VERBOSE=1 \
+ LANGUAGE=$2 \
+ git ls-remote "$HTTPD_URL/dumb/repo.git" >output 2>&1 &&
+ tr -d '\015' <output |
+ sort -u |
+ sed -ne '/^Accept-Language:/ p' >actual &&
+ test_cmp expect actual
+}
+
+test_expect_success 'git client sends Accept-Language based on LANGUAGE' '
+ check_language "ko-KR, *;q=0.9" ko_KR.UTF-8'
+
+test_expect_success 'git client sends Accept-Language correctly with unordinary LANGUAGE' '
+ check_language "ko-KR, *;q=0.9" "ko_KR:" &&
+ check_language "ko-KR, en-US;q=0.9, *;q=0.8" "ko_KR::en_US" &&
+ check_language "ko-KR, *;q=0.9" ":::ko_KR" &&
+ check_language "ko-KR, en-US;q=0.9, *;q=0.8" "ko_KR!!:en_US" &&
+ check_language "ko-KR, ja-JP;q=0.9, *;q=0.8" "ko_KR en_US:ja_JP"'
+
+test_expect_success 'git client sends Accept-Language with many preferred languages' '
+ check_language "ko-KR, en-US;q=0.9, fr-CA;q=0.8, de;q=0.7, sr;q=0.6, \
+ja;q=0.5, zh;q=0.4, sv;q=0.3, pt;q=0.2, *;q=0.1" \
+ ko_KR.EUC-KR:en_US.UTF-8:fr_CA:de.UTF-8@euro:sr@latin:ja:zh:sv:pt &&
+ check_language "ko-KR, en-US;q=0.99, fr-CA;q=0.98, de;q=0.97, sr;q=0.96, \
+ja;q=0.95, zh;q=0.94, sv;q=0.93, pt;q=0.92, nb;q=0.91, *;q=0.90" \
+ ko_KR.EUC-KR:en_US.UTF-8:fr_CA:de.UTF-8@euro:sr@latin:ja:zh:sv:pt:nb
+'
+
+test_expect_success 'git client does not send an empty Accept-Language' '
+ GIT_CURL_VERBOSE=1 LANGUAGE= git ls-remote "$HTTPD_URL/dumb/repo.git" 2>stderr &&
+ ! grep "^Accept-Language:" stderr
+'
+
stop_httpd
test_done
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index 6cbc12d..66439e5 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -83,7 +83,7 @@ test_expect_success 'clone http repository' '
test_expect_success 'fetch changes via http' '
echo content >>file &&
git commit -a -m two &&
- git push public
+ git push public &&
(cd clone && git pull) &&
test_cmp file clone/file
'
@@ -169,7 +169,7 @@ test_expect_success 'GIT_SMART_HTTP can disable smart http' '
'
test_expect_success 'invalid Content-Type rejected' '
- test_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual
+ test_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual &&
grep "not valid:" actual
'
@@ -209,14 +209,25 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
git config http.cookiefile cookies.txt &&
git config http.savecookies true &&
git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&
- tail -3 cookies.txt > cookies_tail.txt
+ tail -3 cookies.txt >cookies_tail.txt &&
test_cmp expect_cookies.txt cookies_tail.txt
'
-test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
+test_expect_success 'transfer.hiderefs works over smart-http' '
+ test_commit hidden &&
+ test_commit visible &&
+ git push public HEAD^:refs/heads/a HEAD:refs/heads/b &&
+ git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
+ config transfer.hiderefs refs/heads/a &&
+ git clone --bare "$HTTPD_URL/smart/repo.git" hidden.git &&
+ test_must_fail git -C hidden.git rev-parse --verify a &&
+ git -C hidden.git rev-parse --verify b
+'
+
+test_expect_success 'create 2,000 tags in the repo' '
(
cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
- for i in `test_seq 50000`
+ for i in $(test_seq 2000)
do
echo "commit refs/heads/too-many-refs"
echo "mark :$i"
@@ -237,13 +248,22 @@ test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
)
'
-test_expect_success EXPENSIVE 'clone the 50,000 tag repo to check OS command line overflow' '
- git clone $HTTPD_URL/smart/repo.git too-many-refs &&
+test_expect_success CMDLINE_LIMIT \
+ 'clone the 2,000 tag repo to check OS command line overflow' '
+ run_with_limited_cmdline git clone $HTTPD_URL/smart/repo.git too-many-refs &&
(
cd too-many-refs &&
- test $(git for-each-ref refs/tags | wc -l) = 50000
+ git for-each-ref refs/tags >actual &&
+ test_line_count = 2000 actual
)
'
+test_expect_success 'large fetch-pack requests can be split across POSTs' '
+ GIT_CURL_VERBOSE=1 git -c http.postbuffer=65536 \
+ clone --bare "$HTTPD_URL/smart/repo.git" split.git 2>err &&
+ grep "^> POST" err >posts &&
+ test_line_count = 2 posts
+'
+
stop_httpd
test_done
diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
index 6b16379..b7e2832 100755
--- a/t/t5570-git-daemon.sh
+++ b/t/t5570-git-daemon.sh
@@ -142,4 +142,31 @@ test_expect_success 'read access denied' "test_remote_error -x 'no such reposito
test_expect_success 'not exported' "test_remote_error -n 'repository not exported' fetch repo.git "
stop_git_daemon
+start_git_daemon --interpolated-path="$GIT_DAEMON_DOCUMENT_ROOT_PATH/%H%D"
+
+test_expect_success 'access repo via interpolated hostname' '
+ repo="$GIT_DAEMON_DOCUMENT_ROOT_PATH/localhost/interp.git" &&
+ git init --bare "$repo" &&
+ git push "$repo" HEAD &&
+ >"$repo"/git-daemon-export-ok &&
+ rm -rf tmp.git &&
+ GIT_OVERRIDE_VIRTUAL_HOST=localhost \
+ git clone --bare "$GIT_DAEMON_URL/interp.git" tmp.git &&
+ rm -rf tmp.git &&
+ GIT_OVERRIDE_VIRTUAL_HOST=LOCALHOST \
+ git clone --bare "$GIT_DAEMON_URL/interp.git" tmp.git
+'
+
+test_expect_success 'hostname cannot break out of directory' '
+ rm -rf tmp.git &&
+ repo="$GIT_DAEMON_DOCUMENT_ROOT_PATH/../escape.git" &&
+ git init --bare "$repo" &&
+ git push "$repo" HEAD &&
+ >"$repo"/git-daemon-export-ok &&
+ test_must_fail \
+ env GIT_OVERRIDE_VIRTUAL_HOST=.. \
+ git clone --bare "$GIT_DAEMON_URL/escape.git" tmp.git
+'
+
+stop_git_daemon
test_done
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index e4f10c0..02b40b1 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -301,11 +301,17 @@ expect_ssh () {
(cd "$TRASH_DIRECTORY" && rm -f ssh-expect && >ssh-output)
' &&
{
- case "$1" in
- none)
+ case "$#" in
+ 1)
;;
- *)
+ 2)
echo "ssh: $1 git-upload-pack '$2'"
+ ;;
+ 3)
+ echo "ssh: $1 $2 git-upload-pack '$3'"
+ ;;
+ *)
+ echo "ssh: $1 $2 git-upload-pack '$3' $4"
esac
} >"$TRASH_DIRECTORY/ssh-expect" &&
(cd "$TRASH_DIRECTORY" && test_cmp ssh-expect ssh-output)
@@ -326,7 +332,7 @@ test_expect_success !MINGW,!CYGWIN 'clone local path foo:bar' '
test_expect_success 'bracketed hostnames are still ssh' '
git clone "[myhost:123]:src" ssh-bracket-clone &&
- expect_ssh myhost:123 src
+ expect_ssh myhost '-p 123' src
'
counter=0
@@ -336,7 +342,8 @@ counter=0
test_clone_url () {
counter=$(($counter + 1))
test_might_fail git clone "$1" tmp$counter &&
- expect_ssh "$2" "$3"
+ shift &&
+ expect_ssh "$@"
}
test_expect_success !MINGW 'clone c:temp is ssl' '
@@ -359,7 +366,7 @@ done
for repo in rep rep/home/project 123
do
test_expect_success "clone [::1]:$repo" '
- test_clone_url [::1]:$repo ::1 $repo
+ test_clone_url [::1]:$repo ::1 "$repo"
'
done
#home directory
@@ -400,24 +407,40 @@ test_expect_success 'clone ssh://host.xz:22/~repo' '
'
#IPv6
-test_expect_success 'clone ssh://[::1]/home/user/repo' '
- test_clone_url "ssh://[::1]/home/user/repo" "::1" "/home/user/repo"
-'
+for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]
+do
+ ehost=$(echo $tuah | tr -d "[]")
+ test_expect_success "clone ssh://$tuah/home/user/repo" "
+ test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo
+ "
+done
#IPv6 from home directory
-test_expect_success 'clone ssh://[::1]/~repo' '
- test_clone_url "ssh://[::1]/~repo" "::1" "~repo"
-'
+for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]
+do
+ euah=$(echo $tuah | tr -d "[]")
+ test_expect_success "clone ssh://$tuah/~repo" "
+ test_clone_url ssh://$tuah/~repo $euah '~repo'
+ "
+done
#IPv6 with port number
-test_expect_success 'clone ssh://[::1]:22/home/user/repo' '
- test_clone_url "ssh://[::1]:22/home/user/repo" "-p 22 ::1" "/home/user/repo"
-'
+for tuah in [::1] user@[::1] [user@::1]
+do
+ euah=$(echo $tuah | tr -d "[]")
+ test_expect_success "clone ssh://$tuah:22/home/user/repo" "
+ test_clone_url ssh://$tuah:22/home/user/repo '-p 22' $euah /home/user/repo
+ "
+done
#IPv6 from home directory with port number
-test_expect_success 'clone ssh://[::1]:22/~repo' '
- test_clone_url "ssh://[::1]:22/~repo" "-p 22 ::1" "~repo"
-'
+for tuah in [::1] user@[::1] [user@::1]
+do
+ euah=$(echo $tuah | tr -d "[]")
+ test_expect_success "clone ssh://$tuah:22/~repo" "
+ test_clone_url ssh://$tuah:22/~repo '-p 22' $euah '~repo'
+ "
+done
test_expect_success 'clone from a repository with two identical branches' '
diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh
index 6537911..3e783fc 100755
--- a/t/t5700-clone-reference.sh
+++ b/t/t5700-clone-reference.sh
@@ -198,4 +198,21 @@ test_expect_success 'clone using repo pointed at by gitfile as reference' '
test_cmp expected "$base_dir/O/.git/objects/info/alternates"
'
+test_expect_success 'clone and dissociate from reference' '
+ git init P &&
+ (
+ cd P && test_commit one
+ ) &&
+ git clone P Q &&
+ (
+ cd Q && test_commit two
+ ) &&
+ git clone --no-local --reference=P Q R &&
+ git clone --no-local --reference=P --dissociate Q S &&
+ # removing the reference P would corrupt R but not S
+ rm -fr P &&
+ test_must_fail git -C R fsck &&
+ git -C S fsck
+'
+
test_done
diff --git a/t/t5709-clone-refspec.sh b/t/t5709-clone-refspec.sh
index 6f1ea98..7ace253 100755
--- a/t/t5709-clone-refspec.sh
+++ b/t/t5709-clone-refspec.sh
@@ -147,7 +147,7 @@ test_expect_success '--single-branch with detached' '
git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \
-e "s|/remotes/origin/|/heads/|" >../actual
- )
+ ) &&
# nothing
>expect &&
test_cmp expect actual
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
index 2419407..c9d3ed1 100755
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -281,4 +281,28 @@ test_expect_success 'push messages' '
)
'
+test_expect_success 'fetch HEAD' '
+ (cd server &&
+ git checkout master &&
+ echo more >>file &&
+ git commit -a -m more
+ ) &&
+ (cd local &&
+ git fetch origin HEAD
+ ) &&
+ compare_refs server HEAD local FETCH_HEAD
+'
+
+test_expect_success 'fetch url' '
+ (cd server &&
+ git checkout master &&
+ echo more >>file &&
+ git commit -a -m more
+ ) &&
+ (cd local &&
+ git fetch "testgit::${PWD}/../server"
+ ) &&
+ compare_refs server HEAD local FETCH_HEAD
+'
+
test_done
diff --git a/t/t6000-rev-list-misc.sh b/t/t6000-rev-list-misc.sh
index 2602086..3e752ce 100755
--- a/t/t6000-rev-list-misc.sh
+++ b/t/t6000-rev-list-misc.sh
@@ -42,7 +42,7 @@ test_expect_success 'rev-list --objects with pathspecs and copied files' '
test_tick &&
git commit -m that &&
- ONE=$(git rev-parse HEAD:one)
+ ONE=$(git rev-parse HEAD:one) &&
git rev-list --objects HEAD two >output &&
grep "$ONE two/three" output &&
! grep one output
@@ -85,7 +85,7 @@ test_expect_success 'rev-list can show index objects' '
# - we do not show the root tree; since we updated the index, it
# does not have a valid cache tree
#
- cat >expect <<-\EOF
+ cat >expect <<-\EOF &&
8e4020bb5a8d8c873b25de15933e75cc0fc275df one
d9d3a7417b9605cfd88ee6306b28dadc29e6ab08 only-in-index
9200b628cf9dc883a85a7abc8d6e6730baee589c two
@@ -96,4 +96,8 @@ test_expect_success 'rev-list can show index objects' '
test_cmp expect actual
'
+test_expect_success '--bisect and --first-parent can not be combined' '
+ test_must_fail git rev-list --bisect --first-parent HEAD
+'
+
test_done
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index a02a45a..b77d4c9 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -45,7 +45,7 @@ test_expect_success 'setup' '
head2=$(git rev-parse --verify HEAD) &&
head2_short=$(git rev-parse --verify --short $head2) &&
tree2=$(git rev-parse --verify HEAD:) &&
- tree2_short=$(git rev-parse --verify --short $tree2)
+ tree2_short=$(git rev-parse --verify --short $tree2) &&
git config --unset i18n.commitEncoding
'
@@ -358,10 +358,7 @@ test_expect_success 'empty email' '
test_tick &&
C=$(GIT_AUTHOR_EMAIL= git commit-tree HEAD^{tree} </dev/null) &&
A=$(git show --pretty=format:%an,%ae,%ad%n -s $C) &&
- test "$A" = "A U Thor,,Thu Apr 7 15:14:13 2005 -0700" || {
- echo "Eh? $A" >failure
- false
- }
+ verbose test "$A" = "A U Thor,,Thu Apr 7 15:14:13 2005 -0700"
'
test_expect_success 'del LF before empty (1)' '
diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh
index fde5e71..b89cd6b 100755
--- a/t/t6012-rev-list-simplify.sh
+++ b/t/t6012-rev-list-simplify.sh
@@ -95,10 +95,7 @@ check_outcome () {
git log --pretty="$FMT" --parents $param |
unnote >actual &&
sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&
- test_cmp expect check || {
- cat actual
- false
- }
+ test_cmp expect check
'
}
@@ -121,10 +118,7 @@ test_expect_success 'full history simplification without parent' '
git log --pretty="$FMT" --full-history E -- lost |
unnote >actual &&
sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&
- test_cmp expect check || {
- cat actual
- false
- }
+ test_cmp expect check
'
test_expect_success '--full-diff is not affected by --parents' '
diff --git a/t/t6014-rev-list-all.sh b/t/t6014-rev-list-all.sh
index 991ab4a..c9bedd2 100755
--- a/t/t6014-rev-list-all.sh
+++ b/t/t6014-rev-list-all.sh
@@ -35,4 +35,8 @@ test_expect_success 'repack does not lose detached HEAD' '
'
+test_expect_success 'rev-list --graph --no-walk is forbidden' '
+ test_must_fail git rev-list --graph --no-walk HEAD
+'
+
test_done
diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh
index a89dfbe..05ebba7 100755
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
@@ -685,7 +685,7 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' '
git add -A &&
git commit -mA &&
- git checkout -b side
+ git checkout -b side &&
git rm -rf df &&
git commit -mB &&
@@ -716,7 +716,7 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' '
git add -A &&
git commit -mA &&
- git checkout -b side
+ git checkout -b side &&
git rm -f file &&
git commit -m "Delete file" &&
@@ -745,7 +745,7 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' '
git add -A &&
git commit -mA &&
- git checkout -b side
+ git checkout -b side &&
cp file newfile &&
git add -A &&
git commit -m "Add file copy" &&
diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
index 3758961..190ee90 100755
--- a/t/t6023-merge-file.sh
+++ b/t/t6023-merge-file.sh
@@ -69,7 +69,8 @@ test_expect_success 'works in subdirectory' '
cp new1.txt dir/a.txt &&
cp orig.txt dir/o.txt &&
cp new2.txt dir/b.txt &&
- ( cd dir && git merge-file a.txt o.txt b.txt )
+ ( cd dir && git merge-file a.txt o.txt b.txt ) &&
+ test_path_is_missing a.txt
'
cp new1.txt test.txt
diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh
index 5e43997..3c21938 100755
--- a/t/t6026-merge-attr.sh
+++ b/t/t6026-merge-attr.sh
@@ -11,7 +11,7 @@ test_expect_success setup '
for f in text binary union
do
- echo Initial >$f && git add $f || break
+ echo Initial >$f && git add $f || return 1
done &&
test_tick &&
git commit -m Initial &&
@@ -19,7 +19,7 @@ test_expect_success setup '
git branch side &&
for f in text binary union
do
- echo Master >>$f && git add $f || break
+ echo Master >>$f && git add $f || return 1
done &&
test_tick &&
git commit -m Master &&
@@ -27,7 +27,7 @@ test_expect_success setup '
git checkout side &&
for f in text binary union
do
- echo Side >>$f && git add $f || break
+ echo Side >>$f && git add $f || return 1
done &&
test_tick &&
git commit -m Side &&
diff --git a/t/t6028-merge-up-to-date.sh b/t/t6028-merge-up-to-date.sh
index c518e9c..7763c1b 100755
--- a/t/t6028-merge-up-to-date.sh
+++ b/t/t6028-merge-up-to-date.sh
@@ -83,7 +83,7 @@ test_expect_success 'merge fast-forward octopus' '
git reset --hard c0 &&
test_tick &&
- git merge c1 c2
+ git merge c1 c2 &&
expect=$(git rev-parse c2) &&
current=$(git rev-parse HEAD) &&
test "$expect" = "$current"
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 064f5ce..06b4868 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -52,15 +52,8 @@ test_expect_success 'bisect starts with only one bad' '
test_expect_success 'bisect does not start with only one good' '
git bisect reset &&
git bisect start &&
- git bisect good $HASH1 || return 1
-
- if git bisect next
- then
- echo Oops, should have failed.
- false
- else
- :
- fi
+ git bisect good $HASH1 &&
+ test_must_fail git bisect next
'
test_expect_success 'bisect start with one bad and good' '
@@ -191,34 +184,27 @@ test_expect_success 'bisect start: no ".git/BISECT_START" if checkout error' '
# but $HASH2 is bad,
# so we should find $HASH2 as the first bad commit
test_expect_success 'bisect skip: successful result' '
+ test_when_finished git bisect reset &&
git bisect reset &&
git bisect start $HASH4 $HASH1 &&
git bisect skip &&
git bisect bad > my_bisect_log.txt &&
- grep "$HASH2 is the first bad commit" my_bisect_log.txt &&
- git bisect reset
+ grep "$HASH2 is the first bad commit" my_bisect_log.txt
'
# $HASH1 is good, $HASH4 is bad, we skip $HASH3 and $HASH2
# so we should not be able to tell the first bad commit
# among $HASH2, $HASH3 and $HASH4
test_expect_success 'bisect skip: cannot tell between 3 commits' '
+ test_when_finished git bisect reset &&
git bisect start $HASH4 $HASH1 &&
- git bisect skip || return 1
-
- if git bisect skip > my_bisect_log.txt
- then
- echo Oops, should have failed.
- false
- else
- test $? -eq 2 &&
- grep "first bad commit could be any of" my_bisect_log.txt &&
- ! grep $HASH1 my_bisect_log.txt &&
- grep $HASH2 my_bisect_log.txt &&
- grep $HASH3 my_bisect_log.txt &&
- grep $HASH4 my_bisect_log.txt &&
- git bisect reset
- fi
+ git bisect skip &&
+ test_expect_code 2 git bisect skip >my_bisect_log.txt &&
+ grep "first bad commit could be any of" my_bisect_log.txt &&
+ ! grep $HASH1 my_bisect_log.txt &&
+ grep $HASH2 my_bisect_log.txt &&
+ grep $HASH3 my_bisect_log.txt &&
+ grep $HASH4 my_bisect_log.txt
'
# $HASH1 is good, $HASH4 is bad, we skip $HASH3
@@ -226,22 +212,15 @@ test_expect_success 'bisect skip: cannot tell between 3 commits' '
# so we should not be able to tell the first bad commit
# among $HASH3 and $HASH4
test_expect_success 'bisect skip: cannot tell between 2 commits' '
+ test_when_finished git bisect reset &&
git bisect start $HASH4 $HASH1 &&
- git bisect skip || return 1
-
- if git bisect good > my_bisect_log.txt
- then
- echo Oops, should have failed.
- false
- else
- test $? -eq 2 &&
- grep "first bad commit could be any of" my_bisect_log.txt &&
- ! grep $HASH1 my_bisect_log.txt &&
- ! grep $HASH2 my_bisect_log.txt &&
- grep $HASH3 my_bisect_log.txt &&
- grep $HASH4 my_bisect_log.txt &&
- git bisect reset
- fi
+ git bisect skip &&
+ test_expect_code 2 git bisect good >my_bisect_log.txt &&
+ grep "first bad commit could be any of" my_bisect_log.txt &&
+ ! grep $HASH1 my_bisect_log.txt &&
+ ! grep $HASH2 my_bisect_log.txt &&
+ grep $HASH3 my_bisect_log.txt &&
+ grep $HASH4 my_bisect_log.txt
'
# $HASH1 is good, $HASH4 is both skipped and bad, we skip $HASH3
@@ -249,24 +228,18 @@ test_expect_success 'bisect skip: cannot tell between 2 commits' '
# so we should not be able to tell the first bad commit
# among $HASH3 and $HASH4
test_expect_success 'bisect skip: with commit both bad and skipped' '
+ test_when_finished git bisect reset &&
git bisect start &&
git bisect skip &&
git bisect bad &&
git bisect good $HASH1 &&
git bisect skip &&
- if git bisect good > my_bisect_log.txt
- then
- echo Oops, should have failed.
- false
- else
- test $? -eq 2 &&
- grep "first bad commit could be any of" my_bisect_log.txt &&
- ! grep $HASH1 my_bisect_log.txt &&
- ! grep $HASH2 my_bisect_log.txt &&
- grep $HASH3 my_bisect_log.txt &&
- grep $HASH4 my_bisect_log.txt &&
- git bisect reset
- fi
+ test_expect_code 2 git bisect good >my_bisect_log.txt &&
+ grep "first bad commit could be any of" my_bisect_log.txt &&
+ ! grep $HASH1 my_bisect_log.txt &&
+ ! grep $HASH2 my_bisect_log.txt &&
+ grep $HASH3 my_bisect_log.txt &&
+ grep $HASH4 my_bisect_log.txt
'
# We want to automatically find the commit that
@@ -601,8 +574,7 @@ test_expect_success 'test bisection on bare repo - --no-checkout specified' '
git bisect bad $HASH4 &&
git bisect run eval \
"test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
- >../nocheckout.log &&
- git bisect reset
+ >../nocheckout.log
) &&
grep "$HASH3 is the first bad commit" nocheckout.log
'
@@ -617,8 +589,7 @@ test_expect_success 'test bisection on bare repo - --no-checkout defaulted' '
git bisect bad $HASH4 &&
git bisect run eval \
"test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
- >../defaulted.log &&
- git bisect reset
+ >../defaulted.log
) &&
grep "$HASH3 is the first bad commit" defaulted.log
'
@@ -642,14 +613,14 @@ test_expect_success 'broken branch creation' '
mkdir missing &&
:> missing/MISSING &&
git add missing/MISSING &&
- git commit -m "6(broken): Added file that will be deleted"
+ git commit -m "6(broken): Added file that will be deleted" &&
git tag BROKEN_HASH6 &&
add_line_into_file "7(broken): second line on a broken branch" hello2 &&
git tag BROKEN_HASH7 &&
add_line_into_file "8(broken): third line on a broken branch" hello2 &&
git tag BROKEN_HASH8 &&
git rm missing/MISSING &&
- git commit -m "9(broken): Remove missing file"
+ git commit -m "9(broken): Remove missing file" &&
git tag BROKEN_HASH9 &&
rm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d
'
@@ -779,4 +750,13 @@ test_expect_success 'bisect log: only skip commits left' '
git bisect reset
'
+test_expect_success '"git bisect bad HEAD" behaves as "git bisect bad"' '
+ git checkout parallel &&
+ git bisect start HEAD $HASH1 &&
+ git bisect good HEAD &&
+ git bisect bad HEAD &&
+ test "$HASH6" = $(git rev-parse --verify HEAD) &&
+ git bisect reset
+'
+
test_done
diff --git a/t/t6032-merge-large-rename.sh b/t/t6032-merge-large-rename.sh
index 15beecc..0f79268 100755
--- a/t/t6032-merge-large-rename.sh
+++ b/t/t6032-merge-large-rename.sh
@@ -28,10 +28,10 @@ make_text() {
test_rename() {
test_expect_success "rename ($1, $2)" '
- n='$1'
- expect='$2'
+ n='$1' &&
+ expect='$2' &&
git checkout -f master &&
- git branch -D test$n || true &&
+ test_might_fail git branch -D test$n &&
git reset --hard initial &&
for i in $(count $n); do
make_text $i initial initial >$i
diff --git a/t/t6034-merge-rename-nocruft.sh b/t/t6034-merge-rename-nocruft.sh
index 65be95f..89871aa 100755
--- a/t/t6034-merge-rename-nocruft.sh
+++ b/t/t6034-merge-rename-nocruft.sh
@@ -73,33 +73,12 @@ test_expect_success 'merge white into red (A->B,M->N)' \
'
git checkout -b red-white red &&
git merge white &&
- git write-tree >/dev/null || {
- echo "BAD: merge did not complete"
- return 1
- }
-
- test -f B || {
- echo "BAD: B does not exist in working directory"
- return 1
- }
- test -f N || {
- echo "BAD: N does not exist in working directory"
- return 1
- }
- test -f R || {
- echo "BAD: R does not exist in working directory"
- return 1
- }
-
- test -f A && {
- echo "BAD: A still exists in working directory"
- return 1
- }
- test -f M && {
- echo "BAD: M still exists in working directory"
- return 1
- }
- return 0
+ git write-tree &&
+ test_path_is_file B &&
+ test_path_is_file N &&
+ test_path_is_file R &&
+ test_path_is_missing A &&
+ test_path_is_missing M
'
# This test broke in 8371234ecaaf6e14fe3f2082a855eff1bbd79ae9
@@ -108,32 +87,13 @@ test_expect_success 'merge blue into white (A->B, mod A, A untracked)' \
git checkout -b white-blue white &&
echo dirty >A &&
git merge blue &&
- git write-tree >/dev/null || {
- echo "BAD: merge did not complete"
- return 1
- }
-
- test -f A || {
- echo "BAD: A does not exist in working directory"
- return 1
- }
- test `cat A` = dirty || {
- echo "BAD: A content is wrong"
- return 1
- }
- test -f B || {
- echo "BAD: B does not exist in working directory"
- return 1
- }
- test -f N || {
- echo "BAD: N does not exist in working directory"
- return 1
- }
- test -f M && {
- echo "BAD: M still exists in working directory"
- return 1
- }
- return 0
+ git write-tree &&
+ test_path_is_file A &&
+ echo dirty >expect &&
+ test_cmp expect A &&
+ test_path_is_file B &&
+ test_path_is_file N &&
+ test_path_is_missing M
'
test_done
diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index a86087b..9d6621c 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -86,7 +86,7 @@ test_expect_success 'setup criss-cross + rename merges with basic modification'
rm -rf .git &&
git init &&
- ten="0 1 2 3 4 5 6 7 8 9"
+ ten="0 1 2 3 4 5 6 7 8 9" &&
for i in $ten
do
echo line $i in a sample file
@@ -195,12 +195,7 @@ test_expect_success 'git detects differently handled merges conflict' '
git reset --hard &&
git checkout D^0 &&
- git merge -s recursive E^0 && {
- echo "BAD: should have conflicted"
- test "Incorrectly merged content" = "$(cat new_a)" &&
- echo "BAD: Silently accepted wrong content"
- return 1
- }
+ test_must_fail git merge -s recursive E^0 &&
test 3 = $(git ls-files -s | wc -l) &&
test 3 = $(git ls-files -u | wc -l) &&
@@ -533,7 +528,7 @@ test_expect_success 'merge of E2 & D fails but has appropriate contents' '
test $(git rev-parse :3:a) = $(git rev-parse B:a) &&
test $(git rev-parse :2:a/file) = $(git rev-parse E2:a/file) &&
- test $(git rev-parse :1:a/file) = $(git rev-parse C:a/file)
+ test $(git rev-parse :1:a/file) = $(git rev-parse C:a/file) &&
test $(git rev-parse :0:ignore-me) = $(git rev-parse A:ignore-me) &&
test -f a~D^0
diff --git a/t/t6039-merge-ignorecase.sh b/t/t6039-merge-ignorecase.sh
index a977653..531850d 100755
--- a/t/t6039-merge-ignorecase.sh
+++ b/t/t6039-merge-ignorecase.sh
@@ -15,7 +15,7 @@ test_expect_success 'merge with case-changing rename' '
>TestCase &&
git add TestCase &&
git commit -m "add TestCase" &&
- git tag baseline
+ git tag baseline &&
git checkout -b with-camel &&
>foo &&
git add foo &&
diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
index 7ac8fd0..3d5c238 100755
--- a/t/t6040-tracking-info.sh
+++ b/t/t6040-tracking-info.sh
@@ -12,10 +12,9 @@ advance () {
}
test_expect_success setup '
- for i in a b c;
- do
- advance $i || break
- done &&
+ advance a &&
+ advance b &&
+ advance c &&
git clone . test &&
(
cd test &&
diff --git a/t/t6111-rev-list-treesame.sh b/t/t6111-rev-list-treesame.sh
index 88b84df..32474c2 100755
--- a/t/t6111-rev-list-treesame.sh
+++ b/t/t6111-rev-list-treesame.sh
@@ -58,7 +58,7 @@ test_expect_success setup '
git checkout master &&
test_tick && git merge --no-ff fiddler-branch &&
- note K
+ note K &&
test_commit "file=Part 1" file "Part 1" L &&
@@ -92,10 +92,7 @@ check_outcome () {
git log --format="$FMT" $param |
unnote >actual &&
sed -e "$munge_actual" <actual >check &&
- test_cmp expect check || {
- cat actual
- false
- }
+ test_cmp expect check
'
}
diff --git a/t/t6132-pathspec-exclude.sh b/t/t6132-pathspec-exclude.sh
index 62049be..e1e1b1f 100755
--- a/t/t6132-pathspec-exclude.sh
+++ b/t/t6132-pathspec-exclude.sh
@@ -30,7 +30,7 @@ test_expect_success 'exclude only should error out' '
'
test_expect_success 't_e_i() exclude sub' '
- git log --oneline --format=%s -- . ":(exclude)sub" >actual
+ git log --oneline --format=%s -- . ":(exclude)sub" >actual &&
cat <<EOF >expect &&
sub2/file
file
@@ -39,7 +39,7 @@ EOF
'
test_expect_success 't_e_i() exclude sub/sub/file' '
- git log --oneline --format=%s -- . ":(exclude)sub/sub/file" >actual
+ git log --oneline --format=%s -- . ":(exclude)sub/sub/file" >actual &&
cat <<EOF >expect &&
sub2/file
sub/sub/sub/file
@@ -51,7 +51,7 @@ EOF
'
test_expect_success 't_e_i() exclude sub using mnemonic' '
- git log --oneline --format=%s -- . ":!sub" >actual
+ git log --oneline --format=%s -- . ":!sub" >actual &&
cat <<EOF >expect &&
sub2/file
file
@@ -60,7 +60,7 @@ EOF
'
test_expect_success 't_e_i() exclude :(icase)SUB' '
- git log --oneline --format=%s -- . ":(exclude,icase)SUB" >actual
+ git log --oneline --format=%s -- . ":(exclude,icase)SUB" >actual &&
cat <<EOF >expect &&
sub2/file
file
@@ -71,7 +71,7 @@ EOF
test_expect_success 't_e_i() exclude sub2 from sub' '
(
cd sub &&
- git log --oneline --format=%s -- :/ ":/!sub2" >actual
+ git log --oneline --format=%s -- :/ ":/!sub2" >actual &&
cat <<EOF >expect &&
sub/sub/sub/file
sub/file2
@@ -84,7 +84,7 @@ EOF
'
test_expect_success 't_e_i() exclude sub/*file' '
- git log --oneline --format=%s -- . ":(exclude)sub/*file" >actual
+ git log --oneline --format=%s -- . ":(exclude)sub/*file" >actual &&
cat <<EOF >expect &&
sub2/file
sub/file2
@@ -94,7 +94,7 @@ EOF
'
test_expect_success 't_e_i() exclude :(glob)sub/*/file' '
- git log --oneline --format=%s -- . ":(exclude,glob)sub/*/file" >actual
+ git log --oneline --format=%s -- . ":(exclude,glob)sub/*/file" >actual &&
cat <<EOF >expect &&
sub2/file
sub/sub/sub/file
@@ -106,7 +106,7 @@ EOF
'
test_expect_success 'm_p_d() exclude sub' '
- git ls-files -- . ":(exclude)sub" >actual
+ git ls-files -- . ":(exclude)sub" >actual &&
cat <<EOF >expect &&
file
sub2/file
@@ -115,7 +115,7 @@ EOF
'
test_expect_success 'm_p_d() exclude sub/sub/file' '
- git ls-files -- . ":(exclude)sub/sub/file" >actual
+ git ls-files -- . ":(exclude)sub/sub/file" >actual &&
cat <<EOF >expect &&
file
sub/file
@@ -127,7 +127,7 @@ EOF
'
test_expect_success 'm_p_d() exclude sub using mnemonic' '
- git ls-files -- . ":!sub" >actual
+ git ls-files -- . ":!sub" >actual &&
cat <<EOF >expect &&
file
sub2/file
@@ -136,7 +136,7 @@ EOF
'
test_expect_success 'm_p_d() exclude :(icase)SUB' '
- git ls-files -- . ":(exclude,icase)SUB" >actual
+ git ls-files -- . ":(exclude,icase)SUB" >actual &&
cat <<EOF >expect &&
file
sub2/file
@@ -147,7 +147,7 @@ EOF
test_expect_success 'm_p_d() exclude sub2 from sub' '
(
cd sub &&
- git ls-files -- :/ ":/!sub2" >actual
+ git ls-files -- :/ ":/!sub2" >actual &&
cat <<EOF >expect &&
../file
file
@@ -160,7 +160,7 @@ EOF
'
test_expect_success 'm_p_d() exclude sub/*file' '
- git ls-files -- . ":(exclude)sub/*file" >actual
+ git ls-files -- . ":(exclude)sub/*file" >actual &&
cat <<EOF >expect &&
file
sub/file2
@@ -170,7 +170,7 @@ EOF
'
test_expect_success 'm_p_d() exclude :(glob)sub/*/file' '
- git ls-files -- . ":(exclude,glob)sub/*/file" >actual
+ git ls-files -- . ":(exclude,glob)sub/*/file" >actual &&
cat <<EOF >expect &&
file
sub/file
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 54b5744..2e2fb0e 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -194,7 +194,7 @@ test_expect_success '--log=5 with custom comment character' '
'
test_expect_success 'merge.log=0 disables shortlog' '
- echo "Merge branch ${apos}left${apos}" >expected
+ echo "Merge branch ${apos}left${apos}" >expected &&
git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&
test_cmp expected actual
'
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index bda354c..c66bf79 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -334,6 +334,19 @@ test_expect_success 'Check that :track[short] cannot be used with other atoms' '
test_must_fail git for-each-ref --format="%(refname:trackshort)" 2>/dev/null
'
+test_expect_success 'Check that :track[short] works when upstream is invalid' '
+ cat >expected <<-\EOF &&
+
+
+ EOF
+ test_when_finished "git config branch.master.merge refs/heads/master" &&
+ git config branch.master.merge refs/heads/does-not-exist &&
+ git for-each-ref \
+ --format="%(upstream:track)$LF%(upstream:trackshort)" \
+ refs/heads >actual &&
+ test_cmp expected actual
+'
+
cat >expected <<EOF
$(git rev-parse --short HEAD)
EOF
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 69f11bd..7b56081 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -161,10 +161,7 @@ test_expect_success "Michael Cassar's test case" '
git mv papers/unsorted/Thesis.pdf papers/all-papers/moo-blah.pdf &&
T=`git write-tree` &&
- git ls-tree -r $T | grep partA/outline.txt || {
- git ls-tree -r $T
- (exit 1)
- }
+ git ls-tree -r $T | verbose grep partA/outline.txt
'
rm -fr papers partA path?
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 796e9f7..fa207f3 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -1081,7 +1081,7 @@ test_expect_success GPG \
get_tag_header rfc1991-signed-tag $commit commit $time >expect
echo "RFC1991 signed tag" >>expect
echo '-----BEGIN PGP MESSAGE-----' >>expect
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
'creating a signed tag with rfc1991' '
echo "rfc1991" >gpghome/gpg.conf &&
git tag -s -m "RFC1991 signed tag" rfc1991-signed-tag $commit &&
@@ -1095,7 +1095,7 @@ cp "$1" actual
EOF
chmod +x fakeeditor
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
'reediting a signed tag body omits signature' '
echo "rfc1991" >gpghome/gpg.conf &&
echo "RFC1991 signed tag" >expect &&
@@ -1103,13 +1103,13 @@ test_expect_success GPG \
test_cmp expect actual
'
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
'verifying rfc1991 signature' '
echo "rfc1991" >gpghome/gpg.conf &&
git tag -v rfc1991-signed-tag
'
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
'list tag with rfc1991 signature' '
echo "rfc1991" >gpghome/gpg.conf &&
echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
@@ -1123,12 +1123,12 @@ test_expect_success GPG \
rm -f gpghome/gpg.conf
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
'verifying rfc1991 signature without --rfc1991' '
git tag -v rfc1991-signed-tag
'
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
'list tag with rfc1991 signature without --rfc1991' '
echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
git tag -l -n1 rfc1991-signed-tag >actual &&
@@ -1139,7 +1139,7 @@ test_expect_success GPG \
test_cmp expect actual
'
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
'reediting a signed tag body omits signature' '
echo "RFC1991 signed tag" >expect &&
GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
@@ -1180,8 +1180,8 @@ test_expect_success 'message in editor has initial comment: first line' '
test_expect_success \
'message in editor has initial comment: remainder' '
# remove commented lines from the remainder -- should be empty
- >rest.expect
- sed -e 1d -e '/^#/d' <actual >rest.actual &&
+ >rest.expect &&
+ sed -e 1d -e "/^#/d" <actual >rest.actual &&
test_cmp rest.expect rest.actual
'
@@ -1459,6 +1459,34 @@ test_expect_success 'invalid sort parameter in configuratoin' '
test_cmp expect actual
'
+test_expect_success 'version sort with prerelease reordering' '
+ git config --unset tag.sort &&
+ git config versionsort.prereleaseSuffix -rc &&
+ git tag foo1.6-rc1 &&
+ git tag foo1.6-rc2 &&
+ git tag -l --sort=version:refname "foo*" >actual &&
+ cat >expect <<-\EOF &&
+ foo1.3
+ foo1.6-rc1
+ foo1.6-rc2
+ foo1.6
+ foo1.10
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'reverse version sort with prerelease reordering' '
+ git tag -l --sort=-version:refname "foo*" >actual &&
+ cat >expect <<-\EOF &&
+ foo1.10
+ foo1.6
+ foo1.6-rc2
+ foo1.6-rc1
+ foo1.3
+ EOF
+ test_cmp expect actual
+'
+
run_with_limited_stack () {
(ulimit -s 128 && "$@")
}
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index da958a8..947b690 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -396,7 +396,7 @@ test_expect_success TTY 'command-specific pager overrides core.pager' '
sane_unset PAGER GIT_PAGER &&
echo "foo:initial" >expect &&
>actual &&
- test_config core.pager "exit 1"
+ test_config core.pager "exit 1" &&
test_config pager.log "sed s/^/foo:/ >actual" &&
test_terminal git log --format=%s -1 &&
test_cmp expect actual
diff --git a/t/t7007-show.sh b/t/t7007-show.sh
index 1b824fe..42d3db6 100755
--- a/t/t7007-show.sh
+++ b/t/t7007-show.sh
@@ -124,4 +124,8 @@ test_expect_success '--quiet suppresses diff' '
test_cmp expect actual
'
+test_expect_success 'show --graph is forbidden' '
+ test_must_fail git show --graph HEAD
+'
+
test_done
diff --git a/t/t7009-filter-branch-null-sha1.sh b/t/t7009-filter-branch-null-sha1.sh
index a997f7a..c27f90f 100755
--- a/t/t7009-filter-branch-null-sha1.sh
+++ b/t/t7009-filter-branch-null-sha1.sh
@@ -13,7 +13,7 @@ test_expect_success 'setup: a commit with a bogus null sha1 in the tree' '
{
git ls-tree HEAD &&
printf "160000 commit $_z40\\tbroken\\n"
- } >broken-tree
+ } >broken-tree &&
echo "add broken entry" >msg &&
tree=$(git mktree <broken-tree) &&
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index eae9e5a..8859236 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -88,14 +88,10 @@ test_expect_success "checkout with unrelated dirty tree without -m" '
git checkout -f master &&
fill 0 1 2 3 4 5 6 7 8 >same &&
- cp same kept
+ cp same kept &&
git checkout side >messages &&
- test_cmp same kept
- (cat > messages.expect <<EOF
-M same
-EOF
-) &&
- touch messages.expect &&
+ test_cmp same kept &&
+ printf "M\t%s\n" same >messages.expect &&
test_cmp messages.expect messages
'
@@ -109,10 +105,7 @@ test_expect_success "checkout -m with dirty tree" '
test "$(git symbolic-ref HEAD)" = "refs/heads/side" &&
- (cat >expect.messages <<EOF
-M one
-EOF
-) &&
+ printf "M\t%s\n" one >expect.messages &&
test_cmp expect.messages messages &&
fill "M one" "A three" "D two" >expect.master &&
@@ -409,12 +402,12 @@ test_expect_success \
test_expect_success \
'checkout w/autosetupmerge=always sets up tracking' '
+ test_when_finished git config branch.autosetupmerge false &&
git config branch.autosetupmerge always &&
git checkout master &&
git checkout -b track2 &&
test "$(git config branch.track2.remote)" &&
- test "$(git config branch.track2.merge)"
- git config branch.autosetupmerge false'
+ test "$(git config branch.track2.merge)"'
test_expect_success 'checkout w/--track from non-branch HEAD fails' '
git checkout master^0 &&
@@ -591,7 +584,7 @@ test_expect_success 'checkout --conflict=merge, overriding config' '
'
test_expect_success 'checkout --conflict=diff3' '
- git config --unset merge.conflictstyle
+ test_unconfig merge.conflictstyle &&
setup_conflicting_index &&
echo "none of the above" >sample &&
echo ourside >expect &&
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 04118ad..99be5d9 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -119,10 +119,7 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with relative prefix' '
git clean -n ../src |
sed -n -e "s|^Would remove ||p"
) &&
- test "$would_clean" = ../src/part3.c || {
- echo "OOps <$would_clean>"
- false
- }
+ verbose test "$would_clean" = ../src/part3.c
'
test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' '
@@ -134,10 +131,7 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' '
git clean -n "$(pwd)/../src" |
sed -n -e "s|^Would remove ||p"
) &&
- test "$would_clean" = ../src/part3.c || {
- echo "OOps <$would_clean>"
- false
- }
+ verbose test "$would_clean" = ../src/part3.c
'
test_expect_success 'git clean with out of work tree relative path' '
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 7c88245..540771c 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -171,6 +171,23 @@ test_expect_success 'submodule add with ./ in path' '
test_cmp empty untracked
'
+test_expect_success 'submodule add with /././ in path' '
+ echo "refs/heads/master" >expect &&
+ >empty &&
+
+ (
+ cd addtest &&
+ git submodule add "$submodurl" dotslashdotsubmod/././frotz/./ &&
+ git submodule init
+ ) &&
+
+ rm -f heads head untracked &&
+ inspect addtest/dotslashdotsubmod/frotz ../../.. &&
+ test_cmp expect heads &&
+ test_cmp expect head &&
+ test_cmp empty untracked
+'
+
test_expect_success 'submodule add with // in path' '
echo "refs/heads/master" >expect &&
>empty &&
@@ -749,7 +766,7 @@ test_expect_success 'moving the superproject does not break submodules' '
(
cd addtest &&
git submodule status >expect
- )
+ ) &&
mv addtest addtest2 &&
(
cd addtest2 &&
@@ -970,7 +987,7 @@ test_expect_success 'submodule with UTF-8 name' '
test_expect_success 'submodule add clone shallow submodule' '
mkdir super &&
- pwd=$(pwd)
+ pwd=$(pwd) &&
(
cd super &&
git init &&
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 29d3d2c..dda3929 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -754,7 +754,7 @@ test_expect_success SYMLINKS 'submodule update can handle symbolic links in pwd'
test_expect_success 'submodule update clone shallow submodule' '
git clone cloned super3 &&
- pwd=$(pwd)
+ pwd=$(pwd) &&
(cd super3 &&
sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
mv -f .gitmodules.tmp .gitmodules &&
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 8ed5788..c3ed7cb 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -66,6 +66,12 @@ strip_comments () {
rm "$1" && mv "$1".tmp "$1"
}
+cat >.gitignore <<\EOF
+.gitignore
+expect*
+output*
+EOF
+
test_expect_success 'status --column' '
cat >expect <<\EOF &&
# On branch master
@@ -83,8 +89,8 @@ test_expect_success 'status --column' '
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
-# dir1/untracked dir2/untracked output
-# dir2/modified expect untracked
+# dir1/untracked dir2/untracked
+# dir2/modified untracked
#
EOF
COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
@@ -116,8 +122,6 @@ cat >expect <<\EOF
# dir1/untracked
# dir2/modified
# dir2/untracked
-# expect
-# output
# untracked
#
EOF
@@ -133,6 +137,23 @@ test_expect_success 'status with status.displayCommentPrefix=false' '
test_i18ncmp expect output
'
+test_expect_success 'status -v' '
+ (cat expect && git diff --cached) >expect-with-v &&
+ git status -v >output &&
+ test_i18ncmp expect-with-v output
+'
+
+test_expect_success 'status -v -v' '
+ (cat expect &&
+ echo "Changes to be committed:" &&
+ git -c diff.mnemonicprefix=true diff --cached &&
+ echo "--------------------------------------------------" &&
+ echo "Changes not staged for commit:" &&
+ git -c diff.mnemonicprefix=true diff) >expect-with-v &&
+ git status -v -v >output &&
+ test_i18ncmp expect-with-v output
+'
+
test_expect_success 'setup fake editor' '
cat >.git/editor <<-\EOF &&
#! /bin/sh
@@ -167,8 +188,6 @@ Untracked files:
dir1/untracked
dir2/modified
dir2/untracked
- expect
- output
untracked
EOF
@@ -186,8 +205,6 @@ A dir2/added
?? dir1/untracked
?? dir2/modified
?? dir2/untracked
-?? expect
-?? output
?? untracked
EOF
@@ -201,7 +218,7 @@ test_expect_success 'status -s' '
test_expect_success 'status with gitignore' '
{
echo ".gitignore" &&
- echo "expect" &&
+ echo "expect*" &&
echo "output" &&
echo "untracked"
} >.gitignore &&
@@ -222,6 +239,7 @@ test_expect_success 'status with gitignore' '
!! dir1/untracked
!! dir2/untracked
!! expect
+ !! expect-with-v
!! output
!! untracked
EOF
@@ -253,6 +271,7 @@ Ignored files:
dir1/untracked
dir2/untracked
expect
+ expect-with-v
output
untracked
@@ -264,7 +283,7 @@ EOF
test_expect_success 'status with gitignore (nothing untracked)' '
{
echo ".gitignore" &&
- echo "expect" &&
+ echo "expect*" &&
echo "dir2/modified" &&
echo "output" &&
echo "untracked"
@@ -285,6 +304,7 @@ test_expect_success 'status with gitignore (nothing untracked)' '
!! dir2/modified
!! dir2/untracked
!! expect
+ !! expect-with-v
!! output
!! untracked
EOF
@@ -312,6 +332,7 @@ Ignored files:
dir2/modified
dir2/untracked
expect
+ expect-with-v
output
untracked
@@ -320,7 +341,11 @@ EOF
test_i18ncmp expect output
'
-rm -f .gitignore
+cat >.gitignore <<\EOF
+.gitignore
+expect*
+output*
+EOF
cat >expect <<\EOF
## master
@@ -329,8 +354,6 @@ A dir2/added
?? dir1/untracked
?? dir2/modified
?? dir2/untracked
-?? expect
-?? output
?? untracked
EOF
@@ -408,7 +431,7 @@ test_expect_success 'status -s -uno' '
'
test_expect_success 'status -s (status.showUntrackedFiles no)' '
- git config status.showuntrackedfiles no
+ git config status.showuntrackedfiles no &&
git status -s >output &&
test_cmp expect output
'
@@ -434,8 +457,6 @@ Untracked files:
dir2/modified
dir2/untracked
dir3/
- expect
- output
untracked
EOF
@@ -444,7 +465,7 @@ EOF
'
test_expect_success 'status (status.showUntrackedFiles normal)' '
- test_config status.showuntrackedfiles normal
+ test_config status.showuntrackedfiles normal &&
git status >output &&
test_i18ncmp expect output
'
@@ -456,8 +477,6 @@ A dir2/added
?? dir2/modified
?? dir2/untracked
?? dir3/
-?? expect
-?? output
?? untracked
EOF
test_expect_success 'status -s -unormal' '
@@ -466,7 +485,7 @@ test_expect_success 'status -s -unormal' '
'
test_expect_success 'status -s (status.showUntrackedFiles normal)' '
- git config status.showuntrackedfiles normal
+ git config status.showuntrackedfiles normal &&
git status -s >output &&
test_cmp expect output
'
@@ -493,8 +512,6 @@ Untracked files:
dir2/untracked
dir3/untracked1
dir3/untracked2
- expect
- output
untracked
EOF
@@ -503,7 +520,7 @@ EOF
'
test_expect_success 'status (status.showUntrackedFiles all)' '
- test_config status.showuntrackedfiles all
+ test_config status.showuntrackedfiles all &&
git status >output &&
test_i18ncmp expect output
'
@@ -518,12 +535,10 @@ A dir2/added
?? dir1/untracked
?? dir2/modified
?? dir2/untracked
-?? expect
-?? output
?? untracked
EOF
test_expect_success 'status -s -uall' '
- git config --unset status.showuntrackedfiles
+ test_unconfig status.showuntrackedfiles &&
git status -s -uall >output &&
test_cmp expect output
'
@@ -554,8 +569,6 @@ Untracked files:
untracked
../dir2/modified
../dir2/untracked
- ../expect
- ../output
../untracked
EOF
@@ -569,8 +582,6 @@ A ../dir2/added
?? untracked
?? ../dir2/modified
?? ../dir2/untracked
-?? ../expect
-?? ../output
?? ../untracked
EOF
test_expect_success 'status -s with relative paths' '
@@ -586,8 +597,6 @@ A dir2/added
?? dir1/untracked
?? dir2/modified
?? dir2/untracked
-?? expect
-?? output
?? untracked
EOF
@@ -625,8 +634,6 @@ Untracked files:
<BLUE>dir1/untracked<RESET>
<BLUE>dir2/modified<RESET>
<BLUE>dir2/untracked<RESET>
- <BLUE>expect<RESET>
- <BLUE>output<RESET>
<BLUE>untracked<RESET>
EOF
@@ -647,8 +654,6 @@ cat >expect <<\EOF
<BLUE>??<RESET> dir1/untracked
<BLUE>??<RESET> dir2/modified
<BLUE>??<RESET> dir2/untracked
-<BLUE>??<RESET> expect
-<BLUE>??<RESET> output
<BLUE>??<RESET> untracked
EOF
@@ -676,8 +681,6 @@ cat >expect <<\EOF
<BLUE>??<RESET> dir1/untracked
<BLUE>??<RESET> dir2/modified
<BLUE>??<RESET> dir2/untracked
-<BLUE>??<RESET> expect
-<BLUE>??<RESET> output
<BLUE>??<RESET> untracked
EOF
@@ -694,8 +697,6 @@ A dir2/added
?? dir1/untracked
?? dir2/modified
?? dir2/untracked
-?? expect
-?? output
?? untracked
EOF
@@ -755,8 +756,6 @@ Untracked files:
dir1/untracked
dir2/modified
dir2/untracked
- expect
- output
untracked
EOF
@@ -772,8 +771,6 @@ A dir2/added
?? dir1/untracked
?? dir2/modified
?? dir2/untracked
-?? expect
-?? output
?? untracked
EOF
@@ -798,8 +795,6 @@ Untracked files:
dir1/untracked
dir2/
- expect
- output
untracked
EOF
@@ -848,8 +843,6 @@ Untracked files:
dir1/untracked
dir2/modified
dir2/untracked
- expect
- output
untracked
EOF
@@ -870,8 +863,6 @@ A sm
?? dir1/untracked
?? dir2/modified
?? dir2/untracked
-?? expect
-?? output
?? untracked
EOF
test_expect_success 'status -s submodule summary is disabled by default' '
@@ -913,8 +904,6 @@ Untracked files:
dir1/untracked
dir2/modified
dir2/untracked
- expect
- output
untracked
EOF
@@ -940,8 +929,6 @@ A sm
?? dir1/untracked
?? dir2/modified
?? dir2/untracked
-?? expect
-?? output
?? untracked
EOF
test_expect_success 'status -s submodule summary' '
@@ -964,8 +951,6 @@ Untracked files:
dir1/untracked
dir2/modified
dir2/untracked
- expect
- output
untracked
no changes added to commit (use "git add" and/or "git commit -a")
@@ -983,8 +968,6 @@ cat >expect <<EOF
?? dir1/untracked
?? dir2/modified
?? dir2/untracked
-?? expect
-?? output
?? untracked
EOF
test_expect_success 'status -s submodule summary (clean submodule)' '
@@ -1025,8 +1008,6 @@ Untracked files:
dir1/untracked
dir2/modified
dir2/untracked
- expect
- output
untracked
EOF
@@ -1080,8 +1061,6 @@ Untracked files:
dir1/untracked
dir2/modified
dir2/untracked
- expect
- output
untracked
EOF
@@ -1192,8 +1171,6 @@ Untracked files:
dir1/untracked
dir2/modified
dir2/untracked
- expect
- output
untracked
EOF
@@ -1254,8 +1231,6 @@ Untracked files:
dir1/untracked
dir2/modified
dir2/untracked
- expect
- output
untracked
EOF
@@ -1336,8 +1311,6 @@ cat > expect << EOF
; dir1/untracked
; dir2/modified
; dir2/untracked
-; expect
-; output
; untracked
;
EOF
@@ -1369,8 +1342,6 @@ Untracked files:
dir1/untracked
dir2/modified
dir2/untracked
- expect
- output
untracked
no changes added to commit (use "git add" and/or "git commit -a")
@@ -1400,8 +1371,6 @@ Untracked files:
dir1/untracked
dir2/modified
dir2/untracked
- expect
- output
untracked
EOF
diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index 474dab3..13331e5 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -42,7 +42,7 @@ test_expect_success GPG 'create signed commits' '
git tag seventh-unsigned &&
test_tick && git rebase -f HEAD^^ && git tag sixth-signed HEAD^ &&
- git tag seventh-signed
+ git tag seventh-signed &&
echo 8 >file && test_tick && git commit -a -m eighth -SB7227189 &&
git tag eighth-signed-alt
@@ -86,8 +86,8 @@ test_expect_success GPG 'show signed commit with signature' '
git show -s --show-signature initial >show &&
git verify-commit -v initial >verify.1 2>verify.2 &&
git cat-file commit initial >cat &&
- grep -v "gpg: " show >show.commit &&
- grep "gpg: " show >show.gpg &&
+ grep -v -e "gpg: " -e "Warning: " show >show.commit &&
+ grep -e "gpg: " -e "Warning: " show >show.gpg &&
grep -v "^ " cat | grep -v "^gpgsig " >cat.commit &&
test_cmp show.commit commit &&
test_cmp show.gpg verify.2 &&
diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh
index 1efb880..bd0ab46 100755
--- a/t/t7513-interpret-trailers.sh
+++ b/t/t7513-interpret-trailers.sh
@@ -213,7 +213,7 @@ test_expect_success 'with 2 files arguments' '
'
test_expect_success 'with message that has comments' '
- cat basic_message >>message_with_comments &&
+ cat basic_message >message_with_comments &&
sed -e "s/ Z\$/ /" >>message_with_comments <<-\EOF &&
# comment
@@ -232,12 +232,44 @@ test_expect_success 'with message that has comments' '
Reviewed-by: Johan
Cc: Peff
+ # last comment
+
EOF
cat basic_patch >>expected &&
git interpret-trailers --trim-empty --trailer "Cc: Peff" message_with_comments >actual &&
test_cmp expected actual
'
+test_expect_success 'with message that has an old style conflict block' '
+ cat basic_message >message_with_comments &&
+ sed -e "s/ Z\$/ /" >>message_with_comments <<-\EOF &&
+ # comment
+
+ # other comment
+ Cc: Z
+ # yet another comment
+ Reviewed-by: Johan
+ Reviewed-by: Z
+ # last comment
+
+ Conflicts:
+
+ EOF
+ cat basic_message >expected &&
+ cat >>expected <<-\EOF &&
+ # comment
+
+ Reviewed-by: Johan
+ Cc: Peff
+ # last comment
+
+ Conflicts:
+
+ EOF
+ git interpret-trailers --trim-empty --trailer "Cc: Peff" message_with_comments >actual &&
+ test_cmp expected actual
+'
+
test_expect_success 'with commit complex message and trailer args' '
cat complex_message_body >expected &&
sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
diff --git a/t/t7516-commit-races.sh b/t/t7516-commit-races.sh
new file mode 100755
index 0000000..f2ce14e
--- /dev/null
+++ b/t/t7516-commit-races.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+test_description='git commit races'
+. ./test-lib.sh
+
+test_expect_success 'race to create orphan commit' '
+ write_script hare-editor <<-\EOF &&
+ git commit --allow-empty -m hare
+ EOF
+ test_must_fail env EDITOR=./hare-editor git commit --allow-empty -m tortoise -e &&
+ git show -s --pretty=format:%s >subject &&
+ grep hare subject &&
+ test -z "$(git show -s --pretty=format:%P)"
+'
+
+test_expect_success 'race to create non-orphan commit' '
+ write_script airplane-editor <<-\EOF &&
+ git commit --allow-empty -m airplane
+ EOF
+ git checkout --orphan branch &&
+ git commit --allow-empty -m base &&
+ git rev-parse HEAD >base &&
+ test_must_fail env EDITOR=./airplane-editor git commit --allow-empty -m ship -e &&
+ git show -s --pretty=format:%s >subject &&
+ grep airplane subject &&
+ git rev-parse HEAD^ >parent &&
+ test_cmp base parent
+'
+
+test_done
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index b164621..75c50ee 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -133,7 +133,7 @@ test_expect_success 'setup' '
test_tick &&
git commit -m "commit 3" &&
git tag c3 &&
- c3=$(git rev-parse HEAD)
+ c3=$(git rev-parse HEAD) &&
git reset --hard "$c0" &&
create_merge_msgs
'
diff --git a/t/t7612-merge-verify-signatures.sh b/t/t7612-merge-verify-signatures.sh
index 21a0bf8..8ae69a6 100755
--- a/t/t7612-merge-verify-signatures.sh
+++ b/t/t7612-merge-verify-signatures.sh
@@ -29,7 +29,7 @@ test_expect_success GPG 'create signed commits' '
git checkout -b side-untrusted &&
echo 3 >baz && git add baz &&
- test_tick && git commit -SB7227189 -m "untrusted on side"
+ test_tick && git commit -SB7227189 -m "untrusted on side" &&
git checkout master
'
diff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh
index aad8a9c..b66e383 100755
--- a/t/t7701-repack-unpack-unreachable.sh
+++ b/t/t7701-repack-unpack-unreachable.sh
@@ -57,7 +57,7 @@ compare_mtimes ()
{
read tref rest &&
while read t rest; do
- test "$tref" = "$t" || break
+ test "$tref" = "$t" || return 1
done
}
diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
index 2a3469b..32895e5 100755
--- a/t/t8003-blame-corner-cases.sh
+++ b/t/t8003-blame-corner-cases.sh
@@ -26,7 +26,7 @@ test_expect_success setup '
cat one >uno &&
mv two dos &&
cat one >>tres &&
- echo DEF >>mouse
+ echo DEF >>mouse &&
git add uno dos tres mouse &&
test_tick &&
GIT_AUTHOR_NAME=Second git commit -a -m Second &&
@@ -153,15 +153,15 @@ test_expect_success 'blame path that used to be a directory' '
'
test_expect_success 'blame to a commit with no author name' '
- TREE=`git rev-parse HEAD:`
- cat >badcommit <<EOF
+ TREE=`git rev-parse HEAD:` &&
+ cat >badcommit <<EOF &&
tree $TREE
author <noname> 1234567890 +0000
committer David Reiss <dreiss@facebook.com> 1234567890 +0000
some message
EOF
- COMMIT=`git hash-object -t commit -w badcommit`
+ COMMIT=`git hash-object -t commit -w badcommit` &&
git --no-pager blame $COMMIT -- uno >/dev/null
'
diff --git a/t/t8008-blame-formats.sh b/t/t8008-blame-formats.sh
index d15f8b3..29f84a6 100755
--- a/t/t8008-blame-formats.sh
+++ b/t/t8008-blame-formats.sh
@@ -5,7 +5,7 @@ test_description='blame output in various formats on a simple case'
test_expect_success 'setup' '
echo a >file &&
- git add file
+ git add file &&
test_tick &&
git commit -m one &&
echo b >>file &&
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 19a3ced..7be14a4 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -6,35 +6,37 @@ test_description='git send-email'
# May be altered later in the test
PREREQ="PERL"
-test_expect_success $PREREQ \
- 'prepare reference tree' \
- 'echo "1A quick brown fox jumps over the" >file &&
- echo "lazy dog" >>file &&
- git add file &&
- GIT_AUTHOR_NAME="A" git commit -a -m "Initial."'
-
-test_expect_success $PREREQ \
- 'Setup helper tool' \
- '(echo "#!$SHELL_PATH"
- echo shift
- echo output=1
- echo "while test -f commandline\$output; do output=\$((\$output+1)); done"
- echo for a
- echo do
- echo " echo \"!\$a!\""
- echo "done >commandline\$output"
- echo "cat > msgtxt\$output"
- ) >fake.sendmail &&
- chmod +x ./fake.sendmail &&
- git add fake.sendmail &&
- GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
-
-clean_fake_sendmail() {
+test_expect_success $PREREQ 'prepare reference tree' '
+ echo "1A quick brown fox jumps over the" >file &&
+ echo "lazy dog" >>file &&
+ git add file &&
+ GIT_AUTHOR_NAME="A" git commit -a -m "Initial."
+'
+
+test_expect_success $PREREQ 'Setup helper tool' '
+ write_script fake.sendmail <<-\EOF &&
+ shift
+ output=1
+ while test -f commandline$output
+ do
+ output=$(($output+1))
+ done
+ for a
+ do
+ echo "!$a!"
+ done >commandline$output
+ cat >"msgtxt$output"
+ EOF
+ git add fake.sendmail &&
+ GIT_AUTHOR_NAME="A" git commit -a -m "Second."
+'
+
+clean_fake_sendmail () {
rm -f commandline* msgtxt*
}
test_expect_success $PREREQ 'Extract patches' '
- patches=`git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1`
+ patches=`git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1`
'
# Test no confirm early to ensure remaining tests will not hang
@@ -47,9 +49,9 @@ test_no_confirm () {
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
$@ \
- $patches > stdout &&
+ $patches >stdout &&
test_must_fail grep "Send this email" stdout &&
- > no_confirm_okay
+ >no_confirm_okay
}
# Exit immediately to prevent hang if a no-confirm test fails
@@ -82,61 +84,61 @@ test_expect_success $PREREQ 'No confirm with sendemail.confirm=never' '
'
test_expect_success $PREREQ 'Send patches' '
- git send-email --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
+ git send-email --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
'
test_expect_success $PREREQ 'setup expect' '
-cat >expected <<\EOF
-!nobody@example.com!
-!author@example.com!
-!one@example.com!
-!two@example.com!
-EOF
+ cat >expected <<-\EOF
+ !nobody@example.com!
+ !author@example.com!
+ !one@example.com!
+ !two@example.com!
+ EOF
'
-test_expect_success $PREREQ \
- 'Verify commandline' \
- 'test_cmp expected commandline1'
+test_expect_success $PREREQ 'Verify commandline' '
+ test_cmp expected commandline1
+'
test_expect_success $PREREQ 'Send patches with --envelope-sender' '
- clean_fake_sendmail &&
- git send-email --envelope-sender="Patch Contributor <patch@example.com>" --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
+ clean_fake_sendmail &&
+ git send-email --envelope-sender="Patch Contributor <patch@example.com>" --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
'
test_expect_success $PREREQ 'setup expect' '
-cat >expected <<\EOF
-!patch@example.com!
-!-i!
-!nobody@example.com!
-!author@example.com!
-!one@example.com!
-!two@example.com!
-EOF
+ cat >expected <<-\EOF
+ !patch@example.com!
+ !-i!
+ !nobody@example.com!
+ !author@example.com!
+ !one@example.com!
+ !two@example.com!
+ EOF
'
-test_expect_success $PREREQ \
- 'Verify commandline' \
- 'test_cmp expected commandline1'
+test_expect_success $PREREQ 'Verify commandline' '
+ test_cmp expected commandline1
+'
test_expect_success $PREREQ 'Send patches with --envelope-sender=auto' '
- clean_fake_sendmail &&
- git send-email --envelope-sender=auto --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
+ clean_fake_sendmail &&
+ git send-email --envelope-sender=auto --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
'
test_expect_success $PREREQ 'setup expect' '
-cat >expected <<\EOF
-!nobody@example.com!
-!-i!
-!nobody@example.com!
-!author@example.com!
-!one@example.com!
-!two@example.com!
-EOF
+ cat >expected <<-\EOF
+ !nobody@example.com!
+ !-i!
+ !nobody@example.com!
+ !author@example.com!
+ !one@example.com!
+ !two@example.com!
+ EOF
'
-test_expect_success $PREREQ \
- 'Verify commandline' \
- 'test_cmp expected commandline1'
+test_expect_success $PREREQ 'Verify commandline' '
+ test_cmp expected commandline1
+'
test_expect_success $PREREQ 'setup expect' "
cat >expected-show-all-headers <<\EOF
@@ -240,6 +242,13 @@ test_expect_success $PREREQ 'non-ascii self name is suppressed' "
'non_ascii_self_suppressed'
"
+# This name is long enough to force format-patch to split it into multiple
+# encoded-words, assuming it uses UTF-8 with the "Q" encoding.
+test_expect_success $PREREQ 'long non-ascii self name is suppressed' "
+ test_suppress_self_quoted 'Ƒüñníęř €. Nâṁé' 'odd_?=mail@example.com' \
+ 'long_non_ascii_self_suppressed'
+"
+
test_expect_success $PREREQ 'sanitized self name is suppressed' "
test_suppress_self_unquoted '\"A U. Thor\"' 'author@example.com' \
'self_name_sanitized_suppressed'
@@ -307,11 +316,9 @@ test_expect_success $PREREQ 'tocmd works' '
clean_fake_sendmail &&
cp $patches tocmd.patch &&
echo tocmd--tocmd@example.com >>tocmd.patch &&
- {
- echo "#!$SHELL_PATH"
- echo sed -n -e s/^tocmd--//p \"\$1\"
- } > tocmd-sed &&
- chmod +x tocmd-sed &&
+ write_script tocmd-sed <<-\EOF &&
+ sed -n -e "s/^tocmd--//p" "$1"
+ EOF
git send-email \
--from="Example <nobody@example.com>" \
--to-cmd=./tocmd-sed \
@@ -325,11 +332,9 @@ test_expect_success $PREREQ 'cccmd works' '
clean_fake_sendmail &&
cp $patches cccmd.patch &&
echo "cccmd-- cccmd@example.com" >>cccmd.patch &&
- {
- echo "#!$SHELL_PATH"
- echo sed -n -e s/^cccmd--//p \"\$1\"
- } > cccmd-sed &&
- chmod +x cccmd-sed &&
+ write_script cccmd-sed <<-\EOF &&
+ sed -n -e "s/^cccmd--//p" "$1"
+ EOF
git send-email \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
@@ -367,7 +372,7 @@ test_expect_success $PREREQ 'Author From: in message body' '
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
$patches &&
- sed "1,/^\$/d" < msgtxt1 > msgbody1 &&
+ sed "1,/^\$/d" <msgtxt1 >msgbody1 &&
grep "From: A <author@example.com>" msgbody1
'
@@ -378,7 +383,7 @@ test_expect_success $PREREQ 'Author From: not in message body' '
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
$patches &&
- sed "1,/^\$/d" < msgtxt1 > msgbody1 &&
+ sed "1,/^\$/d" <msgtxt1 >msgbody1 &&
! grep "From: A <author@example.com>" msgbody1
'
@@ -387,7 +392,7 @@ test_expect_success $PREREQ 'allow long lines with --no-validate' '
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
- --novalidate \
+ --no-validate \
$patches longline.patch \
2>errors
'
@@ -421,7 +426,7 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
git send-email \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
- --nochain-reply-to \
+ --no-chain-reply-to \
--in-reply-to="$(cat expect)" \
--smtp-server="$(pwd)/fake.sendmail" \
$patches $patches $patches \
@@ -459,10 +464,9 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
'
test_expect_success $PREREQ 'setup fake editor' '
- (echo "#!$SHELL_PATH" &&
- echo "echo fake edit >>\"\$1\""
- ) >fake-editor &&
- chmod +x fake-editor
+ write_script fake-editor <<-\EOF
+ echo fake edit >>"$1"
+ EOF
'
test_set_editor "$(pwd)/fake-editor"
@@ -598,8 +602,9 @@ EOF
"
test_expect_success $PREREQ 'sendemail.cccmd' '
- echo echo cc-cmd@example.com > cccmd &&
- chmod +x cccmd &&
+ write_script cccmd <<-\EOF &&
+ echo cc-cmd@example.com
+ EOF
git config sendemail.cccmd ./cccmd &&
test_suppression cccmd
'
@@ -792,7 +797,7 @@ test_confirm () {
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
- $@ $patches > stdout &&
+ $@ $patches >stdout &&
grep "Send this email" stdout
}
@@ -813,25 +818,19 @@ test_expect_success $PREREQ '--confirm=compose' '
'
test_expect_success $PREREQ 'confirm by default (due to cc)' '
- CONFIRM=$(git config --get sendemail.confirm) &&
+ test_when_finished git config sendemail.confirm never &&
git config --unset sendemail.confirm &&
test_confirm
- ret="$?"
- git config sendemail.confirm ${CONFIRM:-never}
- test $ret = "0"
'
test_expect_success $PREREQ 'confirm by default (due to --compose)' '
- CONFIRM=$(git config --get sendemail.confirm) &&
+ test_when_finished git config sendemail.confirm never &&
git config --unset sendemail.confirm &&
test_confirm --suppress-cc=all --compose
- ret="$?"
- git config sendemail.confirm ${CONFIRM:-never}
- test $ret = "0"
'
test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' '
- CONFIRM=$(git config --get sendemail.confirm) &&
+ test_when_finished git config sendemail.confirm never &&
git config --unset sendemail.confirm &&
rm -fr outdir &&
git format-patch -2 -o outdir &&
@@ -840,14 +839,11 @@ test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' '
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
- outdir/*.patch < /dev/null
- ret="$?"
- git config sendemail.confirm ${CONFIRM:-never}
- test $ret = "0"
+ outdir/*.patch </dev/null
'
test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' '
- CONFIRM=$(git config --get sendemail.confirm) &&
+ test_when_finished git config sendemail.confirm never &&
git config sendemail.confirm auto &&
GIT_SEND_EMAIL_NOTTY=1 &&
export GIT_SEND_EMAIL_NOTTY &&
@@ -855,14 +851,11 @@ test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' '
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
- $patches < /dev/null
- ret="$?"
- git config sendemail.confirm ${CONFIRM:-never}
- test $ret = "0"
+ $patches </dev/null
'
test_expect_success $PREREQ 'confirm does not loop forever' '
- CONFIRM=$(git config --get sendemail.confirm) &&
+ test_when_finished git config sendemail.confirm never &&
git config sendemail.confirm auto &&
GIT_SEND_EMAIL_NOTTY=1 &&
export GIT_SEND_EMAIL_NOTTY &&
@@ -871,9 +864,6 @@ test_expect_success $PREREQ 'confirm does not loop forever' '
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
$patches
- ret="$?"
- git config sendemail.confirm ${CONFIRM:-never}
- test $ret = "0"
'
test_expect_success $PREREQ 'utf8 Cc is rfc2047 encoded' '
@@ -891,39 +881,39 @@ test_expect_success $PREREQ 'utf8 Cc is rfc2047 encoded' '
test_expect_success $PREREQ '--compose adds MIME for utf8 body' '
clean_fake_sendmail &&
- (echo "#!$SHELL_PATH" &&
- echo "echo utf8 body: àéìöú >>\"\$1\""
- ) >fake-editor-utf8 &&
- chmod +x fake-editor-utf8 &&
- GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
- git send-email \
- --compose --subject foo \
- --from="Example <nobody@example.com>" \
- --to=nobody@example.com \
- --smtp-server="$(pwd)/fake.sendmail" \
- $patches &&
+ write_script fake-editor-utf8 <<-\EOF &&
+ echo "utf8 body: àéìöú" >>"$1"
+ EOF
+ GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
+ git send-email \
+ --compose --subject foo \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches &&
grep "^utf8 body" msgtxt1 &&
grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1
'
test_expect_success $PREREQ '--compose respects user mime type' '
clean_fake_sendmail &&
- (echo "#!$SHELL_PATH" &&
- echo "(echo MIME-Version: 1.0"
- echo " echo Content-Type: text/plain\\; charset=iso-8859-1"
- echo " echo Content-Transfer-Encoding: 8bit"
- echo " echo Subject: foo"
- echo " echo "
- echo " echo utf8 body: àéìöú) >\"\$1\""
- ) >fake-editor-utf8-mime &&
- chmod +x fake-editor-utf8-mime &&
- GIT_EDITOR="\"$(pwd)/fake-editor-utf8-mime\"" \
- git send-email \
- --compose --subject foo \
- --from="Example <nobody@example.com>" \
- --to=nobody@example.com \
- --smtp-server="$(pwd)/fake.sendmail" \
- $patches &&
+ write_script fake-editor-utf8-mime <<-\EOF &&
+ cat >"$1" <<-\EOM
+ MIME-Version: 1.0
+ Content-Type: text/plain; charset=iso-8859-1
+ Content-Transfer-Encoding: 8bit
+ Subject: foo
+
+ utf8 body: àéìöú
+ EOM
+ EOF
+ GIT_EDITOR="\"$(pwd)/fake-editor-utf8-mime\"" \
+ git send-email \
+ --compose --subject foo \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches &&
grep "^utf8 body" msgtxt1 &&
grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1 &&
! grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1
@@ -931,13 +921,13 @@ test_expect_success $PREREQ '--compose respects user mime type' '
test_expect_success $PREREQ '--compose adds MIME for utf8 subject' '
clean_fake_sendmail &&
- GIT_EDITOR="\"$(pwd)/fake-editor\"" \
- git send-email \
- --compose --subject utf8-sübjëct \
- --from="Example <nobody@example.com>" \
- --to=nobody@example.com \
- --smtp-server="$(pwd)/fake.sendmail" \
- $patches &&
+ GIT_EDITOR="\"$(pwd)/fake-editor\"" \
+ git send-email \
+ --compose --subject utf8-sübjëct \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches &&
grep "^fake edit" msgtxt1 &&
grep "^Subject: =?UTF-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
'
@@ -949,9 +939,9 @@ test_expect_success $PREREQ 'utf8 author is correctly passed on' '
git commit --amend --author "Füñný Nâmé <odd_?=mail@example.com>" &&
git format-patch --stdout -1 >funny_name.patch &&
git send-email --from="Example <nobody@example.com>" \
- --to=nobody@example.com \
- --smtp-server="$(pwd)/fake.sendmail" \
- funny_name.patch &&
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ funny_name.patch &&
grep "^From: Füñný Nâmé <odd_?=mail@example.com>" msgtxt1
'
@@ -962,9 +952,9 @@ test_expect_success $PREREQ 'utf8 sender is not duplicated' '
git commit --amend --author "Füñný Nâmé <odd_?=mail@example.com>" &&
git format-patch --stdout -1 >funny_name.patch &&
git send-email --from="Füñný Nâmé <odd_?=mail@example.com>" \
- --to=nobody@example.com \
- --smtp-server="$(pwd)/fake.sendmail" \
- funny_name.patch &&
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ funny_name.patch &&
grep "^From: " msgtxt1 >msgfrom &&
test_line_count = 1 msgfrom
'
@@ -972,35 +962,33 @@ test_expect_success $PREREQ 'utf8 sender is not duplicated' '
test_expect_success $PREREQ 'sendemail.composeencoding works' '
clean_fake_sendmail &&
git config sendemail.composeencoding iso-8859-1 &&
- (echo "#!$SHELL_PATH" &&
- echo "echo utf8 body: àéìöú >>\"\$1\""
- ) >fake-editor-utf8 &&
- chmod +x fake-editor-utf8 &&
- GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
- git send-email \
- --compose --subject foo \
- --from="Example <nobody@example.com>" \
- --to=nobody@example.com \
- --smtp-server="$(pwd)/fake.sendmail" \
- $patches &&
+ write_script fake-editor-utf8 <<-\EOF &&
+ echo "utf8 body: àéìöú" >>"$1"
+ EOF
+ GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
+ git send-email \
+ --compose --subject foo \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches &&
grep "^utf8 body" msgtxt1 &&
grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
'
test_expect_success $PREREQ '--compose-encoding works' '
clean_fake_sendmail &&
- (echo "#!$SHELL_PATH" &&
- echo "echo utf8 body: àéìöú >>\"\$1\""
- ) >fake-editor-utf8 &&
- chmod +x fake-editor-utf8 &&
- GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
- git send-email \
- --compose-encoding iso-8859-1 \
- --compose --subject foo \
- --from="Example <nobody@example.com>" \
- --to=nobody@example.com \
- --smtp-server="$(pwd)/fake.sendmail" \
- $patches &&
+ write_script fake-editor-utf8 <<-\EOF &&
+ echo "utf8 body: àéìöú" >>"$1"
+ EOF
+ GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
+ git send-email \
+ --compose-encoding iso-8859-1 \
+ --compose --subject foo \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches &&
grep "^utf8 body" msgtxt1 &&
grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
'
@@ -1008,38 +996,37 @@ test_expect_success $PREREQ '--compose-encoding works' '
test_expect_success $PREREQ '--compose-encoding overrides sendemail.composeencoding' '
clean_fake_sendmail &&
git config sendemail.composeencoding iso-8859-1 &&
- (echo "#!$SHELL_PATH" &&
- echo "echo utf8 body: àéìöú >>\"\$1\""
- ) >fake-editor-utf8 &&
- chmod +x fake-editor-utf8 &&
- GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
- git send-email \
- --compose-encoding iso-8859-2 \
- --compose --subject foo \
- --from="Example <nobody@example.com>" \
- --to=nobody@example.com \
- --smtp-server="$(pwd)/fake.sendmail" \
- $patches &&
+ write_script fake-editor-utf8 <<-\EOF &&
+ echo "utf8 body: àéìöú" >>"$1"
+ EOF
+ GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
+ git send-email \
+ --compose-encoding iso-8859-2 \
+ --compose --subject foo \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches &&
grep "^utf8 body" msgtxt1 &&
grep "^Content-Type: text/plain; charset=iso-8859-2" msgtxt1
'
test_expect_success $PREREQ '--compose-encoding adds correct MIME for subject' '
clean_fake_sendmail &&
- GIT_EDITOR="\"$(pwd)/fake-editor\"" \
- git send-email \
- --compose-encoding iso-8859-2 \
- --compose --subject utf8-sübjëct \
- --from="Example <nobody@example.com>" \
- --to=nobody@example.com \
- --smtp-server="$(pwd)/fake.sendmail" \
- $patches &&
+ GIT_EDITOR="\"$(pwd)/fake-editor\"" \
+ git send-email \
+ --compose-encoding iso-8859-2 \
+ --compose --subject utf8-sübjëct \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches &&
grep "^fake edit" msgtxt1 &&
grep "^Subject: =?iso-8859-2?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
'
test_expect_success $PREREQ 'detects ambiguous reference/file conflict' '
- echo master > master &&
+ echo master >master &&
git add master &&
git commit -m"add master" &&
test_must_fail git send-email --dry-run master 2>errors &&
@@ -1050,10 +1037,10 @@ test_expect_success $PREREQ 'feed two files' '
rm -fr outdir &&
git format-patch -2 -o outdir &&
git send-email \
- --dry-run \
- --from="Example <nobody@example.com>" \
- --to=nobody@example.com \
- outdir/000?-*.patch 2>errors >out &&
+ --dry-run \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ outdir/000?-*.patch 2>errors >out &&
grep "^Subject: " out >subjects &&
test "z$(sed -n -e 1p subjects)" = "zSubject: [PATCH 1/2] Second." &&
test "z$(sed -n -e 2p subjects)" = "zSubject: [PATCH 2/2] add master"
@@ -1065,7 +1052,7 @@ test_expect_success $PREREQ 'in-reply-to but no threading' '
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--in-reply-to="<in-reply-id@example.com>" \
- --nothread \
+ --no-thread \
$patches |
grep "In-Reply-To: <in-reply-id@example.com>"
'
@@ -1075,7 +1062,7 @@ test_expect_success $PREREQ 'no in-reply-to and no threading' '
--dry-run \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
- --nothread \
+ --no-thread \
$patches $patches >stdout &&
! grep "In-Reply-To: " stdout
'
@@ -1086,7 +1073,7 @@ test_expect_success $PREREQ 'threading but no chain-reply-to' '
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--thread \
- --nochain-reply-to \
+ --no-chain-reply-to \
$patches $patches >stdout &&
grep "In-Reply-To: " stdout
'
@@ -1197,7 +1184,7 @@ test_expect_success $PREREQ 'To headers from files reset each patch' '
'
test_expect_success $PREREQ 'setup expect' '
-cat >email-using-8bit <<EOF
+cat >email-using-8bit <<\EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
Message-Id: <bogus-message-id@example.com>
From: author@example.com
@@ -1209,9 +1196,7 @@ EOF
'
test_expect_success $PREREQ 'setup expect' '
-cat >expected <<EOF
-Subject: subject goes here
-EOF
+ echo "Subject: subject goes here" >expected
'
test_expect_success $PREREQ 'ASCII subject is not RFC2047 quoted' '
@@ -1226,11 +1211,11 @@ test_expect_success $PREREQ 'ASCII subject is not RFC2047 quoted' '
'
test_expect_success $PREREQ 'setup expect' '
-cat >content-type-decl <<EOF
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-EOF
+ cat >content-type-decl <<-\EOF
+ MIME-Version: 1.0
+ Content-Type: text/plain; charset=UTF-8
+ Content-Transfer-Encoding: 8bit
+ EOF
'
test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
@@ -1270,21 +1255,21 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
'
test_expect_success $PREREQ 'setup expect' '
-cat >email-using-8bit <<EOF
-From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
-Message-Id: <bogus-message-id@example.com>
-From: author@example.com
-Date: Sat, 12 Jun 2010 15:53:58 +0200
-Subject: Dieser Betreff enthält auch einen Umlaut!
-
-Nothing to see here.
-EOF
+ cat >email-using-8bit <<-\EOF
+ From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+ Message-Id: <bogus-message-id@example.com>
+ From: author@example.com
+ Date: Sat, 12 Jun 2010 15:53:58 +0200
+ Subject: Dieser Betreff enthält auch einen Umlaut!
+
+ Nothing to see here.
+ EOF
'
test_expect_success $PREREQ 'setup expect' '
-cat >expected <<EOF
-Subject: =?UTF-8?q?Dieser=20Betreff=20enth=C3=A4lt=20auch=20einen=20Umlaut!?=
-EOF
+ cat >expected <<-\EOF
+ Subject: =?UTF-8?q?Dieser=20Betreff=20enth=C3=A4lt=20auch=20einen=20Umlaut!?=
+ EOF
'
test_expect_success $PREREQ '--8bit-encoding also treats subject' '
@@ -1298,6 +1283,163 @@ test_expect_success $PREREQ '--8bit-encoding also treats subject' '
test_cmp expected actual
'
+test_expect_success $PREREQ 'setup expect' '
+ cat >email-using-8bit <<-\EOF
+ From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+ Message-Id: <bogus-message-id@example.com>
+ From: A U Thor <author@example.com>
+ Date: Sat, 12 Jun 2010 15:53:58 +0200
+ Content-Type: text/plain; charset=UTF-8
+ Subject: Nothing to see here.
+
+ Dieser Betreff enthält auch einen Umlaut!
+ EOF
+'
+
+test_expect_success $PREREQ 'sendemail.transferencoding=7bit fails on 8bit data' '
+ clean_fake_sendmail &&
+ git config sendemail.transferEncoding 7bit &&
+ test_must_fail git send-email \
+ --transfer-encoding=7bit \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ email-using-8bit \
+ 2>errors >out &&
+ grep "cannot send message as 7bit" errors &&
+ test -z "$(ls msgtxt*)"
+'
+
+test_expect_success $PREREQ '--transfer-encoding overrides sendemail.transferEncoding' '
+ clean_fake_sendmail &&
+ git config sendemail.transferEncoding 8bit &&
+ test_must_fail git send-email \
+ --transfer-encoding=7bit \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ email-using-8bit \
+ 2>errors >out &&
+ grep "cannot send message as 7bit" errors &&
+ test -z "$(ls msgtxt*)"
+'
+
+test_expect_success $PREREQ 'sendemail.transferencoding=8bit' '
+ clean_fake_sendmail &&
+ git send-email \
+ --transfer-encoding=8bit \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ email-using-8bit \
+ 2>errors >out &&
+ sed '1,/^$/d' msgtxt1 >actual &&
+ sed '1,/^$/d' email-using-8bit >expected &&
+ test_cmp expected actual
+'
+
+test_expect_success $PREREQ 'setup expect' '
+ cat >expected <<-\EOF
+ Dieser Betreff enth=C3=A4lt auch einen Umlaut!
+ EOF
+'
+
+test_expect_success $PREREQ '8-bit and sendemail.transferencoding=quoted-printable' '
+ clean_fake_sendmail &&
+ git send-email \
+ --transfer-encoding=quoted-printable \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ email-using-8bit \
+ 2>errors >out &&
+ sed '1,/^$/d' msgtxt1 >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success $PREREQ 'setup expect' '
+ cat >expected <<-\EOF
+ RGllc2VyIEJldHJlZmYgZW50aMOkbHQgYXVjaCBlaW5lbiBVbWxhdXQhCg==
+ EOF
+'
+
+test_expect_success $PREREQ '8-bit and sendemail.transferencoding=base64' '
+ clean_fake_sendmail &&
+ git send-email \
+ --transfer-encoding=base64 \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ email-using-8bit \
+ 2>errors >out &&
+ sed '1,/^$/d' msgtxt1 >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success $PREREQ 'setup expect' '
+ cat >email-using-qp <<-\EOF
+ From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+ Message-Id: <bogus-message-id@example.com>
+ From: A U Thor <author@example.com>
+ Date: Sat, 12 Jun 2010 15:53:58 +0200
+ MIME-Version: 1.0
+ Content-Transfer-Encoding: quoted-printable
+ Content-Type: text/plain; charset=UTF-8
+ Subject: Nothing to see here.
+
+ Dieser Betreff enth=C3=A4lt auch einen Umlaut!
+ EOF
+'
+
+test_expect_success $PREREQ 'convert from quoted-printable to base64' '
+ clean_fake_sendmail &&
+ git send-email \
+ --transfer-encoding=base64 \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ email-using-qp \
+ 2>errors >out &&
+ sed '1,/^$/d' msgtxt1 >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success $PREREQ 'setup expect' "
+tr -d '\\015' | tr '%' '\\015' >email-using-crlf <<EOF
+From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+Message-Id: <bogus-message-id@example.com>
+From: A U Thor <author@example.com>
+Date: Sat, 12 Jun 2010 15:53:58 +0200
+Content-Type: text/plain; charset=UTF-8
+Subject: Nothing to see here.
+
+Look, I have a CRLF and an = sign!%
+EOF
+"
+
+test_expect_success $PREREQ 'setup expect' '
+ cat >expected <<-\EOF
+ Look, I have a CRLF and an =3D sign!=0D
+ EOF
+'
+
+test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=quoted-printable' '
+ clean_fake_sendmail &&
+ git send-email \
+ --transfer-encoding=quoted-printable \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ email-using-crlf \
+ 2>errors >out &&
+ sed '1,/^$/d' msgtxt1 >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success $PREREQ 'setup expect' '
+ cat >expected <<-\EOF
+ TG9vaywgSSBoYXZlIGEgQ1JMRiBhbmQgYW4gPSBzaWduIQ0K
+ EOF
+'
+
+test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=base64' '
+ clean_fake_sendmail &&
+ git send-email \
+ --transfer-encoding=base64 \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ email-using-crlf \
+ 2>errors >out &&
+ sed '1,/^$/d' msgtxt1 >actual &&
+ test_cmp expected actual
+'
+
+
# Note that the patches in this test are deliberately out of order; we
# want to make sure it works even if the cover-letter is not in the
# first mail.
@@ -1306,13 +1448,13 @@ test_expect_success $PREREQ 'refusing to send cover letter template' '
rm -fr outdir &&
git format-patch --cover-letter -2 -o outdir &&
test_must_fail git send-email \
- --from="Example <nobody@example.com>" \
- --to=nobody@example.com \
- --smtp-server="$(pwd)/fake.sendmail" \
- outdir/0002-*.patch \
- outdir/0000-*.patch \
- outdir/0001-*.patch \
- 2>errors >out &&
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ outdir/0002-*.patch \
+ outdir/0000-*.patch \
+ outdir/0001-*.patch \
+ 2>errors >out &&
grep "SUBJECT HERE" errors &&
test -z "$(ls msgtxt*)"
'
@@ -1322,14 +1464,14 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '
rm -fr outdir &&
git format-patch --cover-letter -2 -o outdir &&
git send-email \
- --force \
- --from="Example <nobody@example.com>" \
- --to=nobody@example.com \
- --smtp-server="$(pwd)/fake.sendmail" \
- outdir/0002-*.patch \
- outdir/0000-*.patch \
- outdir/0001-*.patch \
- 2>errors >out &&
+ --force \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ outdir/0002-*.patch \
+ outdir/0000-*.patch \
+ outdir/0001-*.patch \
+ 2>errors >out &&
! grep "SUBJECT HERE" errors &&
test -n "$(ls msgtxt*)"
'
@@ -1344,15 +1486,15 @@ test_cover_addresses () {
mv $cover cover-to-edit.patch &&
perl -pe "s/^From:/$header: extra\@address.com\nFrom:/" cover-to-edit.patch >"$cover" &&
git send-email \
- --force \
- --from="Example <nobody@example.com>" \
- --no-to --no-cc \
- "$@" \
- --smtp-server="$(pwd)/fake.sendmail" \
- outdir/0000-*.patch \
- outdir/0001-*.patch \
- outdir/0002-*.patch \
- 2>errors >out &&
+ --force \
+ --from="Example <nobody@example.com>" \
+ --no-to --no-cc \
+ "$@" \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ outdir/0000-*.patch \
+ outdir/0001-*.patch \
+ outdir/0002-*.patch \
+ 2>errors >out &&
grep "^$header: extra@address.com" msgtxt1 >to1 &&
grep "^$header: extra@address.com" msgtxt2 >to2 &&
grep "^$header: extra@address.com" msgtxt3 >to3 &&
@@ -1385,11 +1527,11 @@ test_expect_success $PREREQ 'sendemail.aliasfiletype=mailrc' '
git config --replace-all sendemail.aliasesfile "$(pwd)/.mailrc" &&
git config sendemail.aliasfiletype mailrc &&
git send-email \
- --from="Example <nobody@example.com>" \
- --to=sbd \
- --smtp-server="$(pwd)/fake.sendmail" \
- outdir/0001-*.patch \
- 2>errors >out &&
+ --from="Example <nobody@example.com>" \
+ --to=sbd \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ outdir/0001-*.patch \
+ 2>errors >out &&
grep "^!somebody@example\.org!$" commandline1
'
@@ -1399,12 +1541,45 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
git config --replace-all sendemail.aliasesfile "~/.mailrc" &&
git config sendemail.aliasfiletype mailrc &&
git send-email \
- --from="Example <nobody@example.com>" \
- --to=sbd \
- --smtp-server="$(pwd)/fake.sendmail" \
- outdir/0001-*.patch \
- 2>errors >out &&
+ --from="Example <nobody@example.com>" \
+ --to=sbd \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ outdir/0001-*.patch \
+ 2>errors >out &&
grep "^!someone@example\.org!$" commandline1
'
+do_xmailer_test () {
+ expected=$1 params=$2 &&
+ git format-patch -1 &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=someone@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $params \
+ 0001-*.patch \
+ 2>errors >out &&
+ { grep '^X-Mailer:' out || :; } >mailer &&
+ test_line_count = $expected mailer
+}
+
+test_expect_success $PREREQ '--[no-]xmailer without any configuration' '
+ do_xmailer_test 1 "--xmailer" &&
+ do_xmailer_test 0 "--no-xmailer"
+'
+
+test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=true' '
+ test_config sendemail.xmailer true &&
+ do_xmailer_test 1 "" &&
+ do_xmailer_test 0 "--no-xmailer" &&
+ do_xmailer_test 1 "--xmailer"
+'
+
+test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '
+ test_config sendemail.xmailer false &&
+ do_xmailer_test 0 "" &&
+ do_xmailer_test 0 "--no-xmailer" &&
+ do_xmailer_test 1 "--xmailer"
+'
+
test_done
diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index 13b179e..83f17e1 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -72,16 +72,18 @@ test_expect_success 'follow larger parent' '
svn import -m "import a larger parent" import "$svnrepo"/larger-parent &&
svn cp -m "hi" "$svnrepo"/larger-parent "$svnrepo"/another-larger &&
git svn init --minimize-url -i larger \
- "$svnrepo"/another-larger/trunk/thunk/bump/thud &&
+ "$svnrepo"/larger-parent/trunk/thunk/bump/thud &&
git svn fetch -i larger &&
+ git svn init --minimize-url -i larger-parent \
+ "$svnrepo"/another-larger/trunk/thunk/bump/thud &&
+ git svn fetch -i larger-parent &&
git rev-parse --verify refs/remotes/larger &&
git rev-parse --verify \
- refs/remotes/larger-parent/trunk/thunk/bump/thud &&
+ refs/remotes/larger-parent &&
test "`git merge-base \
- refs/remotes/larger-parent/trunk/thunk/bump/thud \
+ refs/remotes/larger-parent \
refs/remotes/larger`" = \
"`git rev-parse refs/remotes/larger`"
- true
'
test_expect_success 'follow higher-level parent' '
diff --git a/t/t9148-git-svn-propset.sh b/t/t9148-git-svn-propset.sh
new file mode 100755
index 0000000..1026390
--- /dev/null
+++ b/t/t9148-git-svn-propset.sh
@@ -0,0 +1,95 @@
+#!/bin/sh
+#
+# Copyright (c) 2014 Alfred Perlstein
+#
+
+test_description='git svn propset tests'
+
+. ./lib-git-svn.sh
+
+foo_subdir2="subdir/subdir2/foo_subdir2"
+
+set -e
+mkdir import &&
+(set -e ; cd import
+ mkdir subdir
+ mkdir subdir/subdir2
+ touch foo # for 'add props top level'
+ touch subdir/foo_subdir # for 'add props relative'
+ touch "$foo_subdir2" # for 'add props subdir'
+ svn_cmd import -m 'import for git svn' . "$svnrepo" >/dev/null
+)
+rm -rf import
+
+test_expect_success 'initialize git svn' '
+ git svn init "$svnrepo"
+ '
+
+test_expect_success 'fetch revisions from svn' '
+ git svn fetch
+ '
+
+set_props () {
+ subdir="$1"
+ file="$2"
+ shift;shift;
+ (cd "$subdir" &&
+ while [ $# -gt 0 ] ; do
+ git svn propset "$1" "$2" "$file" || exit 1
+ shift;shift;
+ done &&
+ echo hello >> "$file" &&
+ git commit -m "testing propset" "$file")
+}
+
+confirm_props () {
+ subdir="$1"
+ file="$2"
+ shift;shift;
+ (set -e ; cd "svn_project/$subdir" &&
+ while [ $# -gt 0 ] ; do
+ test "$(svn_cmd propget "$1" "$file")" = "$2" || exit 1
+ shift;shift;
+ done)
+}
+
+
+#The current implementation has a restriction:
+#svn propset will be taken as a delta for svn dcommit only
+#if the file content is also modified
+test_expect_success 'add props top level' '
+ set_props "." "foo" "svn:keywords" "FreeBSD=%H" &&
+ git svn dcommit &&
+ svn_cmd co "$svnrepo" svn_project &&
+ confirm_props "." "foo" "svn:keywords" "FreeBSD=%H" &&
+ rm -rf svn_project
+ '
+
+test_expect_success 'add multiple props' '
+ set_props "." "foo" \
+ "svn:keywords" "FreeBSD=%H" fbsd:nokeywords yes &&
+ git svn dcommit &&
+ svn_cmd co "$svnrepo" svn_project &&
+ confirm_props "." "foo" \
+ "svn:keywords" "FreeBSD=%H" fbsd:nokeywords yes &&
+ rm -rf svn_project
+ '
+
+test_expect_success 'add props subdir' '
+ set_props "." "$foo_subdir2" svn:keywords "FreeBSD=%H" &&
+ git svn dcommit &&
+ svn_cmd co "$svnrepo" svn_project &&
+ confirm_props "." "$foo_subdir2" "svn:keywords" "FreeBSD=%H" &&
+ rm -rf svn_project
+ '
+
+test_expect_success 'add props relative' '
+ set_props "subdir/subdir2" "../foo_subdir" \
+ svn:keywords "FreeBSD=%H" &&
+ git svn dcommit &&
+ svn_cmd co "$svnrepo" svn_project &&
+ confirm_props "subdir/subdir2" "../foo_subdir" \
+ svn:keywords "FreeBSD=%H" &&
+ rm -rf svn_project
+ '
+test_done
diff --git a/t/t9158-git-svn-mergeinfo.sh b/t/t9158-git-svn-mergeinfo.sh
index 8c9539e..13f78f2 100755
--- a/t/t9158-git-svn-mergeinfo.sh
+++ b/t/t9158-git-svn-mergeinfo.sh
@@ -34,7 +34,7 @@ test_expect_success 'change svn:mergeinfo' '
'
test_expect_success 'verify svn:mergeinfo' '
- mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/trunk)
+ mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/trunk) &&
test "$mergeinfo" = "/branches/foo:1-10"
'
@@ -46,7 +46,7 @@ test_expect_success 'change svn:mergeinfo multiline' '
'
test_expect_success 'verify svn:mergeinfo multiline' '
- mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/trunk)
+ mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/trunk) &&
test "$mergeinfo" = "/branches/bar:1-10
/branches/other:3-5,8,10-11"
'
diff --git a/t/t9161-git-svn-mergeinfo-push.sh b/t/t9161-git-svn-mergeinfo-push.sh
index 6cb0909..f113aca 100755
--- a/t/t9161-git-svn-mergeinfo-push.sh
+++ b/t/t9161-git-svn-mergeinfo-push.sh
@@ -24,7 +24,7 @@ test_expect_success 'propagate merge information' '
'
test_expect_success 'check svn:mergeinfo' '
- mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
+ mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
test "$mergeinfo" = "/branches/svnb2:3,8"
'
@@ -34,7 +34,7 @@ test_expect_success 'merge another branch' '
'
test_expect_success 'check primary parent mergeinfo respected' '
- mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
+ mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
test "$mergeinfo" = "/branches/svnb2:3,8
/branches/svnb3:4,9"
'
@@ -45,7 +45,7 @@ test_expect_success 'merge existing merge' '
'
test_expect_success "check both parents' mergeinfo respected" '
- mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
+ mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
test "$mergeinfo" = "/branches/svnb2:3,8
/branches/svnb3:4,9
/branches/svnb4:5-6,10-12
@@ -70,7 +70,7 @@ test_expect_success 'second forward merge' '
'
test_expect_success 'check new mergeinfo added' '
- mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
+ mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
test "$mergeinfo" = "/branches/svnb2:3,8,16-17
/branches/svnb3:4,9
/branches/svnb4:5-6,10-12
@@ -84,7 +84,7 @@ test_expect_success 'reintegration merge' '
'
test_expect_success 'check reintegration mergeinfo' '
- mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb4)
+ mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb4) &&
test "$mergeinfo" = "/branches/svnb1:2-4,7-9,13-18
/branches/svnb2:3,8,16-17
/branches/svnb3:4,9
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 37c2d63..aac126f 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -552,8 +552,8 @@ test_expect_success 'D: verify pack' '
'
cat >expect <<EOF
-:000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A newdir/exec.sh
-:000000 100644 0000000000000000000000000000000000000000 046d0371e9220107917db0d0e030628de8a1de9b A newdir/interesting
+:000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A newdir/exec.sh
+:000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A newdir/interesting
EOF
git diff-tree -M -r branch^ branch >actual
test_expect_success \
@@ -1132,7 +1132,7 @@ test_expect_success \
compare_diff_raw expect actual'
test_expect_success PIPE 'N: read and copy directory' '
- cat >expect <<-\EOF
+ cat >expect <<-\EOF &&
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
EOF
@@ -2228,7 +2228,7 @@ test_expect_success 'R: feature import-marks-if-exists' '
>expect &&
git fast-import --import-marks-if-exists=not_io.marks \
- --export-marks=io.marks <<-\EOF
+ --export-marks=io.marks <<-\EOF &&
feature import-marks-if-exists=io.marks
EOF
test_cmp expect io.marks
@@ -2853,8 +2853,8 @@ test_expect_success 'S: notemodify with garbage after mark commit-ish must fail'
# from
#
test_expect_success 'S: from with garbage after mark must fail' '
- # no &&
- git fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err
+ test_must_fail \
+ git fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&
commit refs/heads/S2
mark :303
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -2865,9 +2865,6 @@ test_expect_success 'S: from with garbage after mark must fail' '
M 100644 :403 hello.c
EOF
- ret=$? &&
- echo returned $ret &&
- test $ret -ne 0 && # failed, but it created the commit
# go create the commit, need it for merge test
git fast-import --import-marks=marks --export-marks=marks <<-EOF &&
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index e74b9ab..e94b2f1 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -297,7 +297,7 @@ test_expect_success 'setup incomplete lines' '
echo "Dominus regit me," >file &&
echo "incomplete line" | tr -d "\\012" >>file &&
git commit -a -m "Change incomplete line" &&
- git tag incomplete_lines_chg
+ git tag incomplete_lines_chg &&
echo "Dominus regit me," >file &&
git commit -a -m "Remove incomplete line" &&
git tag incomplete_lines_rem
@@ -779,7 +779,10 @@ test_expect_success \
test_expect_success \
'unborn HEAD: "summary" page (with "heads" subview)' \
- 'git checkout orphan_branch || git checkout --orphan orphan_branch &&
+ '{
+ git checkout orphan_branch ||
+ git checkout --orphan orphan_branch
+ } &&
test_when_finished "git checkout master" &&
gitweb_run "p=.git;a=summary"'
diff --git a/t/t9502-gitweb-standalone-parse-output.sh b/t/t9502-gitweb-standalone-parse-output.sh
index 86dfee2..0796a43 100755
--- a/t/t9502-gitweb-standalone-parse-output.sh
+++ b/t/t9502-gitweb-standalone-parse-output.sh
@@ -145,9 +145,11 @@ test_expect_success 'forks: not skipped unless "forks" feature enabled' '
grep -q ">fork of .*<" gitweb.body
'
-cat >>gitweb_config.perl <<\EOF &&
-$feature{'forks'}{'default'} = [1];
-EOF
+test_expect_success 'enable forks feature' '
+ cat >>gitweb_config.perl <<-\EOF
+ $feature{"forks"}{"default"} = [1];
+ EOF
+'
test_expect_success 'forks: forks skipped if "forks" feature enabled' '
gitweb_run "a=project_list" &&
@@ -173,7 +175,7 @@ test_expect_success 'forks: can access forked repository' '
'
test_expect_success 'forks: project_index lists all projects (incl. forks)' '
- cat >expected <<-\EOF
+ cat >expected <<-\EOF &&
.git
foo.bar.git
foo.git
diff --git a/t/t9603-cvsimport-patchsets.sh b/t/t9603-cvsimport-patchsets.sh
index 52034c8..c4c3c49 100755
--- a/t/t9603-cvsimport-patchsets.sh
+++ b/t/t9603-cvsimport-patchsets.sh
@@ -16,7 +16,7 @@ test_description='git cvsimport testing for correct patchset estimation'
setup_cvs_test_repository t9603
-test_expect_failure 'import with criss cross times on revisions' '
+test_expect_failure PERL 'import with criss cross times on revisions' '
git cvsimport -p"-x" -C module-git module &&
(cd module-git &&
diff --git a/t/t9604-cvsimport-timestamps.sh b/t/t9604-cvsimport-timestamps.sh
index 1fd5142..a4b3db2 100755
--- a/t/t9604-cvsimport-timestamps.sh
+++ b/t/t9604-cvsimport-timestamps.sh
@@ -5,7 +5,7 @@ test_description='git cvsimport timestamps'
setup_cvs_test_repository t9604
-test_expect_success 'check timestamps are UTC (TZ=CST6CDT)' '
+test_expect_success PERL 'check timestamps are UTC (TZ=CST6CDT)' '
TZ=CST6CDT git cvsimport -p"-x" -C module-1 module &&
git cvsimport -p"-x" -C module-1 module &&
@@ -34,7 +34,7 @@ test_expect_success 'check timestamps are UTC (TZ=CST6CDT)' '
test_cmp actual-1 expect-1
'
-test_expect_success 'check timestamps with author-specific timezones' '
+test_expect_success PERL 'check timestamps with author-specific timezones' '
cat >cvs-authors <<-EOF &&
user1=User One <user1@domain.org>
diff --git a/t/t9817-git-p4-exclude.sh b/t/t9817-git-p4-exclude.sh
new file mode 100755
index 0000000..aac568e
--- /dev/null
+++ b/t/t9817-git-p4-exclude.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+test_description='git p4 tests for excluded paths during clone and sync'
+
+. ./lib-git-p4.sh
+
+test_expect_success 'start p4d' '
+ start_p4d
+'
+
+# Create a repo with the structure:
+#
+# //depot/wanted/foo
+# //depot/discard/foo
+#
+# Check that we can exclude a subdirectory with both
+# clone and sync operations.
+
+test_expect_success 'create exclude repo' '
+ (
+ cd "$cli" &&
+ mkdir -p wanted discard &&
+ echo wanted >wanted/foo &&
+ echo discard >discard/foo &&
+ p4 add wanted/foo discard/foo &&
+ p4 submit -d "initial revision"
+ )
+'
+
+test_expect_success 'check the repo was created correctly' '
+ test_when_finished cleanup_git &&
+ git p4 clone --dest="$git" //depot/...@all &&
+ (
+ cd "$git" &&
+ test_path_is_file wanted/foo &&
+ test_path_is_file discard/foo
+ )
+'
+
+test_expect_success 'clone, excluding part of repo' '
+ test_when_finished cleanup_git &&
+ git p4 clone -//depot/discard/... --dest="$git" //depot/...@all &&
+ (
+ cd "$git" &&
+ test_path_is_file wanted/foo &&
+ test_path_is_missing discard/foo
+ )
+'
+
+test_expect_success 'clone, then sync with exclude' '
+ test_when_finished cleanup_git &&
+ git p4 clone -//depot/discard/... --dest="$git" //depot/...@all &&
+ (
+ cd "$cli" &&
+ p4 edit wanted/foo discard/foo &&
+ date >>wanted/foo &&
+ date >>discard/foo &&
+ p4 submit -d "updating" &&
+
+ cd "$git" &&
+ git p4 sync -//depot/discard/... &&
+ test_path_is_file wanted/foo &&
+ test_path_is_missing discard/foo
+ )
+'
+
+test_expect_success 'kill p4d' '
+ kill_p4d
+'
+
+test_done
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index f10a752..4a14a58 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -351,6 +351,25 @@ test_expect_success '__gitcomp_nl - doesnt fail because of invalid variable name
__gitcomp_nl "$invalid_variable_name"
'
+test_expect_success '__git_remotes - list remotes from $GIT_DIR/remotes and from config file' '
+ cat >expect <<-EOF &&
+ remote_from_file_1
+ remote_from_file_2
+ remote_in_config_1
+ remote_in_config_2
+ EOF
+ test_when_finished "rm -rf .git/remotes" &&
+ mkdir -p .git/remotes &&
+ >.git/remotes/remote_from_file_1 &&
+ >.git/remotes/remote_from_file_2 &&
+ test_when_finished "git remote remove remote_in_config_1" &&
+ git remote add remote_in_config_1 git://remote_1 &&
+ test_when_finished "git remote remove remote_in_config_2" &&
+ git remote add remote_in_config_2 git://remote_2 &&
+ __git_remotes >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'basic' '
run_completion "git " &&
# built-in
@@ -549,7 +568,7 @@ test_expect_success 'complete files' '
test_completion "git commit " "modified" &&
: TODO .gitignore should not be here &&
- test_completion "git ls-files " <<-\EOF
+ test_completion "git ls-files " <<-\EOF &&
.gitignore
dir
modified
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 9150984..49d58e6 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -35,6 +35,8 @@ test_expect_success 'setup for prompt tests' '
git commit -m "another b2" file &&
echo 000 >file &&
git commit -m "yet another b2" file &&
+ mkdir ignored_dir &&
+ echo "ignored_dir/" >>.gitignore &&
git checkout master
'
@@ -164,7 +166,7 @@ test_expect_success 'prompt - inside bare repository' '
'
test_expect_success 'prompt - interactive rebase' '
- printf " (b1|REBASE-i 2/3)" >expected
+ printf " (b1|REBASE-i 2/3)" >expected &&
write_script fake_editor.sh <<-\EOF &&
echo "exec echo" >"$1"
echo "edit $(git log -1 --format="%h")" >>"$1"
@@ -395,6 +397,17 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
test_cmp expected "$actual"
'
+test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '
+ printf " (master %%)" >expected &&
+ (
+ mkdir -p ignored_dir &&
+ cd ignored_dir &&
+ GIT_PS1_SHOWUNTRACKEDFILES=y &&
+ __git_ps1 >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '
printf " (master)" >expected &&
test_config bash.showUntrackedFiles false &&
@@ -588,4 +601,108 @@ test_expect_success 'prompt - zsh color pc mode' '
test_cmp expected "$actual"
'
+test_expect_success 'prompt - hide if pwd ignored - env var unset, config disabled' '
+ printf " (master)" >expected &&
+ test_config bash.hideIfPwdIgnored false &&
+ (
+ cd ignored_dir &&
+ __git_ps1 >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - hide if pwd ignored - env var unset, config disabled, pc mode' '
+ printf "BEFORE: (\${__git_ps1_branch_name}):AFTER" >expected &&
+ test_config bash.hideIfPwdIgnored false &&
+ (
+ cd ignored_dir &&
+ __git_ps1 "BEFORE:" ":AFTER" &&
+ printf "%s" "$PS1" >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - hide if pwd ignored - env var unset, config unset' '
+ printf " (master)" >expected &&
+ (
+ cd ignored_dir &&
+ __git_ps1 >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - hide if pwd ignored - env var unset, config unset, pc mode' '
+ printf "BEFORE: (\${__git_ps1_branch_name}):AFTER" >expected &&
+ (
+ cd ignored_dir &&
+ __git_ps1 "BEFORE:" ":AFTER" &&
+ printf "%s" "$PS1" >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - hide if pwd ignored - env var set, config disabled' '
+ printf " (master)" >expected &&
+ test_config bash.hideIfPwdIgnored false &&
+ (
+ cd ignored_dir &&
+ GIT_PS1_HIDE_IF_PWD_IGNORED=y &&
+ __git_ps1 >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - hide if pwd ignored - env var set, config disabled, pc mode' '
+ printf "BEFORE: (\${__git_ps1_branch_name}):AFTER" >expected &&
+ test_config bash.hideIfPwdIgnored false &&
+ (
+ cd ignored_dir &&
+ GIT_PS1_HIDE_IF_PWD_IGNORED=y &&
+ __git_ps1 "BEFORE:" ":AFTER" &&
+ printf "%s" "$PS1" >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - hide if pwd ignored - env var set, config unset' '
+ printf "" >expected &&
+ (
+ cd ignored_dir &&
+ GIT_PS1_HIDE_IF_PWD_IGNORED=y &&
+ __git_ps1 >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - hide if pwd ignored - env var set, config unset, pc mode' '
+ printf "BEFORE::AFTER" >expected &&
+ (
+ cd ignored_dir &&
+ GIT_PS1_HIDE_IF_PWD_IGNORED=y &&
+ __git_ps1 "BEFORE:" ":AFTER" &&
+ printf "%s" "$PS1" >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - hide if pwd ignored - inside gitdir (stdout)' '
+ printf " (GIT_DIR!)" >expected &&
+ (
+ GIT_PS1_HIDE_IF_PWD_IGNORED=y &&
+ cd .git &&
+ __git_ps1 >"$actual" 2>/dev/null
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - hide if pwd ignored - inside gitdir (stderr)' '
+ printf "" >expected &&
+ (
+ GIT_PS1_HIDE_IF_PWD_IGNORED=y &&
+ cd .git &&
+ __git_ps1 >/dev/null 2>"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
test_done
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 0d93e33..0698ce7 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -745,7 +745,9 @@ test_ln_s_add () {
else
printf '%s' "$1" >"$2" &&
ln_s_obj=$(git hash-object -w "$2") &&
- git update-index --add --cacheinfo 120000 $ln_s_obj "$2"
+ git update-index --add --cacheinfo 120000 $ln_s_obj "$2" &&
+ # pick up stat info from the file
+ git update-index "$2"
fi
}
diff --git a/t/test-lib.sh b/t/test-lib.sh
index cf19339..4ea99a2 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -140,6 +140,9 @@ else
}
fi
+: ${ASAN_OPTIONS=detect_leaks=0}
+export ASAN_OPTIONS
+
# Protect ourselves from common misconfiguration to export
# CDPATH into the environment
unset CDPATH
@@ -149,10 +152,7 @@ unset UNZIP
case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in
1|2|true)
- echo "* warning: Some tests will not work if GIT_TRACE" \
- "is set as to trace on STDERR ! *"
- echo "* warning: Please set GIT_TRACE to something" \
- "other than 1, 2 or true ! *"
+ GIT_TRACE=4
;;
esac
@@ -169,7 +169,11 @@ _z40=0000000000000000000000000000000000000000
LF='
'
-export _x05 _x40 _z40 LF
+# UTF-8 ZERO WIDTH NON-JOINER, which HFS+ ignores
+# when case-folding filenames
+u200c=$(printf '\342\200\214')
+
+export _x05 _x40 _z40 LF u200c
# Each test should start with something like this, after copyright notices:
#
@@ -177,16 +181,8 @@ export _x05 _x40 _z40 LF
# This test checks if command xyzzy does the right thing...
# '
# . ./test-lib.sh
-[ "x$ORIGINAL_TERM" != "xdumb" ] && (
- TERM=$ORIGINAL_TERM &&
- export TERM &&
- [ -t 1 ] &&
- tput bold >/dev/null 2>&1 &&
- tput setaf 1 >/dev/null 2>&1 &&
- tput sgr0 >/dev/null 2>&1
- ) &&
- color=t
+unset color
while test "$#" -ne 0
do
case "$1" in
@@ -233,6 +229,12 @@ do
--root=*)
root=$(expr "z$1" : 'z[^=]*=\(.*\)')
shift ;;
+ --chain-lint)
+ GIT_TEST_CHAIN_LINT=1
+ shift ;;
+ --no-chain-lint)
+ GIT_TEST_CHAIN_LINT=0
+ shift ;;
-x)
trace=t
verbose=t
@@ -251,40 +253,6 @@ then
verbose=t
fi
-if test -n "$color"
-then
- say_color () {
- (
- TERM=$ORIGINAL_TERM
- export TERM
- case "$1" in
- error)
- tput bold; tput setaf 1;; # bold red
- skip)
- tput setaf 4;; # blue
- warn)
- tput setaf 3;; # brown/yellow
- pass)
- tput setaf 2;; # green
- info)
- tput setaf 6;; # cyan
- *)
- test -n "$quiet" && return;;
- esac
- shift
- printf "%s" "$*"
- tput sgr0
- echo
- )
- }
-else
- say_color() {
- test -z "$1" && test -n "$quiet" && return
- shift
- printf "%s\n" "$*"
- }
-fi
-
error () {
say_color error "error: $*"
GIT_EXIT_OK=t
@@ -334,6 +302,7 @@ die () {
GIT_EXIT_OK=
trap 'die' EXIT
+trap 'exit $?' INT
# The user-facing functions are loaded from a separate file so that
# test_perf subshells can have them too
@@ -559,6 +528,16 @@ test_eval_ () {
test_run_ () {
test_cleanup=:
expecting_failure=$2
+
+ if test "${GIT_TEST_CHAIN_LINT:-0}" != 0; then
+ # 117 is magic because it is unlikely to match the exit
+ # code of other programs
+ test_eval_ "(exit 117) && $1"
+ if test "$?" != 117; then
+ error "bug in the test script: broken &&-chain: $1"
+ fi
+ fi
+
setup_malloc_check
test_eval_ "$1"
eval_ret=$?
@@ -677,7 +656,7 @@ test_done () {
then
error "Can't use skip_all after running some tests"
fi
- [ -z "$skip_all" ] || skip_all=" # SKIP $skip_all"
+ test -z "$skip_all" || skip_all=" # SKIP $skip_all"
if test $test_external_has_tap -eq 0
then
@@ -850,6 +829,52 @@ HOME="$TRASH_DIRECTORY"
GNUPGHOME="$HOME/gnupg-home-not-used"
export HOME GNUPGHOME
+# run the tput tests *after* changing HOME (in case ncurses needs
+# ~/.terminfo for $TERM)
+test -n "${color+set}" || test "x$ORIGINAL_TERM" != "xdumb" && (
+ TERM=$ORIGINAL_TERM &&
+ export TERM &&
+ test -t 1 &&
+ tput bold >/dev/null 2>&1 &&
+ tput setaf 1 >/dev/null 2>&1 &&
+ tput sgr0 >/dev/null 2>&1
+ ) &&
+ color=t
+
+if test -n "$color"
+then
+ say_color () {
+ (
+ TERM=$ORIGINAL_TERM
+ export TERM
+ case "$1" in
+ error)
+ tput bold; tput setaf 1;; # bold red
+ skip)
+ tput setaf 4;; # blue
+ warn)
+ tput setaf 3;; # brown/yellow
+ pass)
+ tput setaf 2;; # green
+ info)
+ tput setaf 6;; # cyan
+ *)
+ test -n "$quiet" && return;;
+ esac
+ shift
+ printf "%s" "$*"
+ tput sgr0
+ echo
+ )
+ }
+else
+ say_color() {
+ test -z "$1" && test -n "$quiet" && return
+ shift
+ printf "%s\n" "$*"
+ }
+fi
+
if test -z "$TEST_NO_CREATE_REPO"
then
test_create_repo "$TRASH_DIRECTORY"
@@ -1020,12 +1045,42 @@ test_lazy_prereq USR_BIN_TIME '
test -x /usr/bin/time
'
-# When the tests are run as root, permission tests will report that
-# things are writable when they shouldn't be.
-test -w / || test_set_prereq SANITY
+test_lazy_prereq NOT_ROOT '
+ uid=$(id -u) &&
+ test "$uid" != 0
+'
+
+# On a filesystem that lacks SANITY, a file can be deleted even if
+# the containing directory doesn't have write permissions, or a file
+# can be accessed even if the containing directory doesn't have read
+# or execute permissions, causing our tests that validate that Git
+# works sensibly in such situations.
+test_lazy_prereq SANITY '
+ mkdir SANETESTD.1 SANETESTD.2 &&
+
+ chmod +w SANETESTD.1 SANETESTD.2 &&
+ >SANETESTD.1/x 2>SANETESTD.2/x &&
+ chmod -w SANETESTD.1 &&
+ chmod -rx SANETESTD.2 ||
+ error "bug in test sript: cannot prepare SANETESTD"
+
+ ! rm SANETESTD.1/x && ! test -f SANETESTD.2/x
+ status=$?
+
+ chmod +rwx SANETESTD.1 SANETESTD.2 &&
+ rm -rf SANETESTD.1 SANETESTD.2 ||
+ error "bug in test sript: cannot clean SANETESTD"
+ return $status
+'
GIT_UNZIP=${GIT_UNZIP:-unzip}
test_lazy_prereq UNZIP '
"$GIT_UNZIP" -v
test $? -ne 127
'
+
+run_with_limited_cmdline () {
+ (ulimit -s 128 && "$@")
+}
+
+test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'