]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ah/commit-graph-leakplug'
authorJunio C Hamano <gitster@pobox.com>
Fri, 26 Feb 2021 00:43:31 +0000 (16:43 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Feb 2021 00:43:31 +0000 (16:43 -0800)
Plug a minor memory leak.

* ah/commit-graph-leakplug:
  commit-graph: avoid leaking topo_levels slab in write_commit_graph()

194 files changed:
Documentation/RelNotes/2.31.0.txt
Documentation/diff-options.txt
Documentation/git-branch.txt
Documentation/git-difftool.txt
Documentation/git-gc.txt
Documentation/git-pack-objects.txt
Documentation/git-repack.txt
Documentation/git-rev-list.txt
Documentation/git-stash.txt
Documentation/git-status.txt
Documentation/git-tag.txt
Documentation/git.txt
Documentation/gitdiffcore.txt
Documentation/gitmailmap.txt
Documentation/rev-list-options.txt
Documentation/technical/hash-function-transition.txt
Documentation/technical/protocol-v2.txt
Makefile
builtin/blame.c
builtin/checkout-index.c
builtin/diff-files.c
builtin/diff-index.c
builtin/diff-tree.c
builtin/diff.c
builtin/log.c
builtin/receive-pack.c
builtin/rev-list.c
builtin/stash.c
builtin/tag.c
commit.c
commit.h
diff.c
diff.h
diffcore-rotate.c [new file with mode: 0644]
diffcore.h
entry.c
fmt-merge-msg.c
gpg-interface.c
gpg-interface.h
log-tree.c
pack-bitmap.c
pack-bitmap.h
pager.c
ref-filter.c
run-command.c
t/.gitattributes
t/README
t/lib-bitmap.sh [new file with mode: 0644]
t/lib-bundle.sh [moved from t/test-bundle-functions.sh with 100% similarity]
t/lib-credential.sh
t/lib-diff.sh [moved from t/diff-lib.sh with 100% similarity]
t/lib-diff/COPYING [moved from t/diff-lib/COPYING with 100% similarity]
t/lib-diff/README [moved from t/diff-lib/README with 100% similarity]
t/lib-gitweb.sh [moved from t/gitweb-lib.sh with 100% similarity]
t/lib-log-graph.sh
t/t0000-basic.sh
t/t0006-date.sh
t/t0008-ignores.sh
t/t0012-help.sh
t/t0018-advice.sh
t/t0020-crlf.sh
t/t0021-conversion.sh
t/t0027-auto-crlf.sh
t/t0040-parse-options.sh
t/t0201-gettext-fallbacks.sh
t/t0300-credentials.sh
t/t0500-progress-display.sh
t/t1011-read-tree-sparse-checkout.sh
t/t1308-config-set.sh
t/t1400-update-ref.sh
t/t1404-update-ref-errors.sh
t/t1430-bad-ref-name.sh
t/t1450-fsck.sh
t/t1502-rev-parse-parseopt.sh
t/t1506-rev-parse-diagnosis.sh
t/t1507-rev-parse-upstream.sh
t/t1509-root-work-tree.sh
t/t1512-rev-parse-disambiguation.sh
t/t1600-index.sh
t/t2006-checkout-index-basic.sh
t/t2018-checkout-branch.sh
t/t2020-checkout-detach.sh
t/t2104-update-index-skip-worktree.sh
t/t2200-add-update.sh
t/t2401-worktree-prune.sh
t/t2402-worktree-list.sh
t/t3005-ls-files-relative.sh
t/t3200-branch.sh
t/t3201-branch-contains.sh
t/t3203-branch-output.sh
t/t3300-funny-names.sh
t/t3400-rebase.sh
t/t3404-rebase-interactive.sh
t/t3415-rebase-autosquash.sh
t/t3420-rebase-autostash.sh
t/t3504-cherry-pick-rerere.sh
t/t3507-cherry-pick-conflict.sh
t/t3508-cherry-pick-many-commits.sh
t/t3510-cherry-pick-sequence.sh
t/t3600-rm.sh
t/t3700-add.sh
t/t3701-add-interactive.sh
t/t3800-mktag.sh
t/t3903-stash.sh
t/t3905-stash-include-untracked.sh
t/t4000-diff-format.sh
t/t4001-diff-rename.sh
t/t4003-diff-rename-1.sh
t/t4004-diff-rename-symlink.sh
t/t4005-diff-rename-2.sh
t/t4006-diff-mode.sh
t/t4007-rename-3.sh
t/t4008-diff-break-rewrite.sh
t/t4009-diff-rename-4.sh
t/t4010-diff-pathspec.sh
t/t4011-diff-symlink.sh
t/t4012-diff-binary.sh
t/t4013-diff-various.sh
t/t4014-format-patch.sh
t/t4015-diff-whitespace.sh
t/t4016-diff-quote.sh
t/t4027-diff-submodule.sh
t/t4030-diff-textconv.sh
t/t4034-diff-words.sh
t/t4038-diff-combined.sh
t/t4045-diff-relative.sh
t/t4049-diff-stat-count.sh
t/t4056-diff-order.sh
t/t4061-diff-indent.sh
t/t4100-apply-stat.sh
t/t4150-am.sh
t/t4153-am-resume-override-opts.sh
t/t4205-log-pretty-formats.sh
t/t4206-log-follow-harder-copies.sh
t/t4208-log-magic-pathspec.sh
t/t4254-am-corrupt.sh
t/t5150-request-pull.sh
t/t5300-pack-object.sh
t/t5310-pack-bitmaps.sh
t/t5316-pack-delta-depth.sh
t/t5318-commit-graph.sh
t/t5500-fetch-pack.sh
t/t5505-remote.sh
t/t5510-fetch.sh
t/t5512-ls-remote.sh
t/t5526-fetch-submodules.sh
t/t5541-http-push-smart.sh
t/t5601-clone.sh
t/t6020-bundle-misc.sh
t/t6030-bisect-porcelain.sh
t/t6040-tracking-info.sh
t/t6113-rev-list-bitmap-filters.sh
t/t6115-rev-list-du.sh [new file with mode: 0755]
t/t6120-describe.sh
t/t6134-pathspec-in-submodule.sh
t/t6301-for-each-ref-errors.sh
t/t6423-merge-rename-directories.sh
t/t6426-merge-skip-unneeded-updates.sh
t/t6436-merge-overwrite.sh
t/t6439-merge-co-error-msgs.sh
t/t6500-gc.sh
t/t7001-mv.sh
t/t7004-tag.sh
t/t7006-pager.sh
t/t7012-skip-worktree-writing.sh
t/t7060-wtstatus.sh
t/t7063-status-untracked-cache.sh
t/t7102-reset.sh
t/t7300-clean.sh
t/t7400-submodule-basic.sh
t/t7401-submodule-summary.sh
t/t7406-submodule-update.sh
t/t7407-submodule-foreach.sh
t/t7500-commit-template-squash-signoff.sh
t/t7501-commit-basic-functionality.sh
t/t7502-commit-porcelain.sh
t/t7505-prepare-commit-msg-hook.sh
t/t7508-status.sh
t/t7510-signed-commit.sh
t/t7512-status-help.sh
t/t7519-status-fsmonitor.sh
t/t7521-ignored-mode.sh
t/t7600-merge.sh
t/t7602-merge-octopus-many.sh
t/t7800-difftool.sh
t/t7810-grep.sh
t/t9003-help-autocorrect.sh
t/t9300-fast-import.sh
t/t9500-gitweb-standalone-no-errors.sh
t/t9501-gitweb-standalone-http-status.sh
t/t9502-gitweb-standalone-parse-output.sh
t/test-lib-functions.sh
t/test-lib.sh
tag.c

index 175a644f82cc3c03912981d53530e19d730cde1b..1d2dba2c80f330c14c835fa3ba5a1c924208105b 100644 (file)
@@ -85,6 +85,10 @@ UI, Workflows & Features
  * The error message given when a configuration variable that is
    expected to have a boolean value has been improved.
 
+ * Signed commits and tags now allow verification of objects, whose
+   two object names (one in SHA-1, the other in SHA-256) are both
+   signed.
+
 
 Performance, Internal Implementation, Development Support etc.
 
@@ -169,6 +173,9 @@ Performance, Internal Implementation, Development Support etc.
 
  * Piecemeal of rewrite of "git bisect" in C continues.
 
+ * When a pager spawned by us exited, the trace log did not record its
+   exit status correctly, which has been corrected.
+
 
 Fixes since v2.30
 -----------------
index e5733ccb2d1a7a2e6ad419f20a019f526c5d475a..aa2b5c11f20bf3c94a9a7b704ac72dfe24b5900d 100644 (file)
@@ -700,6 +700,14 @@ matches a pattern if removing any number of the final pathname
 components matches the pattern.  For example, the pattern "`foo*bar`"
 matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`".
 
+--skip-to=<file>::
+--rotate-to=<file>::
+       Discard the files before the named <file> from the output
+       (i.e. 'skip to'), or move them to the end of the output
+       (i.e. 'rotate to').  These were invented primarily for use
+       of the `git difftool` command, and may not be very useful
+       otherwise.
+
 ifndef::git-format-patch[]
 -R::
        Swap two inputs; that is, show differences from index or
index eb815c22484ef6b67b09c787d9b0caabb0098028..94dc9a54f2d7269bb9b8a4de718b8da54c62c02e 100644 (file)
@@ -153,7 +153,7 @@ OPTIONS
 --column[=<options>]::
 --no-column::
        Display branch listing in columns. See configuration variable
-       column.branch for option syntax.`--column` and `--no-column`
+       `column.branch` for option syntax. `--column` and `--no-column`
        without options are equivalent to 'always' and 'never' respectively.
 +
 This option is only applicable in non-verbose mode.
index 484c485fd06c9d52e09b5e7324f5f13fd444e4f9..143b0c49d739aef285aab7b10a0c536257d5f6fc 100644 (file)
@@ -34,6 +34,14 @@ OPTIONS
        This is the default behaviour; the option is provided to
        override any configuration settings.
 
+--rotate-to=<file>::
+       Start showing the diff for the given path,
+       the paths before it will move to end and output.
+
+--skip-to=<file>::
+       Start showing the diff for the given path, skipping all
+       the paths before it.
+
 -t <tool>::
 --tool=<tool>::
        Use the diff tool specified by <tool>.  Valid values include
index 0c114ad1ca26181776032c3cde957230f23aa602..853967dea01d0778e8d1d484afa9098ab4532ffc 100644 (file)
@@ -117,12 +117,14 @@ NOTES
 'git gc' tries very hard not to delete objects that are referenced
 anywhere in your repository. In particular, it will keep not only
 objects referenced by your current set of branches and tags, but also
-objects referenced by the index, remote-tracking branches, notes saved
-by 'git notes' under refs/notes/, reflogs (which may reference commits
-in branches that were later amended or rewound), and anything else in
-the refs/* namespace.  If you are expecting some objects to be deleted
-and they aren't, check all of those locations and decide whether it
-makes sense in your case to remove those references.
+objects referenced by the index, remote-tracking branches, reflogs
+(which may reference commits in branches that were later amended or
+rewound), and anything else in the refs/* namespace. Note that a note
+(of the kind created by 'git notes') attached to an object does not
+contribute in keeping the object alive. If you are expecting some
+objects to be deleted and they aren't, check all of those locations
+and decide whether it makes sense in your case to remove those
+references.
 
 On the other hand, when 'git gc' runs concurrently with another process,
 there is a risk of it deleting an object that the other process is using
index 54d715ead1373d0feb4eee512fbe8ea8b446216c..f85cb7ea934cb92f1e6b0be75d1d3984fa0af164 100644 (file)
@@ -400,6 +400,17 @@ Note that we pick a single island for each regex to go into, using "last
 one wins" ordering (which allows repo-specific config to take precedence
 over user-wide config, and so forth).
 
+
+CONFIGURATION
+-------------
+
+Various configuration variables affect packing, see
+linkgit:git-config[1] (search for "pack" and "delta").
+
+Notably, delta compression is not used on objects larger than the
+`core.bigFileThreshold` configuration variable and on files with the
+attribute `delta` set to false.
+
 SEE ALSO
 --------
 linkgit:git-rev-list[1]
index 92f146d27dc363519e04d0b132e43b0a4667cac8..fbd4b4ae06777f7ee45165c8c5c4d1bf2bbad7d3 100644 (file)
@@ -165,9 +165,12 @@ depth is 4095.
        Pass the `--delta-islands` option to `git-pack-objects`, see
        linkgit:git-pack-objects[1].
 
-Configuration
+CONFIGURATION
 -------------
 
+Various configuration variables affect packing, see
+linkgit:git-config[1] (search for "pack" and "delta").
+
 By default, the command passes `--delta-base-offset` option to
 'git pack-objects'; this typically results in slightly smaller packs,
 but the generated packs are incompatible with versions of Git older than
@@ -178,6 +181,10 @@ need to set the configuration variable `repack.UseDeltaBaseOffset` to
 is unaffected by this option as the conversion is performed on the fly
 as needed in that case.
 
+Delta compression is not used on objects larger than the
+`core.bigFileThreshold` configuration variable and on files with the
+attribute `delta` set to false.
+
 SEE ALSO
 --------
 linkgit:git-pack-objects[1]
index 5da66232dc3f7b21106cdeba55cc1d94bce04393..20bb8e82176b89cbbe68403301a43848b2bef912 100644 (file)
@@ -31,6 +31,99 @@ include::rev-list-options.txt[]
 
 include::pretty-formats.txt[]
 
+EXAMPLES
+--------
+
+* Print the list of commits reachable from the current branch.
++
+----------
+git rev-list HEAD
+----------
+
+* Print the list of commits on this branch, but not present in the
+  upstream branch.
++
+----------
+git rev-list @{upstream}..HEAD
+----------
+
+* Format commits with their author and commit message (see also the
+  porcelain linkgit:git-log[1]).
++
+----------
+git rev-list --format=medium HEAD
+----------
+
+* Format commits along with their diffs (see also the porcelain
+  linkgit:git-log[1], which can do this in a single process).
++
+----------
+git rev-list HEAD |
+git diff-tree --stdin --format=medium -p
+----------
+
+* Print the list of commits on the current branch that touched any
+  file in the `Documentation` directory.
++
+----------
+git rev-list HEAD -- Documentation/
+----------
+
+* Print the list of commits authored by you in the past year, on
+  any branch, tag, or other ref.
++
+----------
+git rev-list --author=you@example.com --since=1.year.ago --all
+----------
+
+* Print the list of objects reachable from the current branch (i.e., all
+  commits and the blobs and trees they contain).
++
+----------
+git rev-list --objects HEAD
+----------
+
+* Compare the disk size of all reachable objects, versus those
+  reachable from reflogs, versus the total packed size. This can tell
+  you whether running `git repack -ad` might reduce the repository size
+  (by dropping unreachable objects), and whether expiring reflogs might
+  help.
++
+----------
+# reachable objects
+git rev-list --disk-usage --objects --all
+# plus reflogs
+git rev-list --disk-usage --objects --all --reflog
+# total disk size used
+du -c .git/objects/pack/*.pack .git/objects/??/*
+# alternative to du: add up "size" and "size-pack" fields
+git count-objects -v
+----------
+
+* Report the disk size of each branch, not including objects used by the
+  current branch. This can find outliers that are contributing to a
+  bloated repository size (e.g., because somebody accidentally committed
+  large build artifacts).
++
+----------
+git for-each-ref --format='%(refname)' |
+while read branch
+do
+       size=$(git rev-list --disk-usage --objects HEAD..$branch)
+       echo "$size $branch"
+done |
+sort -n
+----------
+
+* Compare the on-disk size of branches in one group of refs, excluding
+  another. If you co-mingle objects from multiple remotes in a single
+  repository, this can show which remotes are contributing to the
+  repository size (taking the size of `origin` as a baseline).
++
+----------
+git rev-list --disk-usage --objects --remotes=$suspect --not --remotes=origin
+----------
+
 GIT
 ---
 Part of the linkgit:git[1] suite
index 31f1beb65baf213908e93d0e90c379d9fb0e7d84..f1197d641ba631fb40505febcb6de5e79c281e5a 100644 (file)
@@ -8,8 +8,8 @@ git-stash - Stash the changes in a dirty working directory away
 SYNOPSIS
 --------
 [verse]
-'git stash' list [<options>]
-'git stash' show [<options>] [<stash>]
+'git stash' list [<log-options>]
+'git stash' show [<diff-options>] [<stash>]
 'git stash' drop [-q|--quiet] [<stash>]
 'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
 'git stash' branch <branchname> [<stash>]
@@ -67,7 +67,7 @@ save [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q
        Instead, all non-option arguments are concatenated to form the stash
        message.
 
-list [<options>]::
+list [<log-options>]::
 
        List the stash entries that you currently have.  Each 'stash entry' is
        listed with its name (e.g. `stash@{0}` is the latest entry, `stash@{1}` is
@@ -83,7 +83,7 @@ stash@{1}: On master: 9cc0589... Add git-stash
 The command takes options applicable to the 'git log'
 command to control what is shown and how. See linkgit:git-log[1].
 
-show [<options>] [<stash>]::
+show [<diff-options>] [<stash>]::
 
        Show the changes recorded in the stash entry as a diff between the
        stashed contents and the commit back when the stash entry was first
index c0764e850a44adde9499c6e601dace9320116f38..83f38e31981420e3fbbb52ab00407cca6c7fceab 100644 (file)
@@ -130,7 +130,7 @@ ignored, then the directory is not shown, but all contents are shown.
 --column[=<options>]::
 --no-column::
        Display untracked files in columns. See configuration variable
-       column.status for option syntax.`--column` and `--no-column`
+       `column.status` for option syntax. `--column` and `--no-column`
        without options are equivalent to 'always' and 'never'
        respectively.
 
index 56656d1be60331cf9896b02e0ccf553c83d88b01..31a97a1b6c5b22ab5c8b959a8a550126f26146d2 100644 (file)
@@ -134,7 +134,7 @@ options for details.
 --column[=<options>]::
 --no-column::
        Display tag listing in columns. See configuration variable
-       column.tag for option syntax.`--column` and `--no-column`
+       `column.tag` for option syntax. `--column` and `--no-column`
        without options are equivalent to 'always' and 'never' respectively.
 +
 This option is only applicable when listing tags without annotation lines.
index d36e6fd482530b960ac9ff6544c84cbff638c585..3a9c44987f998c6a767c4dc19755e4e0c10d9411 100644 (file)
@@ -88,7 +88,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
        empty string, instead the environment variable itself must be
        set to the empty string.  It is an error if the `<envvar>` does not exist
        in the environment. `<envvar>` may not contain an equals sign
-       to avoid ambiguity with `<name>`s which contain one.
+       to avoid ambiguity with `<name>` containing one.
 +
 This is useful for cases where you want to pass transitory
 configuration options to git, but are doing so on OS's where
index c970d9fe438a091dc19900a4de1973ac4bcc4434..2bd1220477e5220550dcfdf60c8e9ed3024c3c29 100644 (file)
@@ -74,6 +74,7 @@ into another list.  There are currently 5 such transformations:
 - diffcore-merge-broken
 - diffcore-pickaxe
 - diffcore-order
+- diffcore-rotate
 
 These are applied in sequence.  The set of filepairs 'git diff-{asterisk}'
 commands find are used as the input to diffcore-break, and
@@ -276,6 +277,26 @@ Documentation
 t
 ------------------------------------------------
 
+diffcore-rotate: For Changing At Which Path Output Starts
+---------------------------------------------------------
+
+This transformation takes one pathname, and rotates the set of
+filepairs so that the filepair for the given pathname comes first,
+optionally discarding the paths that come before it.  This is used
+to implement the `--skip-to` and the `--rotate-to` options.  It is
+an error when the specified pathname is not in the set of filepairs,
+but it is not useful to error out when used with "git log" family of
+commands, because it is unreasonable to expect that a given path
+would be modified by each and every commit shown by the "git log"
+command.  For this reason, when used with "git log", the filepair
+that sorts the same as, or the first one that sorts after, the given
+pathname is where the output starts.
+
+Use of this transformation combined with diffcore-order will produce
+unexpected results, as the input to this transformation is likely
+not sorted when diffcore-order is in effect.
+
+
 SEE ALSO
 --------
 linkgit:git-diff[1],
index 052209b33b4ffa5c83b3aa49efc0e0e275fbdc62..3fb39f801fb13c51d598eb72cb8cc2a54ffa75c7 100644 (file)
@@ -50,9 +50,9 @@ which allows mailmap to replace both the name and the email of a
 commit matching both the specified commit name and email address.
 
 Both E-Mails and names are matched case-insensitively. For example
-this would also match the 'Commit Name <commit@email.xx>' above:
+this would also match the 'Commit Name <commit&#64;email.xx>' above:
 --
-Proper Name <proper@email.xx> CoMmIt NaMe <CoMmIt@EmAiL.xX>
+       Proper Name <proper@email.xx> CoMmIt NaMe <CoMmIt@EmAiL.xX>
 --
 
 EXAMPLES
@@ -79,9 +79,9 @@ Jane Doe <jane@example.com>
 Jane Doe <jane@desktop.(none)>
 ------------
 
-Note that there's no need to map the name for 'jane@laptop.(none)' to
+Note that there's no need to map the name for '<jane&#64;laptop.(none)>' to
 only correct the names. However, leaving the obviously broken
-`<jane@laptop.(none)>' and '<jane@desktop.(none)>' E-Mails as-is is
+'<jane&#64;laptop.(none)>' and '<jane&#64;desktop.(none)>' E-Mails as-is is
 usually not what you want. A `.mailmap` file which also corrects those
 is:
 
index 96cc89d157d21f0cbf9cee35db0c49bc4cb18dae..b1c8f86c6efc128514533ef21b3e0272b8680838 100644 (file)
@@ -129,10 +129,10 @@ parents) and `--max-parents=-1` (negative numbers denote no upper limit).
        adjusting to updated upstream from time to time, and
        this option allows you to ignore the individual commits
        brought in to your history by such a merge.
-
 ifdef::git-log[]
-       This option also changes default diff format for merge commits
-       to `first-parent`, see `--diff-merges=first-parent` for details.
++
+This option also changes default diff format for merge commits
+to `first-parent`, see `--diff-merges=first-parent` for details.
 endif::git-log[]
 
 --not::
@@ -227,6 +227,15 @@ ifdef::git-rev-list[]
        test the exit status to see if a range of objects is fully
        connected (or not).  It is faster than redirecting stdout
        to `/dev/null` as the output does not have to be formatted.
+
+--disk-usage::
+       Suppress normal output; instead, print the sum of the bytes used
+       for on-disk storage by the selected commits or objects. This is
+       equivalent to piping the output into `git cat-file
+       --batch-check='%(objectsize:disk)'`, except that it runs much
+       faster (especially with `--use-bitmap-index`). See the `CAVEATS`
+       section in linkgit:git-cat-file[1] for the limitations of what
+       "on-disk storage" means.
 endif::git-rev-list[]
 
 --cherry-mark::
index 6fd20ebbc254472936238a8db590585e93d5eb91..7c1630bf832491080b043e5c2e3126272dc0408c 100644 (file)
@@ -33,16 +33,9 @@ researchers. On 23 February 2017 the SHAttered attack
 
 Git v2.13.0 and later subsequently moved to a hardened SHA-1
 implementation by default, which isn't vulnerable to the SHAttered
-attack.
+attack, but SHA-1 is still weak.
 
-Thus Git has in effect already migrated to a new hash that isn't SHA-1
-and doesn't share its vulnerabilities, its new hash function just
-happens to produce exactly the same output for all known inputs,
-except two PDFs published by the SHAttered researchers, and the new
-implementation (written by those researchers) claims to detect future
-cryptanalytic collision attacks.
-
-Regardless, it's considered prudent to move past any variant of SHA-1
+Thus it's considered prudent to move past any variant of SHA-1
 to a new hash. There's no guarantee that future attacks on SHA-1 won't
 be published in the future, and those attacks may not have viable
 mitigations.
@@ -57,6 +50,38 @@ SHA-1 still possesses the other properties such as fast object lookup
 and safe error checking, but other hash functions are equally suitable
 that are believed to be cryptographically secure.
 
+Choice of Hash
+--------------
+The hash to replace the hardened SHA-1 should be stronger than SHA-1
+was: we would like it to be trustworthy and useful in practice for at
+least 10 years.
+
+Some other relevant properties:
+
+1. A 256-bit hash (long enough to match common security practice; not
+   excessively long to hurt performance and disk usage).
+
+2. High quality implementations should be widely available (e.g., in
+   OpenSSL and Apple CommonCrypto).
+
+3. The hash function's properties should match Git's needs (e.g. Git
+   requires collision and 2nd preimage resistance and does not require
+   length extension resistance).
+
+4. As a tiebreaker, the hash should be fast to compute (fortunately
+   many contenders are faster than SHA-1).
+
+There were several contenders for a successor hash to SHA-1, including
+SHA-256, SHA-512/256, SHA-256x16, K12, and BLAKE2bp-256.
+
+In late 2018 the project picked SHA-256 as its successor hash.
+
+See 0ed8d8da374 (doc hash-function-transition: pick SHA-256 as
+NewHash, 2018-08-04) and numerous mailing list threads at the time,
+particularly the one starting at
+https://lore.kernel.org/git/20180609224913.GC38834@genre.crustytoothpaste.net/
+for more information.
+
 Goals
 -----
 1. The transition to SHA-256 can be done one local repository at a time.
@@ -94,7 +119,7 @@ Overview
 --------
 We introduce a new repository format extension. Repositories with this
 extension enabled use SHA-256 instead of SHA-1 to name their objects.
-This affects both object names and object content --- both the names
+This affects both object names and object content -- both the names
 of objects and all references to other objects within an object are
 switched to the new hash function.
 
@@ -107,7 +132,7 @@ mapping to allow naming objects using either their SHA-1 and SHA-256 names
 interchangeably.
 
 "git cat-file" and "git hash-object" gain options to display an object
-in its sha1 form and write an object given its sha1 form. This
+in its SHA-1 form and write an object given its SHA-1 form. This
 requires all objects referenced by that object to be present in the
 object database so that they can be named using the appropriate name
 (using the bidirectional hash mapping).
@@ -115,7 +140,7 @@ object database so that they can be named using the appropriate name
 Fetches from a SHA-1 based server convert the fetched objects into
 SHA-256 form and record the mapping in the bidirectional mapping table
 (see below for details). Pushes to a SHA-1 based server convert the
-objects being pushed into sha1 form so the server does not have to be
+objects being pushed into SHA-1 form so the server does not have to be
 aware of the hash function the client is using.
 
 Detailed Design
@@ -151,38 +176,38 @@ repository extensions.
 
 Object names
 ~~~~~~~~~~~~
-Objects can be named by their 40 hexadecimal digit sha1-name or 64
-hexadecimal digit sha256-name, plus names derived from those (see
+Objects can be named by their 40 hexadecimal digit SHA-1 name or 64
+hexadecimal digit SHA-256 name, plus names derived from those (see
 gitrevisions(7)).
 
-The sha1-name of an object is the SHA-1 of the concatenation of its
-type, length, a nul byte, and the object's sha1-content. This is the
+The SHA-1 name of an object is the SHA-1 of the concatenation of its
+type, length, a nul byte, and the object's SHA-1 content. This is the
 traditional <sha1> used in Git to name objects.
 
-The sha256-name of an object is the SHA-256 of the concatenation of its
-type, length, a nul byte, and the object's sha256-content.
+The SHA-256 name of an object is the SHA-256 of the concatenation of its
+type, length, a nul byte, and the object's SHA-256 content.
 
 Object format
 ~~~~~~~~~~~~~
 The content as a byte sequence of a tag, commit, or tree object named
-by sha1 and sha256 differ because an object named by sha256-name refers to
-other objects by their sha256-names and an object named by sha1-name
-refers to other objects by their sha1-names.
+by SHA-1 and SHA-256 differ because an object named by SHA-256 name refers to
+other objects by their SHA-256 names and an object named by SHA-1 name
+refers to other objects by their SHA-1 names.
 
-The sha256-content of an object is the same as its sha1-content, except
-that objects referenced by the object are named using their sha256-names
-instead of sha1-names. Because a blob object does not refer to any
-other object, its sha1-content and sha256-content are the same.
+The SHA-256 content of an object is the same as its SHA-1 content, except
+that objects referenced by the object are named using their SHA-256 names
+instead of SHA-1 names. Because a blob object does not refer to any
+other object, its SHA-1 content and SHA-256 content are the same.
 
-The format allows round-trip conversion between sha256-content and
-sha1-content.
+The format allows round-trip conversion between SHA-256 content and
+SHA-1 content.
 
 Object storage
 ~~~~~~~~~~~~~~
 Loose objects use zlib compression and packed objects use the packed
 format described in Documentation/technical/pack-format.txt, just like
-today. The content that is compressed and stored uses sha256-content
-instead of sha1-content.
+today. The content that is compressed and stored uses SHA-256 content
+instead of SHA-1 content.
 
 Pack index
 ~~~~~~~~~~
@@ -191,21 +216,21 @@ hash functions. They have the following format (all integers are in
 network byte order):
 
 - A header appears at the beginning and consists of the following:
-  - The 4-byte pack index signature: '\377t0c'
-  - 4-byte version number: 3
-  - 4-byte length of the header section, including the signature and
+  * The 4-byte pack index signature: '\377t0c'
+  * 4-byte version number: 3
+  * 4-byte length of the header section, including the signature and
     version number
-  - 4-byte number of objects contained in the pack
-  - 4-byte number of object formats in this pack index: 2
-  - For each object format:
-    - 4-byte format identifier (e.g., 'sha1' for SHA-1)
-    - 4-byte length in bytes of shortened object names. This is the
+  * 4-byte number of objects contained in the pack
+  * 4-byte number of object formats in this pack index: 2
+  * For each object format:
+    ** 4-byte format identifier (e.g., 'sha1' for SHA-1)
+    ** 4-byte length in bytes of shortened object names. This is the
       shortest possible length needed to make names in the shortened
       object name table unambiguous.
-    - 4-byte integer, recording where tables relating to this format
+    ** 4-byte integer, recording where tables relating to this format
       are stored in this index file, as an offset from the beginning.
-  - 4-byte offset to the trailer from the beginning of this file.
-  - Zero or more additional key/value pairs (4-byte key, 4-byte
+  * 4-byte offset to the trailer from the beginning of this file.
+  * Zero or more additional key/value pairs (4-byte key, 4-byte
     value). Only one key is supported: 'PSRC'. See the "Loose objects
     and unreachable objects" section for supported values and how this
     is used.  All other keys are reserved. Readers must ignore
@@ -213,37 +238,36 @@ network byte order):
 - Zero or more NUL bytes. This can optionally be used to improve the
   alignment of the full object name table below.
 - Tables for the first object format:
-  - A sorted table of shortened object names.  These are prefixes of
+  * A sorted table of shortened object names.  These are prefixes of
     the names of all objects in this pack file, packed together
     without offset values to reduce the cache footprint of the binary
     search for a specific object name.
 
-  - A table of full object names in pack order. This allows resolving
+  * A table of full object names in pack order. This allows resolving
     a reference to "the nth object in the pack file" (from a
     reachability bitmap or from the next table of another object
     format) to its object name.
 
-  - A table of 4-byte values mapping object name order to pack order.
+  * A table of 4-byte values mapping object name order to pack order.
     For an object in the table of sorted shortened object names, the
     value at the corresponding index in this table is the index in the
     previous table for that same object.
-
     This can be used to look up the object in reachability bitmaps or
     to look up its name in another object format.
 
-  - A table of 4-byte CRC32 values of the packed object data, in the
+  * A table of 4-byte CRC32 values of the packed object data, in the
     order that the objects appear in the pack file. This is to allow
     compressed data to be copied directly from pack to pack during
     repacking without undetected data corruption.
 
-  - A table of 4-byte offset values. For an object in the table of
+  * A table of 4-byte offset values. For an object in the table of
     sorted shortened object names, the value at the corresponding
     index in this table indicates where that object can be found in
     the pack file. These are usually 31-bit pack file offsets, but
     large offsets are encoded as an index into the next table with the
     most significant bit set.
 
-  - A table of 8-byte offset entries (empty for pack files less than
+  * A table of 8-byte offset entries (empty for pack files less than
     2 GiB). Pack files are organized with heavily used objects toward
     the front, so most object references should not need to refer to
     this table.
@@ -252,10 +276,10 @@ network byte order):
   up to and not including the table of CRC32 values.
 - Zero or more NUL bytes.
 - The trailer consists of the following:
-  - A copy of the 20-byte SHA-256 checksum at the end of the
+  * A copy of the 20-byte SHA-256 checksum at the end of the
     corresponding packfile.
 
-  - 20-byte SHA-256 checksum of all of the above.
+  * 20-byte SHA-256 checksum of all of the above.
 
 Loose object index
 ~~~~~~~~~~~~~~~~~~
@@ -288,18 +312,18 @@ To remove entries (e.g. in "git pack-refs" or "git-prune"):
 
 Translation table
 ~~~~~~~~~~~~~~~~~
-The index files support a bidirectional mapping between sha1-names
-and sha256-names. The lookup proceeds similarly to ordinary object
-lookups. For example, to convert a sha1-name to a sha256-name:
+The index files support a bidirectional mapping between SHA-1 names
+and SHA-256 names. The lookup proceeds similarly to ordinary object
+lookups. For example, to convert a SHA-1 name to a SHA-256 name:
 
  1. Look for the object in idx files. If a match is present in the
-    idx's sorted list of truncated sha1-names, then:
-    a. Read the corresponding entry in the sha1-name order to pack
+    idx's sorted list of truncated SHA-1 names, then:
+    a. Read the corresponding entry in the SHA-1 name order to pack
        name order mapping.
-    b. Read the corresponding entry in the full sha1-name table to
+    b. Read the corresponding entry in the full SHA-1 name table to
        verify we found the right object. If it is, then
-    c. Read the corresponding entry in the full sha256-name table.
-       That is the object's sha256-name.
+    c. Read the corresponding entry in the full SHA-256 name table.
+       That is the object's SHA-256 name.
  2. Check for a loose object. Read lines from loose-object-idx until
     we find a match.
 
@@ -313,10 +337,10 @@ Since all operations that make new objects (e.g., "git commit") add
 the new objects to the corresponding index, this mapping is possible
 for all objects in the object store.
 
-Reading an object's sha1-content
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The sha1-content of an object can be read by converting all sha256-names
-its sha256-content references to sha1-names using the translation table.
+Reading an object's SHA-1 content
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The SHA-1 content of an object can be read by converting all SHA-256 names
+of its SHA-256 content references to SHA-1 names using the translation table.
 
 Fetch
 ~~~~~
@@ -339,7 +363,7 @@ the following steps:
 1. index-pack: inflate each object in the packfile and compute its
    SHA-1. Objects can contain deltas in OBJ_REF_DELTA format against
    objects the client has locally. These objects can be looked up
-   using the translation table and their sha1-content read as
+   using the translation table and their SHA-1 content read as
    described above to resolve the deltas.
 2. topological sort: starting at the "want"s from the negotiation
    phase, walk through objects in the pack and emit a list of them,
@@ -348,12 +372,12 @@ the following steps:
    (This list only contains objects reachable from the "wants". If the
    pack from the server contained additional extraneous objects, then
    they will be discarded.)
-3. convert to sha256: open a new (sha256) packfile. Read the topologically
+3. convert to SHA-256: open a new SHA-256 packfile. Read the topologically
    sorted list just generated. For each object, inflate its
-   sha1-content, convert to sha256-content, and write it to the sha256
-   pack. Record the new sha1<->sha256 mapping entry for use in the idx.
+   SHA-1 content, convert to SHA-256 content, and write it to the SHA-256
+   pack. Record the new SHA-1<-->SHA-256 mapping entry for use in the idx.
 4. sort: reorder entries in the new pack to match the order of objects
-   in the pack the server generated and include blobs. Write a sha256 idx
+   in the pack the server generated and include blobs. Write a SHA-256 idx
    file
 5. clean up: remove the SHA-1 based pack file, index, and
    topologically sorted list obtained from the server in steps 1
@@ -378,19 +402,20 @@ experimenting to get this to perform well.
 Push
 ~~~~
 Push is simpler than fetch because the objects referenced by the
-pushed objects are already in the translation table. The sha1-content
+pushed objects are already in the translation table. The SHA-1 content
 of each object being pushed can be read as described in the "Reading
-an object's sha1-content" section to generate the pack written by git
+an object's SHA-1 content" section to generate the pack written by git
 send-pack.
 
 Signed Commits
 ~~~~~~~~~~~~~~
 We add a new field "gpgsig-sha256" to the commit object format to allow
 signing commits without relying on SHA-1. It is similar to the
-existing "gpgsig" field. Its signed payload is the sha256-content of the
+existing "gpgsig" field. Its signed payload is the SHA-256 content of the
 commit object with any "gpgsig" and "gpgsig-sha256" fields removed.
 
 This means commits can be signed
+
 1. using SHA-1 only, as in existing signed commit objects
 2. using both SHA-1 and SHA-256, by using both gpgsig-sha256 and gpgsig
    fields.
@@ -404,10 +429,11 @@ Signed Tags
 ~~~~~~~~~~~
 We add a new field "gpgsig-sha256" to the tag object format to allow
 signing tags without relying on SHA-1. Its signed payload is the
-sha256-content of the tag with its gpgsig-sha256 field and "-----BEGIN PGP
+SHA-256 content of the tag with its gpgsig-sha256 field and "-----BEGIN PGP
 SIGNATURE-----" delimited in-body signature removed.
 
 This means tags can be signed
+
 1. using SHA-1 only, as in existing signed tag objects
 2. using both SHA-1 and SHA-256, by using gpgsig-sha256 and an in-body
    signature.
@@ -415,11 +441,11 @@ This means tags can be signed
 
 Mergetag embedding
 ~~~~~~~~~~~~~~~~~~
-The mergetag field in the sha1-content of a commit contains the
-sha1-content of a tag that was merged by that commit.
+The mergetag field in the SHA-1 content of a commit contains the
+SHA-1 content of a tag that was merged by that commit.
 
-The mergetag field in the sha256-content of the same commit contains the
-sha256-content of the same tag.
+The mergetag field in the SHA-256 content of the same commit contains the
+SHA-256 content of the same tag.
 
 Submodules
 ~~~~~~~~~~
@@ -494,7 +520,7 @@ Caveats
 -------
 Invalid objects
 ~~~~~~~~~~~~~~~
-The conversion from sha1-content to sha256-content retains any
+The conversion from SHA-1 content to SHA-256 content retains any
 brokenness in the original object (e.g., tree entry modes encoded with
 leading 0, tree objects whose paths are not sorted correctly, and
 commit objects without an author or committer). This is a deliberate
@@ -513,15 +539,15 @@ allow lifting this restriction.
 
 Alternates
 ~~~~~~~~~~
-For the same reason, a sha256 repository cannot borrow objects from a
-sha1 repository using objects/info/alternates or
+For the same reason, a SHA-256 repository cannot borrow objects from a
+SHA-1 repository using objects/info/alternates or
 $GIT_ALTERNATE_OBJECT_REPOSITORIES.
 
 git notes
 ~~~~~~~~~
-The "git notes" tool annotates objects using their sha1-name as key.
+The "git notes" tool annotates objects using their SHA-1 name as key.
 This design does not describe a way to migrate notes trees to use
-sha256-names. That migration is expected to happen separately (for
+SHA-256 names. That migration is expected to happen separately (for
 example using a file at the root of the notes tree to describe which
 hash it uses).
 
@@ -555,7 +581,7 @@ unclear:
 
        Git 2.12
 
-Does this mean Git v2.12.0 is the commit with sha1-name
+Does this mean Git v2.12.0 is the commit with SHA-1 name
 e7e07d5a4fcc2a203d9873968ad3e6bd4d7419d7 or the commit with
 new-40-digit-hash-name e7e07d5a4fcc2a203d9873968ad3e6bd4d7419d7?
 
@@ -598,44 +624,12 @@ The user can also explicitly specify which format to use for a
 particular revision specifier and for output, overriding the mode. For
 example:
 
-git --output-format=sha1 log abac87a^{sha1}..f787cac^{sha256}
-
-Choice of Hash
---------------
-In early 2005, around the time that Git was written, Xiaoyun Wang,
-Yiqun Lisa Yin, and Hongbo Yu announced an attack finding SHA-1
-collisions in 2^69 operations. In August they published details.
-Luckily, no practical demonstrations of a collision in full SHA-1 were
-published until 10 years later, in 2017.
-
-Git v2.13.0 and later subsequently moved to a hardened SHA-1
-implementation by default that mitigates the SHAttered attack, but
-SHA-1 is still believed to be weak.
-
-The hash to replace this hardened SHA-1 should be stronger than SHA-1
-was: we would like it to be trustworthy and useful in practice for at
-least 10 years.
-
-Some other relevant properties:
-
-1. A 256-bit hash (long enough to match common security practice; not
-   excessively long to hurt performance and disk usage).
-
-2. High quality implementations should be widely available (e.g., in
-   OpenSSL and Apple CommonCrypto).
-
-3. The hash function's properties should match Git's needs (e.g. Git
-   requires collision and 2nd preimage resistance and does not require
-   length extension resistance).
-
-4. As a tiebreaker, the hash should be fast to compute (fortunately
-   many contenders are faster than SHA-1).
-
-We choose SHA-256.
+    git --output-format=sha1 log abac87a^{sha1}..f787cac^{sha256}
 
 Transition plan
 ---------------
 Some initial steps can be implemented independently of one another:
+
 - adding a hash function API (vtable)
 - teaching fsck to tolerate the gpgsig-sha256 field
 - excluding gpgsig-* from the fields copied by "git commit --amend"
@@ -647,9 +641,9 @@ Some initial steps can be implemented independently of one another:
 - introducing index v3
 - adding support for the PSRC field and safer object pruning
 
-
 The first user-visible change is the introduction of the objectFormat
 extension (without compatObjectFormat). This requires:
+
 - teaching fsck about this mode of operation
 - using the hash function API (vtable) when computing object names
 - signing objects and verifying signatures
@@ -657,6 +651,7 @@ extension (without compatObjectFormat). This requires:
   repository
 
 Next comes introduction of compatObjectFormat:
+
 - implementing the loose-object-idx
 - translating object names between object formats
 - translating object content between object formats
@@ -669,10 +664,11 @@ Next comes introduction of compatObjectFormat:
   "Object names on the command line" above)
 
 The next step is supporting fetches and pushes to SHA-1 repositories:
+
 - allow pushes to a repository using the compat format
 - generate a topologically sorted list of the SHA-1 names of fetched
   objects
-- convert the fetched packfile to sha256 format and generate an idx
+- convert the fetched packfile to SHA-256 format and generate an idx
   file
 - re-sort to match the order of objects in the fetched packfile
 
@@ -734,6 +730,7 @@ Using hash functions in parallel
 Objects newly created would be addressed by the new hash, but inside
 such an object (e.g. commit) it is still possible to address objects
 using the old hash function.
+
 * You cannot trust its history (needed for bisectability) in the
   future without further work
 * Maintenance burden as the number of supported hash functions grows
@@ -743,36 +740,38 @@ using the old hash function.
 Signed objects with multiple hashes
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Instead of introducing the gpgsig-sha256 field in commit and tag objects
-for sha256-content based signatures, an earlier version of this design
-added "hash sha256 <sha256-name>" fields to strengthen the existing
-sha1-content based signatures.
+for SHA-256 content based signatures, an earlier version of this design
+added "hash sha256 <SHA-256 name>" fields to strengthen the existing
+SHA-1 content based signatures.
 
 In other words, a single signature was used to attest to the object
 content using both hash functions. This had some advantages:
+
 * Using one signature instead of two speeds up the signing process.
 * Having one signed payload with both hashes allows the signer to
-  attest to the sha1-name and sha256-name referring to the same object.
+  attest to the SHA-1 name and SHA-256 name referring to the same object.
 * All users consume the same signature. Broken signatures are likely
   to be detected quickly using current versions of git.
 
 However, it also came with disadvantages:
-* Verifying a signed object requires access to the sha1-names of all
+
+* Verifying a signed object requires access to the SHA-1 names of all
   objects it references, even after the transition is complete and
   translation table is no longer needed for anything else. To support
-  this, the design added fields such as "hash sha1 tree <sha1-name>"
-  and "hash sha1 parent <sha1-name>" to the sha256-content of a signed
+  this, the design added fields such as "hash sha1 tree <SHA-1 name>"
+  and "hash sha1 parent <SHA-1 name>" to the SHA-256 content of a signed
   commit, complicating the conversion process.
-* Allowing signed objects without a sha1 (for after the transition is
+* Allowing signed objects without a SHA-1 (for after the transition is
   complete) complicated the design further, requiring a "nohash sha1"
-  field to suppress including "hash sha1" fields in the sha256-content
+  field to suppress including "hash sha1" fields in the SHA-256 content
   and signed payload.
 
 Lazily populated translation table
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Some of the work of building the translation table could be deferred to
 push time, but that would significantly complicate and slow down pushes.
-Calculating the sha1-name at object creation time at the same time it is
-being streamed to disk and having its sha256-name calculated should be
+Calculating the SHA-1 name at object creation time at the same time it is
+being streamed to disk and having its SHA-256 name calculated should be
 an acceptable cost.
 
 Document History
@@ -782,18 +781,19 @@ Document History
 bmwill@google.com, jonathantanmy@google.com, jrnieder@gmail.com,
 sbeller@google.com
 
-Initial version sent to
-http://lore.kernel.org/git/20170304011251.GA26789@aiede.mtv.corp.google.com
+* Initial version sent to https://lore.kernel.org/git/20170304011251.GA26789@aiede.mtv.corp.google.com
 
 2017-03-03 jrnieder@gmail.com
 Incorporated suggestions from jonathantanmy and sbeller:
-* describe purpose of signed objects with each hash type
-* redefine signed object verification using object content under the
+
+* Describe purpose of signed objects with each hash type
+* Redefine signed object verification using object content under the
   first hash function
 
 2017-03-06 jrnieder@gmail.com
+
 * Use SHA3-256 instead of SHA2 (thanks, Linus and brian m. carlson).[1][2]
-* Make sha3-based signatures a separate field, avoiding the need for
+* Make SHA3-based signatures a separate field, avoiding the need for
   "hash" and "nohash" fields (thanks to peff[3]).
 * Add a sorting phase to fetch (thanks to Junio for noticing the need
   for this).
@@ -805,23 +805,26 @@ Incorporated suggestions from jonathantanmy and sbeller:
   especially Junio).
 
 2017-09-27 jrnieder@gmail.com, sbeller@google.com
-* use placeholder NewHash instead of SHA3-256
-* describe criteria for picking a hash function.
-* include a transition plan (thanks especially to Brandon Williams
+
+* Use placeholder NewHash instead of SHA3-256
+* Describe criteria for picking a hash function.
+* Include a transition plan (thanks especially to Brandon Williams
   for fleshing these ideas out)
-* define the translation table (thanks, Shawn Pearce[5], Jonathan
+* Define the translation table (thanks, Shawn Pearce[5], Jonathan
   Tan, and Masaya Suzuki)
-* avoid loose object overhead by packing more aggressively in
+* Avoid loose object overhead by packing more aggressively in
   "git gc --auto"
 
 Later history:
 
- See the history of this file in git.git for the history of subsequent
- edits. This document history is no longer being maintained as it
- would now be superfluous to the commit log
+* See the history of this file in git.git for the history of subsequent
+  edits. This document history is no longer being maintained as it
+  would now be superfluous to the commit log
+
+References:
 
-[1] http://lore.kernel.org/git/CA+55aFzJtejiCjV0e43+9oR3QuJK2PiFiLQemytoLpyJWe6P9w@mail.gmail.com/
-[2] http://lore.kernel.org/git/CA+55aFz+gkAsDZ24zmePQuEs1XPS9BP_s8O7Q4wQ7LV7X5-oDA@mail.gmail.com/
-[3] http://lore.kernel.org/git/20170306084353.nrns455dvkdsfgo5@sigill.intra.peff.net/
-[4] http://lore.kernel.org/git/20170304224936.rqqtkdvfjgyezsht@genre.crustytoothpaste.net
-[5] https://lore.kernel.org/git/CAJo=hJtoX9=AyLHHpUJS7fueV9ciZ_MNpnEPHUz8Whui6g9F0A@mail.gmail.com/
+ [1] https://lore.kernel.org/git/CA+55aFzJtejiCjV0e43+9oR3QuJK2PiFiLQemytoLpyJWe6P9w@mail.gmail.com/
+ [2] https://lore.kernel.org/git/CA+55aFz+gkAsDZ24zmePQuEs1XPS9BP_s8O7Q4wQ7LV7X5-oDA@mail.gmail.com/
+ [3] https://lore.kernel.org/git/20170306084353.nrns455dvkdsfgo5@sigill.intra.peff.net/
+ [4] https://lore.kernel.org/git/20170304224936.rqqtkdvfjgyezsht@genre.crustytoothpaste.net
+ [5] https://lore.kernel.org/git/CAJo=hJtoX9=AyLHHpUJS7fueV9ciZ_MNpnEPHUz8Whui6g9F0A@mail.gmail.com/
index f772d90eaf98cecde7b0c6ddb4c280980af5f13a..a7c806a73e0b5d74069e9c5b208c5f43021f10e5 100644 (file)
@@ -33,8 +33,8 @@ In protocol v2 these special packets will have the following semantics:
 
   * '0000' Flush Packet (flush-pkt) - indicates the end of a message
   * '0001' Delimiter Packet (delim-pkt) - separates sections of a message
-  * '0002' Message Packet (response-end-pkt) - indicates the end of a response
-    for stateless connections
+  * '0002' Response End Packet (response-end-pkt) - indicates the end of a
+    response for stateless connections
 
 Initial Client Request
 ----------------------
index 5a239cac20e334cbc7952abca62fe5f3d25625ff..9b1bde2e0e64f832916be0978d9e2386283b4a73 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -863,6 +863,7 @@ LIB_OBJS += diffcore-delta.o
 LIB_OBJS += diffcore-order.o
 LIB_OBJS += diffcore-pickaxe.o
 LIB_OBJS += diffcore-rename.o
+LIB_OBJS += diffcore-rotate.o
 LIB_OBJS += dir-iterator.o
 LIB_OBJS += dir.o
 LIB_OBJS += editor.o
index b66e938022bc5fdf61d9910c274c08a79084648e..641523ff9af693bcbef8e77e66b3a5a607f7219f 100644 (file)
@@ -425,13 +425,11 @@ static void setup_default_color_by_age(void)
        parse_color_fields("blue,12 month ago,white,1 month ago,red");
 }
 
-static void determine_line_heat(struct blame_entry *ent, const char **dest_color)
+static void determine_line_heat(struct commit_info *ci, const char **dest_color)
 {
        int i = 0;
-       struct commit_info ci;
-       get_commit_info(ent->suspect->commit, &ci, 1);
 
-       while (i < colorfield_nr && ci.author_time > colorfield[i].hop)
+       while (i < colorfield_nr && ci->author_time > colorfield[i].hop)
                i++;
 
        *dest_color = colorfield[i].col;
@@ -453,7 +451,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
        cp = blame_nth_line(sb, ent->lno);
 
        if (opt & OUTPUT_SHOW_AGE_WITH_COLOR) {
-               determine_line_heat(ent, &default_color);
+               determine_line_heat(&ci, &default_color);
                color = default_color;
                reset = GIT_COLOR_RESET;
        }
index 4bbfc92dce5a0e71e4389c16fd096f4a22fef4a1..023e49e271c2e3ed2dc4c5f1f27d39000353aeb7 100644 (file)
@@ -23,22 +23,35 @@ static struct checkout state = CHECKOUT_INIT;
 static void write_tempfile_record(const char *name, const char *prefix)
 {
        int i;
+       int have_tempname = 0;
 
        if (CHECKOUT_ALL == checkout_stage) {
-               for (i = 1; i < 4; i++) {
-                       if (i > 1)
-                               putchar(' ');
-                       if (topath[i][0])
-                               fputs(topath[i], stdout);
-                       else
-                               putchar('.');
+               for (i = 1; i < 4; i++)
+                       if (topath[i][0]) {
+                               have_tempname = 1;
+                               break;
+                       }
+
+               if (have_tempname) {
+                       for (i = 1; i < 4; i++) {
+                               if (i > 1)
+                                       putchar(' ');
+                               if (topath[i][0])
+                                       fputs(topath[i], stdout);
+                               else
+                                       putchar('.');
+                       }
                }
-       } else
+       } else if (topath[checkout_stage][0]) {
+               have_tempname = 1;
                fputs(topath[checkout_stage], stdout);
+       }
 
-       putchar('\t');
-       write_name_quoted_relative(name, prefix, stdout,
-                                  nul_term_line ? '\0' : '\n');
+       if (have_tempname) {
+               putchar('\t');
+               write_name_quoted_relative(name, prefix, stdout,
+                                          nul_term_line ? '\0' : '\n');
+       }
 
        for (i = 0; i < 4; i++) {
                topath[i][0] = 0;
index bb852661020121895abbe3b6d9ae9c164b7244b9..70103c40952093100e41361e15ab6dbe54ef0268 100644 (file)
@@ -54,6 +54,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
        }
        if (!rev.diffopt.output_format)
                rev.diffopt.output_format = DIFF_FORMAT_RAW;
+       rev.diffopt.rotate_to_strict = 1;
 
        /*
         * Make sure there are NO revision (i.e. pending object) parameter,
index c33d7af47859cc1a42ad3c11046812e6a5dd53eb..176fe7ff2b4e15b4a95ffc3019528318af84b42a 100644 (file)
@@ -41,6 +41,8 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
        if (!rev.diffopt.output_format)
                rev.diffopt.output_format = DIFF_FORMAT_RAW;
 
+       rev.diffopt.rotate_to_strict = 1;
+
        /*
         * Make sure there is one revision (i.e. pending object),
         * and there is no revision filtering parameters.
index 178d12f07f95936f53ef3cf800346130b3bb6a37..f33d30d57bff2ef8923ea9649a5afd4d49eb0574 100644 (file)
@@ -156,6 +156,8 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
        if (merge_base && opt->pending.nr != 2)
                die(_("--merge-base only works with two commits"));
 
+       opt->diffopt.rotate_to_strict = 1;
+
        /*
         * NOTE!  We expect "a..b" to expand to "^a b" but it is
         * perfectly valid for revision range parser to yield "b ^a",
@@ -192,6 +194,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
                int saved_nrl = 0;
                int saved_dcctc = 0;
 
+               opt->diffopt.rotate_to_strict = 0;
                if (opt->diffopt.detect_rename) {
                        if (!the_index.cache)
                                repo_read_index(the_repository);
index 0f4859abf75b6bfa15f6755f95d34f9435e03f2b..617b9a4101dbd8255983664d403316a238e0c952 100644 (file)
@@ -491,6 +491,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
        }
 
        rev.diffopt.flags.recursive = 1;
+       rev.diffopt.rotate_to_strict = 1;
 
        setup_diff_pager(&rev.diffopt);
 
index be29c3f89fc0b60ffa77aa0ebf0d083792f2ba8c..f67b67d80ed1e8d7cd95982a8da96b435b8a452b 100644 (file)
@@ -307,10 +307,11 @@ static struct itimerval early_output_timer;
 
 static void log_show_early(struct rev_info *revs, struct commit_list *list)
 {
-       int i = revs->early_output, close_file = revs->diffopt.close_file;
+       int i = revs->early_output;
        int show_header = 1;
+       int no_free = revs->diffopt.no_free;
 
-       revs->diffopt.close_file = 0;
+       revs->diffopt.no_free = 0;
        sort_in_topological_order(&list, revs->sort_order);
        while (list && i) {
                struct commit *commit = list->item;
@@ -327,8 +328,8 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)
                case commit_ignore:
                        break;
                case commit_error:
-                       if (close_file)
-                               fclose(revs->diffopt.file);
+                       revs->diffopt.no_free = no_free;
+                       diff_free(&revs->diffopt);
                        return;
                }
                list = list->next;
@@ -336,8 +337,8 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)
 
        /* Did we already get enough commits for the early output? */
        if (!i) {
-               if (close_file)
-                       fclose(revs->diffopt.file);
+               revs->diffopt.no_free = 0;
+               diff_free(&revs->diffopt);
                return;
        }
 
@@ -401,7 +402,7 @@ static int cmd_log_walk(struct rev_info *rev)
 {
        struct commit *commit;
        int saved_nrl = 0;
-       int saved_dcctc = 0, close_file = rev->diffopt.close_file;
+       int saved_dcctc = 0;
 
        if (rev->early_output)
                setup_early_output();
@@ -417,7 +418,7 @@ static int cmd_log_walk(struct rev_info *rev)
         * and HAS_CHANGES being accumulated in rev->diffopt, so be careful to
         * retain that state information if replacing rev->diffopt in this loop
         */
-       rev->diffopt.close_file = 0;
+       rev->diffopt.no_free = 1;
        while ((commit = get_revision(rev)) != NULL) {
                if (!log_tree_commit(rev, commit) && rev->max_count >= 0)
                        /*
@@ -442,8 +443,8 @@ static int cmd_log_walk(struct rev_info *rev)
        }
        rev->diffopt.degraded_cc_to_c = saved_dcctc;
        rev->diffopt.needed_rename_limit = saved_nrl;
-       if (close_file)
-               fclose(rev->diffopt.file);
+       rev->diffopt.no_free = 0;
+       diff_free(&rev->diffopt);
 
        if (rev->diffopt.output_format & DIFF_FORMAT_CHECKDIFF &&
            rev->diffopt.flags.check_failed) {
@@ -1961,7 +1962,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                 * file, but but we must instruct it not to close after each
                 * diff.
                 */
-               rev.diffopt.close_file = 0;
+               rev.diffopt.no_free = 1;
        } else {
                int saved;
 
index d49d050e6e57c0dd8f795a36d6f1a64aa7c8ddee..b89ce31bf23104da3343c3b49c46b597bc117f66 100644 (file)
@@ -764,7 +764,7 @@ static void prepare_push_cert_sha1(struct child_process *proc)
 
                memset(&sigcheck, '\0', sizeof(sigcheck));
 
-               bogs = parse_signature(push_cert.buf, push_cert.len);
+               bogs = parse_signed_buffer(push_cert.buf, push_cert.len);
                check_signature(push_cert.buf, bogs, push_cert.buf + bogs,
                                push_cert.len - bogs, &sigcheck);
 
@@ -2050,7 +2050,7 @@ static void queue_commands_from_cert(struct command **tail,
                die("malformed push certificate %.*s", 100, push_cert->buf);
        else
                boc += 2;
-       eoc = push_cert->buf + parse_signature(push_cert->buf, push_cert->len);
+       eoc = push_cert->buf + parse_signed_buffer(push_cert->buf, push_cert->len);
 
        while (boc < eoc) {
                const char *eol = memchr(boc, '\n', eoc - boc);
index 25c6c3b38d4b120687bb02220c3db25af2ae66de..b4d8ea0a35b5b2a0fde7302312b3bf39a5edcda1 100644 (file)
@@ -80,6 +80,19 @@ static int arg_show_object_names = 1;
 
 #define DEFAULT_OIDSET_SIZE     (16*1024)
 
+static int show_disk_usage;
+static off_t total_disk_usage;
+
+static off_t get_object_disk_usage(struct object *obj)
+{
+       off_t size;
+       struct object_info oi = OBJECT_INFO_INIT;
+       oi.disk_sizep = &size;
+       if (oid_object_info_extended(the_repository, &obj->oid, &oi, 0) < 0)
+               die(_("unable to get disk usage of %s"), oid_to_hex(&obj->oid));
+       return size;
+}
+
 static void finish_commit(struct commit *commit);
 static void show_commit(struct commit *commit, void *data)
 {
@@ -88,6 +101,9 @@ static void show_commit(struct commit *commit, void *data)
 
        display_progress(progress, ++progress_counter);
 
+       if (show_disk_usage)
+               total_disk_usage += get_object_disk_usage(&commit->object);
+
        if (info->flags & REV_LIST_QUIET) {
                finish_commit(commit);
                return;
@@ -258,6 +274,8 @@ static void show_object(struct object *obj, const char *name, void *cb_data)
        if (finish_object(obj, name, cb_data))
                return;
        display_progress(progress, ++progress_counter);
+       if (show_disk_usage)
+               total_disk_usage += get_object_disk_usage(obj);
        if (info->flags & REV_LIST_QUIET)
                return;
 
@@ -452,6 +470,23 @@ static int try_bitmap_traversal(struct rev_info *revs,
        return 0;
 }
 
+static int try_bitmap_disk_usage(struct rev_info *revs,
+                                struct list_objects_filter_options *filter)
+{
+       struct bitmap_index *bitmap_git;
+
+       if (!show_disk_usage)
+               return -1;
+
+       bitmap_git = prepare_bitmap_walk(revs, filter);
+       if (!bitmap_git)
+               return -1;
+
+       printf("%"PRIuMAX"\n",
+              (uintmax_t)get_disk_usage_from_bitmap(bitmap_git, revs));
+       return 0;
+}
+
 int cmd_rev_list(int argc, const char **argv, const char *prefix)
 {
        struct rev_info revs;
@@ -584,6 +619,12 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
                        continue;
                }
 
+               if (!strcmp(arg, "--disk-usage")) {
+                       show_disk_usage = 1;
+                       info.flags |= REV_LIST_QUIET;
+                       continue;
+               }
+
                usage(rev_list_usage);
 
        }
@@ -626,6 +667,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
        if (use_bitmap_index) {
                if (!try_bitmap_count(&revs, &filter_options))
                        return 0;
+               if (!try_bitmap_disk_usage(&revs, &filter_options))
+                       return 0;
                if (!try_bitmap_traversal(&revs, &filter_options))
                        return 0;
        }
@@ -690,5 +733,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
                        printf("%d\n", revs.count_left + revs.count_right);
        }
 
+       if (show_disk_usage)
+               printf("%"PRIuMAX"\n", (uintmax_t)total_disk_usage);
+
        return 0;
 }
index 9bc85f91cd004024b5bba9bf9cb587101e9dedce..6f2b58f6ab2046aebd13a1a6486f1bd59662f7f9 100644 (file)
@@ -87,7 +87,7 @@ static const char * const git_stash_save_usage[] = {
        NULL
 };
 
-static const char *ref_stash = "refs/stash";
+static const char ref_stash[] = "refs/stash";
 static struct strbuf stash_index_path = STRBUF_INIT;
 
 /*
index e8b85eefd878b5b2fd1eafe0627d811ecd49b8ea..4237dc724c75f3ae30df6716ae37dd37b844bbda 100644 (file)
@@ -198,11 +198,17 @@ static void write_tag_body(int fd, const struct object_id *oid)
 {
        unsigned long size;
        enum object_type type;
-       char *buf, *sp;
+       char *buf, *sp, *orig;
+       struct strbuf payload = STRBUF_INIT;
+       struct strbuf signature = STRBUF_INIT;
 
-       buf = read_object_file(oid, &type, &size);
+       orig = buf = read_object_file(oid, &type, &size);
        if (!buf)
                return;
+       if (parse_signature(buf, size, &payload, &signature)) {
+               buf = payload.buf;
+               size = payload.len;
+       }
        /* skip header */
        sp = strstr(buf, "\n\n");
 
@@ -211,9 +217,11 @@ static void write_tag_body(int fd, const struct object_id *oid)
                return;
        }
        sp += 2; /* skip the 2 LFs */
-       write_or_die(fd, sp, parse_signature(sp, buf + size - sp));
+       write_or_die(fd, sp, buf + size - sp);
 
-       free(buf);
+       free(orig);
+       strbuf_release(&payload);
+       strbuf_release(&signature);
 }
 
 static int build_tag_object(struct strbuf *buf, int sign, struct object_id *result)
index 4694c4cf9bca07a4e86a9d9701053c9185df9ebd..6ccd774841c6939eb977696ac6f30c04dd514ce3 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -995,7 +995,7 @@ static const char *gpg_sig_headers[] = {
        "gpgsig-sha256",
 };
 
-static int do_sign_commit(struct strbuf *buf, const char *keyid)
+int sign_with_header(struct strbuf *buf, const char *keyid)
 {
        struct strbuf sig = STRBUF_INIT;
        int inspos, copypos;
@@ -1035,21 +1035,32 @@ static int do_sign_commit(struct strbuf *buf, const char *keyid)
        return 0;
 }
 
+
+
 int parse_signed_commit(const struct commit *commit,
-                       struct strbuf *payload, struct strbuf *signature)
+                       struct strbuf *payload, struct strbuf *signature,
+                       const struct git_hash_algo *algop)
 {
-
        unsigned long size;
        const char *buffer = get_commit_buffer(commit, &size);
-       int in_signature, saw_signature = -1;
-       const char *line, *tail;
-       const char *gpg_sig_header = gpg_sig_headers[hash_algo_by_ptr(the_hash_algo)];
-       int gpg_sig_header_len = strlen(gpg_sig_header);
+       int ret = parse_buffer_signed_by_header(buffer, size, payload, signature, algop);
+
+       unuse_commit_buffer(commit, buffer);
+       return ret;
+}
+
+int parse_buffer_signed_by_header(const char *buffer,
+                                 unsigned long size,
+                                 struct strbuf *payload,
+                                 struct strbuf *signature,
+                                 const struct git_hash_algo *algop)
+{
+       int in_signature = 0, saw_signature = 0, other_signature = 0;
+       const char *line, *tail, *p;
+       const char *gpg_sig_header = gpg_sig_headers[hash_algo_by_ptr(algop)];
 
        line = buffer;
        tail = buffer + size;
-       in_signature = 0;
-       saw_signature = 0;
        while (line < tail) {
                const char *sig = NULL;
                const char *next = memchr(line, '\n', tail - line);
@@ -1057,9 +1068,15 @@ int parse_signed_commit(const struct commit *commit,
                next = next ? next + 1 : tail;
                if (in_signature && line[0] == ' ')
                        sig = line + 1;
-               else if (starts_with(line, gpg_sig_header) &&
-                        line[gpg_sig_header_len] == ' ')
-                       sig = line + gpg_sig_header_len + 1;
+               else if (skip_prefix(line, gpg_sig_header, &p) &&
+                        *p == ' ') {
+                       sig = line + strlen(gpg_sig_header) + 1;
+                       other_signature = 0;
+               }
+               else if (starts_with(line, "gpgsig"))
+                       other_signature = 1;
+               else if (other_signature && line[0] != ' ')
+                       other_signature = 0;
                if (sig) {
                        strbuf_add(signature, sig, next - sig);
                        saw_signature = 1;
@@ -1068,12 +1085,12 @@ int parse_signed_commit(const struct commit *commit,
                        if (*line == '\n')
                                /* dump the whole remainder of the buffer */
                                next = tail;
-                       strbuf_add(payload, line, next - line);
+                       if (!other_signature)
+                               strbuf_add(payload, line, next - line);
                        in_signature = 0;
                }
                line = next;
        }
-       unuse_commit_buffer(commit, buffer);
        return saw_signature;
 }
 
@@ -1082,23 +1099,29 @@ int remove_signature(struct strbuf *buf)
        const char *line = buf->buf;
        const char *tail = buf->buf + buf->len;
        int in_signature = 0;
-       const char *sig_start = NULL;
-       const char *sig_end = NULL;
+       struct sigbuf {
+               const char *start;
+               const char *end;
+       } sigs[2], *sigp = &sigs[0];
+       int i;
+       const char *orig_buf = buf->buf;
+
+       memset(sigs, 0, sizeof(sigs));
 
        while (line < tail) {
                const char *next = memchr(line, '\n', tail - line);
                next = next ? next + 1 : tail;
 
                if (in_signature && line[0] == ' ')
-                       sig_end = next;
+                       sigp->end = next;
                else if (starts_with(line, "gpgsig")) {
                        int i;
                        for (i = 1; i < GIT_HASH_NALGOS; i++) {
                                const char *p;
                                if (skip_prefix(line, gpg_sig_headers[i], &p) &&
                                    *p == ' ') {
-                                       sig_start = line;
-                                       sig_end = next;
+                                       sigp->start = line;
+                                       sigp->end = next;
                                        in_signature = 1;
                                }
                        }
@@ -1106,15 +1129,18 @@ int remove_signature(struct strbuf *buf)
                        if (*line == '\n')
                                /* dump the whole remainder of the buffer */
                                next = tail;
+                       if (in_signature && sigp - sigs != ARRAY_SIZE(sigs))
+                               sigp++;
                        in_signature = 0;
                }
                line = next;
        }
 
-       if (sig_start)
-               strbuf_remove(buf, sig_start - buf->buf, sig_end - sig_start);
+       for (i = ARRAY_SIZE(sigs) - 1; i >= 0; i--)
+               if (sigs[i].start)
+                       strbuf_remove(buf, sigs[i].start - orig_buf, sigs[i].end - sigs[i].start);
 
-       return sig_start != NULL;
+       return sigs[0].start != NULL;
 }
 
 static void handle_signed_tag(struct commit *parent, struct commit_extra_header ***tail)
@@ -1122,8 +1148,10 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header
        struct merge_remote_desc *desc;
        struct commit_extra_header *mergetag;
        char *buf;
-       unsigned long size, len;
+       unsigned long size;
        enum object_type type;
+       struct strbuf payload = STRBUF_INIT;
+       struct strbuf signature = STRBUF_INIT;
 
        desc = merge_remote_util(parent);
        if (!desc || !desc->obj)
@@ -1131,8 +1159,7 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header
        buf = read_object_file(&desc->obj->oid, &type, &size);
        if (!buf || type != OBJ_TAG)
                goto free_return;
-       len = parse_signature(buf, size);
-       if (size == len)
+       if (!parse_signature(buf, size, &payload, &signature))
                goto free_return;
        /*
         * We could verify this signature and either omit the tag when
@@ -1151,6 +1178,8 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header
 
        **tail = mergetag;
        *tail = &mergetag->next;
+       strbuf_release(&payload);
+       strbuf_release(&signature);
        return;
 
 free_return:
@@ -1165,7 +1194,7 @@ int check_commit_signature(const struct commit *commit, struct signature_check *
 
        sigc->result = 'N';
 
-       if (parse_signed_commit(commit, &payload, &signature) <= 0)
+       if (parse_signed_commit(commit, &payload, &signature, the_hash_algo) <= 0)
                goto out;
        ret = check_signature(payload.buf, payload.len, signature.buf,
                signature.len, sigc);
@@ -1515,7 +1544,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
        if (encoding_is_utf8 && !verify_utf8(&buffer))
                fprintf(stderr, _(commit_utf8_warn));
 
-       if (sign_commit && do_sign_commit(&buffer, sign_commit)) {
+       if (sign_commit && sign_with_header(&buffer, sign_commit)) {
                result = -1;
                goto out;
        }
index 9e0c157bea3a95bec08b6bc5db7d6d7d9677b228..49c0f503964ec3bb0e682390b0b409b6a76b0924 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -319,7 +319,8 @@ void set_merge_remote_desc(struct commit *commit,
 struct commit *get_merge_parent(const char *name);
 
 int parse_signed_commit(const struct commit *commit,
-                       struct strbuf *message, struct strbuf *signature);
+                       struct strbuf *message, struct strbuf *signature,
+                       const struct git_hash_algo *algop);
 int remove_signature(struct strbuf *buf);
 
 /*
@@ -361,4 +362,13 @@ int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void
 LAST_ARG_MUST_BE_NULL
 int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...);
 
+/* Sign a commit or tag buffer, storing the result in a header. */
+int sign_with_header(struct strbuf *buf, const char *keyid);
+/* Parse the signature out of a header. */
+int parse_buffer_signed_by_header(const char *buffer,
+                                 unsigned long size,
+                                 struct strbuf *payload,
+                                 struct strbuf *signature,
+                                 const struct git_hash_algo *algop);
+
 #endif /* COMMIT_H */
diff --git a/diff.c b/diff.c
index 69e3bc00ed8f72ad8d012175541166a6cec4ffcd..6956f5e335c235d0a1a2ea6d8b7b8e7b7678deda 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -5348,6 +5348,19 @@ static int diff_opt_word_diff_regex(const struct option *opt,
        return 0;
 }
 
+static int diff_opt_rotate_to(const struct option *opt, const char *arg, int unset)
+{
+       struct diff_options *options = opt->value;
+
+       BUG_ON_OPT_NEG(unset);
+       if (!strcmp(opt->long_name, "skip-to"))
+               options->skip_instead_of_rotate = 1;
+       else
+               options->skip_instead_of_rotate = 0;
+       options->rotate_to = arg;
+       return 0;
+}
+
 static void prep_parse_options(struct diff_options *options)
 {
        struct option parseopts[] = {
@@ -5599,6 +5612,12 @@ static void prep_parse_options(struct diff_options *options)
                          DIFF_PICKAXE_REGEX, PARSE_OPT_NONEG),
                OPT_FILENAME('O', NULL, &options->orderfile,
                             N_("control the order in which files appear in the output")),
+               OPT_CALLBACK_F(0, "rotate-to", options, N_("<path>"),
+                              N_("show the change in the specified path first"),
+                              PARSE_OPT_NONEG, diff_opt_rotate_to),
+               OPT_CALLBACK_F(0, "skip-to", options, N_("<path>"),
+                              N_("skip the output to the specified path"),
+                              PARSE_OPT_NONEG, diff_opt_rotate_to),
                OPT_CALLBACK_F(0, "find-object", options, N_("<object-id>"),
                               N_("look for differences that change the number of occurrences of the specified object"),
                               PARSE_OPT_NONEG, diff_opt_find_object),
@@ -6336,6 +6355,32 @@ static void diff_flush_patch_all_file_pairs(struct diff_options *o)
        }
 }
 
+static void diff_free_file(struct diff_options *options)
+{
+       if (options->close_file)
+               fclose(options->file);
+}
+
+static void diff_free_ignore_regex(struct diff_options *options)
+{
+       int i;
+
+       for (i = 0; i < options->ignore_regex_nr; i++) {
+               regfree(options->ignore_regex[i]);
+               free(options->ignore_regex[i]);
+       }
+       free(options->ignore_regex);
+}
+
+void diff_free(struct diff_options *options)
+{
+       if (options->no_free)
+               return;
+
+       diff_free_file(options);
+       diff_free_ignore_regex(options);
+}
+
 void diff_flush(struct diff_options *options)
 {
        struct diff_queue_struct *q = &diff_queued_diff;
@@ -6399,8 +6444,7 @@ void diff_flush(struct diff_options *options)
                 * options->file to /dev/null should be safe, because we
                 * aren't supposed to produce any output anyway.
                 */
-               if (options->close_file)
-                       fclose(options->file);
+               diff_free_file(options);
                options->file = xfopen("/dev/null", "w");
                options->close_file = 1;
                options->color_moved = 0;
@@ -6433,8 +6477,7 @@ void diff_flush(struct diff_options *options)
 free_queue:
        free(q->queue);
        DIFF_QUEUE_CLEAR(q);
-       if (options->close_file)
-               fclose(options->file);
+       diff_free(options);
 
        /*
         * Report the content-level differences with HAS_CHANGES;
@@ -6669,6 +6712,8 @@ void diffcore_std(struct diff_options *options)
                diffcore_pickaxe(options);
        if (options->orderfile)
                diffcore_order(options->orderfile);
+       if (options->rotate_to)
+               diffcore_rotate(options);
        if (!options->found_follow)
                /* See try_to_follow_renames() in tree-diff.c */
                diff_resolve_rename_copy();
diff --git a/diff.h b/diff.h
index 2ff2b1c7f2ca05ca8c2c194f6a7447fb0965dbed..c8f3faea8aa9ad9d627ec61326d89cd8f2ea27c5 100644 (file)
--- a/diff.h
+++ b/diff.h
  * - Once you finish feeding the pairs of files, call `diffcore_std()`.
  * This will tell the diffcore library to go ahead and do its work.
  *
- * - Calling `diff_flush()` will produce the output.
+ * - Calling `diff_flush()` will produce the output, it will call
+ *   `diff_free()` to free any resources, e.g. those allocated in
+ *   `diff_opt_parse()`.
+ *
+ * - Set `.no_free = 1` before calling `diff_flush()` to defer the
+ *   freeing of allocated memory in diff_options. This is useful when
+ *   `diff_flush()` is being called in a loop, rather than as a
+ *   one-off. When setting `.no_free = 1` you must ensure that
+ *   `diff_free()` is called at the end, either by flipping the flag
+ *   before the last `diff_flush()` call, or by flipping it before
+ *   calling `diff_free()` yourself.
  */
 
 struct combine_diff_path;
@@ -227,6 +237,27 @@ enum diff_submodule_format {
 struct diff_options {
        const char *orderfile;
 
+       /*
+        * "--rotate-to=<file>" would start showing at <file> and when
+        * the output reaches the end, wrap around by default.
+        * Setting skip_instead_of_rotate to true stops the output at the
+        * end, effectively discarding the earlier part of the output
+        * before <file>'s diff (this is used to implement the
+        * "--skip-to=<file>" option).
+        *
+        * When rotate_to_strict is set, it is an error if there is no
+        * <file> in the diff.  Otherwise, the output starts at the
+        * path that is the same as, or first path that sorts after,
+        * <file>.  Because it is unreasonable to require the exact
+        * match for "git log -p --rotate-to=<file>" (i.e. not all
+        * commit would touch that single <file>), "git log" sets it
+        * to false.  "git diff" sets it to true to detect an error
+        * in the command line option.
+        */
+       const char *rotate_to;
+       int skip_instead_of_rotate;
+       int rotate_to_strict;
+
        /**
         * A constant string (can and typically does contain newlines to look for
         * a block of text, not just a single line) to filter out the filepairs
@@ -365,6 +396,8 @@ struct diff_options {
 
        struct repository *repo;
        struct option *parseopts;
+
+       int no_free;
 };
 
 unsigned diff_filter_bit(char status);
@@ -559,6 +592,7 @@ void diffcore_fix_diff_index(void);
 
 int diff_queue_is_empty(void);
 void diff_flush(struct diff_options*);
+void diff_free(struct diff_options*);
 void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc);
 
 /* diff-raw status letters */
diff --git a/diffcore-rotate.c b/diffcore-rotate.c
new file mode 100644 (file)
index 0000000..445f060
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021, Google LLC.
+ * Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano
+ */
+#include "cache.h"
+#include "diff.h"
+#include "diffcore.h"
+
+void diffcore_rotate(struct diff_options *opt)
+{
+       struct diff_queue_struct *q = &diff_queued_diff;
+       struct diff_queue_struct outq;
+       int rotate_to, i;
+
+       if (!q->nr)
+               return;
+
+       for (i = 0; i < q->nr; i++) {
+               int cmp = strcmp(opt->rotate_to, q->queue[i]->two->path);
+               if (!cmp)
+                       break; /* exact match */
+               if (!opt->rotate_to_strict && cmp < 0)
+                       break; /* q->queue[i] is now past the target pathname */
+       }
+
+       if (q->nr <= i) {
+               /* we did not find the specified path */
+               if (opt->rotate_to_strict)
+                       die(_("No such path '%s' in the diff"), opt->rotate_to);
+               return;
+       }
+
+       DIFF_QUEUE_CLEAR(&outq);
+       rotate_to = i;
+
+       for (i = rotate_to; i < q->nr; i++)
+               diff_q(&outq, q->queue[i]);
+       for (i = 0; i < rotate_to; i++) {
+               if (opt->skip_instead_of_rotate)
+                       diff_free_filepair(q->queue[i]);
+               else
+                       diff_q(&outq, q->queue[i]);
+       }
+       free(q->queue);
+       *q = outq;
+}
index d2a63c5c71f4e3667643b1fba5c195e049e313c9..c1592bcd0135ec6066b6c04bb94bc818c1ae1cc8 100644 (file)
@@ -164,6 +164,7 @@ void diffcore_rename(struct diff_options *);
 void diffcore_merge_broken(void);
 void diffcore_pickaxe(struct diff_options *);
 void diffcore_order(const char *orderfile);
+void diffcore_rotate(struct diff_options *);
 
 /* low-level interface to diffcore_order */
 struct obj_order {
diff --git a/entry.c b/entry.c
index a0532f1f00007be7c9b675a54a7e8c48c000d638..7b9f43716f76e6e7a701966045429b263cfb691e 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -282,7 +282,7 @@ static int write_entry(struct cache_entry *ce,
                new_blob = read_blob_entry(ce, &size);
                if (!new_blob)
                        return error("unable to read sha1 file of %s (%s)",
-                                    path, oid_to_hex(&ce->oid));
+                                    ce->name, oid_to_hex(&ce->oid));
 
                /*
                 * We can't make a real symlink; write out a regular file entry
@@ -309,7 +309,7 @@ static int write_entry(struct cache_entry *ce,
                        new_blob = read_blob_entry(ce, &size);
                        if (!new_blob)
                                return error("unable to read sha1 file of %s (%s)",
-                                            path, oid_to_hex(&ce->oid));
+                                            ce->name, oid_to_hex(&ce->oid));
                }
 
                /*
@@ -354,7 +354,7 @@ static int write_entry(struct cache_entry *ce,
 
        case S_IFGITLINK:
                if (to_tempfile)
-                       return error("cannot create temporary submodule %s", path);
+                       return error("cannot create temporary submodule %s", ce->name);
                if (mkdir(path, 0777) < 0)
                        return error("cannot create submodule directory %s", path);
                sub = submodule_from_ce(ce);
@@ -365,7 +365,7 @@ static int write_entry(struct cache_entry *ce,
                break;
 
        default:
-               return error("unknown file mode for %s in index", path);
+               return error("unknown file mode for %s in index", ce->name);
        }
 
 finish:
index 46f6015c447dad5d2a6768bf92274cf728725846..1e51492a05085f4e76bed5a32d72a6e2049b1271 100644 (file)
@@ -510,22 +510,28 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
        for (i = 0; i < origins.nr; i++) {
                struct object_id *oid = origins.items[i].util;
                enum object_type type;
-               unsigned long size, len;
+               unsigned long size;
                char *buf = read_object_file(oid, &type, &size);
+               char *origbuf = buf;
+               unsigned long len = size;
                struct signature_check sigc = { NULL };
-               struct strbuf sig = STRBUF_INIT;
+               struct strbuf payload = STRBUF_INIT, sig = STRBUF_INIT;
 
                if (!buf || type != OBJ_TAG)
                        goto next;
-               len = parse_signature(buf, size);
 
-               if (size == len)
-                       ; /* merely annotated */
-               else if (check_signature(buf, len, buf + len, size - len, &sigc) &&
-                       !sigc.gpg_output)
-                       strbuf_addstr(&sig, "gpg verification failed.\n");
-               else
-                       strbuf_addstr(&sig, sigc.gpg_output);
+               if (!parse_signature(buf, size, &payload, &sig))
+                       ;/* merely annotated */
+               else {
+                       buf = payload.buf;
+                       len = payload.len;
+                       if (check_signature(payload.buf, payload.len, sig.buf,
+                                        sig.len, &sigc) &&
+                               !sigc.gpg_output)
+                               strbuf_addstr(&sig, "gpg verification failed.\n");
+                       else
+                               strbuf_addstr(&sig, sigc.gpg_output);
+               }
                signature_check_clear(&sigc);
 
                if (!tag_number++) {
@@ -548,9 +554,10 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
                                        strlen(origins.items[i].string));
                        fmt_tag_signature(&tagbuf, &sig, buf, len);
                }
+               strbuf_release(&payload);
                strbuf_release(&sig);
        next:
-               free(buf);
+               free(origbuf);
        }
        if (tagbuf.len) {
                strbuf_addch(out, '\n');
index b49927083661c8ca695112b8432691f17ed6d835..127aecfc2b071f9a745a871a9ea205931eeb672f 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "commit.h"
 #include "config.h"
 #include "run-command.h"
 #include "strbuf.h"
@@ -345,7 +346,7 @@ void print_signature_buffer(const struct signature_check *sigc, unsigned flags)
                fputs(output, stderr);
 }
 
-size_t parse_signature(const char *buf, size_t size)
+size_t parse_signed_buffer(const char *buf, size_t size)
 {
        size_t len = 0;
        size_t match = size;
@@ -361,6 +362,18 @@ size_t parse_signature(const char *buf, size_t size)
        return match;
 }
 
+int parse_signature(const char *buf, size_t size, struct strbuf *payload, struct strbuf *signature)
+{
+       size_t match = parse_signed_buffer(buf, size);
+       if (match != size) {
+               strbuf_add(payload, buf, match);
+               remove_signature(payload);
+               strbuf_add(signature, buf + match, size - match);
+               return 1;
+       }
+       return 0;
+}
+
 void set_signing_key(const char *key)
 {
        free(configured_signing_key);
index f4e9b4f3715a0b0d4be3ef526388bf6b87b56fda..80567e4894868d5d7a192cab0afb9ca9c09cb70d 100644 (file)
@@ -37,13 +37,20 @@ struct signature_check {
 
 void signature_check_clear(struct signature_check *sigc);
 
+/*
+ * Look at a GPG signed tag object.  If such a signature exists, store it in
+ * signature and the signed content in payload.  Return 1 if a signature was
+ * found, and 0 otherwise.
+ */
+int parse_signature(const char *buf, size_t size, struct strbuf *payload, struct strbuf *signature);
+
 /*
  * Look at GPG signed content (e.g. a signed tag object), whose
  * payload is followed by a detached signature on it.  Return the
  * offset where the embedded detached signature begins, or the end of
  * the data when there is no such signature.
  */
-size_t parse_signature(const char *buf, size_t size);
+size_t parse_signed_buffer(const char *buf, size_t size);
 
 /*
  * Create a detached signature for the contents of "buffer" and append
index e7dab999508399cd16c0f6012c4c1b8a8b5d409e..4531cebfab38c047fcdffb3ac0acaec747f688f1 100644 (file)
@@ -502,7 +502,7 @@ static void show_signature(struct rev_info *opt, struct commit *commit)
        struct signature_check sigc = { 0 };
        int status;
 
-       if (parse_signed_commit(commit, &payload, &signature) <= 0)
+       if (parse_signed_commit(commit, &payload, &signature, the_hash_algo) <= 0)
                goto out;
 
        status = check_signature(payload.buf, payload.len, signature.buf,
@@ -548,7 +548,8 @@ static int show_one_mergetag(struct commit *commit,
        struct strbuf verify_message;
        struct signature_check sigc = { 0 };
        int status, nth;
-       size_t payload_size;
+       struct strbuf payload = STRBUF_INIT;
+       struct strbuf signature = STRBUF_INIT;
 
        hash_object_file(the_hash_algo, extra->value, extra->len,
                         type_name(OBJ_TAG), &oid);
@@ -571,13 +572,11 @@ static int show_one_mergetag(struct commit *commit,
                strbuf_addf(&verify_message,
                            "parent #%d, tagged '%s'\n", nth + 1, tag->tag);
 
-       payload_size = parse_signature(extra->value, extra->len);
        status = -1;
-       if (extra->len > payload_size) {
+       if (parse_signature(extra->value, extra->len, &payload, &signature)) {
                /* could have a good signature */
-               status = check_signature(extra->value, payload_size,
-                                        extra->value + payload_size,
-                                        extra->len - payload_size, &sigc);
+               status = check_signature(payload.buf, payload.len,
+                                        signature.buf, signature.len, &sigc);
                if (sigc.gpg_output)
                        strbuf_addstr(&verify_message, sigc.gpg_output);
                else
@@ -588,6 +587,8 @@ static int show_one_mergetag(struct commit *commit,
 
        show_sig_lines(opt, status, verify_message.buf);
        strbuf_release(&verify_message);
+       strbuf_release(&payload);
+       strbuf_release(&signature);
        return 0;
 }
 
@@ -962,12 +963,14 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
 int log_tree_commit(struct rev_info *opt, struct commit *commit)
 {
        struct log_info log;
-       int shown, close_file = opt->diffopt.close_file;
+       int shown;
+       /* maybe called by e.g. cmd_log_walk(), maybe stand-alone */
+       int no_free = opt->diffopt.no_free;
 
        log.commit = commit;
        log.parent = NULL;
        opt->loginfo = &log;
-       opt->diffopt.close_file = 0;
+       opt->diffopt.no_free = 1;
 
        if (opt->line_level_traverse)
                return line_log_print(opt, commit);
@@ -984,7 +987,7 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
                fprintf(opt->diffopt.file, "\n%s\n", opt->break_bar);
        opt->loginfo = NULL;
        maybe_flush_or_die(opt->diffopt.file, "stdout");
-       if (close_file)
-               fclose(opt->diffopt.file);
+       opt->diffopt.no_free = no_free;
+       diff_free(&opt->diffopt);
        return shown;
 }
index 60fe20fb87a42ea05e3cd16f07966bf30448ae3f..1f69b5fa85354b76169f93139a29e7d98846795f 100644 (file)
@@ -1430,3 +1430,84 @@ int bitmap_has_oid_in_uninteresting(struct bitmap_index *bitmap_git,
        return bitmap_git &&
                bitmap_walk_contains(bitmap_git, bitmap_git->haves, oid);
 }
+
+static off_t get_disk_usage_for_type(struct bitmap_index *bitmap_git,
+                                    enum object_type object_type)
+{
+       struct bitmap *result = bitmap_git->result;
+       struct packed_git *pack = bitmap_git->pack;
+       off_t total = 0;
+       struct ewah_iterator it;
+       eword_t filter;
+       size_t i;
+
+       init_type_iterator(&it, bitmap_git, object_type);
+       for (i = 0; i < result->word_alloc &&
+                       ewah_iterator_next(&filter, &it); i++) {
+               eword_t word = result->words[i] & filter;
+               size_t base = (i * BITS_IN_EWORD);
+               unsigned offset;
+
+               if (!word)
+                       continue;
+
+               for (offset = 0; offset < BITS_IN_EWORD; offset++) {
+                       size_t pos;
+
+                       if ((word >> offset) == 0)
+                               break;
+
+                       offset += ewah_bit_ctz64(word >> offset);
+                       pos = base + offset;
+                       total += pack_pos_to_offset(pack, pos + 1) -
+                                pack_pos_to_offset(pack, pos);
+               }
+       }
+
+       return total;
+}
+
+static off_t get_disk_usage_for_extended(struct bitmap_index *bitmap_git)
+{
+       struct bitmap *result = bitmap_git->result;
+       struct packed_git *pack = bitmap_git->pack;
+       struct eindex *eindex = &bitmap_git->ext_index;
+       off_t total = 0;
+       struct object_info oi = OBJECT_INFO_INIT;
+       off_t object_size;
+       size_t i;
+
+       oi.disk_sizep = &object_size;
+
+       for (i = 0; i < eindex->count; i++) {
+               struct object *obj = eindex->objects[i];
+
+               if (!bitmap_get(result, pack->num_objects + i))
+                       continue;
+
+               if (oid_object_info_extended(the_repository, &obj->oid, &oi, 0) < 0)
+                       die(_("unable to get disk usage of %s"),
+                           oid_to_hex(&obj->oid));
+
+               total += object_size;
+       }
+       return total;
+}
+
+off_t get_disk_usage_from_bitmap(struct bitmap_index *bitmap_git,
+                                struct rev_info *revs)
+{
+       off_t total = 0;
+
+       total += get_disk_usage_for_type(bitmap_git, OBJ_COMMIT);
+       if (revs->tree_objects)
+               total += get_disk_usage_for_type(bitmap_git, OBJ_TREE);
+       if (revs->blob_objects)
+               total += get_disk_usage_for_type(bitmap_git, OBJ_BLOB);
+       if (revs->tag_objects)
+               total += get_disk_usage_for_type(bitmap_git, OBJ_TAG);
+
+       total += get_disk_usage_for_extended(bitmap_git);
+
+       return total;
+}
index 25dfcf56156bf8b9b03ebbbaae895a71fc8cf89b..36d99930d8d5288a7367235eba8d533ed8f76f99 100644 (file)
@@ -68,6 +68,8 @@ int bitmap_walk_contains(struct bitmap_index *,
  */
 int bitmap_has_oid_in_uninteresting(struct bitmap_index *, const struct object_id *oid);
 
+off_t get_disk_usage_from_bitmap(struct bitmap_index *, struct rev_info *);
+
 void bitmap_writer_show_progress(int show);
 void bitmap_writer_set_checksum(unsigned char *sha1);
 void bitmap_writer_build_type_index(struct packing_data *to_pack,
diff --git a/pager.c b/pager.c
index ee435de67562dc5a3142a153e41672c292924640..3d37dd7adaa27ed1b6bc3952711b11ff6dfc0f56 100644 (file)
--- a/pager.c
+++ b/pager.c
 static struct child_process pager_process = CHILD_PROCESS_INIT;
 static const char *pager_program;
 
-static void wait_for_pager(int in_signal)
+static void close_pager_fds(void)
 {
-       if (!in_signal) {
-               fflush(stdout);
-               fflush(stderr);
-       }
        /* signal EOF to pager */
        close(1);
        close(2);
-       if (in_signal)
-               finish_command_in_signal(&pager_process);
-       else
-               finish_command(&pager_process);
 }
 
 static void wait_for_pager_atexit(void)
 {
-       wait_for_pager(0);
+       fflush(stdout);
+       fflush(stderr);
+       close_pager_fds();
+       finish_command(&pager_process);
 }
 
 static void wait_for_pager_signal(int signo)
 {
-       wait_for_pager(1);
+       close_pager_fds();
+       finish_command_in_signal(&pager_process);
        sigchain_pop(signo);
        raise(signo);
 }
index fd994e18744cebd22e68fd1d969fb0f621d2362e..bade6528ee36e1efd0a28aeedcb5202f7cc7910d 100644 (file)
@@ -1210,12 +1210,20 @@ static void grab_person(const char *who, struct atom_value *val, int deref, void
 }
 
 static void find_subpos(const char *buf,
-                       const char **sub, unsigned long *sublen,
-                       const char **body, unsigned long *bodylen,
-                       unsigned long *nonsiglen,
-                       const char **sig, unsigned long *siglen)
+                       const char **sub, size_t *sublen,
+                       const char **body, size_t *bodylen,
+                       size_t *nonsiglen,
+                       const char **sig, size_t *siglen)
 {
+       struct strbuf payload = STRBUF_INIT;
+       struct strbuf signature = STRBUF_INIT;
        const char *eol;
+       const char *end = buf + strlen(buf);
+       const char *sigstart;
+
+       /* parse signature first; we might not even have a subject line */
+       parse_signature(buf, end - buf, &payload, &signature);
+
        /* skip past header until we hit empty line */
        while (*buf && *buf != '\n') {
                eol = strchrnul(buf, '\n');
@@ -1226,16 +1234,14 @@ static void find_subpos(const char *buf,
        /* skip any empty lines */
        while (*buf == '\n')
                buf++;
-
-       /* parse signature first; we might not even have a subject line */
-       *sig = buf + parse_signature(buf, strlen(buf));
-       *siglen = strlen(*sig);
+       *sig = strbuf_detach(&signature, siglen);
+       sigstart = buf + parse_signed_buffer(buf, strlen(buf));
 
        /* subject is first non-empty line */
        *sub = buf;
        /* subject goes to first empty line before signature begins */
        if ((eol = strstr(*sub, "\n\n"))) {
-               eol = eol < *sig ? eol : *sig;
+               eol = eol < sigstart ? eol : sigstart;
        /* check if message uses CRLF */
        } else if (! (eol = strstr(*sub, "\r\n\r\n"))) {
                /* treat whole message as subject */
@@ -1253,7 +1259,7 @@ static void find_subpos(const char *buf,
                buf++;
        *body = buf;
        *bodylen = strlen(buf);
-       *nonsiglen = *sig - buf;
+       *nonsiglen = sigstart - buf;
 }
 
 /*
@@ -1285,12 +1291,13 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, void *buf)
 {
        int i;
        const char *subpos = NULL, *bodypos = NULL, *sigpos = NULL;
-       unsigned long sublen = 0, bodylen = 0, nonsiglen = 0, siglen = 0;
+       size_t sublen = 0, bodylen = 0, nonsiglen = 0, siglen = 0;
 
        for (i = 0; i < used_atom_cnt; i++) {
                struct used_atom *atom = &used_atom[i];
                const char *name = atom->name;
                struct atom_value *v = &val[i];
+
                if (!!deref != (*name == '*'))
                        continue;
                if (deref)
@@ -1322,7 +1329,7 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, void *buf)
                        v->s = xmemdupz(sigpos, siglen);
                else if (atom->u.contents.option == C_LINES) {
                        struct strbuf s = STRBUF_INIT;
-                       const char *contents_end = bodylen + bodypos - siglen;
+                       const char *contents_end = bodypos + nonsiglen;
 
                        /*  Size is the length of the message after removing the signature */
                        append_lines(&s, subpos, contents_end - subpos, atom->u.contents.nlines);
@@ -1336,7 +1343,9 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, void *buf)
                        v->s = strbuf_detach(&s, NULL);
                } else if (atom->u.contents.option == C_BARE)
                        v->s = xstrdup(subpos);
+
        }
+       free((void *)sigpos);
 }
 
 /*
index ea4d0fb4b154c89a0fcd12d29e41ffcbb2af0302..509841bf273d821df41c0f0aef86d5768dda9e0b 100644 (file)
@@ -551,8 +551,11 @@ static int wait_or_whine(pid_t pid, const char *argv0, int in_signal)
 
        while ((waiting = waitpid(pid, &status, 0)) < 0 && errno == EINTR)
                ;       /* nothing */
-       if (in_signal)
-               return 0;
+       if (in_signal) {
+               if (WIFEXITED(status))
+                       code = WEXITSTATUS(status);
+               return code;
+       }
 
        if (waiting < 0) {
                failed_errno = errno;
index df05434d32cc1fa720d5408c26c22371d1f0e9e8..dafa17c3e616756d38dd9c0dba45de978c8088ff 100644 (file)
@@ -1,13 +1,13 @@
 t[0-9][0-9][0-9][0-9]/* -whitespace
 /chainlint/*.expect eol=lf
-/diff-lib/* eol=lf
+/lib-diff/* eol=lf
 /t0110/url-* binary
 /t3206/* eol=lf
 /t3900/*.txt eol=lf
 /t3901/*.txt eol=lf
-/t4034/*/* eol=lf
 /t4013/* eol=lf
 /t4018/* eol=lf
+/t4034/*/* eol=lf
 /t4051/* eol=lf
 /t4100/* eol=lf
 /t4101/* eol=lf
index bc57006c041bc5113095a13700e5bf475ab515e8..593d4a4e270cc07b0f8e7d93e0da4d3c0b73eebd 100644 (file)
--- a/t/README
+++ b/t/README
@@ -917,13 +917,13 @@ library for your script to use.
 
    Check whether a file has the length it is expected to.
 
- - test_path_is_file <path> [<diagnosis>]
-   test_path_is_dir <path> [<diagnosis>]
-   test_path_is_missing <path> [<diagnosis>]
+ - test_path_is_file <path>
+   test_path_is_dir <path>
+   test_path_is_missing <path>
 
    Check if the named path is a file, if the named path is a
    directory, or if the named path does not exist, respectively,
-   and fail otherwise, showing the <diagnosis> text.
+   and fail otherwise.
 
  - test_when_finished <script>
 
diff --git a/t/lib-bitmap.sh b/t/lib-bitmap.sh
new file mode 100644 (file)
index 0000000..fe3f98b
--- /dev/null
@@ -0,0 +1,26 @@
+# Compare a file containing rev-list bitmap traversal output to its non-bitmap
+# counterpart. You can't just use test_cmp for this, because the two produce
+# subtly different output:
+#
+#   - regular output is in traversal order, whereas bitmap is split by type,
+#     with non-packed objects at the end
+#
+#   - regular output has a space and the pathname appended to non-commit
+#     objects; bitmap output omits this
+#
+# This function normalizes and compares the two. The second file should
+# always be the bitmap output.
+test_bitmap_traversal () {
+       if test "$1" = "--no-confirm-bitmaps"
+       then
+               shift
+       elif cmp "$1" "$2"
+       then
+               echo >&2 "identical raw outputs; are you sure bitmaps were used?"
+               return 1
+       fi &&
+       cut -d' ' -f1 "$1" | sort >"$1.normalized" &&
+       sort "$2" >"$2.normalized" &&
+       test_cmp "$1.normalized" "$2.normalized" &&
+       rm -f "$1.normalized" "$2.normalized"
+}
similarity index 100%
rename from t/test-bundle-functions.sh
rename to t/lib-bundle.sh
index dea2cbef5172954666f9ee40142273252b6fe7a2..5ea8bc9f1dcfe644da4b9ce720f2a523ff172475 100644 (file)
@@ -20,7 +20,7 @@ check() {
                false
        fi &&
        test_cmp expect-stdout stdout &&
-       test_i18ncmp expect-stderr stderr
+       test_cmp expect-stderr stderr
 }
 
 read_chunk() {
similarity index 100%
rename from t/diff-lib.sh
rename to t/lib-diff.sh
similarity index 100%
rename from t/diff-lib/COPYING
rename to t/lib-diff/COPYING
similarity index 100%
rename from t/diff-lib/README
rename to t/lib-diff/README
similarity index 100%
rename from t/gitweb-lib.sh
rename to t/lib-gitweb.sh
index 1184cceef262283ac65c99985cf9f4ebb3edce68..bf952ef9204dbbff379803810d4ec8ef87749a35 100644 (file)
@@ -12,13 +12,13 @@ sanitize_log_output () {
 lib_test_cmp_graph () {
        git log --graph "$@" >output &&
        sed 's/ *$//' >output.sanitized <output &&
-       test_i18ncmp expect output.sanitized
+       test_cmp expect output.sanitized
 }
 
 lib_test_cmp_short_graph () {
        git log --graph --pretty=short "$@" >output &&
        sanitize_log_output >output.sanitized <output &&
-       test_i18ncmp expect output.sanitized
+       test_cmp expect output.sanitized
 }
 
 lib_test_cmp_colored_graph () {
index a6e570d674ac97c33396a605cbc752f9f121bb2e..705d62cc27a574a990978f786cf45c864ebffd50 100755 (executable)
@@ -271,7 +271,7 @@ test_expect_success 'pretend we have a mix of all possible results' '
        EOF
 '
 
-test_expect_success C_LOCALE_OUTPUT 'test --verbose' '
+test_expect_success 'test --verbose' '
        run_sub_test_lib_test_err \
                t1234-verbose "test verbose" --verbose <<-\EOF &&
        test_expect_success "passing test" true
index 75ee9a96b80bbad5506bc6961b23988358a65c8a..6b757d7169252b467ed18c4f209c0428e286bba3 100755 (executable)
@@ -11,7 +11,7 @@ check_relative() {
        echo "$t -> $2" >expect
        test_expect_${3:-success} "relative date ($2)" "
        test-tool date relative $t >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
        "
 }
 
@@ -139,7 +139,7 @@ check_date_format_human() {
        echo "$t -> $2" >expect
        test_expect_success "human date $t" '
                test-tool date human $t >actual &&
-               test_i18ncmp expect actual
+               test_cmp expect actual
 '
 }
 
index 370a389e5c5c509b51189e23b81c6ce2d1b79a18..f7abde62f633ee2ff89614777fd03533559cb887 100755 (executable)
@@ -34,7 +34,7 @@ expect_from_stdin () {
 test_stderr () {
        expected="$1"
        expect_in stderr "$1" &&
-       test_i18ncmp "$HOME/expected-stderr" "$HOME/stderr"
+       test_cmp "$HOME/expected-stderr" "$HOME/stderr"
 }
 
 broken_c_unquote () {
index e8ef7300ecb8693367906d4c314797e5750bdf50..5679e29c62479c663446e76fbc587a2648efe601 100755 (executable)
@@ -55,7 +55,7 @@ test_expect_success "--help does not work for guides" "
                git: 'revisions' is not a git command. See 'git --help'.
        EOF
        test_must_fail git revisions --help 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 "
 
 test_expect_success 'git help' '
index e03554d2f3457b354aa4035d446ffb856061e9a3..39e5e4b34f8729e361f7cc7801dadb4db6d6c76b 100755 (executable)
@@ -10,7 +10,7 @@ test_expect_success 'advice should be printed when config variable is unset' '
        hint: Disable this message with "git config advice.nestedTag false"
        EOF
        test-tool advise "This is a piece of advice" 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'advice should be printed when config variable is set to true' '
@@ -20,7 +20,7 @@ test_expect_success 'advice should be printed when config variable is set to tru
        EOF
        test_config advice.nestedTag true &&
        test-tool advise "This is a piece of advice" 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'advice should not be printed when config variable is set to false' '
index 375cf9439858d974b9db8f826062a9577d70af9d..f25ae8b5e1f34dd8e58bbe65ee171cbf5c8aa14b 100755 (executable)
@@ -87,10 +87,8 @@ test_expect_success 'safecrlf: print warning only once' '
        git commit -m "nowarn" &&
        for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >doublewarn &&
        git add doublewarn 2>err &&
-       if test_have_prereq C_LOCALE_OUTPUT
-       then
-               test $(grep "CRLF will be replaced by LF" err | wc -l) = 1
-       fi
+       grep "CRLF will be replaced by LF" err >err.warnings &&
+       test_line_count = 1 err.warnings
 '
 
 
index e4c4de5c74563a6ded58c0f553d07a7e59cd2b78..e828ee964c1b86f307d7522ce280ee2483348111 100755 (executable)
@@ -34,7 +34,7 @@ filter_git () {
 # Compare two files and ensure that `clean` and `smudge` respectively are
 # called at least once if specified in the `expect` file. The actual
 # invocation count is not relevant because their number can vary.
-# c.f. http://lore.kernel.org/git/xmqqshv18i8i.fsf@gitster.mtv.corp.google.com/
+# c.f. https://lore.kernel.org/git/xmqqshv18i8i.fsf@gitster.mtv.corp.google.com/
 test_cmp_count () {
        expect=$1
        actual=$2
@@ -49,7 +49,7 @@ test_cmp_count () {
 
 # Compare two files but exclude all `clean` invocations because Git can
 # call `clean` zero or more times.
-# c.f. http://lore.kernel.org/git/xmqqshv18i8i.fsf@gitster.mtv.corp.google.com/
+# c.f. https://lore.kernel.org/git/xmqqshv18i8i.fsf@gitster.mtv.corp.google.com/
 test_cmp_exclude_clean () {
        expect=$1
        actual=$2
index 51f74a3ddf3fc9ee617134a0e947dfc60e23aba2..d24d5acfbc7947c97250da98d50b8612ef0da459 100755 (executable)
@@ -83,7 +83,7 @@ check_warning () {
        *) echo >&2 "Illegal 1": "$1" ; return false ;;
        esac
        grep "will be replaced by" "$2" | sed -e "s/\(.*\) in [^ ]*$/\1/" | uniq  >"$2".actual
-       test_i18ncmp "$2".expect "$2".actual
+       test_cmp "$2".expect "$2".actual
 }
 
 commit_check_warn () {
index 14cafc138b7875013afeee01d74dbbeb2e56d495..ad4746d899a48b6eef46f7690d291c0ec6411d5b 100755 (executable)
@@ -61,7 +61,7 @@ EOF
 test_expect_success 'test help' '
        test_must_fail test-tool parse-options -h >output 2>output.err &&
        test_must_be_empty output.err &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 mv expect expect.err
@@ -84,7 +84,7 @@ check_unknown_i18n() {
        cat expect.err >>expect &&
        test_must_fail test-tool parse-options $* >output 2>output.err &&
        test_must_be_empty output &&
-       test_i18ncmp expect output.err
+       test_cmp expect output.err
 }
 
 test_expect_success 'OPT_BOOL() #1' 'check boolean: 1 --yes'
@@ -250,7 +250,7 @@ EOF
 test_expect_success 'detect possible typos' '
        test_must_fail test-tool parse-options -boolean >output 2>output.err &&
        test_must_be_empty output &&
-       test_i18ncmp typo.err output.err
+       test_cmp typo.err output.err
 '
 
 cat >typo.err <<\EOF
@@ -260,7 +260,7 @@ EOF
 test_expect_success 'detect possible typos' '
        test_must_fail test-tool parse-options -ambiguous >output 2>output.err &&
        test_must_be_empty output &&
-       test_i18ncmp typo.err output.err
+       test_cmp typo.err output.err
 '
 
 test_expect_success 'keep some options as arguments' '
index 90da1c7ddc41b73dc07b4433255d3b0ffd66bd5d..6c74df0dc67e575d171c8ad4a4ab57465b1e622c 100755 (executable)
@@ -18,7 +18,7 @@ test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_TEST_FALLBACKS is set' '
     test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
 '
 
-test_expect_success C_LOCALE_OUTPUT 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is fallthrough' '
+test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is fallthrough' '
     echo fallthrough >expect &&
     echo $GIT_INTERNAL_GETTEXT_SH_SCHEME >actual &&
     test_cmp expect actual
@@ -27,25 +27,25 @@ test_expect_success C_LOCALE_OUTPUT 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is
 test_expect_success 'gettext: our gettext() fallback has pass-through semantics' '
     printf "test" >expect &&
     gettext "test" >actual &&
-    test_i18ncmp expect actual &&
+    test_cmp expect actual &&
     printf "test more words" >expect &&
     gettext "test more words" >actual &&
-    test_i18ncmp expect actual
+    test_cmp expect actual
 '
 
 test_expect_success 'eval_gettext: our eval_gettext() fallback has pass-through semantics' '
     printf "test" >expect &&
     eval_gettext "test" >actual &&
-    test_i18ncmp expect actual &&
+    test_cmp expect actual &&
     printf "test more words" >expect &&
     eval_gettext "test more words" >actual &&
-    test_i18ncmp expect actual
+    test_cmp expect actual
 '
 
 test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables' '
     printf "test YesPlease" >expect &&
     GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease eval_gettext "test \$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" >actual &&
-    test_i18ncmp expect actual
+    test_cmp expect actual
 '
 
 test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces' '
@@ -53,7 +53,7 @@ test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate v
     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 &&
-    test_i18ncmp expect actual
+    test_cmp expect actual
 '
 
 test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces and quotes' '
@@ -61,7 +61,7 @@ test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate v
     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 &&
-    test_i18ncmp expect actual
+    test_cmp expect actual
 '
 
 test_done
index a18f8a473bfc667023c433a6c55c05defcc2e9f0..3485c0534e6d39be9ef6f285fa2ec80400dc47cd 100755 (executable)
@@ -578,7 +578,7 @@ test_expect_success 'helpers can abort the process' '
        quit: host=example.com
        fatal: credential helper '\''quit'\'' told us to quit
        EOF
-       test_i18ncmp expect stderr
+       test_cmp expect stderr
 '
 
 test_expect_success 'empty helper spec resets helper list' '
@@ -606,7 +606,7 @@ test_expect_success 'url parser rejects embedded newlines' '
        warning: url contains a newline in its path component: https://one.example.com?%0ahost=two.example.com/
        fatal: credential url cannot be parsed: https://one.example.com?%0ahost=two.example.com/
        EOF
-       test_i18ncmp expect stderr
+       test_cmp expect stderr
 '
 
 test_expect_success 'host-less URLs are parsed as empty host' '
@@ -633,7 +633,7 @@ test_expect_success 'credential system refuses to work with missing host' '
        cat >expect <<-\EOF &&
        fatal: refusing to work with credential missing host field
        EOF
-       test_i18ncmp expect stderr
+       test_cmp expect stderr
 '
 
 test_expect_success 'credential system refuses to work with missing protocol' '
@@ -643,7 +643,7 @@ test_expect_success 'credential system refuses to work with missing protocol' '
        cat >expect <<-\EOF &&
        fatal: refusing to work with credential missing protocol field
        EOF
-       test_i18ncmp expect stderr
+       test_cmp expect stderr
 '
 
 # usage: check_host_and_path <url> <expected-host> <expected-path>
index 84cce345e7dd3d9d704c064ab49cc726c4c7af32..22058b503ac78c41f542eb02a5a3dbd1cb200d3e 100755 (executable)
@@ -29,7 +29,7 @@ test_expect_success 'simple progress display' '
        test-tool progress "Working hard" <in 2>stderr &&
 
        show_cr <stderr >out &&
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 test_expect_success 'progress display with total' '
@@ -48,7 +48,7 @@ test_expect_success 'progress display with total' '
        test-tool progress --total=3 "Working hard" <in 2>stderr &&
 
        show_cr <stderr >out &&
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 test_expect_success 'progress display breaks long lines #1' '
@@ -72,7 +72,7 @@ EOF
                <in 2>stderr &&
 
        show_cr <stderr >out &&
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 test_expect_success 'progress display breaks long lines #2' '
@@ -100,7 +100,7 @@ EOF
                <in 2>stderr &&
 
        show_cr <stderr >out &&
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 test_expect_success 'progress display breaks long lines #3 - even the first is too long' '
@@ -126,7 +126,7 @@ EOF
                <in 2>stderr &&
 
        show_cr <stderr >out &&
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 test_expect_success 'progress display breaks long lines #4 - title line matches terminal width' '
@@ -150,7 +150,7 @@ EOF
                <in 2>stderr &&
 
        show_cr <stderr >out &&
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 # Progress counter goes backwards, this should not happen in practice.
@@ -172,7 +172,7 @@ test_expect_success 'progress shortens - crazy caller' '
        test-tool progress --total=1000 "Working hard" <in 2>stderr &&
 
        show_cr <stderr >out &&
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 test_expect_success 'progress display with throughput' '
@@ -201,7 +201,7 @@ test_expect_success 'progress display with throughput' '
        test-tool progress "Working hard" <in 2>stderr &&
 
        show_cr <stderr >out &&
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 test_expect_success 'progress display with throughput and total' '
@@ -226,7 +226,7 @@ test_expect_success 'progress display with throughput and total' '
        test-tool progress --total=40 "Working hard" <in 2>stderr &&
 
        show_cr <stderr >out &&
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 test_expect_success 'cover up after throughput shortens' '
@@ -255,7 +255,7 @@ test_expect_success 'cover up after throughput shortens' '
        test-tool progress "Working hard" <in 2>stderr &&
 
        show_cr <stderr >out &&
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 test_expect_success 'cover up after throughput shortens a lot' '
@@ -280,7 +280,7 @@ test_expect_success 'cover up after throughput shortens a lot' '
        test-tool progress "Working hard" <in 2>stderr &&
 
        show_cr <stderr >out &&
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 test_expect_success 'progress generates traces' '
index dfe9794a74081dc4534966cc68ee64dd4fed9a92..24092c09a95771df742337e8d6c1c9eac77221ba 100755 (executable)
@@ -253,7 +253,7 @@ warning: The following paths were already present and thus not updated despite s
 
 After fixing the above paths, you may want to run `git sparse-checkout reapply`.
 EOF
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'checkout without --ignore-skip-worktree-bits' '
index 3a527e3a8438a583bfd8704ad23f9ae2e48ac382..88b119a0a35dc6608a789b0415a97650c88b2e19 100755 (executable)
@@ -208,14 +208,14 @@ test_expect_success 'proper error on error in default config files' '
        echo "[" >>.git/config &&
        echo "fatal: bad config line 34 in file .git/config" >expect &&
        test_expect_code 128 test-tool config get_value foo.bar 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'proper error on error in custom config files' '
        echo "[" >>syntax-error &&
        echo "fatal: bad config line 1 in file syntax-error" >expect &&
        test_expect_code 128 test-tool config configset_get_value foo.bar syntax-error 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'check line errors for malformed values' '
index 359d8731c8f097cf015a304f1f4f01d3794c7b56..e31f65f381c9bdbdc3a9dc4c10a90e5051cf9bc6 100755 (executable)
@@ -374,7 +374,7 @@ test_expect_success 'Query "main@{May 25 2005}" (before history)' '
        echo "$C" >expect &&
        test_cmp expect o &&
        echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
-       test_i18ncmp expect e
+       test_cmp expect e
 '
 test_expect_success 'Query main@{2005-05-25} (before history)' '
        test_when_finished "rm -f o e" &&
@@ -382,7 +382,7 @@ test_expect_success 'Query main@{2005-05-25} (before history)' '
        echo "$C" >expect &&
        test_cmp expect o &&
        echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
-       test_i18ncmp expect e
+       test_cmp expect e
 '
 test_expect_success 'Query "main@{May 26 2005 23:31:59}" (1 second before history)' '
        test_when_finished "rm -f o e" &&
@@ -390,7 +390,7 @@ test_expect_success 'Query "main@{May 26 2005 23:31:59}" (1 second before histor
        echo "$C" >expect &&
        test_cmp expect o &&
        echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
-       test_i18ncmp expect e
+       test_cmp expect e
 '
 test_expect_success 'Query "main@{May 26 2005 23:32:00}" (exactly history start)' '
        test_when_finished "rm -f o e" &&
index 2d142e5535e5abfbeb2c8dbc68c5e9de9e2d92cd..8b51c4efc1359dacd1b760897e48c264b965f861 100755 (executable)
@@ -101,7 +101,7 @@ df_test() {
                printf "%s\n" "delete $delname" "create $addname $D"
        fi >commands &&
        test_must_fail git update-ref --stdin <commands 2>output.err &&
-       test_i18ncmp expected-err output.err &&
+       test_cmp expected-err output.err &&
        printf "%s\n" "$C $delref" >expected-refs &&
        git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
        test_cmp expected-refs actual-refs
index 354902e514f964194828dbbe04d9d0d81dc50d85..b1839e08771d4162db11f2b6b6eabd33da10b275 100755 (executable)
@@ -125,7 +125,7 @@ test_expect_success 'push cannot create a badly named ref' '
        ! grep -e "broken\.\.\.ref" output
 '
 
-test_expect_failure C_LOCALE_OUTPUT 'push --mirror can delete badly named ref' '
+test_expect_failure 'push --mirror can delete badly named ref' '
        top=$(pwd) &&
        git init src &&
        git init dest &&
index 231243152b2e128b54a7facdb4983009f36df603..5071ac63a5b51b89c973456211ce3aaac3587553 100755 (executable)
@@ -376,7 +376,7 @@ test_expect_success 'tag with incorrect tag name & missing tagger' '
        warning in tag $tag: badTagName: invalid '\''tag'\'' name: wrong name format
        warning in tag $tag: missingTaggerEntry: invalid format - expected '\''tagger'\'' line
        EOF
-       test_i18ncmp expect out
+       test_cmp expect out
 '
 
 test_expect_success 'tag with bad tagger' '
@@ -804,7 +804,7 @@ test_expect_success 'fsck notices dangling objects' '
                git fsck >actual &&
                # the output order is non-deterministic, as it comes from a hash
                sort <actual >actual.sorted &&
-               test_i18ncmp expect actual.sorted
+               test_cmp expect actual.sorted
        )
 '
 
@@ -814,7 +814,7 @@ test_expect_success 'fsck --connectivity-only notices dangling objects' '
                git fsck --connectivity-only >actual &&
                # the output order is non-deterministic, as it comes from a hash
                sort <actual >actual.sorted &&
-               test_i18ncmp expect actual.sorted
+               test_cmp expect actual.sorted
        )
 '
 
index a859abedf5820da7fd2a2457c6d19b213ff78784..b29563fc9973aad63a313cbb94f239d2365ee0d8 100755 (executable)
@@ -95,7 +95,7 @@ test_expect_success 'test --parseopt help output' '
 |EOF
 END_EXPECT
        test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'test --parseopt help output no switches' '
@@ -108,7 +108,7 @@ test_expect_success 'test --parseopt help output no switches' '
 |EOF
 END_EXPECT
        test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec_no_switches &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'test --parseopt help output hidden switches' '
@@ -121,7 +121,7 @@ test_expect_success 'test --parseopt help output hidden switches' '
 |EOF
 END_EXPECT
        test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec_only_hidden_switches &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'test --parseopt help-all output hidden switches' '
@@ -136,7 +136,7 @@ test_expect_success 'test --parseopt help-all output hidden switches' '
 |EOF
 END_EXPECT
        test_expect_code 129 git rev-parse --parseopt -- --help-all > output < optionspec_only_hidden_switches &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'test --parseopt invalid switch help output' '
@@ -176,7 +176,7 @@ test_expect_success 'test --parseopt invalid switch help output' '
 |
 END_EXPECT
        test_expect_code 129 git rev-parse --parseopt -- --does-not-exist 1>/dev/null 2>output < optionspec &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'setup expect.1' "
index f6e6f23f7e6950ea43a7632eb2f0652afc1ed0ae..65a154a8a20f8df27a3f0eaee9ff9b65d5132639 100755 (executable)
@@ -15,7 +15,7 @@ test_did_you_mean ()
        fatal: path '$2$3' $4, but not ${5:-$SQ$3$SQ}
        hint: Did you mean '$1:$2$3'${2:+ aka $SQ$1:./$3$SQ}?
        EOF
-       test_i18ncmp expected error
+       test_cmp expected error
 }
 
 HASH_file=
index 73b4f34c6eee30a70098c950a5482756a9f95e61..c34714ffe3fbe5545da1d05b9a74cfc6113e43dd 100755 (executable)
@@ -172,7 +172,7 @@ test_expect_success 'branch@{u} error message when no upstream' '
        fatal: no upstream configured for branch ${SQ}non-tracking${SQ}
        EOF
        error_message non-tracking@{u} &&
-       test_i18ncmp expect error
+       test_cmp expect error
 '
 
 test_expect_success '@{u} error message when no upstream' '
@@ -180,7 +180,7 @@ test_expect_success '@{u} error message when no upstream' '
        fatal: no upstream configured for branch ${SQ}main${SQ}
        EOF
        test_must_fail git rev-parse --verify @{u} 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'branch@{u} error message with misspelt branch' '
@@ -188,7 +188,7 @@ test_expect_success 'branch@{u} error message with misspelt branch' '
        fatal: no such branch: ${SQ}no-such-branch${SQ}
        EOF
        error_message no-such-branch@{u} &&
-       test_i18ncmp expect error
+       test_cmp expect error
 '
 
 test_expect_success '@{u} error message when not on a branch' '
@@ -197,7 +197,7 @@ test_expect_success '@{u} error message when not on a branch' '
        EOF
        git checkout HEAD^0 &&
        test_must_fail git rev-parse --verify @{u} 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'branch@{u} error message if upstream branch not fetched' '
@@ -205,7 +205,7 @@ test_expect_success 'branch@{u} error message if upstream branch not fetched' '
        fatal: upstream branch ${SQ}refs/heads/side${SQ} not stored as a remote-tracking branch
        EOF
        error_message bad-upstream@{u} &&
-       test_i18ncmp expect error
+       test_cmp expect error
 '
 
 test_expect_success 'pull works when tracking a local branch' '
index fd2f7abf1c192eebaa98a3b7d3d22433cd523ae4..553a3f601ba7c76efa193d4a33823197c05281e7 100755 (executable)
@@ -221,7 +221,7 @@ test_expect_success 'setup' '
        rm -rf /.git &&
        echo "Initialized empty Git repository in /.git/" > expected &&
        git init > result &&
-       test_i18ncmp expected result
+       test_cmp expected result
 '
 
 test_vars 'auto gitdir, root' ".git" "/" ""
@@ -246,7 +246,7 @@ test_expect_success 'setup' '
        cd / &&
        echo "Initialized empty Git repository in /" > expected &&
        git init --bare > result &&
-       test_i18ncmp expected result
+       test_cmp expected result
 '
 
 test_vars 'auto gitdir, root' "." "" ""
index 242abbfa0bc2b3a1303665feee93e23f8c98a1f6..7891a6becf3a0b4092b2a3fd91ed6679e24cdd08 100755 (executable)
@@ -314,39 +314,39 @@ test_expect_success 'ambiguous short sha1 ref' '
        grep "refname.*${REF}.*ambiguous" err
 '
 
-test_expect_success C_LOCALE_OUTPUT 'ambiguity errors are not repeated (raw)' '
+test_expect_success 'ambiguity errors are not repeated (raw)' '
        test_must_fail git rev-parse 00000 2>stderr &&
        grep "is ambiguous" stderr >errors &&
        test_line_count = 1 errors
 '
 
-test_expect_success C_LOCALE_OUTPUT 'ambiguity errors are not repeated (treeish)' '
+test_expect_success 'ambiguity errors are not repeated (treeish)' '
        test_must_fail git rev-parse 00000:foo 2>stderr &&
        grep "is ambiguous" stderr >errors &&
        test_line_count = 1 errors
 '
 
-test_expect_success C_LOCALE_OUTPUT 'ambiguity errors are not repeated (peel)' '
+test_expect_success 'ambiguity errors are not repeated (peel)' '
        test_must_fail git rev-parse 00000^{commit} 2>stderr &&
        grep "is ambiguous" stderr >errors &&
        test_line_count = 1 errors
 '
 
-test_expect_success C_LOCALE_OUTPUT 'ambiguity hints' '
+test_expect_success 'ambiguity hints' '
        test_must_fail git rev-parse 000000000 2>stderr &&
        grep ^hint: stderr >hints &&
        # 16 candidates, plus one intro line
        test_line_count = 17 hints
 '
 
-test_expect_success C_LOCALE_OUTPUT 'ambiguity hints respect type' '
+test_expect_success 'ambiguity hints respect type' '
        test_must_fail git rev-parse 000000000^{commit} 2>stderr &&
        grep ^hint: stderr >hints &&
        # 5 commits, 1 tag (which is a committish), plus intro line
        test_line_count = 7 hints
 '
 
-test_expect_success C_LOCALE_OUTPUT 'failed type-selector still shows hint' '
+test_expect_success 'failed type-selector still shows hint' '
        # these two blobs share the same prefix "ee3d", but neither
        # will pass for a commit
        echo 851 | git hash-object --stdin -w &&
@@ -370,7 +370,7 @@ test_expect_success 'core.disambiguate does not override context' '
                git -c core.disambiguate=committish rev-parse $sha1^{tree}
 '
 
-test_expect_success C_LOCALE_OUTPUT 'ambiguous commits are printed by type first, then hash order' '
+test_expect_success 'ambiguous commits are printed by type first, then hash order' '
        test_must_fail git rev-parse 0000 2>stderr &&
        grep ^hint: stderr >hints &&
        grep 0000 hints >objects &&
index b7c31aa86a11ffbecd7c82a3ab3e920105caf71f..c9b9e718b89403012b8ce555b474698b8d567140 100755 (executable)
@@ -18,7 +18,7 @@ test_expect_success 'bogus GIT_INDEX_VERSION issues warning' '
                        warning: GIT_INDEX_VERSION set, but the value is invalid.
                        Using version Z
                EOF
-               test_i18ncmp expect.err actual.err
+               test_cmp expect.err actual.err
        )
 '
 
@@ -32,7 +32,7 @@ test_expect_success 'out of bounds GIT_INDEX_VERSION issues warning' '
                        warning: GIT_INDEX_VERSION set, but the value is invalid.
                        Using version Z
                EOF
-               test_i18ncmp expect.err actual.err
+               test_cmp expect.err actual.err
        )
 '
 
@@ -55,7 +55,7 @@ test_expect_success 'out of bounds index.version issues warning' '
                        warning: index.version set, but the value is invalid.
                        Using version Z
                EOF
-               test_i18ncmp expect.err actual.err
+               test_cmp expect.err actual.err
        )
 '
 
index 8e181dbf01c46a324b54471cc62e1c9291852079..7ff3edab05aec604b740608a29e54b4f257f8f8f 100755 (executable)
@@ -32,4 +32,27 @@ test_expect_success 'checkout-index reports errors (stdin)' '
        test_i18ngrep not.in.the.cache stderr
 '
 
+test_expect_success 'checkout-index --temp correctly reports error on missing blobs' '
+       test_when_finished git reset --hard &&
+       missing_blob=$(echo "no such blob here" | git hash-object --stdin) &&
+       cat >objs <<-EOF &&
+       100644 $missing_blob    file
+       120000 $missing_blob    symlink
+       EOF
+       git update-index --index-info <objs &&
+
+       test_must_fail git checkout-index --temp symlink file 2>stderr &&
+       test_i18ngrep "unable to read sha1 file of file ($missing_blob)" stderr &&
+       test_i18ngrep "unable to read sha1 file of symlink ($missing_blob)" stderr
+'
+
+test_expect_success 'checkout-index --temp correctly reports error for submodules' '
+       git init sub &&
+       test_commit -C sub file &&
+       git submodule add ./sub &&
+       git commit -m sub &&
+       test_must_fail git checkout-index --temp sub 2>stderr &&
+       test_i18ngrep "cannot create temporary submodule sub" stderr
+'
+
 test_done
index 5f761bc616ee5871055d6beed29e768b328f6827..93be1c0eae5ead7eeb4f37dab01dbc1c1fbacdba 100755 (executable)
@@ -150,7 +150,7 @@ test_expect_success 'checkout -b to @{-1} fails with the right branch name' '
        git checkout branch2 &&
        echo  >expect "fatal: A branch named '\''branch1'\'' already exists." &&
        test_must_fail git checkout -b @{-1} 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'checkout -B to an existing branch resets branch to HEAD' '
index b432b6427b62538580b5833188b0d211c748545e..bc46713a43e24193bae9a4be204455eb5c066501 100755 (executable)
@@ -163,7 +163,7 @@ test_expect_success 'tracking count is accurate after orphan check' '
        git config branch.child.merge refs/heads/main &&
        git checkout child^ &&
        git checkout child >stdout &&
-       test_i18ncmp expect stdout
+       test_cmp expect stdout
 '
 
 test_expect_success 'no advice given for explicit detached head state' '
@@ -237,15 +237,15 @@ test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not as
        sane_unset GIT_PRINT_SHA1_ELLIPSIS &&
        git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
        check_detached &&
-       test_i18ncmp 1st_detach actual &&
+       test_cmp 1st_detach actual &&
 
        GIT_PRINT_SHA1_ELLIPSIS="no" git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
        check_detached &&
-       test_i18ncmp 2nd_detach actual &&
+       test_cmp 2nd_detach actual &&
 
        GIT_PRINT_SHA1_ELLIPSIS= git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
        check_detached &&
-       test_i18ncmp 3rd_detach actual &&
+       test_cmp 3rd_detach actual &&
 
        sane_unset GIT_PRINT_SHA1_ELLIPSIS &&
 
@@ -256,17 +256,17 @@ test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not as
        # Make no mention of the env var at all
        git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
        check_detached &&
-       test_i18ncmp 1st_detach actual &&
+       test_cmp 1st_detach actual &&
 
        GIT_PRINT_SHA1_ELLIPSIS='nope' &&
        git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
        check_detached &&
-       test_i18ncmp 2nd_detach actual &&
+       test_cmp 2nd_detach actual &&
 
        GIT_PRINT_SHA1_ELLIPSIS=nein &&
        git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
        check_detached &&
-       test_i18ncmp 3rd_detach actual &&
+       test_cmp 3rd_detach actual &&
 
        true
 "
@@ -319,15 +319,15 @@ test_expect_success 'describe_detached_head does print SHA-1 ellipsis when asked
 
        GIT_PRINT_SHA1_ELLIPSIS=yes git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
        check_detached &&
-       test_i18ncmp 1st_detach actual &&
+       test_cmp 1st_detach actual &&
 
        GIT_PRINT_SHA1_ELLIPSIS=Yes git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
        check_detached &&
-       test_i18ncmp 2nd_detach actual &&
+       test_cmp 2nd_detach actual &&
 
        GIT_PRINT_SHA1_ELLIPSIS=YES git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
        check_detached &&
-       test_i18ncmp 3rd_detach actual &&
+       test_cmp 3rd_detach actual &&
 
        true
 "
index 7e2e7dd4ae5842bc49ccaf5dc116deb3b3d6b993..30666fc70d28264d036105659871a68323ce2460 100755 (executable)
@@ -9,6 +9,11 @@ test_description='skip-worktree bit test'
 
 sane_unset GIT_TEST_SPLIT_INDEX
 
+test_set_index_version () {
+    GIT_INDEX_VERSION="$1"
+    export GIT_INDEX_VERSION
+}
+
 test_set_index_version 3
 
 cat >expect.full <<EOF
index 7cb7a7038277fdf5e55e984f998d56324d7c62cd..45ca35d60ac5b750a635ef42f96275c4bb197692 100755 (executable)
@@ -135,7 +135,7 @@ test_expect_success 'add -n -u should not add but just report' '
        after=$(git ls-files -s check top) &&
 
        test "$before" = "$after" &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 
 '
 
index aff877590dfe4b98b9e8f89439b6ecd2b0af6516..a615d3b4838192af5acac8afd9a19e662553e409 100755 (executable)
@@ -23,7 +23,7 @@ test_expect_success 'prune files inside $GIT_DIR/worktrees' '
        cat >expect <<EOF &&
 Removing worktrees/abc: not a valid directory
 EOF
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
        ! test -f .git/worktrees/abc &&
        ! test -d .git/worktrees
 '
@@ -35,7 +35,7 @@ test_expect_success 'prune directories without gitdir' '
 Removing worktrees/def: gitdir file does not exist
 EOF
        git worktree prune --verbose >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
        ! test -d .git/worktrees/def &&
        ! test -d .git/worktrees
 '
index 42d35d9ae82f5e3084d1cc37512718565aa6c41a..fedcefe8de334f2925f0536b16fd405fecc52836 100755 (executable)
@@ -167,7 +167,7 @@ test_expect_success '"list" all worktrees --verbose with prunable' '
        rm -rf prunable &&
        git worktree list --verbose >out &&
        sed -n "s/  */ /g;/\/prunable  *[0-9a-f].*$/,/prunable: .*$/p" <out >actual &&
-       test_i18ncmp actual expect
+       test_cmp actual expect
 '
 
 test_expect_success 'bare repo setup' '
index 2ec69a8a266fa2438f960ef7d63d6517bbe61b78..727e9ae1a449ee4f105fe234b5041c6fbc397b45 100755 (executable)
@@ -46,7 +46,7 @@ test_expect_success 'ls-files -c' '
                ls ../x* >expect.out &&
                test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err &&
                test_cmp expect.out actual.out &&
-               test_i18ncmp expect.err actual.err
+               test_cmp expect.err actual.err
        )
 '
 
@@ -61,7 +61,7 @@ test_expect_success 'ls-files -o' '
                ls ../y* >expect.out &&
                test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err &&
                test_cmp expect.out actual.out &&
-               test_i18ncmp expect.err actual.err
+               test_cmp expect.err actual.err
        )
 '
 
index 00761e408015ddf60e1ce2cd5ab18032f79e3c68..cc4b10236e2c8335465185cff84105208b807aa9 100755 (executable)
@@ -695,7 +695,7 @@ test_expect_success 'deleting a symref' '
        git branch -d symref >actual &&
        test_path_is_file .git/refs/heads/target &&
        test_path_is_missing .git/refs/heads/symref &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'deleting a dangling symref' '
@@ -704,7 +704,7 @@ test_expect_success 'deleting a dangling symref' '
        echo "Deleted branch dangling-symref (was nowhere)." >expect &&
        git branch -d dangling-symref >actual &&
        test_path_is_missing .git/refs/heads/dangling-symref &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'deleting a self-referential symref' '
@@ -713,7 +713,7 @@ test_expect_success 'deleting a self-referential symref' '
        echo "Deleted branch self-reference (was refs/heads/self-reference)." >expect &&
        git branch -d self-reference >actual &&
        test_path_is_missing .git/refs/heads/self-reference &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'renaming a symref is not allowed' '
@@ -808,7 +808,7 @@ test_expect_success 'test deleting branch without config' '
        sha1=$(git rev-parse my7 | cut -c 1-7) &&
        echo "Deleted branch my7 (was $sha1)." >expect &&
        git branch -d my7 >actual 2>&1 &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'deleting currently checked out branch fails' '
@@ -843,7 +843,7 @@ test_expect_success 'branch from tag w/--track causes failure' '
 test_expect_success '--set-upstream-to fails on multiple branches' '
        echo "fatal: too many arguments to set new upstream" >expect &&
        test_must_fail git branch --set-upstream-to main a b c 2>err &&
-       test_i18ncmp expect err
+       test_cmp expect err
 '
 
 test_expect_success '--set-upstream-to fails on detached HEAD' '
@@ -851,13 +851,13 @@ test_expect_success '--set-upstream-to fails on detached HEAD' '
        test_when_finished git checkout - &&
        echo "fatal: could not set upstream of HEAD to main when it does not point to any branch." >expect &&
        test_must_fail git branch --set-upstream-to main 2>err &&
-       test_i18ncmp expect err
+       test_cmp expect err
 '
 
 test_expect_success '--set-upstream-to fails on a missing dst branch' '
        echo "fatal: branch '"'"'does-not-exist'"'"' does not exist" >expect &&
        test_must_fail git branch --set-upstream-to main does-not-exist 2>err &&
-       test_i18ncmp expect err
+       test_cmp expect err
 '
 
 test_expect_success '--set-upstream-to fails on a missing src branch' '
@@ -868,7 +868,7 @@ test_expect_success '--set-upstream-to fails on a missing src branch' '
 test_expect_success '--set-upstream-to fails on a non-ref' '
        echo "fatal: Cannot setup tracking information; starting point '"'"'HEAD^{}'"'"' is not a branch." >expect &&
        test_must_fail git branch --set-upstream-to HEAD^{} 2>err &&
-       test_i18ncmp expect err
+       test_cmp expect err
 '
 
 test_expect_success '--set-upstream-to fails on locked config' '
@@ -899,7 +899,7 @@ test_expect_success 'use --set-upstream-to modify a particular branch' '
 test_expect_success '--unset-upstream should fail if given a non-existent branch' '
        echo "fatal: Branch '"'"'i-dont-exist'"'"' has no upstream information" >expect &&
        test_must_fail git branch --unset-upstream i-dont-exist 2>err &&
-       test_i18ncmp expect err
+       test_cmp expect err
 '
 
 test_expect_success '--unset-upstream should fail if config is locked' '
@@ -921,13 +921,13 @@ test_expect_success 'test --unset-upstream on HEAD' '
        # fail for a branch without upstream set
        echo "fatal: Branch '"'"'main'"'"' has no upstream information" >expect &&
        test_must_fail git branch --unset-upstream 2>err &&
-       test_i18ncmp expect err
+       test_cmp expect err
 '
 
 test_expect_success '--unset-upstream should fail on multiple branches' '
        echo "fatal: too many arguments to unset upstream" >expect &&
        test_must_fail git branch --unset-upstream a b c 2>err &&
-       test_i18ncmp expect err
+       test_cmp expect err
 '
 
 test_expect_success '--unset-upstream should fail on detached HEAD' '
@@ -935,7 +935,7 @@ test_expect_success '--unset-upstream should fail on detached HEAD' '
        test_when_finished git checkout - &&
        echo "fatal: could not unset upstream of HEAD when it does not point to any branch." >expect &&
        test_must_fail git branch --unset-upstream 2>err &&
-       test_i18ncmp expect err
+       test_cmp expect err
 '
 
 test_expect_success 'test --unset-upstream on a particular branch' '
@@ -957,7 +957,7 @@ test_expect_success '--set-upstream-to notices an error to set branch as own ups
        EOF
        test_expect_code 1 git config branch.my13.remote &&
        test_expect_code 1 git config branch.my13.merge &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 # Keep this test last, as it changes the current branch
index 578b5f48255deb3f1ef547a224a7c6169f2251fc..349a810cee11df36dda3c8ed4bbca3df58040001 100755 (executable)
@@ -264,7 +264,7 @@ test_expect_success 'branch --merged with --verbose' '
        * topic $(git rev-parse --short topic ) [ahead 1] foo
          zzz   $(git rev-parse --short zzz   ) second on main
        EOF
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_done
index b6fcd017afe9d9bdcb470071b849d69322ba5443..5325b9f67a00783974c34b4ac88431b903b3ccec 100755 (executable)
@@ -160,7 +160,7 @@ test_expect_success 'git branch shows detached HEAD properly' '
 EOF
        git checkout HEAD^0 &&
        git branch >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'git branch shows detached HEAD properly after checkout --detach' '
@@ -173,7 +173,7 @@ test_expect_success 'git branch shows detached HEAD properly after checkout --de
 EOF
        git checkout --detach &&
        git branch >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'git branch shows detached HEAD properly after moving' '
@@ -185,7 +185,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving' '
 EOF
        git reset --hard HEAD^1 &&
        git branch >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'git branch shows detached HEAD properly from tag' '
@@ -198,7 +198,7 @@ EOF
        git tag fromtag main &&
        git checkout fromtag &&
        git branch >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'git branch shows detached HEAD properly after moving from tag' '
@@ -210,7 +210,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving from t
 EOF
        git reset --hard HEAD^1 &&
        git branch >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'git branch `--sort=[-]objectsize` option' '
@@ -221,7 +221,7 @@ test_expect_success 'git branch `--sort=[-]objectsize` option' '
          main
        EOF
        git branch --sort=objectsize >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        cat >expect <<-\EOF &&
        * (HEAD detached from fromtag)
@@ -230,7 +230,7 @@ test_expect_success 'git branch `--sort=[-]objectsize` option' '
          branch-two
        EOF
        git branch --sort=-objectsize >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'git branch `--sort=[-]type` option' '
@@ -241,7 +241,7 @@ test_expect_success 'git branch `--sort=[-]type` option' '
          main
        EOF
        git branch --sort=type >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        cat >expect <<-\EOF &&
        * (HEAD detached from fromtag)
@@ -250,7 +250,7 @@ test_expect_success 'git branch `--sort=[-]type` option' '
          main
        EOF
        git branch --sort=-type >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'git branch `--sort=[-]version:refname` option' '
@@ -261,7 +261,7 @@ test_expect_success 'git branch `--sort=[-]version:refname` option' '
          main
        EOF
        git branch --sort=version:refname >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        cat >expect <<-\EOF &&
        * (HEAD detached from fromtag)
@@ -270,7 +270,7 @@ test_expect_success 'git branch `--sort=[-]version:refname` option' '
          branch-one
        EOF
        git branch --sort=-version:refname >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'git branch --points-at option' '
@@ -337,7 +337,7 @@ test_expect_success 'git branch --format option' '
        Refname is refs/heads/ref-to-remote
        EOF
        git branch --format="Refname is %(refname)" >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'worktree colors correct' '
@@ -355,7 +355,7 @@ test_expect_success 'worktree colors correct' '
        rm -r worktree_dir &&
        git worktree prune &&
        test_decode_color <actual.raw >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success "set up color tests" '
@@ -398,7 +398,7 @@ test_expect_success 'verbose output lists worktree path' '
        git branch -vv >actual &&
        rm -r worktree_dir &&
        git worktree prune &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_done
index 04de03cad0a7466106a125205742b5feea1b1e2f..f5bf16abcd8ce2aae5929129913cbb8927b06539 100755 (executable)
@@ -181,7 +181,7 @@ test_expect_success 'diffstat for rename quotes funny filename' '
        git diff-index -M -p $t0 >diff &&
        git apply --stat <diff >diffstat &&
        sed -e "s/|.*//" -e "s/ *\$//" <diffstat >current &&
-       test_i18ncmp expected current
+       test_cmp expected current
 '
 
 test_expect_success 'numstat for rename quotes funny filename' '
index 5e88a10f8d770ff53e05a4005bd4aa6d7b90918c..587b408063a8f705124fa44855f15cdd4c873a4c 100755 (executable)
@@ -113,7 +113,7 @@ test_expect_success 'rebase off of the previous branch using "-"' '
        test_cmp expect.forkpoint actual.forkpoint &&
        # the next one is dubious---we may want to say "-",
        # instead of @{-1}, in the message
-       test_i18ncmp expect.messages actual.messages
+       test_cmp expect.messages actual.messages
 '
 
 test_expect_success 'rebase a single mode change' '
index 1e738df81d574e2e68d343a67afae266443e39c6..66bcbbf9528cec9e372f39be80e23fa789aabbd2 100755 (executable)
@@ -86,7 +86,7 @@ test_expect_success 'rebase -i with empty todo list' '
                        git rebase -i HEAD^ >output 2>&1
        ) &&
        tail -n 1 output >actual &&  # Ignore output about changing todo list
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'rebase -i with the exec command' '
@@ -101,7 +101,8 @@ test_expect_success 'rebase -i with the exec command' '
        ) &&
        test_path_is_file touch-one &&
        test_path_is_file touch-two &&
-       test_path_is_missing touch-three " (should have stopped before)" &&
+       # Missing because we should have stopped by now.
+       test_path_is_missing touch-three &&
        test_cmp_rev C HEAD &&
        git rebase --continue &&
        test_path_is_file touch-three &&
@@ -158,9 +159,9 @@ test_expect_success 'rebase -x with empty command fails' '
        test_when_finished "git rebase --abort ||:" &&
        test_must_fail env git rebase -x "" @ 2>actual &&
        test_write_lines "error: empty exec command" >expected &&
-       test_i18ncmp expected actual &&
+       test_cmp expected actual &&
        test_must_fail env git rebase -x " " @ 2>actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'rebase -x with newline in command fails' '
@@ -168,7 +169,7 @@ test_expect_success 'rebase -x with newline in command fails' '
        test_must_fail env git rebase -x "a${LF}b" @ 2>actual &&
        test_write_lines "error: exec commands cannot contain newlines" \
                         >expected &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'rebase -i with exec of inexistent command' '
@@ -450,7 +451,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '
        grep "^ file1 | 2 +-$" output
 '
 
-test_expect_success C_LOCALE_OUTPUT 'multi-squash only fires up editor once' '
+test_expect_success 'multi-squash only fires up editor once' '
        base=$(git rev-parse HEAD~4) &&
        (
                set_fake_editor &&
@@ -463,7 +464,7 @@ test_expect_success C_LOCALE_OUTPUT 'multi-squash only fires up editor once' '
        test 1 = $(git show | grep ONCE | wc -l)
 '
 
-test_expect_success C_LOCALE_OUTPUT 'multi-fixup does not fire up editor' '
+test_expect_success 'multi-fixup does not fire up editor' '
        git checkout -b multi-fixup E &&
        base=$(git rev-parse HEAD~4) &&
        (
@@ -514,7 +515,7 @@ test_expect_success 'commit message retained after conflict' '
        git branch -D conflict-squash
 '
 
-test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messages' '
+test_expect_success 'squash and fixup generate correct log messages' '
        cat >expect-squash-fixup <<-\EOF &&
        B
 
@@ -541,7 +542,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messa
        git branch -D squash-fixup
 '
 
-test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' '
+test_expect_success 'squash ignores comments' '
        git checkout -b skip-comments E &&
        base=$(git rev-parse HEAD~4) &&
        (
@@ -557,7 +558,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' '
        git branch -D skip-comments
 '
 
-test_expect_success C_LOCALE_OUTPUT 'squash ignores blank lines' '
+test_expect_success 'squash ignores blank lines' '
        git checkout -b skip-blank-lines E &&
        base=$(git rev-parse HEAD~4) &&
        (
@@ -995,7 +996,7 @@ test_expect_success 'rebase -ix with several instances of --exec' '
        test_cmp expected actual
 '
 
-test_expect_success C_LOCALE_OUTPUT 'rebase -ix with --autosquash' '
+test_expect_success 'rebase -ix with --autosquash' '
        git reset --hard execute &&
        git checkout -b autosquash &&
        echo second >second.txt &&
@@ -1136,7 +1137,7 @@ test_expect_success 'rebase -i --root reword root when root has untracked file c
        test "$(git rev-list --count HEAD)" = 2
 '
 
-test_expect_success C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-interactive rebase' '
+test_expect_success 'rebase --edit-todo does not work on non-interactive rebase' '
        git checkout reword-original-root-branch &&
        git reset --hard &&
        git checkout conflict-branch &&
@@ -1465,7 +1466,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '
                FAKE_LINES="1 2 3 4" git rebase -i --root 2>actual.2
        ) &&
        head -n4 actual.2 >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
        test D = $(git cat-file commit HEAD | sed -ne \$p)
 '
 
@@ -1489,7 +1490,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' '
                set_fake_editor &&
                test_must_fail env FAKE_LINES="1 2 4" \
                        git rebase -i --root 2>actual &&
-               test_i18ncmp expect actual &&
+               test_cmp expect actual &&
                cp .git/rebase-merge/git-rebase-todo.backup \
                        .git/rebase-merge/git-rebase-todo &&
                FAKE_LINES="1 2 drop 3 4 drop 5" git rebase --edit-todo
@@ -1535,11 +1536,11 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = wa
                cp .git/rebase-merge/git-rebase-todo.backup orig &&
                FAKE_LINES="2 3 4" git rebase --edit-todo 2>actual.2 &&
                head -n6 actual.2 >actual &&
-               test_i18ncmp expect actual &&
+               test_cmp expect actual &&
                cp orig .git/rebase-merge/git-rebase-todo &&
                FAKE_LINES="1 2 3 4" git rebase --edit-todo 2>actual.2 &&
                head -n4 actual.2 >actual &&
-               test_i18ncmp expect.3 actual &&
+               test_cmp expect.3 actual &&
                git rebase --continue 2>actual
        ) &&
        test D = $(git cat-file commit HEAD | sed -ne \$p) &&
@@ -1575,16 +1576,16 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = er
                cp .git/rebase-merge/git-rebase-todo.backup orig &&
                test_must_fail env FAKE_LINES="2 3 4" \
                        git rebase --edit-todo 2>actual &&
-               test_i18ncmp expect actual &&
+               test_cmp expect actual &&
                test_must_fail git rebase --continue 2>actual &&
-               test_i18ncmp expect.2 actual &&
+               test_cmp expect.2 actual &&
                test_must_fail git rebase --edit-todo &&
                cp orig .git/rebase-merge/git-rebase-todo &&
                test_must_fail env FAKE_LINES="1 2 3 4" \
                        git rebase --edit-todo 2>actual &&
-               test_i18ncmp expect.3 actual &&
+               test_cmp expect.3 actual &&
                test_must_fail git rebase --continue 2>actual &&
-               test_i18ncmp expect.3 actual &&
+               test_cmp expect.3 actual &&
                cp orig .git/rebase-merge/git-rebase-todo &&
                FAKE_LINES="1 2 3 4 drop 5" git rebase --edit-todo &&
                git rebase --continue 2>actual
index 36f169d7f15559c0e7cd129365e404ec5ad99b03..908016c2f883e393b0d5da97d6183c3edab6a035 100755 (executable)
@@ -306,23 +306,23 @@ test_auto_fixup_fixup () {
        fi
 }
 
-test_expect_success C_LOCALE_OUTPUT 'fixup! fixup!' '
+test_expect_success 'fixup! fixup!' '
        test_auto_fixup_fixup fixup fixup
 '
 
-test_expect_success C_LOCALE_OUTPUT 'fixup! squash!' '
+test_expect_success 'fixup! squash!' '
        test_auto_fixup_fixup fixup squash
 '
 
-test_expect_success C_LOCALE_OUTPUT 'squash! squash!' '
+test_expect_success 'squash! squash!' '
        test_auto_fixup_fixup squash squash
 '
 
-test_expect_success C_LOCALE_OUTPUT 'squash! fixup!' '
+test_expect_success 'squash! fixup!' '
        test_auto_fixup_fixup squash fixup
 '
 
-test_expect_success C_LOCALE_OUTPUT 'autosquash with custom inst format' '
+test_expect_success 'autosquash with custom inst format' '
        git reset --hard base &&
        git config --add rebase.instructionFormat "[%an @ %ar] %s"  &&
        echo 2 >file1 &&
index 4caa014c71c442f181b2668a3690c4e6ce1806db..43fcb68f27e439b5542e82a85bc77e401adc6e98 100755 (executable)
@@ -110,7 +110,7 @@ testrebase () {
                fi &&
                create_expected_success_$suffix &&
                sed "$remove_progress_re" <actual >actual2 &&
-               test_i18ncmp expected actual2
+               test_cmp expected actual2
        '
 
        test_expect_success "rebase$type: dirty index, non-conflicting rebase" '
@@ -231,7 +231,7 @@ testrebase () {
                fi &&
                create_expected_failure_$suffix &&
                sed "$remove_progress_re" <actual >actual2 &&
-               test_i18ncmp expected actual2
+               test_cmp expected actual2
        '
 }
 
index 9198535874c9788df49b6ad71183b5372d44eacd..4581ae98b87cf1f05d018cfc07599e8e26d256da 100755 (executable)
@@ -74,10 +74,10 @@ test_expect_success 'cherry-pick --continue rejects --rerere-autoupdate' '
        git diff-files --quiet &&
        test_must_fail git cherry-pick --continue --rerere-autoupdate >actual 2>&1 &&
        echo "fatal: cherry-pick: --rerere-autoupdate cannot be used with --continue" >expect &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
        test_must_fail git cherry-pick --continue --no-rerere-autoupdate >actual 2>&1 &&
        echo "fatal: cherry-pick: --no-rerere-autoupdate cannot be used with --continue" >expect &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
        git cherry-pick --abort
 '
 
index 5f4564c830682223187f160b343a1a8604a49018..014001b8f325c0f1d8b140e7828332bb15610574 100755 (executable)
@@ -59,7 +59,7 @@ test_expect_success 'advice from failed cherry-pick' "
        EOF
        test_must_fail git cherry-pick picked 2>actual &&
 
-       test_i18ncmp expected actual
+       test_cmp expected actual
 "
 
 test_expect_success 'advice from failed cherry-pick --no-commit' "
@@ -73,7 +73,7 @@ test_expect_success 'advice from failed cherry-pick --no-commit' "
        EOF
        test_must_fail git cherry-pick --no-commit picked 2>actual &&
 
-       test_i18ncmp expected actual
+       test_cmp expected actual
 "
 
 test_expect_success 'failed cherry-pick sets CHERRY_PICK_HEAD' '
@@ -256,7 +256,7 @@ test_expect_success \
 
        test_must_fail git cherry-pick picked &&
 
-       test_i18ncmp expected .git/MERGE_MSG
+       test_cmp expected .git/MERGE_MSG
 '
 
 test_expect_success \
@@ -276,7 +276,7 @@ test_expect_success \
 
        test_must_fail git cherry-pick --cleanup=scissors picked &&
 
-       test_i18ncmp expected .git/MERGE_MSG
+       test_cmp expected .git/MERGE_MSG
 '
 
 test_expect_success 'failed cherry-pick describes conflict in work tree' '
@@ -465,7 +465,7 @@ test_expect_success \
        test_must_fail git revert picked &&
 
        sed "s/$OID_REGEX/OBJID/" .git/MERGE_MSG >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success \
@@ -488,7 +488,7 @@ test_expect_success \
        test_must_fail git revert --cleanup=scissors picked &&
 
        sed "s/$OID_REGEX/OBJID/" .git/MERGE_MSG >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'failed cherry-pick does not forget -s' '
index ec7a2c9fcfa2f2636c428ed78b12050cfa733d46..e8375d1c970e3313302a2580d742f1e88732070c 100755 (executable)
@@ -86,7 +86,7 @@ test_expect_success 'output to keep user entertained during multi-pick' '
        git cherry-pick first..fourth >actual &&
        sed -e "s/$_x05[0-9a-f][0-9a-f]/OBJID/" <actual >actual.fuzzy &&
        test_line_count -ge 3 actual.fuzzy &&
-       test_i18ncmp expected actual.fuzzy
+       test_cmp expected actual.fuzzy
 '
 
 test_expect_success 'cherry-pick --strategy resolve first..fourth works' '
@@ -123,7 +123,7 @@ test_expect_success 'output during multi-pick indicates merge strategy' '
        test_tick &&
        git cherry-pick --strategy resolve first..fourth >actual &&
        sed -e "s/$_x05[0-9a-f][0-9a-f]/OBJID/" <actual >actual.fuzzy &&
-       test_i18ncmp expected actual.fuzzy
+       test_cmp expected actual.fuzzy
 '
 
 test_expect_success 'cherry-pick --ff first..fourth works' '
index 5b94fdaa6713a2bcf7958d6630925a09fea05ed6..b76cb6de91d0dd67bb242fcad1bc88b4c8a4901f 100755 (executable)
@@ -170,7 +170,7 @@ test_expect_success 'check advice when we move HEAD by committing' '
        git commit -a &&
        test_path_is_missing .git/CHERRY_PICK_HEAD &&
        test_must_fail git cherry-pick --skip 2>advice &&
-       test_i18ncmp expect advice
+       test_cmp expect advice
 '
 
 test_expect_success 'selectively advise --skip while launching another sequence' '
@@ -182,7 +182,7 @@ test_expect_success 'selectively advise --skip while launching another sequence'
        EOF
        test_must_fail git cherry-pick picked..yetanotherpick &&
        test_must_fail git cherry-pick picked..yetanotherpick 2>advice &&
-       test_i18ncmp expect advice &&
+       test_cmp expect advice &&
        cat >expect <<-EOF &&
        error: cherry-pick is already in progress
        hint: try "git cherry-pick (--continue | --abort | --quit)"
@@ -190,7 +190,7 @@ test_expect_success 'selectively advise --skip while launching another sequence'
        EOF
        git reset --merge &&
        test_must_fail git cherry-pick picked..yetanotherpick 2>advice &&
-       test_i18ncmp expect advice
+       test_cmp expect advice
 '
 
 test_expect_success 'allow skipping commit but not abort for a new history' '
@@ -204,7 +204,7 @@ test_expect_success 'allow skipping commit but not abort for a new history' '
        test_must_fail git cherry-pick anotherpick &&
        test_must_fail git cherry-pick --abort 2>advice &&
        git cherry-pick --skip &&
-       test_i18ncmp expect advice
+       test_cmp expect advice
 '
 
 test_expect_success 'allow skipping stopped cherry-pick because of untracked file modifications' '
index 7547f11a5c760726c2777e2dde33abe37b6fc3ac..bb9ef35dac082e396d5cbcbdc83bc5394fb95a7c 100755 (executable)
@@ -454,7 +454,7 @@ test_expect_success 'rm issues a warning when section is not found in .gitmodule
        git add .gitmodules &&
        echo "warning: Could not find section in .gitmodules where path=submod" >expect.err &&
        git rm submod >actual 2>actual.err &&
-       test_i18ncmp expect.err actual.err &&
+       test_cmp expect.err actual.err &&
        test_path_is_missing submod &&
        test_path_is_missing submod/.git &&
        git status -s -uno >actual &&
@@ -824,7 +824,7 @@ test_expect_success 'rm files with different staged content' '
        echo content1 >foo.txt &&
        echo content1 >bar.txt &&
        test_must_fail git rm foo.txt bar.txt 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'rm files with different staged content without hints' '
@@ -837,7 +837,7 @@ test_expect_success 'rm files with different staged content without hints' '
        echo content2 >foo.txt &&
        echo content2 >bar.txt &&
        test_must_fail git -c advice.rmhints=false rm foo.txt bar.txt 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'rm file with local modification' '
@@ -849,7 +849,7 @@ test_expect_success 'rm file with local modification' '
        git commit -m "testing rm 3" &&
        echo content3 >foo.txt &&
        test_must_fail git rm foo.txt 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'rm file with local modification without hints' '
@@ -859,7 +859,7 @@ test_expect_success 'rm file with local modification without hints' '
        EOF
        echo content4 >bar.txt &&
        test_must_fail git -c advice.rmhints=false rm bar.txt 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'rm file with changes in the index' '
@@ -872,7 +872,7 @@ test_expect_success 'rm file with changes in the index' '
        echo content5 >foo.txt &&
        git add foo.txt &&
        test_must_fail git rm foo.txt 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'rm file with changes in the index without hints' '
@@ -881,7 +881,7 @@ test_expect_success 'rm file with changes in the index without hints' '
            foo.txt
        EOF
        test_must_fail git -c advice.rmhints=false rm foo.txt 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'rm files with two different errors' '
@@ -900,7 +900,7 @@ test_expect_success 'rm files with two different errors' '
        echo content6 >bar1.txt &&
        git add bar1.txt &&
        test_must_fail git rm bar1.txt foo1.txt 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'rm empty string should fail' '
index b7d4ba608cbc96998fdac714ebb53a0f53c46f9e..dda84004f96fa89c17f4226072d978a7a1f2c84c 100755 (executable)
@@ -304,7 +304,7 @@ test_expect_success 'error on a repository with no commits' '
        error: '"'empty/'"' does not have a commit checked out
        fatal: adding files failed
        EOF
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'git add --dry-run of existing changed file' "
@@ -320,7 +320,7 @@ test_expect_success 'git add --dry-run of non-existing file' "
 
 test_expect_success 'git add --dry-run of an existing file output' "
        echo \"fatal: pathspec 'ignored-file' did not match any files\" >expect &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 "
 
 cat >expect.err <<\EOF
@@ -339,8 +339,8 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
 '
 
 test_expect_success 'git add --dry-run --ignore-missing of non-existing file output' '
-       test_i18ncmp expect.out actual.out &&
-       test_i18ncmp expect.err actual.err
+       test_cmp expect.out actual.out &&
+       test_cmp expect.err actual.err
 '
 
 test_expect_success 'git add empty string should fail' '
index b2f90997dbc0457b8d06563977e2d7f4b1fc345d..207714655f283971f791b4ab2426aa0d7b910080 100755 (executable)
@@ -370,7 +370,7 @@ test_expect_success 'setup expected' '
 '
 
 # Test splitting the first patch, then adding both
-test_expect_success C_LOCALE_OUTPUT 'add first line works' '
+test_expect_success 'add first line works' '
        git commit -am "clear local changes" &&
        git apply patch &&
        printf "%s\n" s y y | git add -p file 2>error |
@@ -974,7 +974,7 @@ test_expect_success 'show help from add--helper' '
        EOF
        test_write_lines h | force_color git add -i >actual.colored &&
        test_decode_color <actual.colored >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_done
index 86bfeb271ecb616d64cf483d8a46e33fa55ecc7b..60a666da595cf359b9132fb359960e43ea7e2f41 100755 (executable)
@@ -13,13 +13,11 @@ test_description='git mktag: tag object verify test'
 
 check_verify_failure () {
        test_expect_success "$1" "
-               test_must_fail env GIT_TEST_GETTEXT_POISON=false \
-                       git mktag <tag.sig 2>message &&
+               test_must_fail git mktag <tag.sig 2>message &&
                grep '$2' message &&
                if test '$3' != '--no-strict'
                then
-                       test_must_fail env GIT_TEST_GETTEXT_POISON=false \
-                               git mktag --no-strict <tag.sig 2>message.no-strict &&
+                       test_must_fail git mktag --no-strict <tag.sig 2>message.no-strict &&xb
                        grep '$2' message.no-strict
                fi
        "
@@ -443,11 +441,9 @@ test_expect_success 'invalid header entry config & fsck' '
        git -c fsck.extraHeaderEntry=ignore mktag --no-strict <tag.sig &&
 
        git fsck &&
-       env GIT_TEST_GETTEXT_POISON=false \
-               git -c fsck.extraHeaderEntry=warn fsck 2>err &&
+       git -c fsck.extraHeaderEntry=warn fsck 2>err &&
        grep "warning .*extraHeaderEntry:" err &&
-       test_must_fail env GIT_TEST_GETTEXT_POISON=false \
-               git -c fsck.extraHeaderEntry=error 2>err fsck &&
+       test_must_fail git -c fsck.extraHeaderEntry=error 2>err fsck &&
        grep "error .* extraHeaderEntry:" err
 '
 
index 84b039e5739378fd6ef1365d643304b862a7b95a..5f282ecf6175d381242b13178b9088a76cd28805 100755 (executable)
@@ -564,7 +564,7 @@ test_expect_success 'stash show format defaults to --stat' '
         1 file changed, 1 insertion(+)
        EOF
        git stash show ${STASH_ID} >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'stash show - stashes on stack, stash-like argument' '
@@ -792,7 +792,7 @@ test_expect_success 'apply: show same status as git status (relative to ./)' '
                git stash apply
        ) |
        sed -e 1d >actual && # drop "Saved..."
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat >expect <<EOF
@@ -1114,7 +1114,7 @@ test_expect_success 'stash push -p with pathspec shows no changes only once' '
        git stash push -p foo >actual &&
        echo "No local changes to save" >expect &&
        git reset --hard HEAD~ &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'push <pathspec>: show no changes when there are none' '
@@ -1124,7 +1124,7 @@ test_expect_success 'push <pathspec>: show no changes when there are none' '
        git stash push foo >actual &&
        echo "No local changes to save" >expect &&
        git reset --hard HEAD~ &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'push: <pathspec> not in the repository errors out' '
index f075c7f1f3165adc256e0018d26c34e8f7823b96..598b17f6d4de87f566f5f8d2cde2ac3e43b5c427 100755 (executable)
@@ -8,16 +8,16 @@ test_description='Test git stash --include-untracked'
 . ./test-lib.sh
 
 test_expect_success 'stash save --include-untracked some dirty working directory' '
-       echo 1 > file &&
+       echo 1 >file &&
        git add file &&
        test_tick &&
        git commit -m initial &&
-       echo 2 > file &&
+       echo 2 >file &&
        git add file &&
-       echo 3 > file &&
+       echo 3 >file &&
        test_tick &&
-       echo 1 > file2 &&
-       echo 1 > HEAD &&
+       echo 1 >file2 &&
+       echo 1 >HEAD &&
        mkdir untracked &&
        echo untracked >untracked/untracked &&
        git stash --include-untracked &&
@@ -25,48 +25,50 @@ test_expect_success 'stash save --include-untracked some dirty working directory
        git diff-index --cached --quiet HEAD
 '
 
-cat > expect <<EOF
-?? actual
-?? expect
-EOF
-
 test_expect_success 'stash save --include-untracked cleaned the untracked files' '
+       cat >expect <<-EOF &&
+       ?? actual
+       ?? expect
+       EOF
+
        git status --porcelain >actual &&
        test_cmp expect actual
 '
 
-tracked=$(git rev-parse --short $(echo 1 | git hash-object --stdin))
-untracked=$(git rev-parse --short $(echo untracked | git hash-object --stdin))
-cat > expect.diff <<EOF
-diff --git a/HEAD b/HEAD
-new file mode 100644
-index 0000000..$tracked
---- /dev/null
-+++ b/HEAD
-@@ -0,0 +1 @@
-+1
-diff --git a/file2 b/file2
-new file mode 100644
-index 0000000..$tracked
---- /dev/null
-+++ b/file2
-@@ -0,0 +1 @@
-+1
-diff --git a/untracked/untracked b/untracked/untracked
-new file mode 100644
-index 0000000..$untracked
---- /dev/null
-+++ b/untracked/untracked
-@@ -0,0 +1 @@
-+untracked
-EOF
-cat > expect.lstree <<EOF
-HEAD
-file2
-untracked
-EOF
-
 test_expect_success 'stash save --include-untracked stashed the untracked files' '
+       one_blob=$(echo 1 | git hash-object --stdin) &&
+       tracked=$(git rev-parse --short "$one_blob") &&
+       untracked_blob=$(echo untracked | git hash-object --stdin) &&
+       untracked=$(git rev-parse --short "$untracked_blob") &&
+       cat >expect.diff <<-EOF &&
+       diff --git a/HEAD b/HEAD
+       new file mode 100644
+       index 0000000..$tracked
+       --- /dev/null
+       +++ b/HEAD
+       @@ -0,0 +1 @@
+       +1
+       diff --git a/file2 b/file2
+       new file mode 100644
+       index 0000000..$tracked
+       --- /dev/null
+       +++ b/file2
+       @@ -0,0 +1 @@
+       +1
+       diff --git a/untracked/untracked b/untracked/untracked
+       new file mode 100644
+       index 0000000..$untracked
+       --- /dev/null
+       +++ b/untracked/untracked
+       @@ -0,0 +1 @@
+       +untracked
+       EOF
+       cat >expect.lstree <<-EOF &&
+       HEAD
+       file2
+       untracked
+       EOF
+
        test_path_is_missing file2 &&
        test_path_is_missing untracked &&
        test_path_is_missing HEAD &&
@@ -83,57 +85,64 @@ test_expect_success 'stash save --patch --all fails' '
        test_must_fail git stash --patch --all
 '
 
-git clean --force --quiet
+test_expect_success 'clean up untracked/untracked file to prepare for next tests' '
+       git clean --force --quiet
 
-cat > expect <<EOF
- M file
-?? HEAD
-?? actual
-?? expect
-?? file2
-?? untracked/
-EOF
+'
 
 test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '
+       cat >expect <<-EOF &&
+        M file
+       ?? HEAD
+       ?? actual
+       ?? expect
+       ?? file2
+       ?? untracked/
+       EOF
+
        git stash pop &&
        git status --porcelain >actual &&
        test_cmp expect actual &&
-       test "1" = "$(cat file2)" &&
-       test untracked = "$(cat untracked/untracked)"
+       echo 1 >expect_file2 &&
+       test_cmp expect_file2 file2 &&
+       echo untracked >untracked_expect &&
+       test_cmp untracked_expect untracked/untracked
 '
 
-git clean --force --quiet -d
+test_expect_success 'clean up untracked/ directory to prepare for next tests' '
+       git clean --force --quiet -d
+'
 
 test_expect_success 'stash save -u dirty index' '
-       echo 4 > file3 &&
+       echo 4 >file3 &&
        git add file3 &&
        test_tick &&
        git stash -u
 '
 
-blob=$(git rev-parse --short $(echo 4 | git hash-object --stdin))
-cat > expect <<EOF
-diff --git a/file3 b/file3
-new file mode 100644
-index 0000000..$blob
---- /dev/null
-+++ b/file3
-@@ -0,0 +1 @@
-+4
-EOF
-
 test_expect_success 'stash save --include-untracked dirty index got stashed' '
+       four_blob=$(echo 4 | git hash-object --stdin) &&
+       blob=$(git rev-parse --short "$four_blob") &&
+       cat >expect <<-EOF &&
+       diff --git a/file3 b/file3
+       new file mode 100644
+       index 0000000..$blob
+       --- /dev/null
+       +++ b/file3
+       @@ -0,0 +1 @@
+       +4
+       EOF
+
        git stash pop --index &&
+       test_when_finished "git reset" &&
        git diff --cached >actual &&
        test_cmp expect actual
 '
 
-git reset > /dev/null
-
 # Must direct output somewhere where it won't be considered an untracked file
 test_expect_success 'stash save --include-untracked -q is quiet' '
-       echo 1 > file5 &&
-       git stash save --include-untracked --quiet > .git/stash-output.out 2>&1 &&
+       echo 1 >file5 &&
+       git stash save --include-untracked --quiet >.git/stash-output.out 2>&1 &&
        test_line_count = 0 .git/stash-output.out &&
        rm -f .git/stash-output.out
 '
@@ -141,35 +150,34 @@ test_expect_success 'stash save --include-untracked -q is quiet' '
 test_expect_success 'stash save --include-untracked removed files' '
        rm -f file &&
        git stash save --include-untracked &&
-       echo 1 > expect &&
+       echo 1 >expect &&
+       test_when_finished "rm -f expect" &&
        test_cmp expect file
 '
 
-rm -f expect
-
 test_expect_success 'stash save --include-untracked removed files got stashed' '
        git stash pop &&
        test_path_is_missing file
 '
 
-cat > .gitignore <<EOF
-.gitignore
-ignored
-ignored.d/
-EOF
-
 test_expect_success 'stash save --include-untracked respects .gitignore' '
-       echo ignored > ignored &&
+       cat >.gitignore <<-EOF &&
+       .gitignore
+       ignored
+       ignored.d/
+       EOF
+
+       echo ignored >ignored &&
        mkdir ignored.d &&
        echo ignored >ignored.d/untracked &&
        git stash -u &&
-       test -s ignored &&
-       test -s ignored.d/untracked &&
-       test -s .gitignore
+       test_file_not_empty ignored &&
+       test_file_not_empty ignored.d/untracked &&
+       test_file_not_empty .gitignore
 '
 
 test_expect_success 'stash save -u can stash with only untracked files different' '
-       echo 4 > file4 &&
+       echo 4 >file4 &&
        git stash -u &&
        test_path_is_missing file4
 '
@@ -183,9 +191,9 @@ test_expect_success 'stash save --all does not respect .gitignore' '
 
 test_expect_success 'stash save --all is stash poppable' '
        git stash pop &&
-       test -s ignored &&
-       test -s ignored.d/untracked &&
-       test -s .gitignore
+       test_file_not_empty ignored &&
+       test_file_not_empty ignored.d/untracked &&
+       test_file_not_empty .gitignore
 '
 
 test_expect_success 'stash push --include-untracked with pathspec' '
@@ -214,17 +222,17 @@ test_expect_success 'stash push with $IFS character' '
        test_path_is_file bar
 '
 
-cat > .gitignore <<EOF
-ignored
-ignored.d/*
-EOF
-
 test_expect_success 'stash previously ignored file' '
+       cat >.gitignore <<-EOF &&
+       ignored
+       ignored.d/*
+       EOF
+
        git reset HEAD &&
        git add .gitignore &&
        git commit -m "Add .gitignore" &&
        >ignored.d/foo &&
-       echo "!ignored.d/foo" >> .gitignore &&
+       echo "!ignored.d/foo" >>.gitignore &&
        git stash save --include-untracked &&
        test_path_is_missing ignored.d/foo &&
        git stash pop &&
@@ -280,7 +288,7 @@ test_expect_success 'stash -u -- <ignored> leaves ignored file alone' '
 test_expect_success 'stash -u -- <non-existent> shows no changes when there are none' '
        git stash push -u -- non-existent >actual &&
        echo "No local changes to save" >expect &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'stash -u with globs' '
index e5116a76a1cc660370e1f5e958f87c2844a95f83..cce334981e19ea9b38a4ae204531c66bb8a57dc3 100755 (executable)
@@ -7,7 +7,7 @@ test_description='Test built-in diff output engine.
 
 '
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 echo >path0 'Line 1
 Line 2
index c16486a9d41a125610e6280a79e958ebbb792653..2f9700742aa2fb93385fc7fa83f23f2c8640b31d 100755 (executable)
@@ -7,7 +7,7 @@ test_description='Test rename detection in diff engine.
 
 '
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 test_expect_success 'setup' '
        cat >path0 <<-\EOF &&
index df2accb6555d4202c789b8ffb13ae3943268586d..db07ff3eb1968d606176f44ac2428899de78c6eb 100755 (executable)
@@ -7,11 +7,11 @@ test_description='More rename detection
 
 '
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
 
 test_expect_success \
     'prepare reference tree' \
-    'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
+    'cat "$TEST_DIRECTORY"/lib-diff/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"/diff-lib/COPYING >COPYING &&
+    'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
      git update-index --add --remove COPYING COPYING.1'
 
 # tree has COPYING and rezrov.  work tree has COPYING and COPYING.1,
index 6e562c80d12f9f58353c8f6444c0d7a0737dbae4..3d495e37bb1916741be13afb7664c56b465a7310 100755 (executable)
@@ -10,7 +10,7 @@ copy of symbolic links, but should not produce rename/copy followed
 by an edit for them.
 '
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 test_expect_success SYMLINKS \
     'prepare reference tree' \
index d18a80493c2274d19a6f779bd1c67c50b63a6290..86479061325b67038e31bc13a7948d9b0b0f9323 100755 (executable)
@@ -6,10 +6,10 @@
 test_description='Same rename detection as t4003 but testing diff-raw.'
 
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
 
 test_expect_success 'setup reference tree' '
-       cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
+       cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
        echo frotz >rezrov &&
        git update-index --add COPYING rezrov &&
        tree=$(git write-tree) &&
@@ -64,7 +64,7 @@ test_expect_success 'validate output from rename/copy detection (#2)' '
 # nows how to say Copy.
 
 test_expect_success 'validate output from rename/copy detection (#3)' '
-       cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
+       cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
        git update-index --add --remove COPYING COPYING.1 &&
 
        cat <<-EOF >expected &&
index 03489aff14ea72921f66605eeac3ccddd694e923..275ce5fa15be18de8a5badbb49ac617eee538bf0 100755 (executable)
@@ -39,13 +39,13 @@ test_expect_success '--stat output after text chmod' '
         1 file changed, 0 insertions(+), 0 deletions(-)
        EOF
        git diff HEAD --stat >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success '--shortstat output after text chmod' '
        tail -n 1 <expect >expect.short &&
        git diff HEAD --shortstat >actual &&
-       test_i18ncmp expect.short actual
+       test_cmp expect.short actual
 '
 
 test_expect_success '--stat output after binary chmod' '
@@ -56,13 +56,13 @@ test_expect_success '--stat output after binary chmod' '
         2 files changed, 0 insertions(+), 0 deletions(-)
        EOF
        git diff HEAD --stat >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success '--shortstat output after binary chmod' '
        tail -n 1 <expect >expect.short &&
        git diff HEAD --shortstat >actual &&
-       test_i18ncmp expect.short actual
+       test_cmp expect.short actual
 '
 
 test_done
index b187b7f6c66b8ade9d0ef73aa346a9205df153bc..cbb9c62f535e807d13d72008088b108101c6ec57 100755 (executable)
@@ -7,17 +7,17 @@ test_description='Rename interaction with pathspec.
 
 '
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
 
 test_expect_success 'prepare reference tree' '
        mkdir path0 path1 &&
-       cp "$TEST_DIRECTORY"/diff-lib/COPYING path0/COPYING &&
+       cp "$TEST_DIRECTORY"/lib-diff/COPYING path0/COPYING &&
        git update-index --add path0/COPYING &&
        tree=$(git write-tree) &&
        echo $tree
 '
 
-blob=$(git hash-object "$TEST_DIRECTORY/diff-lib/COPYING")
+blob=$(git hash-object "$TEST_DIRECTORY/lib-diff/COPYING")
 test_expect_success 'prepare work tree' '
        cp path0/COPYING path1/COPYING &&
        git update-index --add --remove path0/COPYING path1/COPYING
index b1ccd4102e09e27529eb09e873c2b4c2467a40db..2299f27511bf29fce131a890e0d8e9c6361d8a3c 100755 (executable)
@@ -22,11 +22,11 @@ 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_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
 
 test_expect_success setup '
-       cat "$TEST_DIRECTORY"/diff-lib/README >file0 &&
-       cat "$TEST_DIRECTORY"/diff-lib/COPYING >file1 &&
+       cat "$TEST_DIRECTORY"/lib-diff/README >file0 &&
+       cat "$TEST_DIRECTORY"/lib-diff/COPYING >file1 &&
        blob0_id=$(git hash-object file0) &&
        blob1_id=$(git hash-object file1) &&
        git update-index --add file0 file1 &&
index b63bdf031f5186a9c482bbd08a9d95bd3beb1906..b1da807f1693147cf9a0d5fffeb1173921f08e57 100755 (executable)
@@ -7,11 +7,11 @@ test_description='Same rename detection as t4003 but testing diff-raw -z.
 
 '
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
 
 test_expect_success \
     'prepare reference tree' \
-    'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
+    'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
      echo frotz >rezrov &&
     git update-index --add COPYING rezrov &&
     orig=$(git hash-object COPYING) &&
@@ -81,7 +81,7 @@ test_expect_success \
 
 test_expect_success \
     'prepare work tree once again' \
-    'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
+    'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
      git update-index --add --remove COPYING COPYING.1'
 
 git diff-index -z -C --find-copies-harder $tree >current
index 65cc703c659b8941f1458e4f4b0b6d88dc5622d1..1bbced79ece861e2329663b09e8aead3daa983e0 100755 (executable)
@@ -10,7 +10,7 @@ Prepare:
         path1/file1
 '
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
 
 test_expect_success \
     setup \
index 717034bb50b57f3edc5d19989f0b178e912e08e6..5a25c259fe333912ba1614c2e645e03e5bdd6e02 100755 (executable)
@@ -7,7 +7,7 @@ test_description='Test diff of symlinks.
 
 '
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 # Print the short OID of a symlink with the given name.
 symlink_oid () {
index 6579c81216a9b2e7dc6f2457cc46003dd905aa30..33ff588ebca03807da91c4a786df76c03fb9bff7 100755 (executable)
@@ -34,19 +34,19 @@ EOF
 test_expect_success 'apply --stat output for binary file change' '
        git diff >diff &&
        git apply --stat --summary <diff >current &&
-       test_i18ncmp expected current
+       test_cmp expected current
 '
 
 test_expect_success 'diff --shortstat output for binary file change' '
        tail -n 1 expected >expect &&
        git diff --shortstat >current &&
-       test_i18ncmp expect current
+       test_cmp expect current
 '
 
 test_expect_success 'diff --shortstat output for binary file change only' '
        echo " 1 file changed, 0 insertions(+), 0 deletions(-)" >expected &&
        git diff --shortstat -- b >current &&
-       test_i18ncmp expected current
+       test_cmp expected current
 '
 
 test_expect_success 'apply --numstat notices binary file change' '
@@ -63,7 +63,7 @@ test_expect_success 'apply --numstat understands diff --binary format' '
 
 # apply needs to be able to skip the binary material correctly
 # in order to report the line number of a corrupt patch.
-test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
+test_expect_success 'apply detecting corrupt patch correctly' '
        git diff >output &&
        sed -e "s/-CIT/xCIT/" <output >broken &&
        test_must_fail git apply --stat --summary broken 2>detected &&
@@ -73,7 +73,7 @@ test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
        test "$detected" = xCIT
 '
 
-test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
+test_expect_success 'apply detecting corrupt patch correctly' '
        git diff --binary | sed -e "s/-CIT/xCIT/" >broken &&
        test_must_fail git apply --stat --summary broken 2>detected &&
        detected=$(cat detected) &&
index ce6aa3914fe74f037eb2451a88e36803594b0e78..6cca8b84a6bf3f2098d47ab56bb9f8da0293dff5 100755 (executable)
@@ -9,7 +9,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 test_expect_success setup '
 
@@ -222,7 +222,7 @@ do
                        process_diffs "$expect" >expect &&
                        case $cmd in
                        *format-patch* | *-stat*)
-                               test_i18ncmp expect actual;;
+                               test_cmp expect actual;;
                        *)
                                test_cmp expect actual;;
                        esac &&
index 66630c8413d5008caa53a2e3c36c652e61937cc5..cdd3154e702674007cef1e1a368cad0c5476c060 100755 (executable)
@@ -888,11 +888,11 @@ echo "fatal: --check does not make sense" >expect.check
 
 test_expect_success 'options no longer allowed for format-patch' '
        test_must_fail git format-patch --name-only 2>output &&
-       test_i18ncmp expect.name-only output &&
+       test_cmp expect.name-only output &&
        test_must_fail git format-patch --name-status 2>output &&
-       test_i18ncmp expect.name-status output &&
+       test_cmp expect.name-status output &&
        test_must_fail git format-patch --check 2>output &&
-       test_i18ncmp expect.check output
+       test_cmp expect.check output
 '
 
 test_expect_success 'format-patch --numstat should produce a patch' '
index 8c574221b27445938694163f90f90ce337bfc4e2..2c13b62d3c654807b85307748c1ec52b6f4155ff 100755 (executable)
@@ -7,7 +7,7 @@ test_description='Test special whitespace in diff engine.
 
 '
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 test_expect_success "Ray Lehtiniemi's example" '
        cat <<-\EOF >x &&
index 9c48e5c2c99ad1eafc343a2cf6b9eeda54f644d4..876271d6826cca4fea73e8cdb459e6983db5b209 100755 (executable)
@@ -82,7 +82,7 @@ test_expect_success 'git diff --stat -M HEAD' '
         7 files changed, 0 insertions(+), 0 deletions(-)
        EOF
        git diff --stat -M HEAD >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_done
index 894a11b224d29d7a9956f6d701e7a666d5c2f94a..94ef77e1dfedc28656d78c80b689eca6806a7b0c 100755 (executable)
@@ -3,7 +3,7 @@
 test_description='difference in submodules'
 
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 test_expect_success setup '
        test_tick &&
index 4cb9f0e523d2218566554cdccd9c2e3929f3d05b..c906320b60dcea80369c6c4ef1f6af70295713cd 100755 (executable)
@@ -139,7 +139,7 @@ EOF
 test_expect_success 'diffstat does not run textconv' '
        echo file diff=fail >.gitattributes &&
        git diff --stat HEAD^ HEAD >actual &&
-       test_i18ncmp expect.stat actual &&
+       test_cmp expect.stat actual &&
 
        head -n1 <expect.stat >expect.line1 &&
        head -n1 <actual >actual.line1 &&
index 0c8fb39cedaa31f6f586895cd57a878158624f13..56f1e62a97bff51505956e672b023d4f681aaf1d 100755 (executable)
@@ -3,7 +3,7 @@
 test_description='word diff colors'
 
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 cat >pre.simple <<-\EOF
        h(4)
index 09ad491a593cc4c1381492e33f09f1a1ff31bd2b..aeac203c424905be395d5ef6d43f2b606dc3bb1d 100755 (executable)
@@ -6,7 +6,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 setup_helper () {
        one=$1 branch=$2 side=$3 &&
index 7be1de736d86c90ac9c36ff68c0e8f4535e9bafd..61ba5f707fbd419aa3625eeedc39210f9d6d59ac 100755 (executable)
@@ -61,7 +61,7 @@ check_stat () {
        EOF
        test_expect_success "--stat $*" "
                git -C '$dir' diff --stat $* HEAD^ >actual &&
-               test_i18ncmp expected actual
+               test_cmp expected actual
        "
 }
 
index a34121740a4ab58e8abd16b3a00df5f44d2f1648..53061b104ecc1af2eebb9d79fa2af5655236471d 100755 (executable)
@@ -25,7 +25,7 @@ test_expect_success 'mode-only change show as a 0-line change' '
         4 files changed, 2 insertions(+)
        EOF
        git diff --stat --stat-count=2 HEAD >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'binary changes do not count in lines' '
@@ -40,7 +40,7 @@ test_expect_success 'binary changes do not count in lines' '
         3 files changed, 2 insertions(+)
        EOF
        git diff --stat --stat-count=2 >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'exclude unmerged entries from total file count' '
@@ -62,7 +62,7 @@ test_expect_success 'exclude unmerged entries from total file count' '
         3 files changed, 3 insertions(+)
        EOF
        git diff --stat --stat-count=2 >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_done
index 63ea7144bb492b1c7526c1103afc0f70a33fc8c8..aec1d9d1b42f65f1080f7e054bca70bbffcefcc6 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-test_description='diff order'
+test_description='diff order & rotate'
 
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
@@ -127,4 +127,74 @@ do
        '
 done
 
+### rotate and skip
+
+test_expect_success 'rotate and skip setup' '
+       >sample1.t &&
+       >sample2.t &&
+       >sample3.t &&
+       >sample4.t &&
+       git add sample[1234].t &&
+       git commit -m "added" sample[1234].t &&
+       echo modified >>sample1.t &&
+       echo modified >>sample2.t &&
+       echo modified >>sample4.t &&
+       git commit -m "updated" sample[1234].t
+'
+
+test_expect_success 'diff --rotate-to' '
+       git diff --rotate-to=sample2.t --name-only HEAD^ >actual &&
+       test_write_lines sample2.t sample4.t sample1.t >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'diff --skip-to' '
+       git diff --skip-to=sample2.t --name-only HEAD^ >actual &&
+       test_write_lines sample2.t sample4.t >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'diff --rotate/skip-to error condition' '
+       test_must_fail git diff --rotate-to=sample3.t HEAD^ &&
+       test_must_fail git diff --skip-to=sample3.t HEAD^
+'
+
+test_expect_success 'log --rotate-to' '
+       git log --rotate-to=sample3.t --raw HEAD~2.. >raw &&
+       # just distill the commit header and paths
+       sed -n -e "s/^commit.*/commit/p" \
+              -e "/^:/s/^.*    //p" raw >actual &&
+
+       cat >expect <<-\EOF &&
+       commit
+       sample4.t
+       sample1.t
+       sample2.t
+       commit
+       sample3.t
+       sample4.t
+       sample1.t
+       sample2.t
+       EOF
+
+       test_cmp expect actual
+'
+
+test_expect_success 'log --skip-to' '
+       git log --skip-to=sample3.t --raw HEAD~2.. >raw &&
+       # just distill the commit header and paths
+       sed -n -e "s/^commit.*/commit/p" \
+              -e "/^:/s/^.*    //p" raw >actual &&
+
+       cat >expect <<-\EOF &&
+       commit
+       sample4.t
+       commit
+       sample3.t
+       sample4.t
+       EOF
+
+       test_cmp expect actual
+'
+
 test_done
index bcf7493740a5157bbeba205eebdba83f41dc0380..7750b87ca16ab39aa965caa4fe71b462d899adc7 100755 (executable)
@@ -7,7 +7,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 # Compare two diff outputs. Ignore "index" lines, because we don't
 # care about SHA-1s or file modes.
index 744b8e51beab59c78807e0622f10bf421b3142ec..9b433de83630774206fb89dfae1a4396264390cc 100755 (executable)
@@ -17,13 +17,13 @@ do
        test_expect_success "$title" '
                git apply --stat --summary \
                        <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" >current &&
-               test_i18ncmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
+               test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
        '
 
        test_expect_success "$title with recount" '
                sed -e "$UNC" <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" |
                git apply --recount --stat --summary >current &&
-               test_i18ncmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
+               test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
        '
 done <<\EOF
 rename
index 99987515dc2dde28b8654ac4ccda2071ddeffc5b..2aaaa0d7dedf68934e8d5b4c6610f1a859acbb29 100755 (executable)
@@ -906,7 +906,7 @@ test_expect_success 'am empty-file does not infloop' '
        test_tick &&
        test_must_fail git am empty-file 2>actual &&
        echo Patch format detection failed. >expected &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'am --message-id really adds the message id' '
index 8ea22d1bcbb8340d32fe87f299a77c98362c3797..b7c3861407d026e7064dbab0237bfa709859c462 100755 (executable)
@@ -61,7 +61,7 @@ test_expect_success '--no-quiet overrides --quiet' '
        # Applying side2 will be quiet.
        git am --no-quiet --continue >out &&
        echo "Applying: side1" >expected &&
-       test_i18ncmp expected out
+       test_cmp expected out
 '
 
 test_expect_success '--signoff overrides --no-signoff' '
index 749bc1431ac26660a477ad33364feba62c426956..85432b80ff52a7014be3c3912c38163e989adc70 100755 (executable)
@@ -123,10 +123,10 @@ test_expect_success 'NUL separation with --stat' '
        stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
        printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected &&
        git log -z --stat --pretty="format:%s" >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
-test_expect_failure C_LOCALE_OUTPUT 'NUL termination with --stat' '
+test_expect_failure 'NUL termination with --stat' '
        stat0_part=$(git diff --stat HEAD^ HEAD) &&
        stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
        printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n0" >expected &&
index ad29e65fcba6be9a6b27954d5dcda7efe31d3018..4871a5dc92f0d586715728d667eefcf8c7644e00 100755 (executable)
@@ -7,7 +7,7 @@ test_description='Test --follow should always find copies hard in git log.
 
 '
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 echo >path0 'Line 1
 Line 2
index 5e10136e9a239fda6526da7f84df3ee49936a6eb..7f0c1dcc0f0bfbfd746648f4fee1b7588a8f31b8 100755 (executable)
@@ -31,13 +31,8 @@ test_expect_success '"git log :/a -- " should not be ambiguous' '
 test_expect_success '"git log :/detached -- " should find a commit only in HEAD' '
        test_when_finished "git checkout main" &&
        git checkout --detach &&
-       # Must manually call `test_tick` instead of using `test_commit`,
-       # because the latter additionally creates a tag, which would make
-       # the commit reachable not only via HEAD.
-       test_tick &&
-       git commit --allow-empty -m detached &&
-       test_tick &&
-       git commit --allow-empty -m something-else &&
+       test_commit --no-tag detached &&
+       test_commit --no-tag something-else &&
        git log :/detached --
 '
 
index daf01c309d03203026d27f2ff978974053e8eeee..54be7da1611212143d843d175bf48f73bb83b417 100755 (executable)
@@ -60,7 +60,7 @@ test_expect_success 'try to apply corrupted patch' '
        test_must_fail git -c advice.amWorkDir=false am bad-patch.diff 2>actual &&
        echo "error: git diff header lacks filename information (line 4)" >expected &&
        test_path_is_file f &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success "NUL in commit message's body" '
index db4e15fd5965d9863f379ad9a6a14041852a64bc..cb67bac1c47487f451c2113c6b6fca60cb438bfd 100755 (executable)
@@ -223,14 +223,14 @@ test_expect_success 'pull request format' '
                git request-pull initial "$downstream_url" tags/full >../request
        ) &&
        <request sed -nf fuzz.sed >request.fuzzy &&
-       test_i18ncmp expect request.fuzzy &&
+       test_cmp expect request.fuzzy &&
 
        (
                cd local &&
                git request-pull initial "$downstream_url" tags/full:refs/tags/full
        ) >request &&
        sed -nf fuzz.sed <request >request.fuzzy &&
-       test_i18ncmp expect request.fuzzy &&
+       test_cmp expect request.fuzzy &&
 
        (
                cd local &&
index 392201cabdfece945104c6cc8bde3e87f3edd99f..d586fdc7a955daf6ddd9590b707e4dee1aefc82c 100755 (executable)
@@ -427,7 +427,7 @@ test_expect_success 'index-pack --strict <pack> works in non-repo' '
        test_path_is_file foo.idx
 '
 
-test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'index-pack --threads=N or pack.threads=N warns when no pthreads' '
+test_expect_success !PTHREADS 'index-pack --threads=N or pack.threads=N warns when no pthreads' '
        test_must_fail git index-pack --threads=2 2>err &&
        grep ^warning: err >warnings &&
        test_line_count = 1 warnings &&
@@ -445,7 +445,7 @@ test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'index-pack --threads=N or pack.th
        grep -F "no threads support, ignoring pack.threads" err
 '
 
-test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'pack-objects --threads=N or pack.threads=N warns when no pthreads' '
+test_expect_success !PTHREADS 'pack-objects --threads=N or pack.threads=N warns when no pthreads' '
        git pack-objects --threads=2 --stdout --all </dev/null >/dev/null 2>err &&
        grep ^warning: err >warnings &&
        test_line_count = 1 warnings &&
index 5ba76031090ef3fb27b6e861e5766dfa7ae3c427..40b9f632441446d5042100d2797e9dd80b17f643 100755 (executable)
@@ -5,6 +5,8 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-bundle.sh
+. "$TEST_DIRECTORY"/lib-bitmap.sh
 
 objpath () {
        echo ".git/objects/$(echo "$1" | sed -e 's|\(..\)|\1/|')"
index 0f06c40eb13f31d8f06962dd1c88c5ff5810618f..a8c1bc0f66b0da238af0cf1051bb7cfafbf27db8 100755 (executable)
@@ -84,14 +84,14 @@ test_expect_success 'packing produces a long delta' '
        pack=$(git pack-objects --all --window=0 </dev/null pack) &&
        echo 9 >expect &&
        max_chain pack-$pack.pack >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success '--depth limits depth' '
        pack=$(git pack-objects --all --depth=5 </dev/null pack) &&
        echo 5 >expect &&
        max_chain pack-$pack.pack >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_done
index 5b15f1aa0f60e819a6a2b12f376224f2ea1ef13f..fa2ba93fe806e6404b9cf6ffeefa705bb96fa730 100755 (executable)
@@ -551,7 +551,7 @@ corrupt_graph_and_verify() {
        zero_pos=${4:-${orig_size}} &&
        printf "$data" | dd of="$objdir/info/commit-graph" bs=1 seek="$pos" conv=notrunc &&
        dd of="$objdir/info/commit-graph" bs=1 seek="$zero_pos" if=/dev/null &&
-       generate_zero_bytes $(($orig_size - $zero_pos)) >>"$objdir/info/commit-graph" &&
+       test-tool genzeros $(($orig_size - $zero_pos)) >>"$objdir/info/commit-graph" &&
        corrupt_graph_verify "$grepstr"
 
 }
index 1f4cc873a837ee305396c9975a4cd08919a028ab..8a5d3492c713b8ca5eceef13ed55f7bd49edcae9 100755 (executable)
@@ -547,7 +547,7 @@ test_expect_success 'test lonely missing ref' '
                cd client &&
                test_must_fail git fetch-pack --no-progress .. refs/heads/xyzzy 2>../error-m
        ) &&
-       test_i18ncmp expect-error error-m
+       test_cmp expect-error error-m
 '
 
 test_expect_success 'test missing ref after existing' '
@@ -555,7 +555,7 @@ test_expect_success 'test missing ref after existing' '
                cd client &&
                test_must_fail git fetch-pack --no-progress .. refs/heads/A refs/heads/xyzzy 2>../error-em
        ) &&
-       test_i18ncmp expect-error error-em
+       test_cmp expect-error error-em
 '
 
 test_expect_success 'test missing ref before existing' '
@@ -563,7 +563,7 @@ test_expect_success 'test missing ref before existing' '
                cd client &&
                test_must_fail git fetch-pack --no-progress .. refs/heads/xyzzy refs/heads/A 2>../error-me
        ) &&
-       test_i18ncmp expect-error error-me
+       test_cmp expect-error error-me
 '
 
 test_expect_success 'test --all, --depth, and explicit head' '
index 045398b94e63f88a09c6354a0e37ec8f85fab284..8c462f20ae63e73a1191bc3bae0160eed2d267ae 100755 (executable)
@@ -59,7 +59,7 @@ test_expect_success 'add remote whose URL agrees with url.<...>.insteadOf' '
        git remote add myremote git@host.com:team/repo.git
 '
 
-test_expect_success C_LOCALE_OUTPUT 'remote information for the origin' '
+test_expect_success 'remote information for the origin' '
        (
                cd test &&
                tokens_match origin "$(git remote)" &&
@@ -81,7 +81,7 @@ test_expect_success 'add another remote' '
        )
 '
 
-test_expect_success C_LOCALE_OUTPUT 'check remote-tracking' '
+test_expect_success 'check remote-tracking' '
        (
                cd test &&
                check_remote_track origin main side &&
@@ -107,7 +107,7 @@ test_expect_success 'remove remote' '
        )
 '
 
-test_expect_success C_LOCALE_OUTPUT 'remove remote' '
+test_expect_success 'remove remote' '
        (
                cd test &&
                tokens_match origin "$(git remote)" &&
@@ -140,8 +140,8 @@ test_expect_success 'remove remote protects local branches' '
                git remote rm oops 2>actual2 &&
                git branch -d foobranch &&
                git tag -d footag &&
-               test_i18ncmp expect1 actual1 &&
-               test_i18ncmp expect2 actual2
+               test_cmp expect1 actual1 &&
+               test_cmp expect2 actual2
        )
 '
 
@@ -150,7 +150,7 @@ test_expect_success 'remove errors out early when deleting non-existent branch'
                cd test &&
                echo "error: No such remote: '\''foo'\''" >expect &&
                test_expect_code 2 git remote rm foo 2>actual &&
-               test_i18ncmp expect actual
+               test_cmp expect actual
        )
 '
 
@@ -178,7 +178,7 @@ test_expect_success 'rename errors out early when deleting non-existent branch'
                cd test &&
                echo "error: No such remote: '\''foo'\''" >expect &&
                test_expect_code 2 git remote rename foo bar 2>actual &&
-               test_i18ncmp expect actual
+               test_cmp expect actual
        )
 '
 
@@ -186,14 +186,14 @@ test_expect_success 'rename errors out early when when new name is invalid' '
        test_config remote.foo.vcs bar &&
        echo "fatal: '\''invalid...name'\'' is not a valid remote name" >expect &&
        test_must_fail git remote rename foo invalid...name 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'add existing foreign_vcs remote' '
        test_config remote.foo.vcs bar &&
        echo "error: remote foo already exists." >expect &&
        test_expect_code 3 git remote add foo bar 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'add existing foreign_vcs remote' '
@@ -201,13 +201,13 @@ test_expect_success 'add existing foreign_vcs remote' '
        test_config remote.bar.vcs bar &&
        echo "error: remote bar already exists." >expect &&
        test_expect_code 3 git remote rename foo bar 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'add invalid foreign_vcs remote' '
        echo "fatal: '\''invalid...name'\'' is not a valid remote name" >expect &&
        test_must_fail git remote add invalid...name bar 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat >test/expect <<EOF
@@ -267,7 +267,7 @@ test_expect_success 'show' '
                git config --add remote.two.push refs/heads/main:refs/heads/another &&
                git remote show origin two >output &&
                git branch -d rebase octopus &&
-               test_i18ncmp expect output
+               test_cmp expect output
        )
 '
 
@@ -294,7 +294,7 @@ test_expect_success 'show -n' '
                cd test &&
                git remote show -n origin >output &&
                mv ../one.unreachable ../one &&
-               test_i18ncmp expect output
+               test_cmp expect output
        )
 '
 
@@ -337,7 +337,7 @@ test_expect_success 'set-head --auto has no problem w/multiple HEADs' '
                git fetch two "refs/heads/*:refs/remotes/two/*" &&
                git remote set-head --auto two >output 2>&1 &&
                echo "two/HEAD set to main" >expect &&
-               test_i18ncmp expect output
+               test_cmp expect output
        )
 '
 
@@ -369,7 +369,7 @@ test_expect_success 'prune --dry-run' '
                git remote prune --dry-run origin >output &&
                git rev-parse refs/remotes/origin/side2 &&
                test_must_fail git rev-parse refs/remotes/origin/side &&
-               test_i18ncmp expect output
+               test_cmp expect output
        )
 '
 
index 42f550300476a1e7ddae6b88dc0a04bb89ff0d80..e83b2a65069f6a1ddf78da5a38efd3f5f85c65e8 100755 (executable)
@@ -9,7 +9,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/test-bundle-functions.sh
+. "$TEST_DIRECTORY"/lib-bundle.sh
 
 D=$(pwd)
 
@@ -1051,7 +1051,7 @@ test_expect_success 'fetch --prune prints the remotes url' '
                git fetch --prune origin 2>&1 | head -n1 >../actual
        ) &&
        echo "From ${D}/." >expect &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'branchname D/F conflict resolved by --prune' '
@@ -1097,7 +1097,7 @@ test_expect_success 'fetching with auto-gc does not lock up' '
        )
 '
 
-test_expect_success C_LOCALE_OUTPUT 'fetch aligned output' '
+test_expect_success 'fetch aligned output' '
        git clone . full-output &&
        test_commit looooooooooooong-tag &&
        (
@@ -1112,7 +1112,7 @@ test_expect_success C_LOCALE_OUTPUT 'fetch aligned output' '
        test_cmp expect actual
 '
 
-test_expect_success C_LOCALE_OUTPUT 'fetch compact output' '
+test_expect_success 'fetch compact output' '
        git clone . compact &&
        test_commit extraaa &&
        (
index 4a568a2398ef4ba96ca2218839f9c2f2741b833d..f53f58895a12979f27a1b24ba9f15ee37bbc49a9 100755 (executable)
@@ -150,7 +150,7 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
        # We could just as easily have used "main"; the "*" emphasizes its
        # role as a pattern.
        test_must_fail git ls-remote "$does_not_exist" >actual 2>&1 &&
-       test_i18ncmp exp actual
+       test_cmp exp actual
 '
 
 test_expect_success 'die with non-2 for wrong repository even with --exit-code' '
index 11513ec15e1e90cc2ee15a3f501d0789f393fe0f..ed11569d8d7ec605198773351e75baeaa232cb1a 100755 (executable)
@@ -74,7 +74,7 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" '
                git fetch --recurse-submodules >../actual.out 2>../actual.err
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err actual.err
+       test_cmp expect.err actual.err
 '
 
 test_expect_success "submodule.recurse option triggers recursive fetch" '
@@ -84,7 +84,7 @@ test_expect_success "submodule.recurse option triggers recursive fetch" '
                git -c submodule.recurse fetch >../actual.out 2>../actual.err
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err actual.err
+       test_cmp expect.err actual.err
 '
 
 test_expect_success "fetch --recurse-submodules -j2 has the same output behaviour" '
@@ -94,7 +94,7 @@ test_expect_success "fetch --recurse-submodules -j2 has the same output behaviou
                GIT_TRACE="$TRASH_DIRECTORY/trace.out" git fetch --recurse-submodules -j2 2>../actual.err
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err actual.err &&
+       test_cmp expect.err actual.err &&
        grep "2 tasks" trace.out
 '
 
@@ -124,7 +124,7 @@ test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses i
                git fetch >../actual.out 2>../actual.err
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err actual.err
+       test_cmp expect.err actual.err
 '
 
 test_expect_success "--no-recurse-submodules overrides .gitmodules config" '
@@ -155,7 +155,7 @@ test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setti
                git config --unset submodule.submodule.fetchRecurseSubmodules
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err actual.err
+       test_cmp expect.err actual.err
 '
 
 test_expect_success "--quiet propagates to submodules" '
@@ -183,7 +183,7 @@ test_expect_success "--dry-run propagates to submodules" '
                git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err actual.err
+       test_cmp expect.err actual.err
 '
 
 test_expect_success "Without --dry-run propagates to submodules" '
@@ -192,7 +192,7 @@ test_expect_success "Without --dry-run propagates to submodules" '
                git fetch --recurse-submodules >../actual.out 2>../actual.err
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err actual.err
+       test_cmp expect.err actual.err
 '
 
 test_expect_success "recurseSubmodules=true propagates into submodules" '
@@ -203,7 +203,7 @@ test_expect_success "recurseSubmodules=true propagates into submodules" '
                git fetch >../actual.out 2>../actual.err
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err actual.err
+       test_cmp expect.err actual.err
 '
 
 test_expect_success "--recurse-submodules overrides config in submodule" '
@@ -217,7 +217,7 @@ test_expect_success "--recurse-submodules overrides config in submodule" '
                git fetch --recurse-submodules >../actual.out 2>../actual.err
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err actual.err
+       test_cmp expect.err actual.err
 '
 
 test_expect_success "--no-recurse-submodules overrides config setting" '
@@ -257,7 +257,7 @@ test_expect_success "Recursion stops when no new submodule commits are fetched"
                cd downstream &&
                git fetch >../actual.out 2>../actual.err
        ) &&
-       test_i18ncmp expect.err.sub actual.err &&
+       test_cmp expect.err.sub actual.err &&
        test_must_be_empty actual.out
 '
 
@@ -275,7 +275,7 @@ test_expect_success "Recursion doesn't happen when new superproject commits don'
                git fetch >../actual.out 2>../actual.err
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err.file actual.err
+       test_cmp expect.err.file actual.err
 '
 
 test_expect_success "Recursion picks up config in submodule" '
@@ -303,7 +303,7 @@ test_expect_success "Recursion picks up config in submodule" '
                        git config --unset fetch.recurseSubmodules
                )
        ) &&
-       test_i18ncmp expect.err.sub actual.err &&
+       test_cmp expect.err.sub actual.err &&
        test_must_be_empty actual.out
 '
 
@@ -336,7 +336,7 @@ test_expect_success "Recursion picks up all submodules when necessary" '
                cd downstream &&
                git fetch >../actual.out 2>../actual.err
        ) &&
-       test_i18ncmp expect.err.2 actual.err &&
+       test_cmp expect.err.2 actual.err &&
        test_must_be_empty actual.out
 '
 
@@ -392,7 +392,7 @@ test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necess
                )
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err actual.err
+       test_cmp expect.err actual.err
 '
 
 test_expect_success "'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
@@ -409,7 +409,7 @@ test_expect_success "'--recurse-submodules=on-demand' stops when no new submodul
                git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err.file actual.err
+       test_cmp expect.err.file actual.err
 '
 
 test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config" '
@@ -437,7 +437,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config
                git config --unset fetch.recurseSubmodules
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err.2 actual.err
+       test_cmp expect.err.2 actual.err
 '
 
 test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
@@ -465,7 +465,7 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override
                git config --unset submodule.submodule.fetchRecurseSubmodules
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err.2 actual.err
+       test_cmp expect.err.2 actual.err
 '
 
 test_expect_success "don't fetch submodule when newly recorded commits are already present" '
@@ -484,7 +484,7 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
                git fetch >../actual.out 2>../actual.err
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err actual.err &&
+       test_cmp expect.err actual.err &&
        (
                cd submodule &&
                git checkout -q sub
@@ -520,7 +520,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .git
                git reset --hard
        ) &&
        test_must_be_empty actual.out &&
-       test_i18ncmp expect.err.2 actual.err &&
+       test_cmp expect.err.2 actual.err &&
        git checkout HEAD^ -- .gitmodules &&
        git add .gitmodules &&
        git commit -m "new submodule restored .gitmodules"
index bc5ccf233f02f8cf641abee4c3007148e4da365b..c024fa2818314d3d127e93da2e281dc259820733 100755 (executable)
@@ -118,7 +118,7 @@ test_expect_success 'rejected update prints status' '
        git commit -m dev2 &&
        test_must_fail git push origin dev2 2>act &&
        sed -e "/^remote: /s/ *$//" <act >cmp &&
-       test_i18ncmp exp cmp
+       test_cmp exp cmp
 '
 rm -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/hooks/update"
 
index 664c913866236dcbb026a1222f18b1b5d41cf163..e7e6c089554c5d2b0ba7cd51b79a53f6880f0ae1 100755 (executable)
@@ -40,7 +40,7 @@ test_expect_success 'clone with excess parameters (2)' '
 
 '
 
-test_expect_success C_LOCALE_OUTPUT 'output from clone' '
+test_expect_success 'output from clone' '
        rm -fr dst &&
        git clone -n "file://$(pwd)/src" dst >output 2>&1 &&
        test $(grep Clon output | wc -l) = 1
index 6249420a80672b98b85b93cefaa65b4d7f8c7151..881f72fd443c8aefbe47c693b5bb80ee842a64db 100755 (executable)
@@ -9,7 +9,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/test-bundle-functions.sh
+. "$TEST_DIRECTORY"/lib-bundle.sh
 
 # Create a commit or tag and set the variable with the object ID.
 test_commit_setvar () {
@@ -175,7 +175,7 @@ test_expect_success 'create bundle from special rev: main^!' '
        cat >expect <<-\EOF &&
        <COMMIT-P> refs/heads/main
        EOF
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        git bundle verify special-rev.bdl |
                make_user_friendly_and_stable_output >actual &&
@@ -185,7 +185,7 @@ test_expect_success 'create bundle from special rev: main^!' '
        The bundle requires this ref:
        <COMMIT-O>
        EOF
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        test_bundle_object_count special-rev.bdl 3
 '
@@ -207,7 +207,7 @@ test_expect_success 'create bundle with --max-count option' '
        The bundle requires this ref:
        <COMMIT-O>
        EOF
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        test_bundle_object_count max-count.bdl 4
 '
@@ -236,7 +236,7 @@ test_expect_success 'create bundle with --since option' '
        <COMMIT-M>
        <COMMIT-K>
        EOF
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        test_bundle_object_count --thin since.bdl 13
 '
@@ -262,11 +262,11 @@ test_expect_success 'create bundle 1 - no prerequisites' '
        # verify bundle, which has no prerequisites
        git bundle verify 1.bdl |
                make_user_friendly_and_stable_output >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        git bundle verify stdin-1.bdl |
                make_user_friendly_and_stable_output >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        test_bundle_object_count       1.bdl 24 &&
        test_bundle_object_count stdin-1.bdl 24
@@ -304,11 +304,11 @@ test_expect_success 'create bundle 2 - has prerequisites' '
 
        git bundle verify 2.bdl |
                make_user_friendly_and_stable_output >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        git bundle verify stdin-2.bdl |
                make_user_friendly_and_stable_output >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        test_bundle_object_count       2.bdl 16 &&
        test_bundle_object_count stdin-2.bdl 16
@@ -326,11 +326,11 @@ test_expect_success 'fail to verify bundle without prerequisites' '
 
        test_must_fail git -C test1.git bundle verify ../2.bdl 2>&1 |
                make_user_friendly_and_stable_output >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        test_must_fail git -C test1.git bundle verify ../stdin-2.bdl 2>&1 |
                make_user_friendly_and_stable_output >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'create bundle 3 - two refs, same object' '
@@ -363,11 +363,11 @@ test_expect_success 'create bundle 3 - two refs, same object' '
 
        git bundle verify 3.bdl |
                make_user_friendly_and_stable_output >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        git bundle verify stdin-3.bdl |
                make_user_friendly_and_stable_output >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        test_bundle_object_count       3.bdl 4 &&
        test_bundle_object_count stdin-3.bdl 4
@@ -404,11 +404,11 @@ test_expect_success 'create bundle 4 - with tags' '
 
        git bundle verify 4.bdl |
                make_user_friendly_and_stable_output >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        git bundle verify stdin-4.bdl |
                make_user_friendly_and_stable_output >actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
 
        test_bundle_object_count       4.bdl 3 &&
        test_bundle_object_count stdin-4.bdl 3
index 7bcde054d73d5815c3bdc52c5c53ebd3e3eb32d4..ef7bdcedf2304ef3e6d1379f29742dcfcf5ee28b 100755 (executable)
@@ -829,7 +829,7 @@ test_expect_success 'bisect terms needs 0 or 1 argument' '
        test_must_fail git bisect terms 1 2 &&
        test_must_fail git bisect terms 2>actual &&
        echo "error: no terms defined" >expected &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'bisect terms shows good/bad after start' '
@@ -903,7 +903,7 @@ test_expect_success 'bisect start --term-* does store terms' '
        Your current terms are two for the old state
        and one for the new state.
        EOF
-       test_i18ncmp expected actual &&
+       test_cmp expected actual &&
        git bisect terms --term-bad >actual &&
        echo one >expected &&
        test_cmp expected actual &&
index a160b2bf99c41c3b30dcd26ebae0a78f6a96b3f8..a313849406ddb4b7f104ee06eabc9068d5551425 100755 (executable)
@@ -57,7 +57,7 @@ test_expect_success 'branch -v' '
                git branch -v
        ) |
        sed -n -e "$t6040_script" >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat >expect <<\EOF
@@ -75,7 +75,7 @@ test_expect_success 'branch -vv' '
                git branch -vv
        ) |
        sed -n -e "$t6040_script" >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'checkout (diverged from upstream)' '
@@ -146,7 +146,7 @@ test_expect_success 'status -s -b (diverged from upstream)' '
                git checkout b1 >/dev/null &&
                git status -s -b | head -1
        ) >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat >expect <<\EOF
@@ -159,7 +159,7 @@ test_expect_success 'status -s -b --no-ahead-behind (diverged from upstream)' '
                git checkout b1 >/dev/null &&
                git status -s -b --no-ahead-behind | head -1
        ) >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat >expect <<\EOF
@@ -172,7 +172,7 @@ test_expect_success 'status.aheadbehind=false status -s -b (diverged from upstre
                git checkout b1 >/dev/null &&
                git -c status.aheadbehind=false status -s -b | head -1
        ) >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat >expect <<\EOF
@@ -187,7 +187,7 @@ test_expect_success 'status --long --branch' '
                git checkout b1 >/dev/null &&
                git status --long -b | head -3
        ) >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'status --long --branch' '
@@ -196,7 +196,7 @@ test_expect_success 'status --long --branch' '
                git checkout b1 >/dev/null &&
                git -c status.aheadbehind=true status --long -b | head -3
        ) >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat >expect <<\EOF
@@ -210,7 +210,7 @@ test_expect_success 'status --long --branch --no-ahead-behind' '
                git checkout b1 >/dev/null &&
                git status --long -b --no-ahead-behind | head -2
        ) >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'status.aheadbehind=false status --long --branch' '
@@ -219,7 +219,7 @@ test_expect_success 'status.aheadbehind=false status --long --branch' '
                git checkout b1 >/dev/null &&
                git -c status.aheadbehind=false status --long -b | head -2
        ) >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat >expect <<\EOF
@@ -232,7 +232,7 @@ test_expect_success 'status -s -b (upstream is gone)' '
                git checkout b5 >/dev/null &&
                git status -s -b | head -1
        ) >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat >expect <<\EOF
@@ -245,7 +245,7 @@ test_expect_success 'status -s -b (up-to-date with upstream)' '
                git checkout b6 >/dev/null &&
                git status -s -b | head -1
        ) >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'fail to track lightweight tags' '
index 2b551e6fd0ce1d6706334eaa2a65cda7f9e56618..3f889949ca14dc77eb6b39e5246bea3fe6823fd8 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='rev-list combining bitmaps and filters'
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-bitmap.sh
 
 test_expect_success 'set up bitmapped repo' '
        # one commit will have bitmaps, the other will not
diff --git a/t/t6115-rev-list-du.sh b/t/t6115-rev-list-du.sh
new file mode 100755 (executable)
index 0000000..b4aef32
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+test_description='basic tests of rev-list --disk-usage'
+. ./test-lib.sh
+
+# we want a mix of reachable and unreachable, as well as
+# objects in the bitmapped pack and some outside of it
+test_expect_success 'set up repository' '
+       test_commit --no-tag one &&
+       test_commit --no-tag two &&
+       git repack -adb &&
+       git reset --hard HEAD^ &&
+       test_commit --no-tag three &&
+       test_commit --no-tag four &&
+       git reset --hard HEAD^
+'
+
+# We don't want to hardcode sizes, because they depend on the exact details of
+# packing, zlib, etc. We'll assume that the regular rev-list and cat-file
+# machinery works and compare the --disk-usage output to that.
+disk_usage_slow () {
+       git rev-list --no-object-names "$@" |
+       git cat-file --batch-check="%(objectsize:disk)" |
+       perl -lne '$total += $_; END { print $total}'
+}
+
+# check behavior with given rev-list options; note that
+# whitespace is not preserved in args
+check_du () {
+       args=$*
+
+       test_expect_success "generate expected size ($args)" "
+               disk_usage_slow $args >expect
+       "
+
+       test_expect_success "rev-list --disk-usage without bitmaps ($args)" "
+               git rev-list --disk-usage $args >actual &&
+               test_cmp expect actual
+       "
+
+       test_expect_success "rev-list --disk-usage with bitmaps ($args)" "
+               git rev-list --disk-usage --use-bitmap-index $args >actual &&
+               test_cmp expect actual
+       "
+}
+
+check_du HEAD
+check_du --objects HEAD
+check_du --objects HEAD^..HEAD
+
+test_done
index 546796f84732c5153444321dc5a1d34bbf8af878..e89b6747beec4fb6a98b9a54a21bb62082cb0c91 100755 (executable)
@@ -136,7 +136,7 @@ warning: tag 'Q' is externally known as 'A'
 EOF
 check_describe A-* HEAD
 test_expect_success 'warning was displayed for Q' '
-       test_i18ncmp err.expect err.actual
+       test_cmp err.expect err.actual
 '
 test_expect_success 'misnamed annotated tag forces long output' '
        description=$(git describe --no-long Q^0) &&
index c670668409817c6d1066de53dc294bade2f27e93..0f1cb49cedc645c5a9b0c56257d3aca4740d5cd3 100755 (executable)
@@ -21,7 +21,7 @@ EOF
 test_expect_success 'error message for path inside submodule' '
        echo a >sub/a &&
        test_must_fail git add sub/a 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'error message for path inside submodule from within submodule' '
index 809854fc0ce98e16d8d4faa1ae22715134293c84..40edf9dab53402db9b5fad6dd060768537f9ba9a 100755 (executable)
@@ -20,8 +20,8 @@ test_expect_success 'Broken refs are reported correctly' '
        test_when_finished "rm -f .git/$r" &&
        echo "warning: ignoring broken ref $r" >broken-err &&
        git for-each-ref >out 2>err &&
-       test_i18ncmp full-list out &&
-       test_i18ncmp broken-err err
+       test_cmp full-list out &&
+       test_cmp broken-err err
 '
 
 test_expect_success 'NULL_SHA1 refs are reported correctly' '
@@ -31,10 +31,10 @@ test_expect_success 'NULL_SHA1 refs are reported correctly' '
        echo "warning: ignoring broken ref $r" >zeros-err &&
        git for-each-ref >out 2>err &&
        test_cmp full-list out &&
-       test_i18ncmp zeros-err err &&
+       test_cmp zeros-err err &&
        git for-each-ref --format="%(objectname) %(refname)" >brief-out 2>brief-err &&
        test_cmp brief-list brief-out &&
-       test_i18ncmp zeros-err brief-err
+       test_cmp zeros-err brief-err
 '
 
 test_expect_success 'Missing objects are reported correctly' '
@@ -43,7 +43,7 @@ test_expect_success 'Missing objects are reported correctly' '
        test_when_finished "rm -f .git/$r" &&
        echo "fatal: missing object $MISSING for $r" >missing-err &&
        test_must_fail git for-each-ref 2>err &&
-       test_i18ncmp missing-err err &&
+       test_cmp missing-err err &&
        (
                cat brief-list &&
                echo "$MISSING $r"
index 4ab133f489ca322a752599dc940e4c9c12461ad3..5d3b711fe682d88601d3d722e7ab1ee27ac9b525 100755 (executable)
@@ -2905,7 +2905,7 @@ test_setup_9e () {
        )
 }
 
-test_expect_success C_LOCALE_OUTPUT '9e: N-to-1 whammo' '
+test_expect_success '9e: N-to-1 whammo' '
        test_setup_9e &&
        (
                cd 9e &&
index d7eeee431061c4195b91a86581fd8462551ceb42..7b5f1c1dcd1f68c74646a5983b6b0d53bd9b4a92 100755 (executable)
@@ -492,7 +492,9 @@ test_expect_success '3a-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
                test_cmp expect actual &&
 
                test_must_fail git rev-parse HEAD:bq HEAD:foo/bq &&
-               test_path_is_missing bq foo/bq foo/whatever
+               test_path_is_missing bq &&
+               test_path_is_missing foo/bq &&
+               test_path_is_missing foo/whatever
        )
 '
 
@@ -522,7 +524,9 @@ test_expect_success '3a-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
                test_cmp expect actual &&
 
                test_must_fail git rev-parse HEAD:bq HEAD:foo/bq &&
-               test_path_is_missing bq foo/bq foo/whatever
+               test_path_is_missing bq &&
+               test_path_is_missing foo/bq &&
+               test_path_is_missing foo/whatever
        )
 '
 
@@ -588,7 +592,9 @@ test_expect_success '3b-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
                test_cmp expect actual &&
 
                test_must_fail git rev-parse HEAD:bq HEAD:foo/bq &&
-               test_path_is_missing bq foo/bq foo/whatever
+               test_path_is_missing bq &&
+               test_path_is_missing foo/bq &&
+               test_path_is_missing foo/whatever
        )
 '
 
@@ -618,7 +624,9 @@ test_expect_success '3b-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
                test_cmp expect actual &&
 
                test_must_fail git rev-parse HEAD:bq HEAD:foo/bq &&
-               test_path_is_missing bq foo/bq foo/whatever
+               test_path_is_missing bq &&
+               test_path_is_missing foo/bq &&
+               test_path_is_missing foo/whatever
        )
 '
 
index 362ae37a122f15d08cc7f8301c828139d5fbc0ac..84b4aacf496d1df73c6adf83860db430bc1c1c4c 100755 (executable)
@@ -139,7 +139,7 @@ test_expect_success 'will not overwrite untracked file in leading path' '
        cp important sub &&
        cp important sub2 &&
        test_must_fail git merge sub 2>out &&
-       test_i18ncmp out expect &&
+       test_cmp out expect &&
        test_path_is_missing .git/MERGE_HEAD &&
        test_cmp important sub &&
        test_cmp important sub2 &&
@@ -174,7 +174,7 @@ test_expect_success 'will not overwrite untracked file on unborn branch' '
        git checkout --orphan new &&
        cp important c0.c &&
        test_must_fail git merge c0 2>out &&
-       test_i18ncmp out expect
+       test_cmp out expect
 '
 
 test_expect_success 'will not overwrite untracked file on unborn branch .git/MERGE_HEAD sanity etc.' '
index e176475ed5bbe1ca9a10e0f533add9a8234b7b56..5bfb027099a6d22849739075de82f3c0af7ca513 100755 (executable)
@@ -40,14 +40,14 @@ EOF
 
 test_expect_success 'untracked files overwritten by merge (fast and non-fast forward)' '
        test_must_fail git merge branch 2>out &&
-       test_i18ncmp out expect &&
+       test_cmp out expect &&
        git commit --allow-empty -m empty &&
        (
                GIT_MERGE_VERBOSITY=0 &&
                export GIT_MERGE_VERBOSITY &&
                test_must_fail git merge branch 2>out2
        ) &&
-       test_i18ncmp out2 expect &&
+       test_cmp out2 expect &&
        git reset --hard HEAD^
 '
 
@@ -68,7 +68,7 @@ test_expect_success 'untracked files or local changes ovewritten by merge' '
        git add three &&
        git add four &&
        test_must_fail git merge branch 2>out &&
-       test_i18ncmp out expect
+       test_cmp out expect
 '
 
 cat >expect <<\EOF
@@ -90,7 +90,7 @@ test_expect_success 'cannot switch branches because of local changes' '
        echo uno >rep/one &&
        echo dos >rep/two &&
        test_must_fail git checkout branch 2>out &&
-       test_i18ncmp out expect
+       test_cmp out expect
 '
 
 cat >expect <<\EOF
@@ -104,7 +104,7 @@ EOF
 test_expect_success 'not uptodate file porcelain checkout error' '
        git add rep/one rep/two &&
        test_must_fail git checkout branch 2>out &&
-       test_i18ncmp out expect
+       test_cmp out expect
 '
 
 cat >expect <<\EOF
@@ -135,7 +135,7 @@ test_expect_success 'not_uptodate_dir porcelain checkout error' '
        >rep/untracked-file &&
        >rep2/untracked-file &&
        test_must_fail git checkout branch 2>out &&
-       test_i18ncmp out ../expect
+       test_cmp out ../expect
 '
 
 test_done
index f76586f80875a3e8813ad36951ec464d4ff3d4a8..60d961b52600548fc121fac4183728f86bde05af 100755 (executable)
@@ -78,7 +78,7 @@ test_expect_success 'gc --keep-largest-pack' '
                git gc &&
                ( cd .git/objects/pack && ls *.pack ) >pack-list &&
                test_line_count = 1 pack-list &&
-               BASE_PACK=.git/objects/pack/pack-*.pack &&
+               cp pack-list base-pack-list &&
                test_commit four &&
                git repack -d &&
                test_commit five &&
@@ -90,7 +90,7 @@ test_expect_success 'gc --keep-largest-pack' '
                test_line_count = 2 pack-list &&
                awk "/^P /{print \$2}" <.git/objects/info/packs >pack-info &&
                test_line_count = 2 pack-info &&
-               test_path_is_file $BASE_PACK &&
+               test_path_is_file .git/objects/pack/$(cat base-pack-list) &&
                git fsck
        )
 '
index 63d5f41a1247839412b9c6022fb3f4a07c4e6b0e..080a65308316b1f03ba57e9bbcc34cb3feb504a9 100755 (executable)
@@ -446,7 +446,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
        echo "warning: Could not find section in .gitmodules where path=sub" >expect.err &&
        mkdir mod &&
        git mv sub mod/sub 2>actual.err &&
-       test_i18ncmp expect.err actual.err &&
+       test_cmp expect.err actual.err &&
        ! test -e sub &&
        [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
        (
index 943a7d5c1db9563eb8ed648f0f760a54b9df58eb..2f72c5c6883e3e45bbc9602f3e85e1dd9ae3fd01 100755 (executable)
@@ -20,6 +20,13 @@ tag_exists () {
        git show-ref --quiet --verify refs/tags/"$1"
 }
 
+test_expect_success 'setup' '
+       test_oid_cache <<-EOM
+       othersigheader sha1:gpgsig-sha256
+       othersigheader sha256:gpgsig
+       EOM
+'
+
 test_expect_success 'listing all tags in an empty tree should succeed' '
        git tag -l &&
        git tag
@@ -91,7 +98,7 @@ test_expect_success 'creating a tag with --create-reflog should create reflog' '
        git tag --create-reflog tag_with_reflog &&
        git reflog exists refs/tags/tag_with_reflog &&
        sed -e "s/^.*   //" .git/logs/refs/tags/tag_with_reflog >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'annotated tag with --create-reflog has correct message' '
@@ -102,7 +109,7 @@ test_expect_success 'annotated tag with --create-reflog has correct message' '
        git tag -m "annotated tag" --create-reflog tag_with_reflog &&
        git reflog exists refs/tags/tag_with_reflog &&
        sed -e "s/^.*   //" .git/logs/refs/tags/tag_with_reflog >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success '--create-reflog does not create reflog on failure' '
@@ -1374,6 +1381,24 @@ test_expect_success GPG \
        'test_config gpg.program echo &&
         test_must_fail git tag -s -m tail tag-gpg-failure'
 
+# try to produce invalid signature
+test_expect_success GPG 'git verifies tag is valid with double signature' '
+       git tag -s -m tail tag-gpg-double-sig &&
+       git cat-file tag tag-gpg-double-sig >tag &&
+       othersigheader=$(test_oid othersigheader) &&
+       sed -ne "/^\$/q;p" tag >new-tag &&
+       cat <<-EOM >>new-tag &&
+       $othersigheader -----BEGIN PGP SIGNATURE-----
+        someinvaliddata
+        -----END PGP SIGNATURE-----
+       EOM
+       sed -e "1,/^tagger/d" tag >>new-tag &&
+       new_tag=$(git hash-object -t tag -w new-tag) &&
+       git update-ref refs/tags/tag-gpg-double-sig $new_tag &&
+       git verify-tag tag-gpg-double-sig &&
+       git fsck
+'
+
 # try to sign with bad user.signingkey
 test_expect_success GPGSM \
        'git tag -s fails if gpgsm is misconfigured (bad key)' \
@@ -1409,7 +1434,7 @@ test_expect_success 'message in editor has initial comment: first line' '
        # check the first line --- should be empty
        echo >first.expect &&
        sed -e 1q <actual >first.actual &&
-       test_i18ncmp first.expect first.actual
+       test_cmp first.expect first.actual
 '
 
 test_expect_success \
@@ -1732,7 +1757,7 @@ test_expect_success 'recursive tagging should give advice' '
        hint: Disable this message with "git config advice.nestedTag false"
        EOF
        git tag -m nested nested annotated-v4.0 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'multiple --points-at are OR-ed together' '
index fdb450e446a987717d4565ef58cccfa332259927..0e7cf75435eca107fc17b836fa939d3378e983a4 100755 (executable)
@@ -656,4 +656,134 @@ test_expect_success TTY 'git tag with auto-columns ' '
        test_cmp expect actual
 '
 
+test_expect_success 'setup trace2' '
+       GIT_TRACE2_BRIEF=1 &&
+       export GIT_TRACE2_BRIEF
+'
+
+test_expect_success TTY 'git returns SIGPIPE on early pager exit' '
+       test_when_finished "rm pager-used trace.normal" &&
+       test_config core.pager ">pager-used; head -n 1; exit 0" &&
+       GIT_TRACE2="$(pwd)/trace.normal" &&
+       export GIT_TRACE2 &&
+       test_when_finished "unset GIT_TRACE2" &&
+
+       if test_have_prereq !MINGW
+       then
+               OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+               test_match_signal 13 "$OUT"
+       else
+               test_terminal git log
+       fi &&
+
+       grep child_exit trace.normal >child-exits &&
+       test_line_count = 1 child-exits &&
+       grep " code:0 " child-exits &&
+       test_path_is_file pager-used
+'
+
+test_expect_success TTY 'git returns SIGPIPE on early pager non-zero exit' '
+       test_when_finished "rm pager-used trace.normal" &&
+       test_config core.pager ">pager-used; head -n 1; exit 1" &&
+       GIT_TRACE2="$(pwd)/trace.normal" &&
+       export GIT_TRACE2 &&
+       test_when_finished "unset GIT_TRACE2" &&
+
+       if test_have_prereq !MINGW
+       then
+               OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+               test_match_signal 13 "$OUT"
+       else
+               test_terminal git log
+       fi &&
+
+       grep child_exit trace.normal >child-exits &&
+       test_line_count = 1 child-exits &&
+       grep " code:1 " child-exits &&
+       test_path_is_file pager-used
+'
+
+test_expect_success TTY 'git discards pager non-zero exit without SIGPIPE' '
+       test_when_finished "rm pager-used trace.normal" &&
+       test_config core.pager "wc >pager-used; exit 1" &&
+       GIT_TRACE2="$(pwd)/trace.normal" &&
+       export GIT_TRACE2 &&
+       test_when_finished "unset GIT_TRACE2" &&
+
+       if test_have_prereq !MINGW
+       then
+               OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+               test "$OUT" -eq 0
+       else
+               test_terminal git log
+       fi &&
+
+       grep child_exit trace.normal >child-exits &&
+       test_line_count = 1 child-exits &&
+       grep " code:1 " child-exits &&
+       test_path_is_file pager-used
+'
+
+test_expect_success TTY 'git discards nonexisting pager without SIGPIPE' '
+       test_when_finished "rm pager-used trace.normal" &&
+       test_config core.pager "wc >pager-used; does-not-exist" &&
+       GIT_TRACE2="$(pwd)/trace.normal" &&
+       export GIT_TRACE2 &&
+       test_when_finished "unset GIT_TRACE2" &&
+
+       if test_have_prereq !MINGW
+       then
+               OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+               test "$OUT" -eq 0
+       else
+               test_terminal git log
+       fi &&
+
+       grep child_exit trace.normal >child-exits &&
+       test_line_count = 1 child-exits &&
+       grep " code:127 " child-exits &&
+       test_path_is_file pager-used
+'
+
+test_expect_success TTY 'git attempts to page to nonexisting pager command, gets SIGPIPE' '
+       test_when_finished "rm trace.normal" &&
+       test_config core.pager "does-not-exist" &&
+       GIT_TRACE2="$(pwd)/trace.normal" &&
+       export GIT_TRACE2 &&
+       test_when_finished "unset GIT_TRACE2" &&
+
+       if test_have_prereq !MINGW
+       then
+               OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+               test_match_signal 13 "$OUT"
+       else
+               test_terminal git log
+       fi &&
+
+       grep child_exit trace.normal >child-exits &&
+       test_line_count = 1 child-exits &&
+       grep " code:-1 " child-exits
+'
+
+test_expect_success TTY 'git returns SIGPIPE on propagated signals from pager' '
+       test_when_finished "rm pager-used trace.normal" &&
+       test_config core.pager ">pager-used; test-tool sigchain" &&
+       GIT_TRACE2="$(pwd)/trace.normal" &&
+       export GIT_TRACE2 &&
+       test_when_finished "unset GIT_TRACE2" &&
+
+       if test_have_prereq !MINGW
+       then
+               OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+               test_match_signal 13 "$OUT"
+       else
+               test_terminal git log
+       fi &&
+
+       grep child_exit trace.normal >child-exits &&
+       test_line_count = 1 child-exits &&
+       grep " code:143 " child-exits &&
+       test_path_is_file pager-used
+'
+
 test_done
index e5c6a038fbfccb3da7c3c179fa0c6c186de68d40..f2a8e765114fd1a01f1256a6768353cd2ab69b4a 100755 (executable)
@@ -125,13 +125,13 @@ EOF
 test_expect_success 'git-clean, absent case' '
        setup_absent &&
        git clean -n > result &&
-       test_i18ncmp expected result
+       test_cmp expected result
 '
 
 test_expect_success 'git-clean, dirty case' '
        setup_dirty &&
        git clean -n > result &&
-       test_i18ncmp expected result
+       test_cmp expected result
 '
 
 test_expect_success '--ignore-skip-worktree-entries leaves worktree alone' '
index 72fb418b8904ffedac1fcf87d97878c86e054b5b..0f4344c55e6421d605ab7364bc2fedfe9165b02b 100755 (executable)
@@ -56,9 +56,9 @@ EOF
                git commit -m delete &&
                test_must_fail git merge main &&
                test_must_fail git commit --dry-run >../actual &&
-               test_i18ncmp ../expect ../actual &&
+               test_cmp ../expect ../actual &&
                git status >../actual &&
-               test_i18ncmp ../expect ../actual
+               test_cmp ../expect ../actual
        )
 '
 
@@ -151,7 +151,7 @@ Unmerged paths:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -185,7 +185,7 @@ Unmerged paths:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -210,7 +210,7 @@ Unmerged paths:
 Untracked files not listed (use -u option to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual &&
+       test_cmp expected actual &&
        git reset --hard &&
        git checkout main
 '
@@ -227,7 +227,7 @@ test_expect_success 'status --branch with detached HEAD' '
        ?? expected
        ?? mdconflict/
        EOF
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 ## Duplicate the above test and verify --porcelain=v1 arg parsing.
@@ -243,7 +243,7 @@ test_expect_success 'status --porcelain=v1 --branch with detached HEAD' '
        ?? expected
        ?? mdconflict/
        EOF
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 ## Verify parser error on invalid --porcelain argument.
index f01bf27727905db64f5d7eeaca5fd05b5e90f02f..accefde72fb1bd518b2fcd7caf4d8c4921180bdc 100755 (executable)
@@ -731,7 +731,7 @@ test_expect_success 'test ident field is working' '
        cp -R done dthree dtwo four three ../other_worktree &&
        GIT_WORK_TREE=../other_worktree git status 2>../err &&
        echo "warning: untracked cache is disabled on this system or location" >../expect &&
-       test_i18ncmp ../expect ../err
+       test_cmp ../expect ../err
 '
 
 test_expect_success 'untracked cache survives a checkout' '
index 7d8fb188ee5eb914cc77e30846191adb78adb5bb..601b2bf97f0e7f40de454358b6a7975488644687 100755 (executable)
@@ -75,14 +75,14 @@ test_expect_success 'reset --hard message' '
        hex=$(git log -1 --format="%h") &&
        git reset --hard >.actual &&
        echo HEAD is now at $hex $(commit_msg) >.expected &&
-       test_i18ncmp .expected .actual
+       test_cmp .expected .actual
 '
 
 test_expect_success 'reset --hard message (ISO8859-1 logoutputencoding)' '
        hex=$(git log -1 --format="%h") &&
        git -c "i18n.logOutputEncoding=$test_encoding" reset --hard >.actual &&
        echo HEAD is now at $hex $(commit_msg $test_encoding) >.expected &&
-       test_i18ncmp .expected .actual
+       test_cmp .expected .actual
 '
 
 test_expect_success 'giving a non existing revision should fail' '
@@ -469,7 +469,7 @@ test_expect_success '--mixed refreshes the index' '
        EOF
        echo 123 >>file2 &&
        git reset --mixed HEAD >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'resetting specific path that is unmerged' '
index cb5e34d94c3a163ecc3785d4b3afdeeb98c60ec6..a74816ca8b466c789c3bc8b17e629d5edcbb25e9 100755 (executable)
@@ -110,7 +110,7 @@ test_expect_success 'git clean with prefix' '
 
 '
 
-test_expect_success C_LOCALE_OUTPUT 'git clean with relative prefix' '
+test_expect_success 'git clean with relative prefix' '
 
        mkdir -p build docs &&
        touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@@ -123,7 +123,7 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with relative prefix' '
        verbose test "$would_clean" = ../src/part3.c
 '
 
-test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' '
+test_expect_success 'git clean with absolute path' '
 
        mkdir -p build docs &&
        touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@@ -407,7 +407,7 @@ test_expect_success 'clean.requireForce and -f' '
 
 '
 
-test_expect_success C_LOCALE_OUTPUT 'core.excludesfile' '
+test_expect_success 'core.excludesfile' '
 
        echo excludes >excludes &&
        echo included >included &&
index d44f69629337f7e617d118e060550737ca92c59a..a924fdb7a6c9aaf6c1b860dd4c783d87b803c36f 100755 (executable)
@@ -55,7 +55,7 @@ test_expect_success 'add aborts on repository with no commits' '
        EOF
        git init repo-no-commits &&
        test_must_fail git submodule add ../a ./repo-no-commits 2>actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'status should ignore inner git repo when not added' '
@@ -185,7 +185,7 @@ test_expect_success 'submodule add to .gitignored path fails' '
                git add --force .gitignore &&
                git commit -m"Ignore everything" &&
                ! git submodule add "$submodurl" submod >actual 2>&1 &&
-               test_i18ncmp expect actual
+               test_cmp expect actual
        )
 '
 
index 76088147089c9bacdf0cb9f7cb570c55c1ec3f4d..9c3cc4cf4046befd76e0239c831d61b33196ee86 100755 (executable)
@@ -190,7 +190,7 @@ test_expect_success 'typechanged submodule(submodule->blob), --cached' "
          < Add foo5
 
        EOF
-       test_i18ncmp expected actual
+       test_cmp expected actual
 "
 
 test_expect_success 'typechanged submodule(submodule->blob), --files' "
@@ -200,7 +200,7 @@ test_expect_success 'typechanged submodule(submodule->blob), --files' "
          > Add foo5
 
        EOF
-       test_i18ncmp expected actual
+       test_cmp expected actual
 "
 
 rm -rf sm1 &&
@@ -211,7 +211,7 @@ test_expect_success 'typechanged submodule(submodule->blob)' "
        * sm1 $head4(submodule)->$head5(blob):
 
        EOF
-       test_i18ncmp expected actual
+       test_cmp expected actual
 "
 
 rm -f sm1 &&
@@ -224,7 +224,7 @@ test_expect_success 'nonexistent commit' "
          Warn: sm1 doesn't contain commit $head4_full
 
        EOF
-       test_i18ncmp expected actual
+       test_cmp expected actual
 "
 
 commit_file
@@ -235,7 +235,7 @@ test_expect_success 'typechanged submodule(blob->submodule)' "
          > Add foo7
 
        EOF
-       test_i18ncmp expected actual
+       test_cmp expected actual
 "
 
 commit_file sm1 &&
@@ -292,7 +292,7 @@ test_expect_success 'given commit' "
 
 test_expect_success '--for-status' "
        git submodule summary --for-status HEAD^ >actual &&
-       test_i18ncmp - actual <<-EOF
+       test_cmp - actual <<-EOF
        * sm1 $head6...0000000:
 
        * sm2 0000000...$head7 (2):
index b9c1624fba9fda209f7e86b3a2703624f3d63bc8..ff3ba5422e9bdae64795eaa4fa617187f0b65725 100755 (executable)
@@ -155,9 +155,9 @@ test_expect_success 'submodule update --init --recursive from subdirectory' '
         cd tmp &&
         git submodule update --init --recursive ../super >../../actual 2>../../actual2
        ) &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
        sort actual2 >actual2.sorted &&
-       test_i18ncmp expect2 actual2.sorted
+       test_cmp expect2 actual2.sorted
 '
 
 cat <<EOF >expect2
@@ -174,7 +174,7 @@ test_expect_success 'submodule update --init from and of subdirectory' '
          git submodule update --init sub 2>../../actual2
         )
        ) &&
-       test_i18ncmp expect2 actual2
+       test_cmp expect2 actual2
 '
 
 test_expect_success 'submodule update does not fetch already present commits' '
@@ -192,7 +192,7 @@ test_expect_success 'submodule update does not fetch already present commits' '
        (cd super &&
          git submodule update > ../actual 2> ../actual.err
        ) &&
-       test_i18ncmp expected actual &&
+       test_cmp expected actual &&
        test_must_be_empty actual.err
 '
 
@@ -461,7 +461,7 @@ test_expect_success 'submodule update - command in .git/config catches failure'
        (cd super &&
         test_must_fail git submodule update submodule 2>../actual
        ) &&
-       test_i18ncmp actual expect
+       test_cmp actual expect
 '
 
 cat << EOF >expect
@@ -479,7 +479,7 @@ test_expect_success 'submodule update - command in .git/config catches failure -
         mkdir tmp && cd tmp &&
         test_must_fail git submodule update ../submodule 2>../../actual
        ) &&
-       test_i18ncmp actual expect
+       test_cmp actual expect
 '
 
 test_expect_success 'submodule update - command run for initial population of submodule' '
@@ -488,7 +488,7 @@ test_expect_success 'submodule update - command run for initial population of su
        EOF
        rm -rf super/submodule &&
        test_must_fail git -C super submodule update 2>actual &&
-       test_i18ncmp expect actual &&
+       test_cmp expect actual &&
        git -C super submodule update --checkout
 '
 
@@ -509,7 +509,7 @@ test_expect_success 'recursive submodule update - command in .git/config catches
         mkdir -p tmp && cd tmp &&
         test_must_fail git submodule update --recursive ../super 2>../../actual
        ) &&
-       test_i18ncmp actual expect
+       test_cmp actual expect
 '
 
 test_expect_success 'submodule init does not copy command into .git/config' '
index 79981b51eb89aced1aaaeee9004bfeb6592af000..e2f110b786387035f6cc4fa31a21f9c380edb2f4 100755 (executable)
@@ -80,7 +80,7 @@ test_expect_success 'test basic "submodule foreach" usage' '
                git config foo.bar zar &&
                git submodule foreach "git config --file \"\$toplevel/.git/config\" foo.bar"
        ) &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat >expect <<EOF
@@ -96,7 +96,7 @@ test_expect_success 'test "submodule foreach" from subdirectory' '
                cd clone/sub &&
                git submodule foreach "echo \$toplevel-\$name-\$sm_path-\$displaypath-\$sha1" >../../actual
        ) &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'setup nested submodules' '
@@ -177,7 +177,7 @@ test_expect_success 'test messages from "foreach --recursive"' '
                cd clone2 &&
                git submodule foreach --recursive "true" > ../actual
        ) &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat > expect <<EOF
@@ -197,7 +197,7 @@ test_expect_success 'test messages from "foreach --recursive" from subdirectory'
                cd untracked &&
                git submodule foreach --recursive >../../actual
        ) &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 sub1sha1=$(cd clone2/sub1 && git rev-parse HEAD)
 sub2sha1=$(cd clone2/sub2 && git rev-parse HEAD)
@@ -229,7 +229,7 @@ test_expect_success 'test "submodule foreach --recursive" from subdirectory' '
                cd clone2/untracked &&
                git submodule foreach --recursive "echo toplevel: \$toplevel name: \$name path: \$sm_path displaypath: \$displaypath hash: \$sha1" >../../actual
        ) &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 cat > expect <<EOF
index 6d19ece05dd320b970492daf015b874eee0d391f..e41ac18e7e0a663b44ef1cce0596f96615a7fc22 100755 (executable)
@@ -15,7 +15,7 @@ commit_msg_is () {
 
        printf "%s" "$(git log --pretty=format:%s%b -1)" >"$actual" &&
        printf "%s" "$1" >"$expect" &&
-       test_i18ncmp "$expect" "$actual"
+       test_cmp "$expect" "$actual"
 }
 
 # A sanity check to see if commit is working at all.
@@ -356,7 +356,7 @@ test_expect_success 'new line found before status message in commit template' '
        touch commit-template-check &&
        git add commit-template-check &&
        GIT_EDITOR="cat >editor-input" git commit --untracked-files=no --allow-empty-message &&
-       test_i18ncmp expected-template editor-input
+       test_cmp expected-template editor-input
 '
 
 test_expect_success 'setup empty commit with unstaged rename and copy' '
index 0f936182e4f186e98897ba4b8a11c5133ffc1911..512ae2781fe2c9b02a5a37f5230ec14992114ae7 100755 (executable)
@@ -11,7 +11,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
-. "$TEST_DIRECTORY/diff-lib.sh"
+. "$TEST_DIRECTORY/lib-diff.sh"
 
 author='The Real Author <someguy@his.email.org>'
 
index e5332adc9a10aae26a2419d209d7337de4d5cae6..6396897cc81804be174db6e37ccc7a8af8d648f1 100755 (executable)
@@ -13,7 +13,7 @@ commit_msg_is () {
 
        printf "%s" "$(git log --pretty=format:%s%b -1)" >$actual &&
        printf "%s" "$1" >$expect &&
-       test_i18ncmp $expect $actual
+       test_cmp $expect $actual
 }
 
 # Arguments: [<prefix] [<commit message>] [<commit options>]
@@ -35,7 +35,7 @@ check_summary_oneline() {
        SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')"
        echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp &&
 
-       test_i18ncmp exp act
+       test_cmp exp act
 }
 
 test_expect_success 'output summary format' '
@@ -300,7 +300,7 @@ echo "sample
 # with '#' will be ignored, and an empty message aborts the commit." >expect
 
 test_expect_success 'cleanup commit messages (strip option,-F,-e): output' '
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'cleanup commit message (fail on invalid cleanup mode option)' '
index 321b4bc0fc69d93a8db838447c01db76e0853c26..7a8194ce720ed5d9244caf2bbd882a56f491476c 100755 (executable)
@@ -218,7 +218,7 @@ test_expect_success 'with hook and editor (merge)' '
 test_rebase () {
        expect=$1 &&
        mode=$2 &&
-       test_expect_$expect C_LOCALE_OUTPUT "with hook (rebase ${mode:--i})" '
+       test_expect_$expect "with hook (rebase ${mode:--i})" '
                test_when_finished "\
                        git rebase --abort
                        git checkout -f main
@@ -307,7 +307,7 @@ test_expect_success 'with failing hook (merge)' '
 
 '
 
-test_expect_success C_LOCALE_OUTPUT 'with failing hook (cherry-pick)' '
+test_expect_success 'with failing hook (cherry-pick)' '
        test_when_finished "git checkout -f main" &&
        git checkout -B other b &&
        test_must_fail git cherry-pick rebase-1 2>actual &&
index d01aacb66b54e1700209e2338a39e062da7d8c36..2b72451ba3ed23eff7d726564845ce14f98e2cc1 100755 (executable)
@@ -109,13 +109,13 @@ test_expect_success 'status --column' '
 #
 EOF
        COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'status --column status.displayCommentPrefix=false' '
        strip_comments expect &&
        COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 cat >expect <<\EOF
@@ -144,19 +144,19 @@ EOF
 
 test_expect_success 'status with status.displayCommentPrefix=true' '
        git -c status.displayCommentPrefix=true status >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'status with status.displayCommentPrefix=false' '
        strip_comments expect &&
        git -c status.displayCommentPrefix=false status >output &&
-       test_i18ncmp expect output
+       test_cmp 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_cmp expect-with-v output
 '
 
 test_expect_success 'status -v -v' '
@@ -167,7 +167,7 @@ test_expect_success 'status -v -v' '
         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_cmp expect-with-v output
 '
 
 test_expect_success 'setup fake editor' '
@@ -214,7 +214,7 @@ EOF
 test_expect_success 'status (advice.statusHints false)' '
        test_config advice.statusHints false &&
        git status >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 
 '
 
@@ -296,7 +296,7 @@ Ignored files:
 
 EOF
        git status --ignored >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'status with gitignore (nothing untracked)' '
@@ -358,7 +358,7 @@ Ignored files:
 
 EOF
        git status --ignored >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 cat >.gitignore <<\EOF
@@ -380,7 +380,7 @@ EOF
 test_expect_success 'status -s -b' '
 
        git status -s -b >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 
 '
 
@@ -390,7 +390,7 @@ test_expect_success 'status -s -z -b' '
        git status -s -z -b >output &&
        nul_to_q <output >output.q &&
        mv output.q output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'setup dir3' '
@@ -418,13 +418,13 @@ Changes not staged for commit:
 Untracked files not listed (use -u option to show untracked files)
 EOF
        git status -uno >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'status (status.showUntrackedFiles no)' '
        test_config status.showuntrackedfiles no &&
        git status >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'status -uno (advice.statusHints false)' '
@@ -443,7 +443,7 @@ Untracked files not listed
 EOF
        test_config advice.statusHints false &&
        git status -uno >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 cat >expect << EOF
@@ -487,13 +487,13 @@ Untracked files:
 
 EOF
        git status -unormal >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'status (status.showUntrackedFiles normal)' '
        test_config status.showuntrackedfiles normal &&
        git status >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 cat >expect <<EOF
@@ -543,13 +543,13 @@ Untracked files:
 
 EOF
        git status -uall >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'status (status.showUntrackedFiles all)' '
        test_config status.showuntrackedfiles all &&
        git status >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'teardown dir3' '
@@ -601,7 +601,7 @@ Untracked files:
 
 EOF
        (cd dir1 && git status) >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 cat >expect <<\EOF
@@ -670,13 +670,13 @@ Untracked files:
 EOF
        test_config color.ui auto &&
        test_terminal git status | test_decode_color >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success TTY 'status with color.status' '
        test_config color.status auto &&
        test_terminal git status | test_decode_color >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 cat >expect <<\EOF
@@ -718,7 +718,7 @@ EOF
 test_expect_success TTY 'status -s -b with color.status' '
 
        test_terminal git status -s -b | test_decode_color >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 
 '
 
@@ -793,7 +793,7 @@ Untracked files:
 EOF
        test_config status.relativePaths false &&
        (cd dir1 && git status) >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 
 '
 
@@ -860,7 +860,7 @@ Untracked files:
 
 EOF
        git commit --dry-run dir1/modified >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 cat >expect <<EOF
@@ -921,13 +921,13 @@ Untracked files:
 
 EOF
        git status >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 # we expect the same as the previous test
 test_expect_success 'status --untracked-files=all does not show submodule' '
        git status --untracked-files=all >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 cat >expect <<EOF
@@ -984,13 +984,13 @@ Untracked files:
 EOF
        git config status.submodulesummary 10 &&
        git status >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'status submodule summary with status.displayCommentPrefix=false' '
        strip_comments expect &&
        git -c status.displayCommentPrefix=false status >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'commit with submodule summary ignores status.displayCommentPrefix' '
@@ -1035,9 +1035,9 @@ EOF
        git commit -m "commit submodule" &&
        git config status.submodulesummary 10 &&
        test_must_fail git commit --dry-run >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git status >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 cat >expect <<EOF
@@ -1091,7 +1091,7 @@ Untracked files:
 EOF
        git config status.submodulesummary 10 &&
        git commit --dry-run --amend >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
@@ -1143,17 +1143,17 @@ Untracked files:
 EOF
        echo modified  sm/untracked &&
        git status --ignore-submodules=untracked >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
        test_config diff.ignoreSubmodules dirty &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config --add -f .gitmodules submodule.subname.ignore untracked &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
@@ -1163,14 +1163,14 @@ test_expect_success '.git/config ignore=untracked suppresses submodules with unt
        git config --add submodule.subname.ignore untracked &&
        git config --add submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config --remove-section submodule.subname &&
        git config --remove-section -f .gitmodules submodule.subname
 '
 
 test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
        git status --ignore-submodules=dirty >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
@@ -1180,7 +1180,7 @@ test_expect_success '.gitmodules ignore=dirty suppresses submodules with untrack
        git config --add -f .gitmodules submodule.subname.ignore dirty &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
@@ -1190,7 +1190,7 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with untrack
        git config --add submodule.subname.ignore dirty &&
        git config --add submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config --remove-section submodule.subname &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
@@ -1198,14 +1198,14 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with untrack
 test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
        echo modified >sm/foo &&
        git status --ignore-submodules=dirty >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
        git config --add -f .gitmodules submodule.subname.ignore dirty &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
@@ -1215,7 +1215,7 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with modifie
        git config --add submodule.subname.ignore dirty &&
        git config --add submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config --remove-section submodule.subname &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
@@ -1253,14 +1253,14 @@ Untracked files:
 
 EOF
        git status --ignore-submodules=untracked > output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
        git config --add -f .gitmodules submodule.subname.ignore untracked &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
@@ -1270,7 +1270,7 @@ test_expect_success ".git/config ignore=untracked doesn't suppress submodules wi
        git config --add submodule.subname.ignore untracked &&
        git config --add submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config --remove-section submodule.subname &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
@@ -1314,14 +1314,14 @@ Untracked files:
 
 EOF
        git status --ignore-submodules=untracked > output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
        git config --add -f .gitmodules submodule.subname.ignore untracked &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
@@ -1331,20 +1331,20 @@ test_expect_success ".git/config ignore=untracked doesn't suppress submodule sum
        git config --add submodule.subname.ignore untracked &&
        git config --add submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config --remove-section submodule.subname &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
 test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
        git status --ignore-submodules=dirty > output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
        git config --add -f .gitmodules submodule.subname.ignore dirty &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
@@ -1354,7 +1354,7 @@ test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary
        git config --add submodule.subname.ignore dirty &&
        git config --add submodule.subname.path sm &&
        git status >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config --remove-section submodule.subname &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
@@ -1398,7 +1398,7 @@ EOF
 test_expect_success "status (core.commentchar with submodule summary)" '
        test_config core.commentchar ";" &&
        git -c status.displayCommentPrefix=true status >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success "status (core.commentchar with two chars with submodule summary)" '
@@ -1429,7 +1429,7 @@ Untracked files:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --ignore-submodules=all > output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success '.gitmodules ignore=all suppresses unstaged submodule summary' '
@@ -1460,7 +1460,7 @@ EOF
        git config --add -f .gitmodules submodule.subname.ignore all &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status > output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
@@ -1470,7 +1470,7 @@ test_expect_success '.git/config ignore=all suppresses unstaged submodule summar
        git config --add submodule.subname.ignore all &&
        git config --add submodule.subname.path sm &&
        git status > output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git config --remove-section submodule.subname &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
@@ -1571,7 +1571,7 @@ Changes not staged for commit:
 Untracked files not listed (use -u option to show untracked files)
 EOF
        git commit -uno --dry-run >output &&
-       test_i18ncmp expect output &&
+       test_cmp expect output &&
        git status -s --ignore-submodules=dirty >output &&
        test_i18ngrep "^M. sm" output
 '
index f4bf925bdd26bbbe062c268536054ce8019253ba..8df5a74f1db4ecd846c9365c0474f6628cbbd443 100755 (executable)
@@ -175,7 +175,7 @@ test_expect_success GPG 'show signed commit with signature' '
        git cat-file commit initial >cat &&
        grep -v -e "gpg: " -e "Warning: " show >show.commit &&
        grep -e "gpg: " -e "Warning: " show >show.gpg &&
-       grep -v "^ " cat | grep -v "^$(test_oid header) " >cat.commit &&
+       grep -v "^ " cat | grep -v "^gpgsig.* " >cat.commit &&
        test_cmp show.commit commit &&
        test_cmp show.gpg verify.2 &&
        test_cmp cat.commit verify.1
@@ -337,4 +337,45 @@ test_expect_success GPG 'show double signature with custom format' '
        test_cmp expect actual
 '
 
+
+test_expect_success GPG 'verify-commit verifies multiply signed commits' '
+       git init multiply-signed &&
+       cd multiply-signed &&
+       test_commit first &&
+       echo 1 >second &&
+       git add second &&
+       tree=$(git write-tree) &&
+       parent=$(git rev-parse HEAD^{commit}) &&
+       git commit --gpg-sign -m second &&
+       git cat-file commit HEAD &&
+       # Avoid trailing whitespace.
+       sed -e "s/^Q//" -e "s/^Z/ /" >commit <<-EOF &&
+       Qtree $tree
+       Qparent $parent
+       Qauthor A U Thor <author@example.com> 1112912653 -0700
+       Qcommitter C O Mitter <committer@example.com> 1112912653 -0700
+       Qgpgsig -----BEGIN PGP SIGNATURE-----
+       QZ
+       Q iHQEABECADQWIQRz11h0S+chaY7FTocTtvUezd5DDQUCX/uBDRYcY29tbWl0dGVy
+       Q QGV4YW1wbGUuY29tAAoJEBO29R7N3kMNd+8AoK1I8mhLHviPH+q2I5fIVgPsEtYC
+       Q AKCTqBh+VabJceXcGIZuF0Ry+udbBQ==
+       Q =tQ0N
+       Q -----END PGP SIGNATURE-----
+       Qgpgsig-sha256 -----BEGIN PGP SIGNATURE-----
+       QZ
+       Q iHQEABECADQWIQRz11h0S+chaY7FTocTtvUezd5DDQUCX/uBIBYcY29tbWl0dGVy
+       Q QGV4YW1wbGUuY29tAAoJEBO29R7N3kMN/NEAn0XO9RYSBj2dFyozi0JKSbssYMtO
+       Q AJwKCQ1BQOtuwz//IjU8TiS+6S4iUw==
+       Q =pIwP
+       Q -----END PGP SIGNATURE-----
+       Q
+       Qsecond
+       EOF
+       head=$(git hash-object -t commit -w commit) &&
+       git reset --hard $head &&
+       git verify-commit $head 2>actual &&
+       grep "Good signature from" actual &&
+       ! grep "BAD signature from" actual
+'
+
 test_done
index 9f5e3ce7931991d29d9108b8f8522c1eba6e3bc6..7f2956d77ad033a57981a9569db3ef803ef93961 100755 (executable)
@@ -41,7 +41,7 @@ Unmerged paths:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -61,7 +61,7 @@ Changes to be committed:
 Untracked files not listed (use -u option to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -93,7 +93,7 @@ Unmerged paths:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -116,7 +116,7 @@ Changes to be committed:
 Untracked files not listed (use -u option to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -154,7 +154,7 @@ Unmerged paths:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -180,7 +180,7 @@ Changes to be committed:
 Untracked files not listed (use -u option to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -210,7 +210,7 @@ You are currently editing a commit while rebasing branch '\''rebase_i_edit'\'' o
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -249,7 +249,7 @@ Changes not staged for commit:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -282,7 +282,7 @@ You are currently editing a commit while rebasing branch '\''amend_last'\'' on '
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -321,7 +321,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -356,7 +356,7 @@ Changes not staged for commit:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -387,7 +387,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -418,7 +418,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -454,7 +454,7 @@ Changes not staged for commit:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -486,7 +486,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -519,7 +519,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -557,7 +557,7 @@ Changes not staged for commit:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -591,7 +591,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -619,7 +619,7 @@ You are in the middle of an am session.
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -641,7 +641,7 @@ You are in the middle of an am session.
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -664,7 +664,7 @@ The current patch is empty.
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -687,7 +687,7 @@ You are currently bisecting, started from branch '\''bisect'\''.
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -712,7 +712,7 @@ Unmerged paths:
 no changes added to commit
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -746,7 +746,7 @@ Unmerged paths:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 
@@ -770,7 +770,7 @@ Changes to be committed:
 Untracked files not listed (use -u option to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'status when cherry-picking after committing conflict resolution' '
@@ -789,7 +789,7 @@ Cherry-pick currently in progress.
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'status shows cherry-pick with invalid oid' '
@@ -798,7 +798,7 @@ test_expect_success 'status shows cherry-pick with invalid oid' '
        git status --untracked-files=no >actual 2>err &&
        git cherry-pick --quit &&
        test_must_be_empty err &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'status does not show error if .git/sequencer is a file' '
@@ -816,7 +816,7 @@ HEAD detached at atag
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual &&
+       test_cmp expected actual &&
 
        git reset --hard HEAD^ &&
        cat >expected <<\EOF &&
@@ -824,7 +824,7 @@ HEAD detached from atag
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'status while reverting commit (conflicts)' '
@@ -852,7 +852,7 @@ Unmerged paths:
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'status while reverting commit (conflicts resolved)' '
@@ -872,7 +872,7 @@ Changes to be committed:
 Untracked files not listed (use -u option to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'status after reverting commit' '
@@ -882,7 +882,7 @@ On branch main
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'status while reverting after committing conflict resolution' '
@@ -901,7 +901,7 @@ Revert currently in progress.
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'prepare for different number of commits rebased' '
@@ -931,7 +931,7 @@ You are currently editing a commit while rebasing branch '\''several_commits'\''
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'status: two commands done with some white lines in done file' '
@@ -959,7 +959,7 @@ You are currently editing a commit while rebasing branch '\''several_commits'\''
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'status: two remaining commands with some white lines in todo file' '
@@ -988,7 +988,7 @@ You are currently editing a commit while rebasing branch '\''several_commits'\''
 nothing to commit (use -u to show untracked files)
 EOF
        git status --untracked-files=no >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'status: handle not-yet-started rebase -i gracefully' '
@@ -1007,7 +1007,7 @@ You are currently editing a commit while rebasing branch '\''several_commits'\''
 
 nothing to commit (use -u to show untracked files)
 EOF
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_done
index fbfdcca000777461aed96c19eb7c2cc4b298c86c..45d025f96010da185f4af33b02ee60004236b1ea 100755 (executable)
@@ -236,7 +236,7 @@ test_expect_success 'refresh_index() invalidates fsmonitor cache' '
        git reset HEAD~1 &&
        git status >actual &&
        git -c core.fsmonitor= status >expect &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 # test fsmonitor with and without preloadIndex
@@ -273,7 +273,7 @@ do
                        git add dir2/new &&
                        git status >actual &&
                        git -c core.fsmonitor= status >expect &&
-                       test_i18ncmp expect actual
+                       test_cmp expect actual
                '
 
                # Make sure it's actually skipping the check for modified and untracked
index 91790943c3df0555c1dbaadc05a0832f4961f9bf..a88b02b06ed34234abfb3aa3131dd31a7d364141 100755 (executable)
@@ -30,7 +30,7 @@ test_expect_success 'Verify behavior of status on directories with ignored files
                dir/ignored/ignored_1.ign dir/ignored/ignored_2.ign &&
 
        git status --porcelain=v2 --ignored=matching --untracked-files=all >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'Verify status behavior on directory with tracked & ignored files' '
@@ -55,7 +55,7 @@ test_expect_success 'Verify status behavior on directory with tracked & ignored
        git commit -m "commit tracked files" &&
 
        git status --porcelain=v2 --ignored=matching --untracked-files=all >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'Verify status behavior on directory with untracked and ignored files' '
@@ -80,7 +80,7 @@ test_expect_success 'Verify status behavior on directory with untracked and igno
                dir/untracked_ignored/ignored_1.ign dir/untracked_ignored/ignored_2.ign &&
 
        git status --porcelain=v2 --ignored=matching --untracked-files=all >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'Verify status matching ignored files on ignored directory' '
@@ -96,7 +96,7 @@ test_expect_success 'Verify status matching ignored files on ignored directory'
                ignored_dir/ignored_1.ign ignored_dir/ignored_2.ign &&
 
        git status --porcelain=v2 --ignored=matching --untracked-files=all >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'Verify status behavior on ignored directory containing tracked file' '
@@ -117,7 +117,7 @@ test_expect_success 'Verify status behavior on ignored directory containing trac
        git add -f ignored_dir/tracked &&
        git commit -m "Force add file in ignored directory" &&
        git status --porcelain=v2 --ignored=matching --untracked-files=all >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'Verify matching ignored files with --untracked-files=normal' '
@@ -136,7 +136,7 @@ test_expect_success 'Verify matching ignored files with --untracked-files=normal
                ignored_files/ignored_1.ign ignored_files/ignored_2.ign \
                untracked_dir/untracked &&
        git status --porcelain=v2 --ignored=matching --untracked-files=normal >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'Verify matching ignored files with --untracked-files=normal' '
@@ -155,7 +155,7 @@ test_expect_success 'Verify matching ignored files with --untracked-files=normal
                ignored_files/ignored_1.ign ignored_files/ignored_2.ign \
                untracked_dir/untracked &&
        git status --porcelain=v2 --ignored=matching --untracked-files=normal >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'Verify status behavior on ignored directory containing tracked file' '
@@ -176,7 +176,7 @@ test_expect_success 'Verify status behavior on ignored directory containing trac
        git add -f ignored_dir/tracked &&
        git commit -m "Force add file in ignored directory" &&
        git status --porcelain=v2 --ignored=matching --untracked-files=normal >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'Verify behavior of status with --ignored=no' '
@@ -191,7 +191,7 @@ test_expect_success 'Verify behavior of status with --ignored=no' '
                dir/ignored/ignored_1.ign dir/ignored/ignored_2.ign &&
 
        git status --porcelain=v2 --ignored=no --untracked-files=all >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'Verify behavior of status with --ignored=traditional and --untracked-files=all' '
@@ -210,7 +210,7 @@ test_expect_success 'Verify behavior of status with --ignored=traditional and --
                dir/ignored/ignored_1.ign dir/ignored/ignored_2.ign &&
 
        git status --porcelain=v2 --ignored=traditional --untracked-files=all >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_expect_success 'Verify behavior of status with --ignored=traditional and --untracked-files=normal' '
@@ -227,7 +227,7 @@ test_expect_success 'Verify behavior of status with --ignored=traditional and --
                dir/ignored/ignored_1.ign dir/ignored/ignored_2.ign &&
 
        git status --porcelain=v2 --ignored=traditional --untracked-files=normal >output &&
-       test_i18ncmp expect output
+       test_cmp expect output
 '
 
 test_done
index b2c1d861dcb07aa0dd87b8b88269d9e7cb5d69aa..1cbc9715a81bdc9cf13bbe6d1341388468d0d047 100755 (executable)
@@ -272,7 +272,7 @@ test_expect_success 'merge c3 with c7 with commit.cleanup = scissors' '
        EOF
        git cat-file commit HEAD >raw &&
        sed -e "1,/^$/d" raw >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_expect_success 'merge c3 with c7 with --squash commit.cleanup = scissors' '
@@ -296,7 +296,7 @@ test_expect_success 'merge c3 with c7 with --squash commit.cleanup = scissors' '
        EOF
        git cat-file commit HEAD >raw &&
        sed -e "1,/^$/d" raw >actual &&
-       test_i18ncmp expect actual
+       test_cmp expect actual
 '
 
 test_debug 'git log --graph --decorate --oneline --all'
index 13859ec8595f7f5abc32cc5322e83328a4556319..a9c816b47f269ad0bf073f97f50e03a6ba3890d7 100755 (executable)
@@ -66,7 +66,7 @@ EOF
 test_expect_success 'merge output uses pretty names' '
        git reset --hard c1 &&
        git merge c2 c3 c4 >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 cat >expected <<\EOF
@@ -84,7 +84,7 @@ test_expect_success 'merge reduces irrelevant remote heads' '
                rm expected.tmp
        fi &&
        GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 cat >expected <<\EOF
@@ -101,7 +101,7 @@ EOF
 test_expect_success 'merge fast-forward output uses pretty names' '
        git reset --hard c0 &&
        git merge c1 c2 >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_done
index 9192c141ffc618f70e15b7cf25883d55469e5c11..3e041e83aede07ead62d54cc9a9b485b8eaeda0f 100755 (executable)
@@ -762,4 +762,36 @@ test_expect_success 'difftool --gui, --tool and --extcmd are mutually exclusive'
        test_must_fail git difftool --gui --tool=test-tool --extcmd=cat
 '
 
+test_expect_success 'difftool --rotate-to' '
+       difftool_test_setup &&
+       test_when_finished git reset --hard &&
+       echo 1 >1 &&
+       echo 2 >2 &&
+       echo 4 >4 &&
+       git add 1 2 4 &&
+       git commit -a -m "124" &&
+       git difftool --no-prompt --extcmd=cat --rotate-to="2" HEAD^ >output&&
+       cat >expect <<-\EOF &&
+       2
+       4
+       1
+       EOF
+       test_cmp output expect
+'
+
+test_expect_success 'difftool --skip-to' '
+       difftool_test_setup &&
+       test_when_finished git reset --hard &&
+       git difftool --no-prompt --extcmd=cat --skip-to="2" HEAD^ >output &&
+       cat >expect <<-\EOF &&
+       2
+       4
+       EOF
+       test_cmp output expect
+'
+
+test_expect_success 'difftool --rotate/skip-to error condition' '
+       test_must_fail git difftool --no-prompt --extcmd=cat --rotate-to="3" HEAD^ &&
+       test_must_fail git difftool --no-prompt --extcmd=cat --skip-to="3" HEAD^
+'
 test_done
index 8f7591c9ccdac33a46b8db0caa59030c670e8d79..edfaa9a6d1cbe962c5b3e138adc529a5df3397e7 100755 (executable)
@@ -969,7 +969,7 @@ do
        "
 done
 
-test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'grep --threads=N or pack.threads=N warns when no pthreads' '
+test_expect_success !PTHREADS 'grep --threads=N or pack.threads=N warns when no pthreads' '
        git grep --threads=2 Hello hello_world 2>err &&
        grep ^warning: err >warnings &&
        test_line_count = 1 warnings &&
index 03cd5c5423627fa7c5162fb84ad41cdb1960a645..f00deaf3815f3b49c42da4021335e011bbcb3c32 100755 (executable)
@@ -56,11 +56,8 @@ test_expect_success 'autocorrect can be declined altogether' '
        git config help.autocorrect never &&
 
        test_must_fail git lfg 2>actual &&
-       if test_have_prereq C_LOCALE_OUTPUT
-       then
-               grep "is not a git command" actual &&
-               test_line_count = 1 actual
-       fi
+       grep "is not a git command" actual &&
+       test_line_count = 1 actual
 '
 
 test_done
index 8f1caf8025e393a4319c74cf4cd46a8f02e849c1..5c47ac4465cb554fbfc9bf48e674f41f5e0ac041 100755 (executable)
@@ -8,7 +8,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
 
 verify_packs () {
        for p in .git/objects/pack/*.pack
index ee8c6e30e67f5b969bd32889f3f57a1e11771e90..0333065d4d60a0113cb5ac1de391a4a997d2eaa8 100755 (executable)
@@ -13,7 +13,7 @@ or warnings to log.'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
-. ./gitweb-lib.sh
+. ./lib-gitweb.sh
 
 # ----------------------------------------------------------------------
 # no commits (empty, just initialized repository)
index 141610de5464882eb660133d80ceb65df7323b17..32814e75df5b0d796b292c2ac39d370c636e5e67 100755 (executable)
@@ -13,7 +13,7 @@ code and message.'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
-. ./gitweb-lib.sh
+. ./lib-gitweb.sh
 
 #
 # Gitweb only provides the functionality tested by the 'modification times'
index 9cf7ab30a8d8f824088a02ddd646fb7a6a881378..3167473b3031c66555883745d296a881593b8272 100755 (executable)
@@ -13,7 +13,7 @@ in the HTTP header or the actual script output.'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
-. ./gitweb-lib.sh
+. ./lib-gitweb.sh
 
 # ----------------------------------------------------------------------
 # snapshot file name and prefix
index 05dc2cc6be8eed02f7aa5e49c94117287085ae4f..6348e8d7339cda585d9bd20ca867d6638e706364 100644 (file)
@@ -32,11 +32,6 @@ test_set_editor () {
        export EDITOR
 }
 
-test_set_index_version () {
-    GIT_INDEX_VERSION="$1"
-    export GIT_INDEX_VERSION
-}
-
 test_decode_color () {
        awk '
                function name(n) {
@@ -116,13 +111,6 @@ remove_cr () {
        tr '\015' Q | sed -e 's/Q$//'
 }
 
-# Generate an output of $1 bytes of all zeroes (NULs, not ASCII zeroes).
-# If $1 is 'infinity', output forever or until the receiving pipe stops reading,
-# whichever comes first.
-generate_zero_bytes () {
-       test-tool genzeros "$@"
-}
-
 # In some bourne shell implementations, the "unset" builtin returns
 # nonzero status when a variable to be unset was not set in the first
 # place.
@@ -202,6 +190,7 @@ test_commit () {
        author= &&
        signoff= &&
        indir= &&
+       no_tag= &&
        while test $# != 0
        do
                case "$1" in
@@ -228,6 +217,9 @@ test_commit () {
                        indir="$2"
                        shift
                        ;;
+               --no-tag)
+                       no_tag=yes
+                       ;;
                *)
                        break
                        ;;
@@ -250,7 +242,10 @@ test_commit () {
        git ${indir:+ -C "$indir"} commit \
            ${author:+ --author "$author"} \
            $signoff -m "$1" &&
-       git ${indir:+ -C "$indir"} tag "${4:-$1}"
+       if test -z "$no_tag"
+       then
+               git ${indir:+ -C "$indir"} tag "${4:-$1}"
+       fi
 }
 
 # Call test_merge with the arguments "<message> <commit>", where <commit>
@@ -735,34 +730,37 @@ test_external_without_stderr () {
 }
 
 # debugging-friendly alternatives to "test [-f|-d|-e]"
-# The commands test the existence or non-existence of $1. $2 can be
-# given to provide a more precise diagnosis.
+# The commands test the existence or non-existence of $1
 test_path_is_file () {
+       test "$#" -ne 1 && BUG "1 param"
        if ! test -f "$1"
        then
-               echo "File $1 doesn't exist. $2"
+               echo "File $1 doesn't exist"
                false
        fi
 }
 
 test_path_is_dir () {
+       test "$#" -ne 1 && BUG "1 param"
        if ! test -d "$1"
        then
-               echo "Directory $1 doesn't exist. $2"
+               echo "Directory $1 doesn't exist"
                false
        fi
 }
 
 test_path_exists () {
+       test "$#" -ne 1 && BUG "1 param"
        if ! test -e "$1"
        then
-               echo "Path $1 doesn't exist. $2"
+               echo "Path $1 doesn't exist"
                false
        fi
 }
 
 # Check if the directory exists and is empty as expected, barf otherwise.
 test_dir_is_empty () {
+       test "$#" -ne 1 && BUG "1 param"
        test_path_is_dir "$1" &&
        if test -n "$(ls -a1 "$1" | egrep -v '^\.\.?$')"
        then
@@ -774,6 +772,7 @@ test_dir_is_empty () {
 
 # Check if the file exists and has a size greater than zero
 test_file_not_empty () {
+       test "$#" = 2 && BUG "2 param"
        if ! test -s "$1"
        then
                echo "'$1' is not a non-empty file."
@@ -782,6 +781,7 @@ test_file_not_empty () {
 }
 
 test_path_is_missing () {
+       test "$#" -ne 1 && BUG "1 param"
        if test -e "$1"
        then
                echo "Path exists:"
@@ -818,6 +818,7 @@ test_line_count () {
 }
 
 test_file_size () {
+       test "$#" -ne 1 && BUG "1 param"
        test-tool path-utils file-size "$1"
 }
 
@@ -990,6 +991,7 @@ test_expect_code () {
 # - not all diff versions understand "-u"
 
 test_cmp () {
+       test "$#" -ne 2 && BUG "2 param"
        eval "$GIT_TEST_CMP" '"$@"'
 }
 
@@ -1019,6 +1021,7 @@ test_cmp_config () {
 # test_cmp_bin - helper to compare binary files
 
 test_cmp_bin () {
+       test "$#" -ne 2 && BUG "2 param"
        cmp "$@"
 }
 
@@ -1079,6 +1082,7 @@ verbose () {
 # otherwise.
 
 test_must_be_empty () {
+       test "$#" -ne 1 && BUG "1 param"
        test_path_is_file "$1" &&
        if test -s "$1"
        then
@@ -1102,7 +1106,7 @@ test_cmp_rev () {
        fi
        if test $# != 2
        then
-               error "bug in the test script: test_cmp_rev requires two revisions, but got $#"
+               BUG "test_cmp_rev requires two revisions, but got $#"
        else
                local r1 r2
                r1=$(git rev-parse --verify "$1") &&
@@ -1213,7 +1217,7 @@ test_atexit () {
        # doing so on Bash is better than nothing (the test will
        # silently pass on other shells).
        test "${BASH_SUBSHELL-0}" = 0 ||
-       error "bug in test script: test_atexit does nothing in a subshell"
+       BUG "test_atexit does nothing in a subshell"
        test_atexit_cleanup="{ $*
                } && (exit \"\$eval_ret\"); eval_ret=\$?; $test_atexit_cleanup"
 }
@@ -1611,33 +1615,6 @@ test_set_port () {
        eval $var=$port
 }
 
-# Compare a file containing rev-list bitmap traversal output to its non-bitmap
-# counterpart. You can't just use test_cmp for this, because the two produce
-# subtly different output:
-#
-#   - regular output is in traversal order, whereas bitmap is split by type,
-#     with non-packed objects at the end
-#
-#   - regular output has a space and the pathname appended to non-commit
-#     objects; bitmap output omits this
-#
-# This function normalizes and compares the two. The second file should
-# always be the bitmap output.
-test_bitmap_traversal () {
-       if test "$1" = "--no-confirm-bitmaps"
-       then
-               shift
-       elif cmp "$1" "$2"
-       then
-               echo >&2 "identical raw outputs; are you sure bitmaps were used?"
-               return 1
-       fi &&
-       cut -d' ' -f1 "$1" | sort >"$1.normalized" &&
-       sort "$2" >"$2.normalized" &&
-       test_cmp "$1.normalized" "$2.normalized" &&
-       rm -f "$1.normalized" "$2.normalized"
-}
-
 # Tests for the hidden file attribute on Windows
 test_path_is_hidden () {
        test_have_prereq MINGW ||
index 431adba0fb3f8eafbf28795c15b8a8c941b51f9e..d3f6af6a65451cdd7868e5dc355b44fed49a0670 100644 (file)
@@ -453,36 +453,6 @@ export GIT_DEFAULT_HASH
 GIT_TRACE_BARE=1
 export GIT_TRACE_BARE
 
-check_var_migration () {
-       # the warnings and hints given from this helper depends
-       # on end-user settings, which will disrupt the self-test
-       # done on the test framework itself.
-       case "$GIT_TEST_FRAMEWORK_SELFTEST" in
-       t)      return ;;
-       esac
-
-       old_name=$1 new_name=$2
-       eval "old_isset=\${${old_name}:+isset}"
-       eval "new_isset=\${${new_name}:+isset}"
-
-       case "$old_isset,$new_isset" in
-       isset,)
-               echo >&2 "warning: $old_name is now $new_name"
-               echo >&2 "hint: set $new_name too during the transition period"
-               eval "$new_name=\$$old_name"
-               ;;
-       isset,isset)
-               # do this later
-               # echo >&2 "warning: $old_name is now $new_name"
-               # echo >&2 "hint: remove $old_name"
-               ;;
-       esac
-}
-
-check_var_migration GIT_FSMONITOR_TEST GIT_TEST_FSMONITOR
-check_var_migration TEST_GIT_INDEX_VERSION GIT_TEST_INDEX_VERSION
-check_var_migration GIT_FORCE_PRELOAD_TEST GIT_TEST_PRELOAD_INDEX
-
 # Use specific version of the index file format
 if test -n "${GIT_TEST_INDEX_VERSION:+isset}"
 then
@@ -1519,11 +1489,6 @@ test -n "$USE_LIBPCRE2" && test_set_prereq PCRE
 test -n "$USE_LIBPCRE2" && test_set_prereq LIBPCRE2
 test -z "$NO_GETTEXT" && test_set_prereq GETTEXT
 
-# Used to be used for GIT_TEST_GETTEXT_POISON=false. Only here as a
-# shim for other in-flight changes. Should not be used and will be
-# removed soon.
-test_set_prereq C_LOCALE_OUTPUT
-
 if test -z "$GIT_TEST_CHECK_CACHE_TREE"
 then
        GIT_TEST_CHECK_CACHE_TREE=true
diff --git a/tag.c b/tag.c
index 1ed2684e45bd50d051ade60cc6b66c8c44fbed59..3e18a41841485e8138d7ccaf36e24cc99e5d81cd 100644 (file)
--- a/tag.c
+++ b/tag.c
@@ -13,26 +13,27 @@ const char *tag_type = "tag";
 static int run_gpg_verify(const char *buf, unsigned long size, unsigned flags)
 {
        struct signature_check sigc;
-       size_t payload_size;
+       struct strbuf payload = STRBUF_INIT;
+       struct strbuf signature = STRBUF_INIT;
        int ret;
 
        memset(&sigc, 0, sizeof(sigc));
 
-       payload_size = parse_signature(buf, size);
-
-       if (size == payload_size) {
+       if (!parse_signature(buf, size, &payload, &signature)) {
                if (flags & GPG_VERIFY_VERBOSE)
-                       write_in_full(1, buf, payload_size);
+                       write_in_full(1, buf, size);
                return error("no signature found");
        }
 
-       ret = check_signature(buf, payload_size, buf + payload_size,
-                               size - payload_size, &sigc);
+       ret = check_signature(payload.buf, payload.len, signature.buf,
+                               signature.len, &sigc);
 
        if (!(flags & GPG_VERIFY_OMIT_STATUS))
                print_signature_buffer(&sigc, flags);
 
        signature_check_clear(&sigc);
+       strbuf_release(&payload);
+       strbuf_release(&signature);
        return ret;
 }