Imported Upstream version 2.13.1 upstream/2.13.1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 3 Mar 2021 06:16:09 +0000 (15:16 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 3 Mar 2021 06:16:09 +0000 (15:16 +0900)
113 files changed:
.gitattributes
.travis.yml
Documentation/CodingGuidelines
Documentation/RelNotes/2.13.1.txt [new file with mode: 0644]
Documentation/config.txt
Documentation/git-bisect-lk2009.txt
Documentation/git-filter-branch.txt
Documentation/git-interpret-trailers.txt
Documentation/git-read-tree.txt
Documentation/git-rev-parse.txt
Documentation/git-tag.txt
Documentation/git.txt
Documentation/gitcredentials.txt
Documentation/gitweb.txt
Documentation/pretty-formats.txt
Documentation/technical/pack-protocol.txt
GIT-VERSION-GEN
Makefile
RelNotes
apply.c
bisect.c
builtin/am.c
builtin/blame.c
builtin/cat-file.c
builtin/checkout.c
builtin/clone.c
builtin/commit.c
builtin/difftool.c
builtin/fast-export.c
builtin/log.c
builtin/mailsplit.c
builtin/mktree.c
builtin/name-rev.c
builtin/notes.c
builtin/pack-objects.c
builtin/pack-redundant.c
builtin/read-tree.c
builtin/receive-pack.c
builtin/remote.c
builtin/worktree.c
ci/test-documentation.sh
commit.c
compat/mingw.c
compat/mingw.h
compat/winansi.c
config.c
config.mak.uname
contrib/completion/.gitattributes [new file with mode: 0644]
contrib/completion/git-completion.bash
contrib/persistent-https/README
contrib/workdir/.gitattributes [new file with mode: 0644]
git-filter-branch.sh
git-gui/.gitattributes
git-rebase--interactive.sh
gitweb/gitweb.perl
help.c
line-log.c
mailinfo.c
notes-utils.c
parse-options.c
patch-ids.c
ref-filter.c
reflog-walk.c
remote.c
revision.c
sequencer.c
setup.c
sha1dc/sha1.c
sha1dc/sha1.h
sha1dc/ubc_check.c
sha1dc/ubc_check.h
sha1dc_git.c [new file with mode: 0644]
sha1dc_git.h [new file with mode: 0644]
shallow.c
t/.gitattributes
t/t0025-crlf-auto.sh [deleted file]
t/t0027-auto-crlf.sh
t/t0203-gettext-setlocale-sanity.sh
t/t1309-early-config.sh
t/t1430-bad-ref-name.sh
t/t3200-branch.sh
t/t3203-branch-output.sh
t/t3404-rebase-interactive.sh
t/t3415-rebase-autosquash.sh
t/t3511-cherry-pick-x.sh
t/t3901-i18n-patch.sh
t/t3901/8859-1.txt [moved from t/t3901-8859-1.txt with 100% similarity]
t/t3901/utf8.txt [moved from t/t3901-utf8.txt with 100% similarity]
t/t3903-stash.sh
t/t4038-diff-combined.sh
t/t4202-log.sh
t/t4205-log-pretty-formats.sh
t/t5310-pack-bitmaps.sh
t/t5316-pack-delta-depth.sh
t/t5400-send-pack.sh
t/t5531-deep-submodule-push.sh
t/t5534-push-signed.sh
t/t5611-clone-config.sh
t/t6134-pathspec-in-submodule.sh
t/t6501-freshen-objects.sh
t/t7004-tag.sh
t/t7400-submodule-basic.sh
t/t7406-submodule-update.sh
t/t7508-status.sh
t/t7509-commit.sh
t/t7513-interpret-trailers.sh
t/t7800-difftool.sh
t/t9350-fast-export.sh
t/t9500-gitweb-standalone-no-errors.sh
tree-walk.c
worktree.c
wt-status.c
wt-status.h

index 320e33c..8ce9c6b 100644 (file)
@@ -1,3 +1,9 @@
 * whitespace=!indent,trail,space
 *.[ch] whitespace=indent,trail,space diff=cpp
-*.sh whitespace=indent,trail,space
+*.sh whitespace=indent,trail,space eol=lf
+*.perl eol=lf
+*.pm eol=lf
+/Documentation/git-*.txt eol=lf
+/command-list.txt eol=lf
+/GIT-VERSION-GEN eol=lf
+/mergetools/* eol=lf
index 1b32c98..278943d 100644 (file)
@@ -39,6 +39,11 @@ env:
 
 matrix:
   include:
+    - env: GETTEXT_POISON=YesPlease
+      os: linux
+      compiler:
+      addons:
+      before_install:
     - env: Windows
       os: linux
       compiler:
@@ -52,6 +57,7 @@ matrix:
       after_failure:
     - env: Linux32
       os: linux
+      compiler:
       services:
         - docker
       before_install:
@@ -86,14 +92,14 @@ matrix:
       after_failure:
     - env: Documentation
       os: linux
-      compiler: clang
+      compiler:
       addons:
         apt:
           packages:
           - asciidoc
           - xmlto
       before_install:
-      before_script:
+      before_script: gem install asciidoctor
       script: ci/test-documentation.sh
       after_failure:
 
@@ -134,12 +140,14 @@ before_install:
     p4 -V | grep Rev.;
     echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)";
     git-lfs version;
-    mkdir -p $HOME/travis-cache;
-    ln -s $HOME/travis-cache/.prove t/.prove;
 
 before_script: make --jobs=2
 
-script: make --quiet test
+script:
+  - >
+    mkdir -p $HOME/travis-cache;
+    ln -s $HOME/travis-cache/.prove t/.prove;
+    make --quiet test;
 
 after_failure:
   - >
index a4191aa..c4cb5ff 100644 (file)
@@ -24,7 +24,7 @@ code.  For Git in general, a few rough rules are:
 
    "Once it _is_ in the tree, it's not really worth the patch noise to
    go and fix it up."
-   Cf. http://article.gmane.org/gmane.linux.kernel/943020
+   Cf. http://lkml.iu.edu/hypermail/linux/kernel/1001.3/01069.html
 
 Make your code readable and sensible, and don't try to be clever.
 
@@ -256,12 +256,12 @@ For C programs:
 
    Note however that a comment that explains a translatable string to
    translators uses a convention of starting with a magic token
-   "TRANSLATORS: " immediately after the opening delimiter, even when
-   it spans multiple lines.  We do not add an asterisk at the beginning
-   of each line, either.  E.g.
+   "TRANSLATORS: ", e.g.
 
-       /* TRANSLATORS: here is a comment that explains the string
-          to be translated, that follows immediately after it */
+       /*
+        * TRANSLATORS: here is a comment that explains the string to
+        * be translated, that follows immediately after it.
+        */
        _("Here is a translatable string explained by the above.");
 
  - Double negation is often harder to understand than no negation
diff --git a/Documentation/RelNotes/2.13.1.txt b/Documentation/RelNotes/2.13.1.txt
new file mode 100644 (file)
index 0000000..ed7cd97
--- /dev/null
@@ -0,0 +1,114 @@
+Git v2.13.1 Release Notes
+=========================
+
+Fixes since v2.13
+-----------------
+
+ * The Web interface to gmane news archive is long gone, even though
+   the articles are still accessible via NTTP.  Replace the links with
+   ones to public-inbox.org.  Because their message identification is
+   based on the actual message-id, it is likely that it will be easier
+   to migrate away from it if/when necessary.
+
+ * Update tests to pass under GETTEXT_POISON (a mechanism to ensure
+   that output strings that should not be translated are not
+   translated by mistake), and tell TravisCI to run them.
+
+ * Setting "log.decorate=false" in the configuration file did not take
+   effect in v2.13, which has been corrected.
+
+ * An earlier update to test 7400 needed to be skipped on CYGWIN.
+
+ * Git sometimes gives an advice in a rhetorical question that does
+   not require an answer, which can confuse new users and non native
+   speakers.  Attempt to rephrase them.
+
+ * "git read-tree -m" (no tree-ish) gave a nonsense suggestion "use
+   --empty if you want to clear the index".  With "-m", such a request
+   will still fail anyway, as you'd need to name at least one tree-ish
+   to be merged.
+
+ * The codepath in "git am" that is used when running "git rebase"
+   leaked memory held for the log message of the commits being rebased.
+
+ * "pack-objects" can stream a slice of an existing packfile out when
+   the pack bitmap can tell that the reachable objects are all needed
+   in the output, without inspecting individual objects.  This
+   strategy however would not work well when "--local" and other
+   options are in use, and need to be disabled.
+
+ * Clarify documentation for include.path and includeIf.<condition>.path
+   configuration variables.
+
+ * Tag objects, which are not reachable from any ref, that point at
+   missing objects were mishandled by "git gc" and friends (they
+   should silently be ignored instead)
+
+ * A few http:// links that are redirected to https:// in the
+   documentation have been updated to https:// links.
+
+ * Make sure our tests would pass when the sources are checked out
+   with "platform native" line ending convention by default on
+   Windows.  Some "text" files out tests use and the test scripts
+   themselves that are meant to be run with /bin/sh, ought to be
+   checked out with eol=LF even on Windows.
+
+ * Fix memory leaks pointed out by Coverity (and people).
+
+ * The receive-pack program now makes sure that the push certificate
+   records the same set of push options used for pushing.
+
+ * "git cherry-pick" and other uses of the sequencer machinery
+   mishandled a trailer block whose last line is an incomplete line.
+   This has been fixed so that an additional sign-off etc. are added
+   after completing the existing incomplete line.
+
+ * The shell completion script (in contrib/) learned "git stash" has
+   a new "push" subcommand.
+
+ * Travis CI gained a task to format the documentation with both
+   AsciiDoc and AsciiDoctor.
+
+ * Update the C style recommendation for notes for translators, as
+   recent versions of gettext tools can work with our style of
+   multi-line comments.
+
+ * "git clone --config var=val" is a way to populate the
+   per-repository configuration file of the new repository, but it did
+   not work well when val is an empty string.  This has been fixed.
+
+ * A few codepaths in "checkout" and "am" working on an unborn branch
+   tried to access an uninitialized piece of memory.
+
+ * "git for-each-ref --format=..." with %(HEAD) in the format used to
+   resolve the HEAD symref as many times as it had processed refs,
+   which was wasteful, and "git branch" shared the same problem.
+
+ * "git interpret-trailers", when used as GIT_EDITOR for "git commit
+   -v", looked for and appended to a trailer block at the very end,
+   i.e. at the end of the "diff" output.  The command has been
+   corrected to pay attention to the cut-mark line "commit -v" adds to
+   the buffer---the real trailer block should appear just before it.
+
+ * A test allowed both "git push" and "git receive-pack" on the other
+   end write their traces into the same file.  This is OK on platforms
+   that allows atomically appending to a file opened with O_APPEND,
+   but on other platforms led to a mangled output, causing
+   intermittent test failures.  This has been fixed by disabling
+   traces from "receive-pack" in the test.
+
+ * "foo\bar\baz" in "git fetch foo\bar\baz", even though there is no
+   slashes in it, cannot be a nickname for a remote on Windows, as
+   that is likely to be a pathname on a local filesystem.
+
+ * The "collision detecting" SHA-1 implementation shipped with 2.13
+   was quite broken on some big-endian platforms and/or platforms that
+   do not like unaligned fetches.  Update to the upstream code which
+   has already fixed these issues.
+
+ * "git am -h" triggered a BUG().
+
+ * The interaction of "url.*.insteadOf" and custom URL scheme's
+   whitelisting is now documented better.
+
+Also contains various documentation updates and code clean-ups.
index 475e874..a6a589a 100644 (file)
@@ -79,14 +79,20 @@ escape sequences) are invalid.
 Includes
 ~~~~~~~~
 
+The `include` and `includeIf` sections allow you to include config
+directives from another source. These sections behave identically to
+each other with the exception that `includeIf` sections may be ignored
+if their condition does not evaluate to true; see "Conditional includes"
+below.
+
 You can include a config file from another by setting the special
-`include.path` variable to the name of the file to be included. The
-variable takes a pathname as its value, and is subject to tilde
-expansion. `include.path` can be given multiple times.
+`include.path` (or `includeIf.*.path`) variable to the name of the file
+to be included. The variable takes a pathname as its value, and is
+subject to tilde expansion. These variables can be given multiple times.
 
-The included file is expanded immediately, as if its contents had been
-found at the location of the include directive. If the value of the
-`include.path` variable is a relative path, the path is considered to
+The contents of the included file are inserted immediately, as if they
+had been found at the location of the include directive. If the value of the
+variable is a relative path, the path is considered to
 be relative to the configuration file in which the include directive
 was found.  See below for examples.
 
@@ -95,8 +101,7 @@ Conditional includes
 
 You can include a config file from another conditionally by setting a
 `includeIf.<condition>.path` variable to the name of the file to be
-included. The variable's value is treated the same way as
-`include.path`. `includeIf.<condition>.path` can be given multiple times.
+included.
 
 The condition starts with a keyword followed by a colon and some data
 whose format and meaning depends on the keyword. Supported keywords
@@ -167,8 +172,8 @@ Example
 
        [include]
                path = /path/to/foo.inc ; include by absolute path
-               path = foo ; expand "foo" relative to the current file
-               path = ~/foo ; expand "foo" in your `$HOME` directory
+               path = foo.inc ; find "foo.inc" relative to the current file
+               path = ~/foo.inc ; find "foo.inc" in your `$HOME` directory
 
        ; include if $GIT_DIR is /path/to/foo/.git
        [includeIf "gitdir:/path/to/foo/.git"]
@@ -182,6 +187,12 @@ Example
        [includeIf "gitdir:~/to/group/"]
                path = /path/to/foo.inc
 
+       ; relative paths are always relative to the including
+       ; file (if the condition is true); their location is not
+       ; affected by the condition
+       [includeIf "gitdir:/path/to/group/"]
+               path = foo.inc
+
 Values
 ~~~~~~
 
@@ -334,7 +345,7 @@ core.fileMode::
        is to be honored.
 +
 Some filesystems lose the executable bit when a file that is
-marked as executable is checked out, or checks out an
+marked as executable is checked out, or checks out a
 non-executable file with executable bit on.
 linkgit:git-clone[1] or linkgit:git-init[1] probe the filesystem
 to see if it handles the executable bit correctly
@@ -862,6 +873,7 @@ core.abbrev::
        computed based on the approximate number of packed objects
        in your repository, which hopefully is enough for
        abbreviated object names to stay unique for some time.
+       The minimum length is 4.
 
 add.ignoreErrors::
 add.ignore-errors (deprecated)::
@@ -2140,6 +2152,10 @@ log.showRoot::
        Tools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which
        normally hide the root commit will now show it. True by default.
 
+log.showSignature::
+       If true, makes linkgit:git-log[1], linkgit:git-show[1], and
+       linkgit:git-whatchanged[1] assume `--show-signature`.
+
 log.mailmap::
        If true, makes linkgit:git-log[1], linkgit:git-show[1], and
        linkgit:git-whatchanged[1] assume `--use-mailmap`.
@@ -2620,9 +2636,8 @@ receive.advertiseAtomic::
        capability, set this variable to false.
 
 receive.advertisePushOptions::
-       By default, git-receive-pack will advertise the push options
-       capability to its clients. If you don't want to advertise this
-       capability, set this variable to false.
+       When set to true, git-receive-pack will advertise the push options
+       capability to its clients. False by default.
 
 receive.autogc::
        By default, git-receive-pack will run "git-gc --auto" after
@@ -3208,6 +3223,13 @@ url.<base>.insteadOf::
        the best alternative for the particular user, even for a
        never-before-seen repository on the site.  When more than one
        insteadOf strings match a given URL, the longest match is used.
++
+Note that any protocol restrictions will be applied to the rewritten
+URL. If the rewrite changes the URL to use a custom protocol or remote
+helper, you may need to adjust the `protocol.*.allow` config to permit
+the request.  In particular, protocols you expect to use for submodules
+must be set to `always` rather than the default of `user`. See the
+description of `protocol.allow` above.
 
 url.<base>.pushInsteadOf::
        Any URL that starts with this value will not be pushed to;
index 8ac75fc..78479b0 100644 (file)
@@ -1350,9 +1350,9 @@ References
 - [[[1]]] https://www.nist.gov/sites/default/files/documents/director/planning/report02-3.pdf['The Economic Impacts of Inadequate Infratructure for Software Testing'.  Nist Planning Report 02-3], see Executive Summary and Chapter 8.
 - [[[2]]] http://www.oracle.com/technetwork/java/codeconvtoc-136057.html['Code Conventions for the Java Programming Language'. Sun Microsystems.]
 - [[[3]]] https://en.wikipedia.org/wiki/Software_maintenance['Software maintenance'. Wikipedia.]
-- [[[4]]] http://article.gmane.org/gmane.comp.version-control.git/45195/[Junio C Hamano. 'Automated bisect success story'. Gmane.]
+- [[[4]]] https://public-inbox.org/git/7vps5xsbwp.fsf_-_@assigned-by-dhcp.cox.net/[Junio C Hamano. 'Automated bisect success story'.]
 - [[[5]]] https://lwn.net/Articles/317154/[Christian Couder. 'Fully automated bisecting with "git bisect run"'. LWN.net.]
 - [[[6]]] https://lwn.net/Articles/277872/[Jonathan Corbet. 'Bisection divides users and developers'. LWN.net.]
-- [[[7]]] http://article.gmane.org/gmane.linux.scsi/36652/[Ingo Molnar. 'Re: BUG 2.6.23-rc3 can't see sd partitions on Alpha'. Gmane.]
+- [[[7]]] http://marc.info/?l=linux-kernel&m=119702753411680&w=2[Ingo Molnar. 'Re: BUG 2.6.23-rc3 can't see sd partitions on Alpha'. Linux-kernel mailing list.]
 - [[[8]]] https://www.kernel.org/pub/software/scm/git/docs/git-bisect.html[Junio C Hamano and the git-list. 'git-bisect(1) Manual Page'. Linux Kernel Archives.]
 - [[[9]]] https://github.com/Ealdwulf/bbchop[Ealdwulf. 'bbchop'. GitHub.]
index 6e4bb02..7b695db 100644 (file)
@@ -86,8 +86,7 @@ OPTIONS
        This filter may be used if you only need to modify the environment
        in which the commit will be performed.  Specifically, you might
        want to rewrite the author/committer name/email/time environment
-       variables (see linkgit:git-commit-tree[1] for details).  Do not forget
-       to re-export the variables.
+       variables (see linkgit:git-commit-tree[1] for details).
 
 --tree-filter <command>::
        This is the filter for rewriting the tree and its contents.
@@ -340,12 +339,10 @@ git filter-branch --env-filter '
        if test "$GIT_AUTHOR_EMAIL" = "root@localhost"
        then
                GIT_AUTHOR_EMAIL=john@example.com
-               export GIT_AUTHOR_EMAIL
        fi
        if test "$GIT_COMMITTER_EMAIL" = "root@localhost"
        then
                GIT_COMMITTER_EMAIL=john@example.com
-               export GIT_COMMITTER_EMAIL
        fi
 ' -- --all
 --------------------------------------------------------
index 09074c7..31cdeae 100644 (file)
@@ -123,7 +123,7 @@ trailer.ifexists::
        same <token> in the message.
 +
 The valid values for this option are: `addIfDifferentNeighbor` (this
-is the default), `addIfDifferent`, `add`, `overwrite` or `doNothing`.
+is the default), `addIfDifferent`, `add`, `replace` or `doNothing`.
 +
 With `addIfDifferentNeighbor`, a new trailer will be added only if no
 trailer with the same (<token>, <value>) pair is above or below the line
index ed9d63e..02576d8 100644 (file)
@@ -137,7 +137,7 @@ Merging
 -------
 If `-m` is specified, 'git read-tree' can perform 3 kinds of
 merge, a single tree merge if only 1 tree is given, a
-fast-forward merge with 2 trees, or a 3-way merge if 3 trees are
+fast-forward merge with 2 trees, or a 3-way merge if 3 or more trees are
 provided.
 
 
index c40c470..b1293f2 100644 (file)
@@ -126,6 +126,12 @@ can be used.
        'git diff-{asterisk}'). In contrast to the `--sq-quote` option,
        the command input is still interpreted as usual.
 
+--short[=length]::
+       Same as `--verify` but shortens the object name to a unique
+       prefix with at least `length` characters. The minimum length
+       is 4, the default is the effective value of the `core.abbrev`
+       configuration variable (see linkgit:git-config[1]).
+
 --not::
        When showing object names, prefix them with '{caret}' and
        strip '{caret}' prefix from the object names that already have
@@ -136,12 +142,6 @@ can be used.
        The option core.warnAmbiguousRefs is used to select the strict
        abbreviation mode.
 
---short::
---short=number::
-       Instead of outputting the full SHA-1 values of object names try to
-       abbreviate them to a shorter unique name. When no length is specified
-       7 is used. The minimum length is 4.
-
 --symbolic::
        Usually the object names are output in SHA-1 form (with
        possible '{caret}' prefix); this option makes them output in a
index f8a0b78..1eb15af 100644 (file)
@@ -12,7 +12,7 @@ SYNOPSIS
 'git tag' [-a | -s | -u <keyid>] [-f] [-m <msg> | -F <file>]
        <tagname> [<commit> | <object>]
 'git tag' -d <tagname>...
-'git tag' [-n[<num>]] -l [--contains <commit>] [--contains <commit>]
+'git tag' [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]
        [--points-at <object>] [--column[=<options>] | --no-column]
        [--create-reflog] [--sort=<key>] [--format=<format>]
        [--[no-]merged [<commit>]] [<pattern>...]
index fb10314..7dd5e03 100644 (file)
@@ -35,516 +35,6 @@ manual page gives you an overview of the command-line command syntax.
 A formatted and hyperlinked copy of the latest Git documentation
 can be viewed at `https://git.github.io/htmldocs/git.html`.
 
-ifdef::stalenotes[]
-[NOTE]
-============
-
-You are reading the documentation for the latest (possibly
-unreleased) version of Git, that is available from the 'master'
-branch of the `git.git` repository.
-Documentation for older releases are available here:
-
-* link:v2.13.0/git.html[documentation for release 2.13]
-
-* release notes for
-  link:RelNotes/2.13.0.txt[2.13].
-
-
-* link:v2.12.3/git.html[documentation for release 2.12.3]
-
-* release notes for
-  link:RelNotes/2.12.3.txt[2.12.3],
-  link:RelNotes/2.12.2.txt[2.12.2],
-  link:RelNotes/2.12.1.txt[2.12.1],
-  link:RelNotes/2.12.0.txt[2.12].
-
-* link:v2.11.1/git.html[documentation for release 2.11.1]
-
-* release notes for
-  link:RelNotes/2.11.2.txt[2.11.2],
-  link:RelNotes/2.11.1.txt[2.11.1],
-  link:RelNotes/2.11.0.txt[2.11].
-
-* link:v2.10.3/git.html[documentation for release 2.10.3]
-
-* release notes for
-  link:RelNotes/2.10.3.txt[2.10.3],
-  link:RelNotes/2.10.2.txt[2.10.2],
-  link:RelNotes/2.10.1.txt[2.10.1],
-  link:RelNotes/2.10.0.txt[2.10].
-
-* link:v2.9.4/git.html[documentation for release 2.9.4]
-
-* release notes for
-  link:RelNotes/2.9.4.txt[2.9.4],
-  link:RelNotes/2.9.3.txt[2.9.3],
-  link:RelNotes/2.9.2.txt[2.9.2],
-  link:RelNotes/2.9.1.txt[2.9.1],
-  link:RelNotes/2.9.0.txt[2.9].
-
-* link:v2.8.5/git.html[documentation for release 2.8.5]
-
-* release notes for
-  link:RelNotes/2.8.5.txt[2.8.5],
-  link:RelNotes/2.8.4.txt[2.8.4],
-  link:RelNotes/2.8.3.txt[2.8.3],
-  link:RelNotes/2.8.2.txt[2.8.2],
-  link:RelNotes/2.8.1.txt[2.8.1],
-  link:RelNotes/2.8.0.txt[2.8].
-
-* link:v2.7.5/git.html[documentation for release 2.7.5]
-
-* release notes for
-  link:RelNotes/2.7.5.txt[2.7.5],
-  link:RelNotes/2.7.4.txt[2.7.4],
-  link:RelNotes/2.7.3.txt[2.7.3],
-  link:RelNotes/2.7.2.txt[2.7.2],
-  link:RelNotes/2.7.1.txt[2.7.1],
-  link:RelNotes/2.7.0.txt[2.7].
-
-* link:v2.6.7/git.html[documentation for release 2.6.7]
-
-* release notes for
-  link:RelNotes/2.6.7.txt[2.6.7],
-  link:RelNotes/2.6.6.txt[2.6.6],
-  link:RelNotes/2.6.5.txt[2.6.5],
-  link:RelNotes/2.6.4.txt[2.6.4],
-  link:RelNotes/2.6.3.txt[2.6.3],
-  link:RelNotes/2.6.2.txt[2.6.2],
-  link:RelNotes/2.6.1.txt[2.6.1],
-  link:RelNotes/2.6.0.txt[2.6].
-
-* link:v2.5.6/git.html[documentation for release 2.5.6]
-
-* release notes for
-  link:RelNotes/2.5.6.txt[2.5.6],
-  link:RelNotes/2.5.5.txt[2.5.5],
-  link:RelNotes/2.5.4.txt[2.5.4],
-  link:RelNotes/2.5.3.txt[2.5.3],
-  link:RelNotes/2.5.2.txt[2.5.2],
-  link:RelNotes/2.5.1.txt[2.5.1],
-  link:RelNotes/2.5.0.txt[2.5].
-
-* link:v2.4.12/git.html[documentation for release 2.4.12]
-
-* release notes for
-  link:RelNotes/2.4.12.txt[2.4.12],
-  link:RelNotes/2.4.11.txt[2.4.11],
-  link:RelNotes/2.4.10.txt[2.4.10],
-  link:RelNotes/2.4.9.txt[2.4.9],
-  link:RelNotes/2.4.8.txt[2.4.8],
-  link:RelNotes/2.4.7.txt[2.4.7],
-  link:RelNotes/2.4.6.txt[2.4.6],
-  link:RelNotes/2.4.5.txt[2.4.5],
-  link:RelNotes/2.4.4.txt[2.4.4],
-  link:RelNotes/2.4.3.txt[2.4.3],
-  link:RelNotes/2.4.2.txt[2.4.2],
-  link:RelNotes/2.4.1.txt[2.4.1],
-  link:RelNotes/2.4.0.txt[2.4].
-
-* link:v2.3.10/git.html[documentation for release 2.3.10]
-
-* release notes for
-  link:RelNotes/2.3.10.txt[2.3.10],
-  link:RelNotes/2.3.9.txt[2.3.9],
-  link:RelNotes/2.3.8.txt[2.3.8],
-  link:RelNotes/2.3.7.txt[2.3.7],
-  link:RelNotes/2.3.6.txt[2.3.6],
-  link:RelNotes/2.3.5.txt[2.3.5],
-  link:RelNotes/2.3.4.txt[2.3.4],
-  link:RelNotes/2.3.3.txt[2.3.3],
-  link:RelNotes/2.3.2.txt[2.3.2],
-  link:RelNotes/2.3.1.txt[2.3.1],
-  link:RelNotes/2.3.0.txt[2.3].
-
-* link:v2.2.3/git.html[documentation for release 2.2.3]
-
-* release notes for
-  link:RelNotes/2.2.3.txt[2.2.3],
-  link:RelNotes/2.2.2.txt[2.2.2],
-  link:RelNotes/2.2.1.txt[2.2.1],
-  link:RelNotes/2.2.0.txt[2.2].
-
-* link:v2.1.4/git.html[documentation for release 2.1.4]
-
-* release notes for
-  link:RelNotes/2.1.4.txt[2.1.4],
-  link:RelNotes/2.1.3.txt[2.1.3],
-  link:RelNotes/2.1.2.txt[2.1.2],
-  link:RelNotes/2.1.1.txt[2.1.1],
-  link:RelNotes/2.1.0.txt[2.1].
-
-* link:v2.0.5/git.html[documentation for release 2.0.5]
-
-* release notes for
-  link:RelNotes/2.0.5.txt[2.0.5],
-  link:RelNotes/2.0.4.txt[2.0.4],
-  link:RelNotes/2.0.3.txt[2.0.3],
-  link:RelNotes/2.0.2.txt[2.0.2],
-  link:RelNotes/2.0.1.txt[2.0.1],
-  link:RelNotes/2.0.0.txt[2.0.0].
-
-* link:v1.9.5/git.html[documentation for release 1.9.5]
-
-* release notes for
-  link:RelNotes/1.9.5.txt[1.9.5],
-  link:RelNotes/1.9.4.txt[1.9.4],
-  link:RelNotes/1.9.3.txt[1.9.3],
-  link:RelNotes/1.9.2.txt[1.9.2],
-  link:RelNotes/1.9.1.txt[1.9.1],
-  link:RelNotes/1.9.0.txt[1.9.0].
-
-* link:v1.8.5.6/git.html[documentation for release 1.8.5.6]
-
-* release notes for
-  link:RelNotes/1.8.5.6.txt[1.8.5.6],
-  link:RelNotes/1.8.5.5.txt[1.8.5.5],
-  link:RelNotes/1.8.5.4.txt[1.8.5.4],
-  link:RelNotes/1.8.5.3.txt[1.8.5.3],
-  link:RelNotes/1.8.5.2.txt[1.8.5.2],
-  link:RelNotes/1.8.5.1.txt[1.8.5.1],
-  link:RelNotes/1.8.5.txt[1.8.5].
-
-* link:v1.8.4.5/git.html[documentation for release 1.8.4.5]
-
-* release notes for
-  link:RelNotes/1.8.4.5.txt[1.8.4.5],
-  link:RelNotes/1.8.4.4.txt[1.8.4.4],
-  link:RelNotes/1.8.4.3.txt[1.8.4.3],
-  link:RelNotes/1.8.4.2.txt[1.8.4.2],
-  link:RelNotes/1.8.4.1.txt[1.8.4.1],
-  link:RelNotes/1.8.4.txt[1.8.4].
-
-* link:v1.8.3.4/git.html[documentation for release 1.8.3.4]
-
-* release notes for
-  link:RelNotes/1.8.3.4.txt[1.8.3.4],
-  link:RelNotes/1.8.3.3.txt[1.8.3.3],
-  link:RelNotes/1.8.3.2.txt[1.8.3.2],
-  link:RelNotes/1.8.3.1.txt[1.8.3.1],
-  link:RelNotes/1.8.3.txt[1.8.3].
-
-* link:v1.8.2.3/git.html[documentation for release 1.8.2.3]
-
-* release notes for
-  link:RelNotes/1.8.2.3.txt[1.8.2.3],
-  link:RelNotes/1.8.2.2.txt[1.8.2.2],
-  link:RelNotes/1.8.2.1.txt[1.8.2.1],
-  link:RelNotes/1.8.2.txt[1.8.2].
-
-* link:v1.8.1.6/git.html[documentation for release 1.8.1.6]
-
-* release notes for
-  link:RelNotes/1.8.1.6.txt[1.8.1.6],
-  link:RelNotes/1.8.1.5.txt[1.8.1.5],
-  link:RelNotes/1.8.1.4.txt[1.8.1.4],
-  link:RelNotes/1.8.1.3.txt[1.8.1.3],
-  link:RelNotes/1.8.1.2.txt[1.8.1.2],
-  link:RelNotes/1.8.1.1.txt[1.8.1.1],
-  link:RelNotes/1.8.1.txt[1.8.1].
-
-* link:v1.8.0.3/git.html[documentation for release 1.8.0.3]
-
-* release notes for
-  link:RelNotes/1.8.0.3.txt[1.8.0.3],
-  link:RelNotes/1.8.0.2.txt[1.8.0.2],
-  link:RelNotes/1.8.0.1.txt[1.8.0.1],
-  link:RelNotes/1.8.0.txt[1.8.0].
-
-* link:v1.7.12.4/git.html[documentation for release 1.7.12.4]
-
-* release notes for
-  link:RelNotes/1.7.12.4.txt[1.7.12.4],
-  link:RelNotes/1.7.12.3.txt[1.7.12.3],
-  link:RelNotes/1.7.12.2.txt[1.7.12.2],
-  link:RelNotes/1.7.12.1.txt[1.7.12.1],
-  link:RelNotes/1.7.12.txt[1.7.12].
-
-* link:v1.7.11.7/git.html[documentation for release 1.7.11.7]
-
-* release notes for
-  link:RelNotes/1.7.11.7.txt[1.7.11.7],
-  link:RelNotes/1.7.11.6.txt[1.7.11.6],
-  link:RelNotes/1.7.11.5.txt[1.7.11.5],
-  link:RelNotes/1.7.11.4.txt[1.7.11.4],
-  link:RelNotes/1.7.11.3.txt[1.7.11.3],
-  link:RelNotes/1.7.11.2.txt[1.7.11.2],
-  link:RelNotes/1.7.11.1.txt[1.7.11.1],
-  link:RelNotes/1.7.11.txt[1.7.11].
-
-* link:v1.7.10.5/git.html[documentation for release 1.7.10.5]
-
-* release notes for
-  link:RelNotes/1.7.10.5.txt[1.7.10.5],
-  link:RelNotes/1.7.10.4.txt[1.7.10.4],
-  link:RelNotes/1.7.10.3.txt[1.7.10.3],
-  link:RelNotes/1.7.10.2.txt[1.7.10.2],
-  link:RelNotes/1.7.10.1.txt[1.7.10.1],
-  link:RelNotes/1.7.10.txt[1.7.10].
-
-* link:v1.7.9.7/git.html[documentation for release 1.7.9.7]
-
-* release notes for
-  link:RelNotes/1.7.9.7.txt[1.7.9.7],
-  link:RelNotes/1.7.9.6.txt[1.7.9.6],
-  link:RelNotes/1.7.9.5.txt[1.7.9.5],
-  link:RelNotes/1.7.9.4.txt[1.7.9.4],
-  link:RelNotes/1.7.9.3.txt[1.7.9.3],
-  link:RelNotes/1.7.9.2.txt[1.7.9.2],
-  link:RelNotes/1.7.9.1.txt[1.7.9.1],
-  link:RelNotes/1.7.9.txt[1.7.9].
-
-* link:v1.7.8.6/git.html[documentation for release 1.7.8.6]
-
-* release notes for
-  link:RelNotes/1.7.8.6.txt[1.7.8.6],
-  link:RelNotes/1.7.8.5.txt[1.7.8.5],
-  link:RelNotes/1.7.8.4.txt[1.7.8.4],
-  link:RelNotes/1.7.8.3.txt[1.7.8.3],
-  link:RelNotes/1.7.8.2.txt[1.7.8.2],
-  link:RelNotes/1.7.8.1.txt[1.7.8.1],
-  link:RelNotes/1.7.8.txt[1.7.8].
-
-* link:v1.7.7.7/git.html[documentation for release 1.7.7.7]
-
-* release notes for
-  link:RelNotes/1.7.7.7.txt[1.7.7.7],
-  link:RelNotes/1.7.7.6.txt[1.7.7.6],
-  link:RelNotes/1.7.7.5.txt[1.7.7.5],
-  link:RelNotes/1.7.7.4.txt[1.7.7.4],
-  link:RelNotes/1.7.7.3.txt[1.7.7.3],
-  link:RelNotes/1.7.7.2.txt[1.7.7.2],
-  link:RelNotes/1.7.7.1.txt[1.7.7.1],
-  link:RelNotes/1.7.7.txt[1.7.7].
-
-* link:v1.7.6.6/git.html[documentation for release 1.7.6.6]
-
-* release notes for
-  link:RelNotes/1.7.6.6.txt[1.7.6.6],
-  link:RelNotes/1.7.6.5.txt[1.7.6.5],
-  link:RelNotes/1.7.6.4.txt[1.7.6.4],
-  link:RelNotes/1.7.6.3.txt[1.7.6.3],
-  link:RelNotes/1.7.6.2.txt[1.7.6.2],
-  link:RelNotes/1.7.6.1.txt[1.7.6.1],
-  link:RelNotes/1.7.6.txt[1.7.6].
-
-* link:v1.7.5.4/git.html[documentation for release 1.7.5.4]
-
-* release notes for
-  link:RelNotes/1.7.5.4.txt[1.7.5.4],
-  link:RelNotes/1.7.5.3.txt[1.7.5.3],
-  link:RelNotes/1.7.5.2.txt[1.7.5.2],
-  link:RelNotes/1.7.5.1.txt[1.7.5.1],
-  link:RelNotes/1.7.5.txt[1.7.5].
-
-* link:v1.7.4.5/git.html[documentation for release 1.7.4.5]
-
-* release notes for
-  link:RelNotes/1.7.4.5.txt[1.7.4.5],
-  link:RelNotes/1.7.4.4.txt[1.7.4.4],
-  link:RelNotes/1.7.4.3.txt[1.7.4.3],
-  link:RelNotes/1.7.4.2.txt[1.7.4.2],
-  link:RelNotes/1.7.4.1.txt[1.7.4.1],
-  link:RelNotes/1.7.4.txt[1.7.4].
-
-* link:v1.7.3.5/git.html[documentation for release 1.7.3.5]
-
-* release notes for
-  link:RelNotes/1.7.3.5.txt[1.7.3.5],
-  link:RelNotes/1.7.3.4.txt[1.7.3.4],
-  link:RelNotes/1.7.3.3.txt[1.7.3.3],
-  link:RelNotes/1.7.3.2.txt[1.7.3.2],
-  link:RelNotes/1.7.3.1.txt[1.7.3.1],
-  link:RelNotes/1.7.3.txt[1.7.3].
-
-* link:v1.7.2.5/git.html[documentation for release 1.7.2.5]
-
-* release notes for
-  link:RelNotes/1.7.2.5.txt[1.7.2.5],
-  link:RelNotes/1.7.2.4.txt[1.7.2.4],
-  link:RelNotes/1.7.2.3.txt[1.7.2.3],
-  link:RelNotes/1.7.2.2.txt[1.7.2.2],
-  link:RelNotes/1.7.2.1.txt[1.7.2.1],
-  link:RelNotes/1.7.2.txt[1.7.2].
-
-* link:v1.7.1.4/git.html[documentation for release 1.7.1.4]
-
-* release notes for
-  link:RelNotes/1.7.1.4.txt[1.7.1.4],
-  link:RelNotes/1.7.1.3.txt[1.7.1.3],
-  link:RelNotes/1.7.1.2.txt[1.7.1.2],
-  link:RelNotes/1.7.1.1.txt[1.7.1.1],
-  link:RelNotes/1.7.1.txt[1.7.1].
-
-* link:v1.7.0.9/git.html[documentation for release 1.7.0.9]
-
-* release notes for
-  link:RelNotes/1.7.0.9.txt[1.7.0.9],
-  link:RelNotes/1.7.0.8.txt[1.7.0.8],
-  link:RelNotes/1.7.0.7.txt[1.7.0.7],
-  link:RelNotes/1.7.0.6.txt[1.7.0.6],
-  link:RelNotes/1.7.0.5.txt[1.7.0.5],
-  link:RelNotes/1.7.0.4.txt[1.7.0.4],
-  link:RelNotes/1.7.0.3.txt[1.7.0.3],
-  link:RelNotes/1.7.0.2.txt[1.7.0.2],
-  link:RelNotes/1.7.0.1.txt[1.7.0.1],
-  link:RelNotes/1.7.0.txt[1.7.0].
-
-* link:v1.6.6.3/git.html[documentation for release 1.6.6.3]
-
-* release notes for
-  link:RelNotes/1.6.6.3.txt[1.6.6.3],
-  link:RelNotes/1.6.6.2.txt[1.6.6.2],
-  link:RelNotes/1.6.6.1.txt[1.6.6.1],
-  link:RelNotes/1.6.6.txt[1.6.6].
-
-* link:v1.6.5.9/git.html[documentation for release 1.6.5.9]
-
-* release notes for
-  link:RelNotes/1.6.5.9.txt[1.6.5.9],
-  link:RelNotes/1.6.5.8.txt[1.6.5.8],
-  link:RelNotes/1.6.5.7.txt[1.6.5.7],
-  link:RelNotes/1.6.5.6.txt[1.6.5.6],
-  link:RelNotes/1.6.5.5.txt[1.6.5.5],
-  link:RelNotes/1.6.5.4.txt[1.6.5.4],
-  link:RelNotes/1.6.5.3.txt[1.6.5.3],
-  link:RelNotes/1.6.5.2.txt[1.6.5.2],
-  link:RelNotes/1.6.5.1.txt[1.6.5.1],
-  link:RelNotes/1.6.5.txt[1.6.5].
-
-* link:v1.6.4.5/git.html[documentation for release 1.6.4.5]
-
-* release notes for
-  link:RelNotes/1.6.4.5.txt[1.6.4.5],
-  link:RelNotes/1.6.4.4.txt[1.6.4.4],
-  link:RelNotes/1.6.4.3.txt[1.6.4.3],
-  link:RelNotes/1.6.4.2.txt[1.6.4.2],
-  link:RelNotes/1.6.4.1.txt[1.6.4.1],
-  link:RelNotes/1.6.4.txt[1.6.4].
-
-* link:v1.6.3.4/git.html[documentation for release 1.6.3.4]
-
-* release notes for
-  link:RelNotes/1.6.3.4.txt[1.6.3.4],
-  link:RelNotes/1.6.3.3.txt[1.6.3.3],
-  link:RelNotes/1.6.3.2.txt[1.6.3.2],
-  link:RelNotes/1.6.3.1.txt[1.6.3.1],
-  link:RelNotes/1.6.3.txt[1.6.3].
-
-* release notes for
-  link:RelNotes/1.6.2.5.txt[1.6.2.5],
-  link:RelNotes/1.6.2.4.txt[1.6.2.4],
-  link:RelNotes/1.6.2.3.txt[1.6.2.3],
-  link:RelNotes/1.6.2.2.txt[1.6.2.2],
-  link:RelNotes/1.6.2.1.txt[1.6.2.1],
-  link:RelNotes/1.6.2.txt[1.6.2].
-
-* link:v1.6.1.3/git.html[documentation for release 1.6.1.3]
-
-* release notes for
-  link:RelNotes/1.6.1.3.txt[1.6.1.3],
-  link:RelNotes/1.6.1.2.txt[1.6.1.2],
-  link:RelNotes/1.6.1.1.txt[1.6.1.1],
-  link:RelNotes/1.6.1.txt[1.6.1].
-
-* link:v1.6.0.6/git.html[documentation for release 1.6.0.6]
-
-* release notes for
-  link:RelNotes/1.6.0.6.txt[1.6.0.6],
-  link:RelNotes/1.6.0.5.txt[1.6.0.5],
-  link:RelNotes/1.6.0.4.txt[1.6.0.4],
-  link:RelNotes/1.6.0.3.txt[1.6.0.3],
-  link:RelNotes/1.6.0.2.txt[1.6.0.2],
-  link:RelNotes/1.6.0.1.txt[1.6.0.1],
-  link:RelNotes/1.6.0.txt[1.6.0].
-
-* link:v1.5.6.6/git.html[documentation for release 1.5.6.6]
-
-* release notes for
-  link:RelNotes/1.5.6.6.txt[1.5.6.6],
-  link:RelNotes/1.5.6.5.txt[1.5.6.5],
-  link:RelNotes/1.5.6.4.txt[1.5.6.4],
-  link:RelNotes/1.5.6.3.txt[1.5.6.3],
-  link:RelNotes/1.5.6.2.txt[1.5.6.2],
-  link:RelNotes/1.5.6.1.txt[1.5.6.1],
-  link:RelNotes/1.5.6.txt[1.5.6].
-
-* link:v1.5.5.6/git.html[documentation for release 1.5.5.6]
-
-* release notes for
-  link:RelNotes/1.5.5.6.txt[1.5.5.6],
-  link:RelNotes/1.5.5.5.txt[1.5.5.5],
-  link:RelNotes/1.5.5.4.txt[1.5.5.4],
-  link:RelNotes/1.5.5.3.txt[1.5.5.3],
-  link:RelNotes/1.5.5.2.txt[1.5.5.2],
-  link:RelNotes/1.5.5.1.txt[1.5.5.1],
-  link:RelNotes/1.5.5.txt[1.5.5].
-
-* link:v1.5.4.7/git.html[documentation for release 1.5.4.7]
-
-* release notes for
-  link:RelNotes/1.5.4.7.txt[1.5.4.7],
-  link:RelNotes/1.5.4.6.txt[1.5.4.6],
-  link:RelNotes/1.5.4.5.txt[1.5.4.5],
-  link:RelNotes/1.5.4.4.txt[1.5.4.4],
-  link:RelNotes/1.5.4.3.txt[1.5.4.3],
-  link:RelNotes/1.5.4.2.txt[1.5.4.2],
-  link:RelNotes/1.5.4.1.txt[1.5.4.1],
-  link:RelNotes/1.5.4.txt[1.5.4].
-
-* link:v1.5.3.8/git.html[documentation for release 1.5.3.8]
-
-* release notes for
-  link:RelNotes/1.5.3.8.txt[1.5.3.8],
-  link:RelNotes/1.5.3.7.txt[1.5.3.7],
-  link:RelNotes/1.5.3.6.txt[1.5.3.6],
-  link:RelNotes/1.5.3.5.txt[1.5.3.5],
-  link:RelNotes/1.5.3.4.txt[1.5.3.4],
-  link:RelNotes/1.5.3.3.txt[1.5.3.3],
-  link:RelNotes/1.5.3.2.txt[1.5.3.2],
-  link:RelNotes/1.5.3.1.txt[1.5.3.1],
-  link:RelNotes/1.5.3.txt[1.5.3].
-
-* link:v1.5.2.5/git.html[documentation for release 1.5.2.5]
-
-* release notes for
-  link:RelNotes/1.5.2.5.txt[1.5.2.5],
-  link:RelNotes/1.5.2.4.txt[1.5.2.4],
-  link:RelNotes/1.5.2.3.txt[1.5.2.3],
-  link:RelNotes/1.5.2.2.txt[1.5.2.2],
-  link:RelNotes/1.5.2.1.txt[1.5.2.1],
-  link:RelNotes/1.5.2.txt[1.5.2].
-
-* link:v1.5.1.6/git.html[documentation for release 1.5.1.6]
-
-* release notes for
-  link:RelNotes/1.5.1.6.txt[1.5.1.6],
-  link:RelNotes/1.5.1.5.txt[1.5.1.5],
-  link:RelNotes/1.5.1.4.txt[1.5.1.4],
-  link:RelNotes/1.5.1.3.txt[1.5.1.3],
-  link:RelNotes/1.5.1.2.txt[1.5.1.2],
-  link:RelNotes/1.5.1.1.txt[1.5.1.1],
-  link:RelNotes/1.5.1.txt[1.5.1].
-
-* link:v1.5.0.7/git.html[documentation for release 1.5.0.7]
-
-* release notes for
-  link:RelNotes/1.5.0.7.txt[1.5.0.7],
-  link:RelNotes/1.5.0.6.txt[1.5.0.6],
-  link:RelNotes/1.5.0.5.txt[1.5.0.5],
-  link:RelNotes/1.5.0.3.txt[1.5.0.3],
-  link:RelNotes/1.5.0.2.txt[1.5.0.2],
-  link:RelNotes/1.5.0.1.txt[1.5.0.1],
-  link:RelNotes/1.5.0.txt[1.5.0].
-
-* documentation for release link:v1.4.4.4/git.html[1.4.4.4],
-  link:v1.3.3/git.html[1.3.3],
-  link:v1.2.6/git.html[1.2.6],
-  link:v1.0.13/git.html[1.0.13].
-
-============
-
-endif::stalenotes[]
 
 OPTIONS
 -------
index f3a75d1..f970196 100644 (file)
@@ -101,16 +101,6 @@ $ git help credential-foo
 $ git config --global credential.helper foo
 -------------------------------------------
 
-If there are multiple instances of the `credential.helper` configuration
-variable, each helper will be tried in turn, and may provide a username,
-password, or nothing. Once Git has acquired both a username and a
-password, no more helpers will be tried.
-
-If `credential.helper` is configured to the empty string, this resets
-the helper list to empty (so you may override a helper set by a
-lower-priority config file by configuring the empty-string helper,
-followed by whatever set of helpers you would like).
-
 
 CREDENTIAL CONTEXTS
 -------------------
@@ -162,6 +152,16 @@ helper::
        shell (so, for example, setting this to `foo --option=bar` will execute
        `git credential-foo --option=bar` via the shell. See the manual of
        specific helpers for examples of their use.
++
+If there are multiple instances of the `credential.helper` configuration
+variable, each helper will be tried in turn, and may provide a username,
+password, or nothing. Once Git has acquired both a username and a
+password, no more helpers will be tried.
++
+If `credential.helper` is configured to the empty string, this resets
+the helper list to empty (so you may override a helper set by a
+lower-priority config file by configuring the empty-string helper,
+followed by whatever set of helpers you would like).
 
 username::
 
index 96156e5..8845058 100644 (file)
@@ -84,7 +84,7 @@ separator (rules for Perl's "`split(" ", $line)`").
 
 * Fields use modified URI encoding, defined in RFC 3986, section 2.1
 (Percent-Encoding), or rather "Query string encoding" (see
-http://en.wikipedia.org/wiki/Query_string#URL_encoding[]), the difference
+https://en.wikipedia.org/wiki/Query_string#URL_encoding[]), the difference
 being that SP (" ") can be encoded as "{plus}" (and therefore "{plus}" has to be
 also percent-encoded).
 +
index 47b286b..38040e9 100644 (file)
@@ -199,7 +199,7 @@ endif::git-rev-list[]
   than given and there are spaces on its left, use those spaces
 - '%><(<N>)', '%><|(<N>)': similar to '% <(<N>)', '%<|(<N>)'
   respectively, but padding both sides (i.e. the text is centered)
--%(trailers): display the trailers of the body as interpreted by
+- %(trailers): display the trailers of the body as interpreted by
   linkgit:git-interpret-trailers[1]
 
 NOTE: Some placeholders may depend on other options given to the
index 5b0ba3e..a349171 100644 (file)
@@ -473,13 +473,10 @@ that it wants to update, it sends a line listing the obj-id currently on
 the server, the obj-id the client would like to update it to and the name
 of the reference.
 
-This list is followed by a flush-pkt. Then the push options are transmitted
-one per packet followed by another flush-pkt. After that the packfile that
-should contain all the objects that the server will need to complete the new
-references will be sent.
+This list is followed by a flush-pkt.
 
 ----
-  update-request    =  *shallow ( command-list | push-cert ) [packfile]
+  update-requests   =  *shallow ( command-list | push-cert )
 
   shallow           =  PKT-LINE("shallow" SP obj-id)
 
@@ -500,12 +497,35 @@ references will be sent.
                      PKT-LINE("pusher" SP ident LF)
                      PKT-LINE("pushee" SP url LF)
                      PKT-LINE("nonce" SP nonce LF)
+                     *PKT-LINE("push-option" SP push-option LF)
                      PKT-LINE(LF)
                      *PKT-LINE(command LF)
                      *PKT-LINE(gpg-signature-lines LF)
                      PKT-LINE("push-cert-end" LF)
 
-  packfile          = "PACK" 28*(OCTET)
+  push-option       =  1*( VCHAR | SP )
+----
+
+If the server has advertised the 'push-options' capability and the client has
+specified 'push-options' as part of the capability list above, the client then
+sends its push options followed by a flush-pkt.
+
+----
+  push-options      =  *PKT-LINE(push-option) flush-pkt
+----
+
+For backwards compatibility with older Git servers, if the client sends a push
+cert and push options, it MUST send its push options both embedded within the
+push cert and after the push cert. (Note that the push options within the cert
+are prefixed, but the push options after the cert are not.) Both these lists
+MUST be the same, modulo the prefix.
+
+After that the packfile that
+should contain all the objects that the server will need to complete the new
+references will be sent.
+
+----
+  packfile          =  "PACK" 28*(OCTET)
 ----
 
 If the receiving end does not support delete-refs, the sending end MUST
index afcf9e9..5b67228 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.13.0
+DEF_VER=v2.13.1
 
 LF='
 '
index e35542e..ffa6da7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1414,7 +1414,14 @@ else
        DC_SHA1 := YesPlease
        LIB_OBJS += sha1dc/sha1.o
        LIB_OBJS += sha1dc/ubc_check.o
-       BASIC_CFLAGS += -DSHA1_DC
+       BASIC_CFLAGS += \
+               -DSHA1_DC \
+               -DSHA1DC_NO_STANDARD_INCLUDES \
+               -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
+               -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
+               -DSHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_C="\"sha1dc_git.c\"" \
+               -DSHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_H="\"sha1dc_git.h\"" \
+               -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
 endif
 endif
 endif
index 125bf78..52c8e10 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/2.13.0.txt
\ No newline at end of file
+Documentation/RelNotes/2.13.1.txt
\ No newline at end of file
diff --git a/apply.c b/apply.c
index e6dbab2..c49cef0 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -4091,181 +4091,181 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
        res = write_locked_index(&result, &lock, COMMIT_LOCK);
        discard_index(&result);
 
-        if (res)
-                return error(_("could not write temporary index to %s"),
-                             state->fake_ancestor);
+       if (res)
+               return error(_("could not write temporary index to %s"),
+                            state->fake_ancestor);
 
-        return 0;
- }
+       return 0;
+}
 
- static void stat_patch_list(struct apply_state *state, struct patch *patch)
- {
-        int files, adds, dels;
+static void stat_patch_list(struct apply_state *state, struct patch *patch)
+{
+       int files, adds, dels;
 
-        for (files = adds = dels = 0 ; patch ; patch = patch->next) {
-                files++;
-                adds += patch->lines_added;
-                dels += patch->lines_deleted;
-                show_stats(state, patch);
-        }
+       for (files = adds = dels = 0 ; patch ; patch = patch->next) {
+               files++;
+               adds += patch->lines_added;
+               dels += patch->lines_deleted;
+               show_stats(state, patch);
+       }
 
-        print_stat_summary(stdout, files, adds, dels);
- }
+       print_stat_summary(stdout, files, adds, dels);
+}
 
- static void numstat_patch_list(struct apply_state *state,
-                               struct patch *patch)
- {
-        for ( ; patch; patch = patch->next) {
-                const char *name;
-                name = patch->new_name ? patch->new_name : patch->old_name;
-                if (patch->is_binary)
-                        printf("-\t-\t");
-                else
-                        printf("%d\t%d\t", patch->lines_added, patch->lines_deleted);
-                write_name_quoted(name, stdout, state->line_termination);
-        }
- }
-
- static void show_file_mode_name(const char *newdelete, unsigned int mode, const char *name)
- {
-        if (mode)
-                printf(" %s mode %06o %s\n", newdelete, mode, name);
-        else
-                printf(" %s %s\n", newdelete, name);
- }
-
- static void show_mode_change(struct patch *p, int show_name)
- {
-        if (p->old_mode && p->new_mode && p->old_mode != p->new_mode) {
-                if (show_name)
-                        printf(" mode change %06o => %06o %s\n",
-                               p->old_mode, p->new_mode, p->new_name);
-                else
-                        printf(" mode change %06o => %06o\n",
-                               p->old_mode, p->new_mode);
-        }
- }
-
- static void show_rename_copy(struct patch *p)
- {
-        const char *renamecopy = p->is_rename ? "rename" : "copy";
-        const char *old, *new;
-
-        /* Find common prefix */
-        old = p->old_name;
-        new = p->new_name;
-        while (1) {
-                const char *slash_old, *slash_new;
-                slash_old = strchr(old, '/');
-                slash_new = strchr(new, '/');
-                if (!slash_old ||
-                    !slash_new ||
-                    slash_old - old != slash_new - new ||
-                    memcmp(old, new, slash_new - new))
-                        break;
-                old = slash_old + 1;
-                new = slash_new + 1;
-        }
-        /* p->old_name thru old is the common prefix, and old and new
-         * through the end of names are renames
-         */
-        if (old != p->old_name)
-                printf(" %s %.*s{%s => %s} (%d%%)\n", renamecopy,
-                       (int)(old - p->old_name), p->old_name,
-                       old, new, p->score);
-        else
-                printf(" %s %s => %s (%d%%)\n", renamecopy,
-                       p->old_name, p->new_name, p->score);
-        show_mode_change(p, 0);
- }
-
- static void summary_patch_list(struct patch *patch)
- {
-        struct patch *p;
-
-        for (p = patch; p; p = p->next) {
-                if (p->is_new)
-                        show_file_mode_name("create", p->new_mode, p->new_name);
-                else if (p->is_delete)
-                        show_file_mode_name("delete", p->old_mode, p->old_name);
-                else {
-                        if (p->is_rename || p->is_copy)
-                                show_rename_copy(p);
-                        else {
-                                if (p->score) {
-                                        printf(" rewrite %s (%d%%)\n",
-                                               p->new_name, p->score);
-                                        show_mode_change(p, 0);
-                                }
-                                else
-                                        show_mode_change(p, 1);
-                        }
-                }
-        }
- }
-
- static void patch_stats(struct apply_state *state, struct patch *patch)
- {
-        int lines = patch->lines_added + patch->lines_deleted;
-
-        if (lines > state->max_change)
-                state->max_change = lines;
-        if (patch->old_name) {
-                int len = quote_c_style(patch->old_name, NULL, NULL, 0);
-                if (!len)
-                        len = strlen(patch->old_name);
-                if (len > state->max_len)
-                        state->max_len = len;
-        }
-        if (patch->new_name) {
-                int len = quote_c_style(patch->new_name, NULL, NULL, 0);
-                if (!len)
-                        len = strlen(patch->new_name);
-                if (len > state->max_len)
-                        state->max_len = len;
-        }
- }
-
- static int remove_file(struct apply_state *state, struct patch *patch, int rmdir_empty)
- {
-        if (state->update_index) {
-                if (remove_file_from_cache(patch->old_name) < 0)
-                        return error(_("unable to remove %s from index"), patch->old_name);
-        }
-        if (!state->cached) {
-                if (!remove_or_warn(patch->old_mode, patch->old_name) && rmdir_empty) {
-                        remove_path(patch->old_name);
-                }
-        }
-        return 0;
- }
-
- static int add_index_file(struct apply_state *state,
-                          const char *path,
-                          unsigned mode,
-                          void *buf,
-                          unsigned long size)
- {
-        struct stat st;
-        struct cache_entry *ce;
-        int namelen = strlen(path);
-        unsigned ce_size = cache_entry_size(namelen);
-
-        if (!state->update_index)
-                return 0;
-
-        ce = xcalloc(1, ce_size);
-        memcpy(ce->name, path, namelen);
-        ce->ce_mode = create_ce_mode(mode);
-        ce->ce_flags = create_ce_flags(0);
-        ce->ce_namelen = namelen;
-        if (S_ISGITLINK(mode)) {
-                const char *s;
-
-                if (!skip_prefix(buf, "Subproject commit ", &s) ||
-                    get_oid_hex(s, &ce->oid)) {
+static void numstat_patch_list(struct apply_state *state,
+                              struct patch *patch)
+{
+       for ( ; patch; patch = patch->next) {
+               const char *name;
+               name = patch->new_name ? patch->new_name : patch->old_name;
+               if (patch->is_binary)
+                       printf("-\t-\t");
+               else
+                       printf("%d\t%d\t", patch->lines_added, patch->lines_deleted);
+               write_name_quoted(name, stdout, state->line_termination);
+       }
+}
+
+static void show_file_mode_name(const char *newdelete, unsigned int mode, const char *name)
+{
+       if (mode)
+               printf(" %s mode %06o %s\n", newdelete, mode, name);
+       else
+               printf(" %s %s\n", newdelete, name);
+}
+
+static void show_mode_change(struct patch *p, int show_name)
+{
+       if (p->old_mode && p->new_mode && p->old_mode != p->new_mode) {
+               if (show_name)
+                       printf(" mode change %06o => %06o %s\n",
+                              p->old_mode, p->new_mode, p->new_name);
+               else
+                       printf(" mode change %06o => %06o\n",
+                              p->old_mode, p->new_mode);
+       }
+}
+
+static void show_rename_copy(struct patch *p)
+{
+       const char *renamecopy = p->is_rename ? "rename" : "copy";
+       const char *old, *new;
+
+       /* Find common prefix */
+       old = p->old_name;
+       new = p->new_name;
+       while (1) {
+               const char *slash_old, *slash_new;
+               slash_old = strchr(old, '/');
+               slash_new = strchr(new, '/');
+               if (!slash_old ||
+                   !slash_new ||
+                   slash_old - old != slash_new - new ||
+                   memcmp(old, new, slash_new - new))
+                       break;
+               old = slash_old + 1;
+               new = slash_new + 1;
+       }
+       /* p->old_name thru old is the common prefix, and old and new
+        * through the end of names are renames
+        */
+       if (old != p->old_name)
+               printf(" %s %.*s{%s => %s} (%d%%)\n", renamecopy,
+                      (int)(old - p->old_name), p->old_name,
+                      old, new, p->score);
+       else
+               printf(" %s %s => %s (%d%%)\n", renamecopy,
+                      p->old_name, p->new_name, p->score);
+       show_mode_change(p, 0);
+}
+
+static void summary_patch_list(struct patch *patch)
+{
+       struct patch *p;
+
+       for (p = patch; p; p = p->next) {
+               if (p->is_new)
+                       show_file_mode_name("create", p->new_mode, p->new_name);
+               else if (p->is_delete)
+                       show_file_mode_name("delete", p->old_mode, p->old_name);
+               else {
+                       if (p->is_rename || p->is_copy)
+                               show_rename_copy(p);
+                       else {
+                               if (p->score) {
+                                       printf(" rewrite %s (%d%%)\n",
+                                              p->new_name, p->score);
+                                       show_mode_change(p, 0);
+                               }
+                               else
+                                       show_mode_change(p, 1);
+                       }
+               }
+       }
+}
+
+static void patch_stats(struct apply_state *state, struct patch *patch)
+{
+       int lines = patch->lines_added + patch->lines_deleted;
+
+       if (lines > state->max_change)
+               state->max_change = lines;
+       if (patch->old_name) {
+               int len = quote_c_style(patch->old_name, NULL, NULL, 0);
+               if (!len)
+                       len = strlen(patch->old_name);
+               if (len > state->max_len)
+                       state->max_len = len;
+       }
+       if (patch->new_name) {
+               int len = quote_c_style(patch->new_name, NULL, NULL, 0);
+               if (!len)
+                       len = strlen(patch->new_name);
+               if (len > state->max_len)
+                       state->max_len = len;
+       }
+}
+
+static int remove_file(struct apply_state *state, struct patch *patch, int rmdir_empty)
+{
+       if (state->update_index) {
+               if (remove_file_from_cache(patch->old_name) < 0)
+                       return error(_("unable to remove %s from index"), patch->old_name);
+       }
+       if (!state->cached) {
+               if (!remove_or_warn(patch->old_mode, patch->old_name) && rmdir_empty) {
+                       remove_path(patch->old_name);
+               }
+       }
+       return 0;
+}
+
+static int add_index_file(struct apply_state *state,
+                         const char *path,
+                         unsigned mode,
+                         void *buf,
+                         unsigned long size)
+{
+       struct stat st;
+       struct cache_entry *ce;
+       int namelen = strlen(path);
+       unsigned ce_size = cache_entry_size(namelen);
+
+       if (!state->update_index)
+               return 0;
+
+       ce = xcalloc(1, ce_size);
+       memcpy(ce->name, path, namelen);
+       ce->ce_mode = create_ce_mode(mode);
+       ce->ce_flags = create_ce_flags(0);
+       ce->ce_namelen = namelen;
+       if (S_ISGITLINK(mode)) {
+               const char *s;
+
+               if (!skip_prefix(buf, "Subproject commit ", &s) ||
+                   get_oid_hex(s, &ce->oid)) {
                        free(ce);
-                       return error(_("corrupt patch for submodule %s"), path);
+                      return error(_("corrupt patch for submodule %s"), path);
                }
        } else {
                if (!state->cached) {
index 08c9fb7..aaab6ad 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -546,7 +546,7 @@ static unsigned get_prn(unsigned count) {
 
 /*
  * Custom integer square root from
- * http://en.wikipedia.org/wiki/Integer_square_root
+ * https://en.wikipedia.org/wiki/Integer_square_root
  */
 static int sqrti(int val)
 {
@@ -995,8 +995,10 @@ int bisect_next_all(const char *prefix, int no_checkout)
 
        steps_msg = xstrfmt(Q_("(roughly %d step)", "(roughly %d steps)",
                  steps), steps);
-       /* TRANSLATORS: the last %s will be replaced with
-          "(roughly %d steps)" translation */
+       /*
+        * TRANSLATORS: the last %s will be replaced with "(roughly %d
+        * steps)" translation.
+        */
        printf(Q_("Bisecting: %d revision left to test after this %s\n",
                  "Bisecting: %d revisions left to test after this %s\n",
                  nr), nr, steps_msg);
index a95dd8b..593c1b5 100644 (file)
@@ -1312,7 +1312,7 @@ static int parse_mail(struct am_state *state, const char *mail)
        }
 
        if (is_empty_file(am_path(state, "patch"))) {
-               printf_ln(_("Patch is empty. Was it split wrong?"));
+               printf_ln(_("Patch is empty."));
                die_user_resolve(state);
        }
 
@@ -1351,19 +1351,16 @@ static int get_mail_commit_oid(struct object_id *commit_id, const char *mail)
        struct strbuf sb = STRBUF_INIT;
        FILE *fp = xfopen(mail, "r");
        const char *x;
+       int ret = 0;
 
-       if (strbuf_getline_lf(&sb, fp))
-               return -1;
-
-       if (!skip_prefix(sb.buf, "From ", &x))
-               return -1;
-
-       if (get_oid_hex(x, commit_id) < 0)
-               return -1;
+       if (strbuf_getline_lf(&sb, fp) ||
+           !skip_prefix(sb.buf, "From ", &x) ||
+           get_oid_hex(x, commit_id) < 0)
+               ret = -1;
 
        strbuf_release(&sb);
        fclose(fp);
-       return 0;
+       return ret;
 }
 
 /**
@@ -1372,40 +1369,33 @@ static int get_mail_commit_oid(struct object_id *commit_id, const char *mail)
  */
 static void get_commit_info(struct am_state *state, struct commit *commit)
 {
-       const char *buffer, *ident_line, *author_date, *msg;
+       const char *buffer, *ident_line, *msg;
        size_t ident_len;
-       struct ident_split ident_split;
-       struct strbuf sb = STRBUF_INIT;
+       struct ident_split id;
 
        buffer = logmsg_reencode(commit, NULL, get_commit_output_encoding());
 
        ident_line = find_commit_header(buffer, "author", &ident_len);
 
-       if (split_ident_line(&ident_split, ident_line, ident_len) < 0) {
-               strbuf_add(&sb, ident_line, ident_len);
-               die(_("invalid ident line: %s"), sb.buf);
-       }
+       if (split_ident_line(&id, ident_line, ident_len) < 0)
+               die(_("invalid ident line: %.*s"), (int)ident_len, ident_line);
 
        assert(!state->author_name);
-       if (ident_split.name_begin) {
-               strbuf_add(&sb, ident_split.name_begin,
-                       ident_split.name_end - ident_split.name_begin);
-               state->author_name = strbuf_detach(&sb, NULL);
-       } else
+       if (id.name_begin)
+               state->author_name =
+                       xmemdupz(id.name_begin, id.name_end - id.name_begin);
+       else
                state->author_name = xstrdup("");
 
        assert(!state->author_email);
-       if (ident_split.mail_begin) {
-               strbuf_add(&sb, ident_split.mail_begin,
-                       ident_split.mail_end - ident_split.mail_begin);
-               state->author_email = strbuf_detach(&sb, NULL);
-       } else
+       if (id.mail_begin)
+               state->author_email =
+                       xmemdupz(id.mail_begin, id.mail_end - id.mail_begin);
+       else
                state->author_email = xstrdup("");
 
-       author_date = show_ident_date(&ident_split, DATE_MODE(NORMAL));
-       strbuf_addstr(&sb, author_date);
        assert(!state->author_date);
-       state->author_date = strbuf_detach(&sb, NULL);
+       state->author_date = xstrdup(show_ident_date(&id, DATE_MODE(NORMAL)));
 
        assert(!state->msg);
        msg = strstr(buffer, "\n\n");
@@ -1413,6 +1403,7 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
                die(_("unable to parse commit %s"), oid_to_hex(&commit->object.oid));
        state->msg = xstrdup(msg + 2);
        state->msg_len = strlen(state->msg);
+       unuse_commit_buffer(commit, buffer);
 }
 
 /**
@@ -1940,7 +1931,8 @@ static void am_resolve(struct am_state *state)
 
        if (unmerged_cache()) {
                printf_ln(_("You still have unmerged paths in your index.\n"
-                       "Did you forget to use 'git add'?"));
+                       "You should 'git add' each file with resolved conflicts to mark them as such.\n"
+                       "You might run `git rm` on a file to accept \"deleted by them\" for it."));
                die_user_resolve(state);
        }
 
@@ -2156,7 +2148,7 @@ static void am_abort(struct am_state *state)
        am_rerere_clear();
 
        curr_branch = resolve_refdup("HEAD", 0, curr_head.hash, NULL);
-       has_curr_head = !is_null_oid(&curr_head);
+       has_curr_head = curr_branch && !is_null_oid(&curr_head);
        if (!has_curr_head)
                hashcpy(curr_head.hash, EMPTY_TREE_SHA1_BIN);
 
@@ -2319,6 +2311,9 @@ int cmd_am(int argc, const char **argv, const char *prefix)
                OPT_END()
        };
 
+       if (argc == 2 && !strcmp(argv[1], "-h"))
+               usage_with_options(usage, options);
+
        git_config(git_am_config, NULL);
 
        am_state_init(&state);
index 07506a3..ca9ebe4 100644 (file)
@@ -2688,12 +2688,15 @@ parse_done:
                blame_date_width = sizeof("2006-10-19");
                break;
        case DATE_RELATIVE:
-               /* TRANSLATORS: This string is used to tell us the maximum
-                  display width for a relative timestamp in "git blame"
-                  output.  For C locale, "4 years, 11 months ago", which
-                  takes 22 places, is the longest among various forms of
-                  relative timestamps, but your language may need more or
-                  fewer display columns. */
+               /*
+                * TRANSLATORS: This string is used to tell us the
+                * maximum display width for a relative timestamp in
+                * "git blame" output.  For C locale, "4 years, 11
+                * months ago", which takes 22 places, is the longest
+                * among various forms of relative timestamps, but
+                * your language may need more or fewer display
+                * columns.
+                */
                blame_date_width = utf8_strwidth(_("4 years, 11 months ago")) + 1; /* add the null */
                break;
        case DATE_NORMAL:
index 1890d7a..9af863e 100644 (file)
@@ -165,6 +165,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
                die("git cat-file %s: bad file", obj_name);
 
        write_or_die(1, buf, size);
+       free(buf);
        return 0;
 }
 
index bfa5419..b360943 100644 (file)
@@ -235,22 +235,24 @@ static int checkout_merged(int pos, const struct checkout *state)
        /*
         * NEEDSWORK:
         * There is absolutely no reason to write this as a blob object
-        * and create a phony cache entry just to leak.  This hack is
-        * primarily to get to the write_entry() machinery that massages
-        * the contents to work-tree format and writes out which only
-        * allows it for a cache entry.  The code in write_entry() needs
-        * to be refactored to allow us to feed a <buffer, size, mode>
-        * instead of a cache entry.  Such a refactoring would help
-        * merge_recursive as well (it also writes the merge result to the
-        * object database even when it may contain conflicts).
+        * and create a phony cache entry.  This hack is primarily to get
+        * to the write_entry() machinery that massages the contents to
+        * work-tree format and writes out which only allows it for a
+        * cache entry.  The code in write_entry() needs to be refactored
+        * to allow us to feed a <buffer, size, mode> instead of a cache
+        * entry.  Such a refactoring would help merge_recursive as well
+        * (it also writes the merge result to the object database even
+        * when it may contain conflicts).
         */
        if (write_sha1_file(result_buf.ptr, result_buf.size,
                            blob_type, oid.hash))
                die(_("Unable to add merge result for '%s'"), path);
+       free(result_buf.ptr);
        ce = make_cache_entry(mode, oid.hash, path, 2, 0);
        if (!ce)
                die(_("make_cache_entry failed for path '%s'"), path);
        status = checkout_entry(ce, state, NULL);
+       free(ce);
        return status;
 }
 
@@ -833,7 +835,8 @@ static int switch_branches(const struct checkout_opts *opts,
        int flag, writeout_error = 0;
        memset(&old, 0, sizeof(old));
        old.path = path_to_free = resolve_refdup("HEAD", 0, rev.hash, &flag);
-       old.commit = lookup_commit_reference_gently(rev.hash, 1);
+       if (old.path)
+               old.commit = lookup_commit_reference_gently(rev.hash, 1);
        if (!(flag & REF_ISSYMREF))
                old.path = NULL;
 
@@ -1286,9 +1289,8 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                 * new_branch && argc > 1 will be caught later.
                 */
                if (opts.new_branch && argc == 1)
-                       die(_("Cannot update paths and switch to branch '%s' at the same time.\n"
-                             "Did you intend to checkout '%s' which can not be resolved as commit?"),
-                           opts.new_branch, argv[0]);
+                       die(_("'%s' is not a commit and a branch '%s' cannot be created from it"),
+                               argv[0], opts.new_branch);
 
                if (opts.force_detach)
                        die(_("git checkout: --detach does not take a path argument '%s'"),
index de85b85..a6ae7d6 100644 (file)
@@ -773,7 +773,9 @@ static int checkout(int submodule_progress)
 
 static int write_one_config(const char *key, const char *value, void *data)
 {
-       return git_config_set_multivar_gently(key, value ? value : "true", "^$", 0);
+       return git_config_set_multivar_gently(key,
+                                             value ? value : "true",
+                                             CONFIG_REGEX_NONE, 0);
 }
 
 static void write_config(struct string_list *config)
index 1d805f5..8d1cac0 100644 (file)
@@ -1735,7 +1735,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 
        if (verbose || /* Truncate the message just before the diff, if any. */
            cleanup_mode == CLEANUP_SCISSORS)
-               wt_status_truncate_message_at_cut_line(&sb);
+               strbuf_setlen(&sb, wt_status_locate_end(sb.buf, sb.len));
 
        if (cleanup_mode != CLEANUP_NONE)
                strbuf_stripspace(&sb, cleanup_mode == CLEANUP_ALL);
index 1354d0e..b9a892f 100644 (file)
@@ -226,6 +226,7 @@ static void changed_files(struct hashmap *result, const char *index_path,
                hashmap_entry_init(entry, strhash(buf.buf));
                hashmap_add(result, entry);
        }
+       fclose(fp);
        if (finish_command(&diff_files))
                die("diff-files did not exit properly");
        strbuf_release(&index_env);
@@ -439,8 +440,10 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
                }
 
                if (lmode && status != 'C') {
-                       if (checkout_path(lmode, &loid, src_path, &lstate))
-                               return error("could not write '%s'", src_path);
+                       if (checkout_path(lmode, &loid, src_path, &lstate)) {
+                               ret = error("could not write '%s'", src_path);
+                               goto finish;
+                       }
                }
 
                if (rmode && !S_ISLNK(rmode)) {
@@ -456,9 +459,12 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
                        hashmap_add(&working_tree_dups, entry);
 
                        if (!use_wt_file(workdir, dst_path, &roid)) {
-                               if (checkout_path(rmode, &roid, dst_path, &rstate))
-                                       return error("could not write '%s'",
-                                                    dst_path);
+                               if (checkout_path(rmode, &roid, dst_path,
+                                                 &rstate)) {
+                                       ret = error("could not write '%s'",
+                                                   dst_path);
+                                       goto finish;
+                               }
                        } else if (!is_null_oid(&roid)) {
                                /*
                                 * Changes in the working tree need special
@@ -473,10 +479,12 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
                                                ADD_CACHE_JUST_APPEND);
 
                                add_path(&rdir, rdir_len, dst_path);
-                               if (ensure_leading_directories(rdir.buf))
-                                       return error("could not create "
-                                                    "directory for '%s'",
-                                                    dst_path);
+                               if (ensure_leading_directories(rdir.buf)) {
+                                       ret = error("could not create "
+                                                   "directory for '%s'",
+                                                   dst_path);
+                                       goto finish;
+                               }
                                add_path(&wtdir, wtdir_len, dst_path);
                                if (symlinks) {
                                        if (symlink(wtdir.buf, rdir.buf)) {
@@ -497,13 +505,15 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
                }
        }
 
+       fclose(fp);
+       fp = NULL;
        if (finish_command(&child)) {
                ret = error("error occurred running diff --raw");
                goto finish;
        }
 
        if (!i)
-               return 0;
+               goto finish;
 
        /*
         * Changes to submodules require special treatment.This loop writes a
@@ -626,6 +636,9 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
                exit_cleanup(tmpdir, rc);
 
 finish:
+       if (fp)
+               fclose(fp);
+
        free(lbase_dir);
        free(rbase_dir);
        strbuf_release(&ldir);
index e022063..64617ad 100644 (file)
@@ -734,6 +734,7 @@ static void handle_tag(const char *name, struct tag *tag)
                             oid_to_hex(&tag->object.oid));
                case DROP:
                        /* Ignore this tag altogether */
+                       free(buf);
                        return;
                case REWRITE:
                        if (tagged->type != OBJ_COMMIT) {
@@ -765,6 +766,7 @@ static void handle_tag(const char *name, struct tag *tag)
               (int)(tagger_end - tagger), tagger,
               tagger == tagger_end ? "" : "\n",
               (int)message_size, (int)message_size, message ? message : "");
+       free(buf);
 }
 
 static struct commit *get_commit(struct rev_cmdline_entry *e, char *full_name)
index b3b10cc..ec32583 100644 (file)
@@ -110,6 +110,8 @@ static void init_log_defaults(void)
 {
        init_grep_defaults();
        init_diff_ui_defaults();
+
+       decoration_style = auto_decoration_style();
 }
 
 static void cmd_log_init_defaults(struct rev_info *rev)
@@ -410,8 +412,6 @@ static int git_log_config(const char *var, const char *value, void *cb)
                if (decoration_style < 0)
                        decoration_style = 0; /* maybe warn? */
                return 0;
-       } else {
-               decoration_style = auto_decoration_style();
        }
        if (!strcmp(var, "log.showroot")) {
                default_show_root = git_config_bool(var, value);
index 3068168..664400b 100644 (file)
@@ -232,6 +232,16 @@ static int split_mbox(const char *file, const char *dir, int allow_bare,
 
        do {
                peek = fgetc(f);
+               if (peek == EOF) {
+                       if (f == stdin)
+                               /* empty stdin is OK */
+                               ret = skip;
+                       else {
+                               fclose(f);
+                               error(_("empty mbox: '%s'"), file);
+                       }
+                       goto out;
+               }
        } while (isspace(peek));
        ungetc(peek, f);
 
index de9b40f..da0fd8c 100644 (file)
@@ -72,7 +72,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
        unsigned mode;
        enum object_type mode_type; /* object type derived from mode */
        enum object_type obj_type; /* object type derived from sha */
-       char *path;
+       char *path, *to_free = NULL;
        unsigned char sha1[20];
 
        ptr = buf;
@@ -102,7 +102,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
                struct strbuf p_uq = STRBUF_INIT;
                if (unquote_c_style(&p_uq, path, NULL))
                        die("invalid quoting");
-               path = strbuf_detach(&p_uq, NULL);
+               path = to_free = strbuf_detach(&p_uq, NULL);
        }
 
        /*
@@ -136,6 +136,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
        }
 
        append_to_tree(mode, sha1, path);
+       free(to_free);
 }
 
 int cmd_mktree(int ac, const char **av, const char *prefix)
index 92a5d8a..e7a3fe7 100644 (file)
@@ -28,6 +28,7 @@ static void name_rev(struct commit *commit,
        struct rev_name *name = (struct rev_name *)commit->util;
        struct commit_list *parents;
        int parent_number = 1;
+       char *to_free = NULL;
 
        parse_commit(commit);
 
@@ -35,7 +36,7 @@ static void name_rev(struct commit *commit,
                return;
 
        if (deref) {
-               tip_name = xstrfmt("%s^0", tip_name);
+               tip_name = to_free = xstrfmt("%s^0", tip_name);
 
                if (generation)
                        die("generation: %d, but deref?", generation);
@@ -53,8 +54,10 @@ copy_data:
                name->taggerdate = taggerdate;
                name->generation = generation;
                name->distance = distance;
-       } else
+       } else {
+               free(to_free);
                return;
+       }
 
        for (parents = commit->parents;
                        parents;
index 7b89147..fb856e5 100644 (file)
@@ -340,8 +340,10 @@ static struct notes_tree *init_notes_check(const char *subcommand,
 
        ref = (flags & NOTES_INIT_WRITABLE) ? t->update_ref : t->ref;
        if (!starts_with(ref, "refs/notes/"))
-               /* TRANSLATORS: the first %s will be replaced by a
-                  git notes command: 'add', 'merge', 'remove', etc.*/
+               /*
+                * TRANSLATORS: the first %s will be replaced by a git
+                * notes command: 'add', 'merge', 'remove', etc.
+                */
                die(_("refusing to %s notes in %s (outside of refs/notes/)"),
                    subcommand, ref);
        return t;
index 0fe35d1..50e01aa 100644 (file)
@@ -2717,7 +2717,11 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
  */
 static int pack_options_allow_reuse(void)
 {
-       return pack_to_stdout && allow_ofs_delta;
+       return pack_to_stdout &&
+              allow_ofs_delta &&
+              !ignore_packed_keep &&
+              (!local || !have_non_local_packs) &&
+              !incremental;
 }
 
 static int get_object_list_from_bitmap(struct rev_info *revs)
index 72c8158..cb1df1c 100644 (file)
@@ -442,6 +442,7 @@ static void minimize(struct pack_list **min)
        /* return if there are no objects missing from the unique set */
        if (missing->size == 0) {
                *min = unique;
+               free(missing);
                return;
        }
 
index 23e212e..a52a9e1 100644 (file)
@@ -210,7 +210,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
                        die("failed to unpack tree object %s", arg);
                stage++;
        }
-       if (nr_trees == 0 && !read_empty)
+       if (!nr_trees && !read_empty && !opts.merge)
                warning("read-tree: emptying the index with no arguments is deprecated; use --empty");
        else if (nr_trees > 0 && read_empty)
                die("passing trees as arguments contradicts --empty");
@@ -226,9 +226,10 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
                setup_work_tree();
 
        if (opts.merge) {
-               if (stage < 2)
-                       die("just how do you expect me to merge %d trees?", stage-1);
                switch (stage - 1) {
+               case 0:
+                       die("you must specify at least one tree to merge");
+                       break;
                case 1:
                        opts.fn = opts.prefix ? bind_merge : oneway_merge;
                        break;
index f96834f..da9a3a2 100644 (file)
@@ -473,7 +473,8 @@ static char *prepare_push_cert_nonce(const char *path, unsigned long stamp)
  * after dropping "_commit" from its name and possibly moving it out
  * of commit.c
  */
-static char *find_header(const char *msg, size_t len, const char *key)
+static char *find_header(const char *msg, size_t len, const char *key,
+                        const char **next_line)
 {
        int key_len = strlen(key);
        const char *line = msg;
@@ -486,6 +487,8 @@ static char *find_header(const char *msg, size_t len, const char *key)
                if (line + key_len < eol &&
                    !memcmp(line, key, key_len) && line[key_len] == ' ') {
                        int offset = key_len + 1;
+                       if (next_line)
+                               *next_line = *eol ? eol + 1 : eol;
                        return xmemdupz(line + offset, (eol - line) - offset);
                }
                line = *eol ? eol + 1 : NULL;
@@ -495,7 +498,7 @@ static char *find_header(const char *msg, size_t len, const char *key)
 
 static const char *check_nonce(const char *buf, size_t len)
 {
-       char *nonce = find_header(buf, len, "nonce");
+       char *nonce = find_header(buf, len, "nonce", NULL);
        unsigned long stamp, ostamp;
        char *bohmac, *expect = NULL;
        const char *retval = NONCE_BAD;
@@ -575,6 +578,45 @@ leave:
        return retval;
 }
 
+/*
+ * Return 1 if there is no push_cert or if the push options in push_cert are
+ * the same as those in the argument; 0 otherwise.
+ */
+static int check_cert_push_options(const struct string_list *push_options)
+{
+       const char *buf = push_cert.buf;
+       int len = push_cert.len;
+
+       char *option;
+       const char *next_line;
+       int options_seen = 0;
+
+       int retval = 1;
+
+       if (!len)
+               return 1;
+
+       while ((option = find_header(buf, len, "push-option", &next_line))) {
+               len -= (next_line - buf);
+               buf = next_line;
+               options_seen++;
+               if (options_seen > push_options->nr
+                   || strcmp(option,
+                             push_options->items[options_seen - 1].string)) {
+                       retval = 0;
+                       goto leave;
+               }
+               free(option);
+       }
+
+       if (options_seen != push_options->nr)
+               retval = 0;
+
+leave:
+       free(option);
+       return retval;
+}
+
 static void prepare_push_cert_sha1(struct child_process *proc)
 {
        static int already_done;
@@ -986,7 +1028,8 @@ static const char *update(struct command *cmd, struct shallow_info *si)
 {
        const char *name = cmd->ref_name;
        struct strbuf namespaced_name_buf = STRBUF_INIT;
-       const char *namespaced_name, *ret;
+       static char *namespaced_name;
+       const char *ret;
        struct object_id *old_oid = &cmd->old_oid;
        struct object_id *new_oid = &cmd->new_oid;
 
@@ -997,6 +1040,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
        }
 
        strbuf_addf(&namespaced_name_buf, "%s%s", get_git_namespace(), name);
+       free(namespaced_name);
        namespaced_name = strbuf_detach(&namespaced_name_buf, NULL);
 
        if (is_ref_checked_out(namespaced_name)) {
@@ -1929,6 +1973,11 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
 
                if (use_push_options)
                        read_push_options(&push_options);
+               if (!check_cert_push_options(&push_options)) {
+                       struct command *cmd;
+                       for (cmd = commands; cmd; cmd = cmd->next)
+                               cmd->error_string = "inconsistent push options";
+               }
 
                prepare_shallow_info(&si, &shallow);
                if (!si.nr_ours && !si.nr_theirs)
index addf97a..9054e28 100644 (file)
@@ -1151,8 +1151,11 @@ static int show(int argc, const char **argv)
                        url_nr = states.remote->url_nr;
                }
                for (i = 0; i < url_nr; i++)
-                       /* TRANSLATORS: the colon ':' should align with
-                          the one in "  Fetch URL: %s" translation */
+                       /*
+                        * TRANSLATORS: the colon ':' should align
+                        * with the one in " Fetch URL: %s"
+                        * translation.
+                        */
                        printf_ln(_("  Push  URL: %s"), url[i]);
                if (!i)
                        printf_ln(_("  Push  URL: %s"), _("(no URL)"));
index 1722a9b..ff5dfd2 100644 (file)
@@ -414,9 +414,11 @@ static void show_worktree(struct worktree *wt, int path_maxlen, int abbrev_len)
                                find_unique_abbrev(wt->head_sha1, DEFAULT_ABBREV));
                if (wt->is_detached)
                        strbuf_addstr(&sb, "(detached HEAD)");
-               else if (wt->head_ref)
-                       strbuf_addf(&sb, "[%s]", shorten_unambiguous_ref(wt->head_ref, 0));
-               else
+               else if (wt->head_ref) {
+                       char *ref = shorten_unambiguous_ref(wt->head_ref, 0);
+                       strbuf_addf(&sb, "[%s]", ref);
+                       free(ref);
+               } else
                        strbuf_addstr(&sb, "(error)");
        }
        printf("%s\n", sb.buf);
index 579d540..6214e6a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
 #
 # Perform sanity checks on documentation and build it.
 #
@@ -7,8 +7,19 @@ set -e
 
 make check-builtins
 make check-docs
-make doc
 
+# Build docs with AsciiDoc
+make --jobs=2 doc > >(tee stdout.log) 2> >(tee stderr.log >&2)
+! test -s stderr.log
 test -s Documentation/git.html
 test -s Documentation/git.xml
 test -s Documentation/git.1
+grep '<meta name="generator" content="AsciiDoc ' Documentation/git.html
+
+# Build docs with AsciiDoctor
+make clean
+make --jobs=2 USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.log >&2)
+sed '/^GIT_VERSION = / d' stderr.log
+! test -s stderr.log
+test -s Documentation/git.html
+grep '<meta name="generator" content="Asciidoctor ' Documentation/git.html
index 73c78c2..c14ddf1 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -11,6 +11,7 @@
 #include "commit-slab.h"
 #include "prio-queue.h"
 #include "sha1-lookup.h"
+#include "wt-status.h"
 
 static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
 
@@ -1648,10 +1649,9 @@ const char *find_commit_header(const char *msg, const char *key, size_t *out_len
 /*
  * Inspect the given string and determine the true "end" of the log message, in
  * order to find where to put a new Signed-off-by: line.  Ignored are
- * trailing comment lines and blank lines, and also the traditional
- * "Conflicts:" block that is not commented out, so that we can use
- * "git commit -s --amend" on an existing commit that forgot to remove
- * it.
+ * trailing comment lines and blank lines.  To support "git commit -s
+ * --amend" on an existing commit, we also ignore "Conflicts:".  To
+ * support "git commit -v", we truncate at cut lines.
  *
  * Returns the number of bytes from the tail to ignore, to be fed as
  * the second parameter to append_signoff().
@@ -1661,8 +1661,9 @@ int ignore_non_trailer(const char *buf, size_t len)
        int boc = 0;
        int bol = 0;
        int in_old_conflicts_block = 0;
+       size_t cutoff = wt_status_locate_end(buf, len);
 
-       while (bol < len) {
+       while (bol < cutoff) {
                const char *next_line = memchr(buf + bol, '\n', len - bol);
 
                if (!next_line)
@@ -1688,5 +1689,5 @@ int ignore_non_trailer(const char *buf, size_t len)
                }
                bol = next_line - buf;
        }
-       return boc ? len - boc : 0;
+       return boc ? len - boc : len - cutoff;
 }
index 3fbfda5..fe0e3cc 100644 (file)
@@ -961,8 +961,10 @@ static char **get_path_split(void)
                        ++n;
                }
        }
-       if (!n)
+       if (!n) {
+               free(envpath);
                return NULL;
+       }
 
        ALLOC_ARRAY(path, n + 1);
        p = envpath;
index 3350169..e03aecf 100644 (file)
@@ -398,7 +398,11 @@ HANDLE winansi_get_osfhandle(int fd);
        (isalpha(*(path)) && (path)[1] == ':' ? 2 : 0)
 int mingw_skip_dos_drive_prefix(char **path);
 #define skip_dos_drive_prefix mingw_skip_dos_drive_prefix
-#define is_dir_sep(c) ((c) == '/' || (c) == '\\')
+static inline int mingw_is_dir_sep(int c)
+{
+       return c == '/' || c == '\\';
+}
+#define is_dir_sep mingw_is_dir_sep
 static inline char *mingw_find_last_dir_sep(const char *path)
 {
        char *ret = NULL;
index 793420f..a11a0f1 100644 (file)
@@ -105,6 +105,13 @@ static int is_console(int fd)
        if (!fd) {
                if (!GetConsoleMode(hcon, &mode))
                        return 0;
+               /*
+                * This code path is only reached if there is no console
+                * attached to stdout/stderr, i.e. we will not need to output
+                * any text to any console, therefore we might just as well
+                * use black as foreground color.
+                */
+               sbi.wAttributes = 0;
        } else if (!GetConsoleScreenBufferInfo(hcon, &sbi))
                return 0;
 
@@ -133,6 +140,11 @@ static void write_console(unsigned char *str, size_t len)
 
        /* convert utf-8 to utf-16 */
        int wlen = xutftowcsn(wbuf, (char*) str, ARRAY_SIZE(wbuf), len);
+       if (wlen < 0) {
+               wchar_t *err = L"[invalid]";
+               WriteConsoleW(console, err, wcslen(err), &dummy, NULL);
+               return;
+       }
 
        /* write directly to console */
        WriteConsoleW(console, wbuf, wlen, &dummy, NULL);
index b4a3205..a30056e 100644 (file)
--- a/config.c
+++ b/config.c
@@ -2621,7 +2621,7 @@ int git_config_rename_section_in_file(const char *config_filename,
        struct lock_file *lock;
        int out_fd;
        char buf[1024];
-       FILE *config_file;
+       FILE *config_file = NULL;
        struct stat st;
 
        if (new_name && !section_name_is_ok(new_name)) {
@@ -2703,11 +2703,14 @@ int git_config_rename_section_in_file(const char *config_filename,
                }
        }
        fclose(config_file);
+       config_file = NULL;
 commit_and_out:
        if (commit_lock_file(lock) < 0)
                ret = error_errno("could not write config file %s",
                                  config_filename);
 out:
+       if (config_file)
+               fclose(config_file);
        rollback_lock_file(lock);
 out_no_rollback:
        free(filename_buf);
index 399fe19..192629f 100644 (file)
@@ -237,6 +237,7 @@ ifeq ($(uname_S),AIX)
        NO_MKDTEMP = YesPlease
        NO_STRLCPY = YesPlease
        NO_NSEC = YesPlease
+       NO_REGEX = NeedsStartEnd
        FREAD_READS_DIRECTORIES = UnfortunatelyYes
        INTERNAL_QSORT = UnfortunatelyYes
        NEEDS_LIBICONV = YesPlease
diff --git a/contrib/completion/.gitattributes b/contrib/completion/.gitattributes
new file mode 100644 (file)
index 0000000..1911694
--- /dev/null
@@ -0,0 +1 @@
+*.bash eol=lf
index af65899..3f01249 100644 (file)
@@ -2810,7 +2810,7 @@ _git_show_branch ()
 _git_stash ()
 {
        local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
-       local subcommands='save list show apply clear drop pop create branch'
+       local subcommands='push save list show apply clear drop pop create branch'
        local subcommand="$(__git_find_on_cmdline "$subcommands")"
        if [ -z "$subcommand" ]; then
                case "$cur" in
@@ -2825,6 +2825,9 @@ _git_stash ()
                esac
        else
                case "$subcommand,$cur" in
+               push,--*)
+                       __gitcomp "$save_opts --message"
+                       ;;
                save,--*)
                        __gitcomp "$save_opts"
                        ;;
index f784dd2..7c4cd8d 100644 (file)
@@ -35,6 +35,16 @@ to use persistent-https:
 [url "persistent-http"]
        insteadof = http
 
+You may also want to allow the use of the persistent-https helper for
+submodule URLs (since any https URLs pointing to submodules will be
+rewritten, and Git's out-of-the-box defaults forbid submodules from
+using unknown remote helpers):
+
+[protocol "persistent-https"]
+       allow = always
+[protocol "persistent-http"]
+       allow = always
+
 
 #####################################################################
 # BUILDING FROM SOURCE
diff --git a/contrib/workdir/.gitattributes b/contrib/workdir/.gitattributes
new file mode 100644 (file)
index 0000000..1f78c5d
--- /dev/null
@@ -0,0 +1 @@
+/git-new-workdir eol=lf
index 2b8cdba..aafaf70 100755 (executable)
@@ -239,7 +239,7 @@ git rev-parse --no-flags --revs-only --symbolic-full-name \
 sed -e '/^^/d' "$tempdir"/raw-heads >"$tempdir"/heads
 
 test -s "$tempdir"/heads ||
-       die "Which ref do you want to rewrite?"
+       die "You must specify a ref to rewrite."
 
 GIT_INDEX_FILE="$(pwd)/../index"
 export GIT_INDEX_FILE
index 33d07c0..59cd41d 100644 (file)
@@ -2,3 +2,4 @@
 *           encoding=US-ASCII
 git-gui.sh  encoding=UTF-8
 /po/*.po    encoding=UTF-8
+/GIT-VERSION-GEN eol=lf
index 2c9c016..90b1fbe 100644 (file)
@@ -5,7 +5,7 @@
 # Copyright (c) 2006 Johannes E. Schindelin
 #
 # The original idea comes from Eric W. Biederman, in
-# http://article.gmane.org/gmane.comp.version-control.git/22407
+# https://public-inbox.org/git/m1odwkyuf5.fsf_-_@ebiederm.dsl.xmission.com/
 #
 # The file containing rebase commands, comments, and empty lines.
 # This file is created by "git rebase -i" then edited by the user.  As
index 7cf68f0..d8209c7 100755 (executable)
@@ -8085,7 +8085,7 @@ sub git_search_help {
 <p><strong>Pattern</strong> is by default a normal string that is matched precisely (but without
 regard to case, except in the case of pickaxe). However, when you check the <em>re</em> checkbox,
 the pattern entered is recognized as the POSIX extended
-<a href="http://en.wikipedia.org/wiki/Regular_expression">regular expression</a> (also case
+<a href="https://en.wikipedia.org/wiki/Regular_expression">regular expression</a> (also case
 insensitive).</p>
 <dl>
 <dt><b>commit</b></dt>
diff --git a/help.c b/help.c
index bc6cd19..a07f01e 100644 (file)
--- a/help.c
+++ b/help.c
@@ -411,8 +411,8 @@ const char *help_unknown_cmd(const char *cmd)
 
        if (SIMILAR_ENOUGH(best_similarity)) {
                fprintf_ln(stderr,
-                          Q_("\nDid you mean this?",
-                             "\nDid you mean one of these?",
+                          Q_("\nThe most similar command is",
+                             "\nThe most similar commands are",
                           n));
 
                for (i = 0; i < n; i++)
index a23b910..b908781 100644 (file)
@@ -1125,6 +1125,7 @@ static int process_ranges_ordinary_commit(struct rev_info *rev, struct commit *c
        changed = process_all_files(&parent_range, rev, &queue, range);
        if (parent)
                add_line_range(rev, parent, parent_range);
+       free_line_log_data(parent_range);
        return changed;
 }
 
index 6803775..f92cb9f 100644 (file)
@@ -882,7 +882,10 @@ static int read_one_header_line(struct strbuf *line, FILE *in)
        for (;;) {
                int peek;
 
-               peek = fgetc(in); ungetc(peek, in);
+               peek = fgetc(in);
+               if (peek == EOF)
+                       break;
+               ungetc(peek, in);
                if (peek != ' ' && peek != '\t')
                        break;
                if (strbuf_getline_lf(&continuation, in))
@@ -1099,6 +1102,10 @@ int mailinfo(struct mailinfo *mi, const char *msg, const char *patch)
 
        do {
                peek = fgetc(mi->input);
+               if (peek == EOF) {
+                       fclose(cmitmsg);
+                       return error("empty patch: '%s'", patch);
+               }
        } while (isspace(peek));
        ungetc(peek, mi->input);
 
index 24a3361..8f9ad7d 100644 (file)
@@ -132,8 +132,11 @@ struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd)
                c->mode_from_env = 1;
                c->combine = parse_combine_notes_fn(rewrite_mode_env);
                if (!c->combine)
-                       /* TRANSLATORS: The first %s is the name of the
-                          environment variable, the second %s is its value */
+                       /*
+                        * TRANSLATORS: The first %s is the name of
+                        * the environment variable, the second %s is
+                        * its value.
+                        */
                        error(_("Bad %s value: '%s'"), GIT_NOTES_REWRITE_MODE_ENVIRONMENT,
                                        rewrite_mode_env);
        }
index a23a1e6..e5ad34a 100644 (file)
@@ -589,8 +589,10 @@ static int usage_with_options_internal(struct parse_opt_ctx_t *ctx,
 
        fprintf_ln(outfile, _("usage: %s"), _(*usagestr++));
        while (*usagestr && **usagestr)
-               /* TRANSLATORS: the colon here should align with the
-                  one in "usage: %s" translation */
+               /*
+                * TRANSLATORS: the colon here should align with the
+                * one in "usage: %s" translation.
+                */
                fprintf_ln(outfile, _("   or: %s"), _(*usagestr++));
        while (*usagestr) {
                if (**usagestr)
index fa8f11d..92eba7a 100644 (file)
@@ -99,11 +99,12 @@ struct patch_id *has_commit_patch_id(struct commit *commit,
 struct patch_id *add_commit_patch_id(struct commit *commit,
                                     struct patch_ids *ids)
 {
-       struct patch_id *key = xcalloc(1, sizeof(*key));
+       struct patch_id *key;
 
        if (!patch_id_defined(commit))
                return NULL;
 
+       key = xcalloc(1, sizeof(*key));
        if (init_patch_id_entry(key, commit, ids)) {
                free(key);
                return NULL;
index 3a64044..2cc7b01 100644 (file)
@@ -93,6 +93,7 @@ static struct used_atom {
                        unsigned int length;
                } objectname;
                struct refname_atom refname;
+               char *head;
        } u;
 } *used_atom;
 static int used_atom_cnt, need_tagged, need_symref;
@@ -287,6 +288,12 @@ static void if_atom_parser(struct used_atom *atom, const char *arg)
        }
 }
 
+static void head_atom_parser(struct used_atom *atom, const char *arg)
+{
+       unsigned char unused[GIT_SHA1_RAWSZ];
+
+       atom->u.head = resolve_refdup("HEAD", RESOLVE_REF_READING, unused, NULL);
+}
 
 static struct {
        const char *name;
@@ -325,7 +332,7 @@ static struct {
        { "push", FIELD_STR, remote_ref_atom_parser },
        { "symref", FIELD_STR, refname_atom_parser },
        { "flag" },
-       { "HEAD" },
+       { "HEAD", FIELD_STR, head_atom_parser },
        { "color", FIELD_STR, color_atom_parser },
        { "align", FIELD_STR, align_atom_parser },
        { "end" },
@@ -1251,13 +1258,17 @@ char *get_head_description(void)
                            state.branch);
        else if (state.detached_from) {
                if (state.detached_at)
-                       /* TRANSLATORS: make sure this matches
-                          "HEAD detached at " in wt-status.c */
+                       /*
+                        * TRANSLATORS: make sure this matches "HEAD
+                        * detached at " in wt-status.c
+                        */
                        strbuf_addf(&desc, _("(HEAD detached at %s)"),
                                state.detached_from);
                else
-                       /* TRANSLATORS: make sure this matches
-                          "HEAD detached from " in wt-status.c */
+                       /*
+                        * TRANSLATORS: make sure this matches "HEAD
+                        * detached from " in wt-status.c
+                        */
                        strbuf_addf(&desc, _("(HEAD detached from %s)"),
                                state.detached_from);
        }
@@ -1369,12 +1380,7 @@ static void populate_value(struct ref_array_item *ref)
                } else if (!deref && grab_objectname(name, ref->objectname, v, atom)) {
                        continue;
                } else if (!strcmp(name, "HEAD")) {
-                       const char *head;
-                       unsigned char sha1[20];
-
-                       head = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,
-                                                 sha1, NULL);
-                       if (head && !strcmp(ref->refname, head))
+                       if (atom->u.head && !strcmp(ref->refname, atom->u.head))
                                v->s = "*";
                        else
                                v->s = " ";
index 99679f5..c63eb1a 100644 (file)
@@ -183,7 +183,11 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
                if (!reflogs || reflogs->nr == 0) {
                        struct object_id oid;
                        char *b;
-                       if (dwim_log(branch, strlen(branch), oid.hash, &b) == 1) {
+                       int ret = dwim_log(branch, strlen(branch),
+                                          oid.hash, &b);
+                       if (ret > 1)
+                               free(b);
+                       else if (ret == 1) {
                                if (reflogs) {
                                        free(reflogs->ref);
                                        free(reflogs);
@@ -193,17 +197,27 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
                                reflogs = read_complete_reflog(branch);
                        }
                }
-               if (!reflogs || reflogs->nr == 0)
+               if (!reflogs || reflogs->nr == 0) {
+                       if (reflogs) {
+                               free(reflogs->ref);
+                               free(reflogs);
+                       }
+                       free(branch);
                        return -1;
+               }
                string_list_insert(&info->complete_reflogs, branch)->util
                        = reflogs;
        }
+       free(branch);
 
        commit_reflog = xcalloc(1, sizeof(struct commit_reflog));
        if (recno < 0) {
                commit_reflog->recno = get_reflog_recno_by_time(reflogs, timestamp);
                if (commit_reflog->recno < 0) {
-                       free(branch);
+                       if (reflogs) {
+                               free(reflogs->ref);
+                               free(reflogs);
+                       }
                        free(commit_reflog);
                        return -1;
                }
index 801137c..32f137e 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -649,7 +649,12 @@ static int valid_remote_nick(const char *name)
 {
        if (!name[0] || is_dot_or_dotdot(name))
                return 0;
-       return !strchr(name, '/'); /* no slash */
+
+       /* remote nicknames cannot contain slashes */
+       while (*name)
+               if (is_dir_sep(*name++))
+                       return 0;
+       return 1;
 }
 
 const char *remote_for_branch(struct branch *branch, int *explicit)
@@ -1191,9 +1196,10 @@ static int match_explicit(struct ref *src, struct ref *dst,
                else if (is_null_oid(&matched_src->new_oid))
                        error("unable to delete '%s': remote ref does not exist",
                              dst_value);
-               else if ((dst_guess = guess_ref(dst_value, matched_src)))
+               else if ((dst_guess = guess_ref(dst_value, matched_src))) {
                        matched_dst = make_linked_ref(dst_guess, dst_tail);
-               else
+                       free(dst_guess);
+               } else
                        error("unable to push to unqualified destination: %s\n"
                              "The destination refspec neither matches an "
                              "existing ref on the remote nor\n"
index 7ff61ff..67ebc6f 100644 (file)
@@ -230,7 +230,7 @@ static struct commit *handle_commit(struct rev_info *revs,
                        die("bad tag");
                object = parse_object(tag->tagged->oid.hash);
                if (!object) {
-                       if (flags & UNINTERESTING)
+                       if (revs->ignore_missing_links || (flags & UNINTERESTING))
                                return NULL;
                        die("bad object %s", oid_to_hex(&tag->tagged->oid));
                }
index 10c3b4f..8c72cf1 100644 (file)
@@ -464,7 +464,8 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
 
        if (active_cache_changed &&
            write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
-               /* TRANSLATORS: %s will be "revert", "cherry-pick" or
+               /*
+                * TRANSLATORS: %s will be "revert", "cherry-pick" or
                 * "rebase -i".
                 */
                return error(_("%s: Unable to write new index file"),
@@ -1045,6 +1046,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
                        strbuf_addstr(&msgbuf, p);
 
                if (opts->record_origin) {
+                       strbuf_complete_line(&msgbuf);
                        if (!has_conforming_footer(&msgbuf, NULL, 0))
                                strbuf_addch(&msgbuf, '\n');
                        strbuf_addstr(&msgbuf, cherry_picked_prefix);
@@ -1913,11 +1915,13 @@ static int apply_autostash(struct replay_opts *opts)
        strbuf_trim(&stash_sha1);
 
        child.git_cmd = 1;
+       child.no_stdout = 1;
+       child.no_stderr = 1;
        argv_array_push(&child.args, "stash");
        argv_array_push(&child.args, "apply");
        argv_array_push(&child.args, stash_sha1.buf);
        if (!run_command(&child))
-               printf(_("Applied autostash."));
+               printf(_("Applied autostash.\n"));
        else {
                struct child_process store = CHILD_PROCESS_INIT;
 
@@ -2088,6 +2092,7 @@ cleanup_head_ref:
                                res = error(_("could not read orig-head"));
                                goto cleanup_head_ref;
                        }
+                       strbuf_reset(&buf);
                        if (!read_oneliner(&buf, rebase_path_onto(), 0)) {
                                res = error(_("could not read 'onto'"));
                                goto cleanup_head_ref;
@@ -2357,6 +2362,9 @@ void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag)
                                getenv("GIT_COMMITTER_EMAIL")));
        strbuf_addch(&sob, '\n');
 
+       if (!ignore_footer)
+               strbuf_complete_line(msgbuf);
+
        /*
         * If the whole message buffer is equal to the sob, pretend that we
         * found a conforming footer with a matching sob
@@ -2377,13 +2385,6 @@ void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag)
                         * the title and body to be filled in by the user.
                         */
                        append_newlines = "\n\n";
-               } else if (msgbuf->buf[len - 1] != '\n') {
-                       /*
-                        * Incomplete line.  Complete the line and add a
-                        * blank one so that there is an empty line between
-                        * the message body and the sob.
-                        */
-                       append_newlines = "\n\n";
                } else if (len == 1) {
                        /*
                         * Buffer contains a single newline.  Add another
diff --git a/setup.c b/setup.c
index 0309c27..e3f7699 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -703,11 +703,16 @@ static const char *setup_discovered_git_dir(const char *gitdir,
 
        /* --work-tree is set without --git-dir; use discovered one */
        if (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {
+               char *to_free = NULL;
+               const char *ret;
+
                if (offset != cwd->len && !is_absolute_path(gitdir))
-                       gitdir = real_pathdup(gitdir, 1);
+                       gitdir = to_free = real_pathdup(gitdir, 1);
                if (chdir(cwd->buf))
                        die_errno("Could not come back to cwd");
-               return setup_explicit_git_dir(gitdir, cwd, nongit_ok);
+               ret = setup_explicit_git_dir(gitdir, cwd, nongit_ok);
+               free(to_free);
+               return ret;
        }
 
        /* #16.2, #17.2, #20.2, #21.2, #24, #25, #28, #29 (see t1510) */
@@ -748,7 +753,7 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,
 
        /* --work-tree is set without --git-dir; use discovered one */
        if (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {
-               const char *gitdir;
+               static const char *gitdir;
 
                gitdir = offset == cwd->len ? "." : xmemdupz(cwd->buf, offset);
                if (chdir(cwd->buf))
index 35e9dd5..3dff80a 100644 (file)
@@ -5,9 +5,23 @@
 * https://opensource.org/licenses/MIT
 ***/
 
-#include "cache.h"
-#include "sha1dc/sha1.h"
-#include "sha1dc/ubc_check.h"
+#ifndef SHA1DC_NO_STANDARD_INCLUDES
+#include <string.h>
+#include <memory.h>
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+#ifdef SHA1DC_CUSTOM_INCLUDE_SHA1_C
+#include SHA1DC_CUSTOM_INCLUDE_SHA1_C
+#endif
+
+#ifndef SHA1DC_INIT_SAFE_HASH_DEFAULT
+#define SHA1DC_INIT_SAFE_HASH_DEFAULT 1
+#endif
+
+#include "sha1.h"
+#include "ubc_check.h"
 
 
 /*
    If you are compiling on a big endian platform and your compiler does not define one of these,
    you will have to add whatever macros your tool chain defines to indicate Big-Endianness.
  */
-#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \
+#ifdef SHA1DC_BIGENDIAN
+#undef SHA1DC_BIGENDIAN
+#endif
+#if (!defined SHA1DC_FORCE_LITTLEENDIAN) && \
+    ((defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \
     (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) || \
-    defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) ||  defined(__AARCH64EB__) || \
-    defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
+    defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) ||  defined(__AARCH64EB__) || \
+    defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) || defined(SHA1DC_FORCE_BIGENDIAN))
+
+#define SHA1DC_BIGENDIAN
 
-#define SHA1DC_BIGENDIAN       1
-#else
-#undef SHA1DC_BIGENDIAN
 #endif /*ENDIANNESS SELECTION*/
 
+#if (defined SHA1DC_FORCE_UNALIGNED_ACCESS || \
+     defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || \
+     defined(i386) || defined(__i386) || defined(__i386__) || defined(__i486__)  || \
+     defined(__i586__) || defined(__i686__) || defined(_M_IX86) || defined(__X86__) || \
+     defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) || defined(__INTEL__) || \
+     defined(__386) || defined(_M_X64) || defined(_M_AMD64))
+
+#define SHA1DC_ALLOW_UNALIGNED_ACCESS
+
+#endif /*UNALIGNMENT DETECTION*/
+
+
 #define rotate_right(x,n) (((x)>>(n))|((x)<<(32-(n))))
 #define rotate_left(x,n)  (((x)<<(n))|((x)>>(32-(n))))
 
 
 #define sha1_mix(W, t)  (rotate_left(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1))
 
-#if defined(SHA1DC_BIGENDIAN)
+#ifdef SHA1DC_BIGENDIAN
        #define sha1_load(m, t, temp)  { temp = m[t]; }
 #else
        #define sha1_load(m, t, temp)  { temp = m[t]; sha1_bswap32(temp); }
-#endif /* !defined(SHA1DC_BIGENDIAN) */
+#endif
 
 #define sha1_store(W, t, x)    *(volatile uint32_t *)&W[t] = x
 
@@ -869,6 +898,11 @@ static void sha1recompress_fast_ ## t (uint32_t ihvin[5], uint32_t ihvout[5], co
        ihvout[0] = ihvin[0] + a; ihvout[1] = ihvin[1] + b; ihvout[2] = ihvin[2] + c; ihvout[3] = ihvin[3] + d; ihvout[4] = ihvin[4] + e; \
 }
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4127)  /* Complier complains about the checks in the above macro being constant. */
+#endif
+
 #ifdef DOSTORESTATE0
 SHA1_RECOMPRESS(0)
 #endif
@@ -1189,6 +1223,10 @@ SHA1_RECOMPRESS(78)
 SHA1_RECOMPRESS(79)
 #endif
 
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
 static void sha1_recompression_step(uint32_t step, uint32_t ihvin[5], uint32_t ihvout[5], const uint32_t me2[80], const uint32_t state[5])
 {
        switch (step)
@@ -1662,7 +1700,7 @@ void SHA1DCInit(SHA1_CTX* ctx)
        ctx->ihv[3] = 0x10325476;
        ctx->ihv[4] = 0xC3D2E1F0;
        ctx->found_collision = 0;
-       ctx->safe_hash = 0;
+       ctx->safe_hash = SHA1DC_INIT_SAFE_HASH_DEFAULT;
        ctx->ubc_check = 1;
        ctx->detect_coll = 1;
        ctx->reduced_round_coll = 0;
@@ -1710,6 +1748,7 @@ void SHA1DCSetCallback(SHA1_CTX* ctx, collision_block_callback callback)
 void SHA1DCUpdate(SHA1_CTX* ctx, const char* buf, size_t len)
 {
        unsigned left, fill;
+
        if (len == 0)
                return;
 
@@ -1728,7 +1767,13 @@ void SHA1DCUpdate(SHA1_CTX* ctx, const char* buf, size_t len)
        while (len >= 64)
        {
                ctx->total += 64;
+
+#if defined(SHA1DC_ALLOW_UNALIGNED_ACCESS)
                sha1_process(ctx, (uint32_t*)(buf));
+#else
+               memcpy(ctx->buffer, buf, 64);
+               sha1_process(ctx, (uint32_t*)(ctx->buffer));
+#endif /* defined(SHA1DC_ALLOW_UNALIGNED_ACCESS) */
                buf += 64;
                len -= 64;
        }
@@ -1788,22 +1833,6 @@ int SHA1DCFinal(unsigned char output[20], SHA1_CTX *ctx)
        return ctx->found_collision;
 }
 
-void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx)
-{
-       if (!SHA1DCFinal(hash, ctx))
-               return;
-       die("SHA-1 appears to be part of a collision attack: %s",
-           sha1_to_hex(hash));
-}
-
-void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *vdata, unsigned long len)
-{
-       const char *data = vdata;
-       /* We expect an unsigned long, but sha1dc only takes an int */
-       while (len > INT_MAX) {
-               SHA1DCUpdate(ctx, data, INT_MAX);
-               data += INT_MAX;
-               len -= INT_MAX;
-       }
-       SHA1DCUpdate(ctx, data, len);
-}
+#ifdef SHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_C
+#include SHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_C
+#endif
index bd8bd92..a0ff5d1 100644 (file)
@@ -4,6 +4,7 @@
 * See accompanying file LICENSE.txt or copy at
 * https://opensource.org/licenses/MIT
 ***/
+
 #ifndef SHA1DC_SHA1_H
 #define SHA1DC_SHA1_H
 
 extern "C" {
 #endif
 
-/* uses SHA-1 message expansion to expand the first 16 words of W[] to 80 words */
-/* void sha1_message_expansion(uint32_t W[80]); */
-
-/* sha-1 compression function; first version takes a message block pre-parsed as 16 32-bit integers, second version takes an already expanded message) */
-/* void sha1_compression(uint32_t ihv[5], const uint32_t m[16]);
-void sha1_compression_W(uint32_t ihv[5], const uint32_t W[80]); */
+#ifndef SHA1DC_NO_STANDARD_INCLUDES
+#include <stdint.h>
+#endif
 
-/* same as sha1_compression_W, but additionally store intermediate states */
+/* sha-1 compression function that takes an already expanded message, and additionally store intermediate states */
 /* only stores states ii (the state between step ii-1 and step ii) when DOSTORESTATEii is defined in ubc_check.h */
 void sha1_compression_states(uint32_t[5], const uint32_t[16], uint32_t[80], uint32_t[80][5]);
 
 /*
-// function type for sha1_recompression_step_T (uint32_t ihvin[5], uint32_t ihvout[5], const uint32_t me2[80], const uint32_t state[5])
-// where 0 <= T < 80
-//       me2 is an expanded message (the expansion of an original message block XOR'ed with a disturbance vector's message block difference)
-//       state is the internal state (a,b,c,d,e) before step T of the SHA-1 compression function while processing the original message block
-// the function will return:
-//       ihvin: the reconstructed input chaining value
-//       ihvout: the reconstructed output chaining value
+// Function type for sha1_recompression_step_T (uint32_t ihvin[5], uint32_t ihvout[5], const uint32_t me2[80], const uint32_t state[5]).
+// Where 0 <= T < 80
+//       me2 is an expanded message (the expansion of an original message block XOR'ed with a disturbance vector's message block difference.)
+//       state is the internal state (a,b,c,d,e) before step T of the SHA-1 compression function while processing the original message block.
+// The function will return:
+//       ihvin: The reconstructed input chaining value.
+//       ihvout: The reconstructed output chaining value.
 */
 typedef void(*sha1_recompression_type)(uint32_t*, uint32_t*, const uint32_t*, const uint32_t*);
 
-/* table of sha1_recompression_step_0, ... , sha1_recompression_step_79 */
-/* extern sha1_recompression_type sha1_recompression_step[80];*/
-
-/* a callback function type that can be set to be called when a collision block has been found: */
+/* A callback function type that can be set to be called when a collision block has been found: */
 /* void collision_block_callback(uint64_t byteoffset, const uint32_t ihvin1[5], const uint32_t ihvin2[5], const uint32_t m1[80], const uint32_t m2[80]) */
 typedef void(*collision_block_callback)(uint64_t, const uint32_t*, const uint32_t*, const uint32_t*, const uint32_t*);
 
-/* the SHA-1 context */
+/* The SHA-1 context. */
 typedef struct {
        uint64_t total;
        uint32_t ihv[5];
@@ -59,30 +54,34 @@ typedef struct {
        uint32_t states[80][5];
 } SHA1_CTX;
 
-/* initialize SHA-1 context */
+/* Initialize SHA-1 context. */
 void SHA1DCInit(SHA1_CTX*);
 
 /*
-// function to enable safe SHA-1 hashing:
-// collision attacks are thwarted by hashing a detected near-collision block 3 times
-// think of it as extending SHA-1 from 80-steps to 240-steps for such blocks:
-//   the best collision attacks against SHA-1 have complexity about 2^60,
-//   thus for 240-steps an immediate lower-bound for the best cryptanalytic attacks would 2^180
-//   an attacker would be better off using a generic birthday search of complexity 2^80
-//
-// enabling safe SHA-1 hashing will result in the correct SHA-1 hash for messages where no collision attack was detected
-// but it will result in a different SHA-1 hash for messages where a collision attack was detected
-// this will automatically invalidate SHA-1 based digital signature forgeries
-// enabled by default
+    Function to enable safe SHA-1 hashing:
+    Collision attacks are thwarted by hashing a detected near-collision block 3 times.
+    Think of it as extending SHA-1 from 80-steps to 240-steps for such blocks:
+       The best collision attacks against SHA-1 have complexity about 2^60,
+       thus for 240-steps an immediate lower-bound for the best cryptanalytic attacks would be 2^180.
+       An attacker would be better off using a generic birthday search of complexity 2^80.
+
+   Enabling safe SHA-1 hashing will result in the correct SHA-1 hash for messages where no collision attack was detected,
+   but it will result in a different SHA-1 hash for messages where a collision attack was detected.
+   This will automatically invalidate SHA-1 based digital signature forgeries.
+   Enabled by default.
 */
 void SHA1DCSetSafeHash(SHA1_CTX*, int);
 
-/* function to disable or enable the use of Unavoidable Bitconditions (provides a significant speed up) */
-/* enabled by default */
+/*
+    Function to disable or enable the use of Unavoidable Bitconditions (provides a significant speed up).
+    Enabled by default
+ */
 void SHA1DCSetUseUBC(SHA1_CTX*, int);
 
-/* function to disable or enable the use of Collision Detection */
-/* enabled by default */
+/*
+    Function to disable or enable the use of Collision Detection.
+    Enabled by default.
+ */
 void SHA1DCSetUseDetectColl(SHA1_CTX*, int);
 
 /* function to disable or enable the detection of reduced-round SHA-1 collisions */
@@ -100,23 +99,12 @@ void SHA1DCUpdate(SHA1_CTX*, const char*, size_t);
 /* returns: 0 = no collision detected, otherwise = collision found => warn user for active attack */
 int  SHA1DCFinal(unsigned char[20], SHA1_CTX*);
 
-/*
- * Same as SHA1DCFinal, but convert collision attack case into a verbose die().
- */
-void git_SHA1DCFinal(unsigned char [20], SHA1_CTX *);
-
-/*
- * Same as SHA1DCUpdate, but adjust types to match git's usual interface.
- */
-void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *data, unsigned long len);
-
-#define platform_SHA_CTX SHA1_CTX
-#define platform_SHA1_Init SHA1DCInit
-#define platform_SHA1_Update git_SHA1DCUpdate
-#define platform_SHA1_Final git_SHA1DCFinal
-
 #if defined(__cplusplus)
 }
 #endif
 
-#endif /* SHA1DC_SHA1_H */
+#ifdef SHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_H
+#include SHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_H
+#endif
+
+#endif
index 089dd47..b3beff2 100644 (file)
 // ubc_check has been verified against ubc_check_verify using the 'ubc_check_test' program in the tools section
 */
 
-#include "git-compat-util.h"
-#include "sha1dc/ubc_check.h"
+#ifndef SHA1DC_NO_STANDARD_INCLUDES
+#include <stdint.h>
+#endif
+#ifdef SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C
+#include SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C
+#endif
+#include "ubc_check.h"
 
 static const uint32_t DV_I_43_0_bit    = (uint32_t)(1) << 0;
 static const uint32_t DV_I_44_0_bit    = (uint32_t)(1) << 1;
@@ -361,3 +366,7 @@ if (mask) {
 
        dvmask[0]=mask;
 }
+
+#ifdef SHA1DC_CUSTOM_TRAILING_INCLUDE_UBC_CHECK_C
+#include SHA1DC_CUSTOM_TRAILING_INCLUDE_UBC_CHECK_C
+#endif
index b64c306..d7e17dc 100644 (file)
 // thus one needs to do the recompression check for each DV that has its bit set
 */
 
-#ifndef UBC_CHECK_H
-#define UBC_CHECK_H
+#ifndef SHA1DC_UBC_CHECK_H
+#define SHA1DC_UBC_CHECK_H
 
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
+#ifndef SHA1DC_NO_STANDARD_INCLUDES
+#include <stdint.h>
+#endif
+
 #define DVMASKSIZE 1
 typedef struct { int dvType; int dvK; int dvB; int testt; int maski; int maskb; uint32_t dm[80]; } dv_info_t;
 extern dv_info_t sha1_dvs[];
@@ -41,4 +45,8 @@ void ubc_check(const uint32_t W[80], uint32_t dvmask[DVMASKSIZE]);
 }
 #endif
 
-#endif /* UBC_CHECK_H */
+#ifdef SHA1DC_CUSTOM_TRAILING_INCLUDE_UBC_CHECK_H
+#include SHA1DC_CUSTOM_TRAILING_INCLUDE_UBC_CHECK_H
+#endif
+
+#endif
diff --git a/sha1dc_git.c b/sha1dc_git.c
new file mode 100644 (file)
index 0000000..4d32b4f
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * This code is included at the end of sha1dc/sha1.c with the
+ * SHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_C macro.
+ */
+
+void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx)
+{
+       if (!SHA1DCFinal(hash, ctx))
+               return;
+       die("SHA-1 appears to be part of a collision attack: %s",
+           sha1_to_hex(hash));
+}
+
+void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *vdata, unsigned long len)
+{
+       const char *data = vdata;
+       /* We expect an unsigned long, but sha1dc only takes an int */
+       while (len > INT_MAX) {
+               SHA1DCUpdate(ctx, data, INT_MAX);
+               data += INT_MAX;
+               len -= INT_MAX;
+       }
+       SHA1DCUpdate(ctx, data, len);
+}
diff --git a/sha1dc_git.h b/sha1dc_git.h
new file mode 100644 (file)
index 0000000..a8a5c1d
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * This code is included at the end of sha1dc/sha1.h with the
+ * SHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_H macro.
+ */
+
+/*
+ * Same as SHA1DCFinal, but convert collision attack case into a verbose die().
+ */
+void git_SHA1DCFinal(unsigned char [20], SHA1_CTX *);
+
+/*
+ * Same as SHA1DCUpdate, but adjust types to match git's usual interface.
+ */
+void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *data, unsigned long len);
+
+#define platform_SHA_CTX SHA1_CTX
+#define platform_SHA1_Init SHA1DCInit
+#define platform_SHA1_Update git_SHA1DCUpdate
+#define platform_SHA1_Final git_SHA1DCFinal
index 25b6db9..f937096 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -473,11 +473,15 @@ static void paint_down(struct paint_info *info, const unsigned char *sha1,
        struct commit_list *head = NULL;
        int bitmap_nr = (info->nr_bits + 31) / 32;
        size_t bitmap_size = st_mult(sizeof(uint32_t), bitmap_nr);
-       uint32_t *tmp = xmalloc(bitmap_size); /* to be freed before return */
-       uint32_t *bitmap = paint_alloc(info);
        struct commit *c = lookup_commit_reference_gently(sha1, 1);
+       uint32_t *tmp; /* to be freed before return */
+       uint32_t *bitmap;
+
        if (!c)
                return;
+
+       tmp = xmalloc(bitmap_size);
+       bitmap = paint_alloc(info);
        memset(bitmap, 0, bitmap_size);
        bitmap[id / 32] |= (1U << (id % 32));
        commit_list_insert(c, &head);
index 2d44088..3bd959a 100644 (file)
@@ -1,2 +1,22 @@
 t[0-9][0-9][0-9][0-9]/* -whitespace
-t0110/url-* binary
+/diff-lib/* eol=lf
+/t0110/url-* binary
+/t3900/*.txt eol=lf
+/t3901/*.txt eol=lf
+/t4034/*/* eol=lf
+/t4013/* eol=lf
+/t4018/* eol=lf
+/t4051/* eol=lf
+/t4100/* eol=lf
+/t4101/* eol=lf
+/t4109/* eol=lf
+/t4110/* eol=lf
+/t4135/* eol=lf
+/t4211/* eol=lf
+/t4252/* eol=lf
+/t5100/* eol=lf
+/t5515/* eol=lf
+/t556x_common eol=lf
+/t7500/* eol=lf
+/t8005/*.txt eol=lf
+/t9*/*.dump eol=lf
diff --git a/t/t0025-crlf-auto.sh b/t/t0025-crlf-auto.sh
deleted file mode 100755 (executable)
index 89826c5..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/bin/sh
-
-test_description='CRLF conversion'
-
-. ./test-lib.sh
-
-has_cr() {
-       tr '\015' Q <"$1" | grep Q >/dev/null
-}
-
-test_expect_success setup '
-
-       git config core.autocrlf false &&
-
-       for w in Hello world how are you; do echo $w; done >LFonly &&
-       for w in I am very very fine thank you; do echo ${w}Q; done | q_to_cr >CRLFonly &&
-       for w in Oh here is a QNUL byte how alarming; do echo ${w}; done | q_to_nul >LFwithNUL &&
-       git add . &&
-
-       git commit -m initial &&
-
-       LFonly=$(git rev-parse HEAD:LFonly) &&
-       CRLFonly=$(git rev-parse HEAD:CRLFonly) &&
-       LFwithNUL=$(git rev-parse HEAD:LFwithNUL) &&
-
-       echo happy.
-'
-
-test_expect_success 'default settings cause no changes' '
-
-       rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
-       git read-tree --reset -u HEAD &&
-
-       ! has_cr LFonly &&
-       has_cr CRLFonly &&
-       LFonlydiff=$(git diff LFonly) &&
-       CRLFonlydiff=$(git diff CRLFonly) &&
-       LFwithNULdiff=$(git diff LFwithNUL) &&
-       test -z "$LFonlydiff" -a -z "$CRLFonlydiff" -a -z "$LFwithNULdiff"
-'
-
-test_expect_success 'crlf=true causes a CRLF file to be normalized' '
-
-       # Backwards compatibility check
-       rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
-       echo "CRLFonly crlf" > .gitattributes &&
-       git read-tree --reset -u HEAD &&
-
-       # Note, "normalized" means that git will normalize it if added
-       has_cr CRLFonly &&
-       CRLFonlydiff=$(git diff CRLFonly) &&
-       test -n "$CRLFonlydiff"
-'
-
-test_expect_success 'text=true causes a CRLF file to be normalized' '
-
-       rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
-       echo "CRLFonly text" > .gitattributes &&
-       git read-tree --reset -u HEAD &&
-
-       # Note, "normalized" means that git will normalize it if added
-       has_cr CRLFonly &&
-       CRLFonlydiff=$(git diff CRLFonly) &&
-       test -n "$CRLFonlydiff"
-'
-
-test_expect_success 'eol=crlf gives a normalized file CRLFs with autocrlf=false' '
-
-       rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
-       git config core.autocrlf false &&
-       echo "LFonly eol=crlf" > .gitattributes &&
-       git read-tree --reset -u HEAD &&
-
-       has_cr LFonly &&
-       LFonlydiff=$(git diff LFonly) &&
-       test -z "$LFonlydiff"
-'
-
-test_expect_success 'eol=crlf gives a normalized file CRLFs with autocrlf=input' '
-
-       rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
-       git config core.autocrlf input &&
-       echo "LFonly eol=crlf" > .gitattributes &&
-       git read-tree --reset -u HEAD &&
-
-       has_cr LFonly &&
-       LFonlydiff=$(git diff LFonly) &&
-       test -z "$LFonlydiff"
-'
-
-test_expect_success 'eol=lf gives a normalized file LFs with autocrlf=true' '
-
-       rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
-       git config core.autocrlf true &&
-       echo "LFonly eol=lf" > .gitattributes &&
-       git read-tree --reset -u HEAD &&
-
-       ! has_cr LFonly &&
-       LFonlydiff=$(git diff LFonly) &&
-       test -z "$LFonlydiff"
-'
-
-test_expect_success 'autocrlf=true does not normalize CRLF files' '
-
-       rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
-       git config core.autocrlf true &&
-       git read-tree --reset -u HEAD &&
-
-       has_cr LFonly &&
-       has_cr CRLFonly &&
-       LFonlydiff=$(git diff LFonly) &&
-       CRLFonlydiff=$(git diff CRLFonly) &&
-       LFwithNULdiff=$(git diff LFwithNUL) &&
-       test -z "$LFonlydiff" -a -z "$CRLFonlydiff" -a -z "$LFwithNULdiff"
-'
-
-test_expect_success 'text=auto, autocrlf=true does not normalize CRLF files' '
-
-       rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
-       git config core.autocrlf true &&
-       echo "* text=auto" > .gitattributes &&
-       git read-tree --reset -u HEAD &&
-
-       has_cr LFonly &&
-       has_cr CRLFonly &&
-       LFonlydiff=$(git diff LFonly) &&
-       CRLFonlydiff=$(git diff CRLFonly) &&
-       LFwithNULdiff=$(git diff LFwithNUL) &&
-       test -z "$LFonlydiff" -a -z "$CRLFonlydiff" -a -z "$LFwithNULdiff"
-'
-
-test_expect_success 'text=auto, autocrlf=true does not normalize binary files' '
-
-       rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
-       git config core.autocrlf true &&
-       echo "* text=auto" > .gitattributes &&
-       git read-tree --reset -u HEAD &&
-
-       ! has_cr LFwithNUL &&
-       LFwithNULdiff=$(git diff LFwithNUL) &&
-       test -z "$LFwithNULdiff"
-'
-
-test_expect_success 'eol=crlf _does_ normalize binary files' '
-
-       rm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&
-       echo "LFwithNUL eol=crlf" > .gitattributes &&
-       git read-tree --reset -u HEAD &&
-
-       has_cr LFwithNUL &&
-       LFwithNULdiff=$(git diff LFwithNUL) &&
-       test -z "$LFwithNULdiff"
-'
-
-test_expect_success 'prepare unnormalized' '
-       > .gitattributes &&
-       git config core.autocrlf false &&
-       printf "LINEONE\nLINETWO\r\n"     >mixed &&
-       git add mixed .gitattributes &&
-       git commit -m "Add mixed" &&
-       git ls-files --eol | egrep "i/crlf" &&
-       git ls-files --eol | egrep "i/mixed"
-'
-
-test_expect_success 'normalize unnormalized' '
-       echo "* text=auto" >.gitattributes &&
-       rm .git/index &&
-       git add . &&
-       git commit -m "Introduce end-of-line normalization" &&
-       git ls-files --eol | tr "\\t" " " | sort >act &&
-cat >exp <<EOF &&
-i/-text w/-text attr/text=auto         LFwithNUL
-i/lf    w/crlf  attr/text=auto         CRLFonly
-i/lf    w/crlf  attr/text=auto         LFonly
-i/lf    w/lf    attr/text=auto         .gitattributes
-i/lf    w/mixed attr/text=auto         mixed
-EOF
-       test_cmp exp act
-'
-
-test_done
index 90db54c..deb3ae7 100755 (executable)
@@ -4,12 +4,6 @@ test_description='CRLF conversion all combinations'
 
 . ./test-lib.sh
 
-if ! test_have_prereq EXPENSIVE
-then
-       skip_all="EXPENSIVE not set"
-       test_done
-fi
-
 compare_files () {
        tr '\015\000' QN <"$1" >"$1".expect &&
        tr '\015\000' QN <"$2" | tr -d 'Z' >"$2".actual &&
@@ -75,7 +69,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_cmp "$2".expect "$2".actual
+       test_i18ncmp "$2".expect "$2".actual
 }
 
 commit_check_warn () {
index a212460..71b0d74 100755 (executable)
@@ -8,7 +8,7 @@ test_description="The Git C functions aren't broken by setlocale(3)"
 . ./lib-gettext.sh
 
 test_expect_success 'git show a ISO-8859-1 commit under C locale' '
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
        test_commit "iso-c-commit" iso-under-c &&
        git show >out 2>err &&
        ! test -s err &&
@@ -16,7 +16,7 @@ test_expect_success 'git show a ISO-8859-1 commit under C locale' '
 '
 
 test_expect_success GETTEXT_LOCALE 'git show a ISO-8859-1 commit under a UTF-8 locale' '
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
        test_commit "iso-utf8-commit" iso-under-utf8 &&
        LANGUAGE=is LC_ALL="$is_IS_locale" git show >out 2>err &&
        ! test -s err &&
index 1af8c45..3dda215 100755 (executable)
@@ -77,7 +77,7 @@ test_with_config () {
 
 test_expect_success 'ignore .git/ with incompatible repository version' '
        test_with_config "[core]repositoryformatversion = 999999" 2>err &&
-       grep "warning:.* Expected git repo version <= [1-9]" err
+       test_i18ngrep "warning:.* Expected git repo version <= [1-9]" err
 '
 
 test_expect_failure 'ignore .git/ with invalid repository version' '
index 8937e25..e88349c 100755 (executable)
@@ -122,7 +122,7 @@ test_expect_success 'push cannot create a badly named ref' '
        ! grep -e "broken\.\.\.ref" output
 '
 
-test_expect_failure 'push --mirror can delete badly named ref' '
+test_expect_failure C_LOCALE_OUTPUT 'push --mirror can delete badly named ref' '
        top=$(pwd) &&
        git init src &&
        git init dest &&
index fe62e7c..10f8f02 100755 (executable)
@@ -338,7 +338,7 @@ test_expect_success 'git branch -m s/s s should work when s/t is deleted' '
 
 test_expect_success 'config information was renamed, too' '
        test $(git config branch.s.dummy) = Hello &&
-       test_must_fail git config branch.s/s/dummy
+       test_must_fail git config branch.s/s.dummy
 '
 
 test_expect_success 'deleting a symref' '
index 5778c0a..a428ae6 100755 (executable)
@@ -236,7 +236,7 @@ test_expect_success 'git branch --format option' '
        Refname is refs/heads/ref-to-remote
        EOF
        git branch --format="Refname is %(refname)" >actual &&
-       test_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 test_done
index 33d392b..5bd0275 100755 (executable)
@@ -366,7 +366,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '
        grep "^ file1 | 2 +-$" output
 '
 
-test_expect_success 'multi-squash only fires up editor once' '
+test_expect_success C_LOCALE_OUTPUT 'multi-squash only fires up editor once' '
        base=$(git rev-parse HEAD~4) &&
        set_fake_editor &&
        FAKE_COMMIT_AMEND="ONCE" FAKE_LINES="1 squash 2 squash 3 squash 4" \
@@ -376,7 +376,7 @@ test_expect_success 'multi-squash only fires up editor once' '
        test 1 = $(git show | grep ONCE | wc -l)
 '
 
-test_expect_success 'multi-fixup does not fire up editor' '
+test_expect_success C_LOCALE_OUTPUT 'multi-fixup does not fire up editor' '
        git checkout -b multi-fixup E &&
        base=$(git rev-parse HEAD~4) &&
        set_fake_editor &&
@@ -426,7 +426,7 @@ D
 ONCE
 EOF
 
-test_expect_success 'squash and fixup generate correct log messages' '
+test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messages' '
        git checkout -b squash-fixup E &&
        base=$(git rev-parse HEAD~4) &&
        set_fake_editor &&
@@ -439,7 +439,7 @@ test_expect_success 'squash and fixup generate correct log messages' '
        git branch -D squash-fixup
 '
 
-test_expect_success 'squash ignores comments' '
+test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' '
        git checkout -b skip-comments E &&
        base=$(git rev-parse HEAD~4) &&
        set_fake_editor &&
@@ -452,7 +452,7 @@ test_expect_success 'squash ignores comments' '
        git branch -D skip-comments
 '
 
-test_expect_success 'squash ignores blank lines' '
+test_expect_success C_LOCALE_OUTPUT 'squash ignores blank lines' '
        git checkout -b skip-blank-lines E &&
        base=$(git rev-parse HEAD~4) &&
        set_fake_editor &&
@@ -860,7 +860,7 @@ test_expect_success 'rebase -ix with several instances of --exec' '
        test_cmp expected actual
 '
 
-test_expect_success 'rebase -ix with --autosquash' '
+test_expect_success C_LOCALE_OUTPUT 'rebase -ix with --autosquash' '
        git reset --hard execute &&
        git checkout -b autosquash &&
        echo second >second.txt &&
@@ -943,7 +943,7 @@ test_expect_success 'rebase -i --root fixup root commit' '
        test 0 = $(git cat-file commit HEAD | grep -c ^parent\ )
 '
 
-test_expect_success 'rebase --edit-todo does not works on non-interactive rebase' '
+test_expect_success C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-interactive rebase' '
        git reset --hard &&
        git checkout conflict-branch &&
        set_fake_editor &&
index 48346f1..5848949 100755 (executable)
@@ -234,23 +234,23 @@ test_auto_fixup_fixup () {
        fi
 }
 
-test_expect_success 'fixup! fixup!' '
+test_expect_success C_LOCALE_OUTPUT 'fixup! fixup!' '
        test_auto_fixup_fixup fixup fixup
 '
 
-test_expect_success 'fixup! squash!' '
+test_expect_success C_LOCALE_OUTPUT 'fixup! squash!' '
        test_auto_fixup_fixup fixup squash
 '
 
-test_expect_success 'squash! squash!' '
+test_expect_success C_LOCALE_OUTPUT 'squash! squash!' '
        test_auto_fixup_fixup squash squash
 '
 
-test_expect_success 'squash! fixup!' '
+test_expect_success C_LOCALE_OUTPUT 'squash! fixup!' '
        test_auto_fixup_fixup squash fixup
 '
 
-test_expect_success 'autosquash with custom inst format' '
+test_expect_success C_LOCALE_OUTPUT 'autosquash with custom inst format' '
        git reset --hard base &&
        git config --add rebase.instructionFormat "[%an @ %ar] %s"  &&
        echo 2 >file1 &&
index bf0a5c9..9888bf3 100755 (executable)
@@ -208,6 +208,50 @@ test_expect_success 'cherry-pick -x -s adds sob even when trailing sob exists fo
        test_cmp expect actual
 '
 
+test_expect_success 'cherry-pick -x handles commits with no NL at end of message' '
+       pristine_detach initial &&
+       printf "title\n\nSigned-off-by: A <a@example.com>" >msg &&
+       sha1=$(git commit-tree -p initial mesg-with-footer^{tree} <msg) &&
+       git cherry-pick -x $sha1 &&
+       git log -1 --pretty=format:%B >actual &&
+
+       printf "\n(cherry picked from commit %s)\n" $sha1 >>msg &&
+       test_cmp msg actual
+'
+
+test_expect_success 'cherry-pick -x handles commits with no footer and no NL at end of message' '
+       pristine_detach initial &&
+       printf "title\n\nnot a footer" >msg &&
+       sha1=$(git commit-tree -p initial mesg-with-footer^{tree} <msg) &&
+       git cherry-pick -x $sha1 &&
+       git log -1 --pretty=format:%B >actual &&
+
+       printf "\n\n(cherry picked from commit %s)\n" $sha1 >>msg &&
+       test_cmp msg actual
+'
+
+test_expect_success 'cherry-pick -s handles commits with no NL at end of message' '
+       pristine_detach initial &&
+       printf "title\n\nSigned-off-by: A <a@example.com>" >msg &&
+       sha1=$(git commit-tree -p initial mesg-with-footer^{tree} <msg) &&
+       git cherry-pick -s $sha1 &&
+       git log -1 --pretty=format:%B >actual &&
+
+       printf "\nSigned-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>\n" >>msg &&
+       test_cmp msg actual
+'
+
+test_expect_success 'cherry-pick -s handles commits with no footer and no NL at end of message' '
+       pristine_detach initial &&
+       printf "title\n\nnot a footer" >msg &&
+       sha1=$(git commit-tree -p initial mesg-with-footer^{tree} <msg) &&
+       git cherry-pick -s $sha1 &&
+       git log -1 --pretty=format:%B >actual &&
+
+       printf "\n\nSigned-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>\n" >>msg &&
+       test_cmp msg actual
+'
+
 test_expect_success 'cherry-pick -x treats "(cherry picked from..." line as part of footer' '
        pristine_detach initial &&
        sha1=$(git rev-parse mesg-with-cherry-footer^0) &&
index f663d56..923eb01 100755 (executable)
@@ -31,7 +31,7 @@ test_expect_success setup '
 
        # use UTF-8 in author and committer name to match the
        # i18n.commitencoding settings
-       . "$TEST_DIRECTORY"/t3901-utf8.txt &&
+       . "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
        test_tick &&
        echo "$GIT_AUTHOR_NAME" >mine &&
@@ -55,7 +55,7 @@ test_expect_success setup '
                # the second one on the side branch is ISO-8859-1
                git config i18n.commitencoding ISO8859-1 &&
                # use author and committer name in ISO-8859-1 to match it.
-               . "$TEST_DIRECTORY"/t3901-8859-1.txt
+               . "$TEST_DIRECTORY"/t3901/8859-1.txt
        fi &&
        test_tick &&
        echo Yet another >theirs &&
@@ -100,7 +100,7 @@ test_expect_success 'rebase (U/U)' '
 
        # The result will be committed by GIT_COMMITTER_NAME --
        # we want UTF-8 encoded name.
-       . "$TEST_DIRECTORY"/t3901-utf8.txt &&
+       . "$TEST_DIRECTORY"/t3901/utf8.txt &&
        git checkout -b test &&
        git rebase master &&
 
@@ -110,7 +110,7 @@ test_expect_success 'rebase (U/U)' '
 test_expect_success 'rebase (U/L)' '
        git config i18n.commitencoding UTF-8 &&
        git config i18n.logoutputencoding ISO8859-1 &&
-       . "$TEST_DIRECTORY"/t3901-utf8.txt &&
+       . "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
        git reset --hard side &&
        git rebase master &&
@@ -122,7 +122,7 @@ test_expect_success !MINGW 'rebase (L/L)' '
        # In this test we want ISO-8859-1 encoded commits as the result
        git config i18n.commitencoding ISO8859-1 &&
        git config i18n.logoutputencoding ISO8859-1 &&
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
        git reset --hard side &&
        git rebase master &&
@@ -135,7 +135,7 @@ test_expect_success !MINGW 'rebase (L/U)' '
        # to get ISO-8859-1 results.
        git config i18n.commitencoding ISO8859-1 &&
        git config i18n.logoutputencoding UTF-8 &&
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
        git reset --hard side &&
        git rebase master &&
@@ -148,7 +148,7 @@ test_expect_success 'cherry-pick(U/U)' '
 
        git config i18n.commitencoding UTF-8 &&
        git config i18n.logoutputencoding UTF-8 &&
-       . "$TEST_DIRECTORY"/t3901-utf8.txt &&
+       . "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
        git reset --hard master &&
        git cherry-pick side^ &&
@@ -163,7 +163,7 @@ test_expect_success !MINGW 'cherry-pick(L/L)' '
 
        git config i18n.commitencoding ISO8859-1 &&
        git config i18n.logoutputencoding ISO8859-1 &&
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
        git reset --hard master &&
        git cherry-pick side^ &&
@@ -178,7 +178,7 @@ test_expect_success 'cherry-pick(U/L)' '
 
        git config i18n.commitencoding UTF-8 &&
        git config i18n.logoutputencoding ISO8859-1 &&
-       . "$TEST_DIRECTORY"/t3901-utf8.txt &&
+       . "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
        git reset --hard master &&
        git cherry-pick side^ &&
@@ -194,7 +194,7 @@ test_expect_success !MINGW 'cherry-pick(L/U)' '
 
        git config i18n.commitencoding ISO8859-1 &&
        git config i18n.logoutputencoding UTF-8 &&
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
        git reset --hard master &&
        git cherry-pick side^ &&
@@ -207,7 +207,7 @@ test_expect_success !MINGW 'cherry-pick(L/U)' '
 test_expect_success 'rebase --merge (U/U)' '
        git config i18n.commitencoding UTF-8 &&
        git config i18n.logoutputencoding UTF-8 &&
-       . "$TEST_DIRECTORY"/t3901-utf8.txt &&
+       . "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
        git reset --hard side &&
        git rebase --merge master &&
@@ -218,7 +218,7 @@ test_expect_success 'rebase --merge (U/U)' '
 test_expect_success 'rebase --merge (U/L)' '
        git config i18n.commitencoding UTF-8 &&
        git config i18n.logoutputencoding ISO8859-1 &&
-       . "$TEST_DIRECTORY"/t3901-utf8.txt &&
+       . "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
        git reset --hard side &&
        git rebase --merge master &&
@@ -230,7 +230,7 @@ test_expect_success 'rebase --merge (L/L)' '
        # In this test we want ISO-8859-1 encoded commits as the result
        git config i18n.commitencoding ISO8859-1 &&
        git config i18n.logoutputencoding ISO8859-1 &&
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
        git reset --hard side &&
        git rebase --merge master &&
@@ -243,7 +243,7 @@ test_expect_success 'rebase --merge (L/U)' '
        # to get ISO-8859-1 results.
        git config i18n.commitencoding ISO8859-1 &&
        git config i18n.logoutputencoding UTF-8 &&
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
        git reset --hard side &&
        git rebase --merge master &&
@@ -254,7 +254,7 @@ test_expect_success 'rebase --merge (L/U)' '
 test_expect_success 'am (U/U)' '
        # Apply UTF-8 patches with UTF-8 commitencoding
        git config i18n.commitencoding UTF-8 &&
-       . "$TEST_DIRECTORY"/t3901-utf8.txt &&
+       . "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
        git reset --hard master &&
        git am out-u1 out-u2 &&
@@ -265,7 +265,7 @@ test_expect_success 'am (U/U)' '
 test_expect_success !MINGW 'am (L/L)' '
        # Apply ISO-8859-1 patches with ISO-8859-1 commitencoding
        git config i18n.commitencoding ISO8859-1 &&
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
        git reset --hard master &&
        git am out-l1 out-l2 &&
@@ -276,7 +276,7 @@ test_expect_success !MINGW 'am (L/L)' '
 test_expect_success 'am (U/L)' '
        # Apply ISO-8859-1 patches with UTF-8 commitencoding
        git config i18n.commitencoding UTF-8 &&
-       . "$TEST_DIRECTORY"/t3901-utf8.txt &&
+       . "$TEST_DIRECTORY"/t3901/utf8.txt &&
        git reset --hard master &&
 
        # am specifies --utf8 by default.
@@ -288,7 +288,7 @@ test_expect_success 'am (U/L)' '
 test_expect_success 'am --no-utf8 (U/L)' '
        # Apply ISO-8859-1 patches with UTF-8 commitencoding
        git config i18n.commitencoding UTF-8 &&
-       . "$TEST_DIRECTORY"/t3901-utf8.txt &&
+       . "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
        git reset --hard master &&
        git am --no-utf8 out-l1 out-l2 2>err &&
@@ -303,7 +303,7 @@ test_expect_success 'am --no-utf8 (U/L)' '
 test_expect_success !MINGW 'am (L/U)' '
        # Apply UTF-8 patches with ISO-8859-1 commitencoding
        git config i18n.commitencoding ISO8859-1 &&
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
        git reset --hard master &&
        # mailinfo will re-code the commit message to the charset specified by
similarity index 100%
rename from t/t3901-8859-1.txt
rename to t/t3901/8859-1.txt
similarity index 100%
rename from t/t3901-utf8.txt
rename to t/t3901/utf8.txt
index b71d1e6..3b4bed5 100755 (executable)
@@ -865,7 +865,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_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 test_expect_success 'stash push with pathspec shows no changes when there are none' '
@@ -875,7 +875,7 @@ test_expect_success 'stash push with pathspec shows no changes when there are no
        git stash push foo >actual &&
        echo "No local changes to save" >expect &&
        git reset --hard HEAD~ &&
-       test_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 test_expect_success 'stash push with pathspec not in the repository errors out' '
index 0b4f7df..e2824d3 100755 (executable)
@@ -354,7 +354,7 @@ test_expect_failure 'combine diff coalesce three parents' '
 '
 
 # Test for a bug reported at
-# http://thread.gmane.org/gmane.comp.version-control.git/224410
+# https://public-inbox.org/git/20130515143508.GO25742@login.drsnuggles.stderr.nl/
 # where a delete lines were missing from combined diff output when they
 # occurred exactly before the context lines of a later change.
 test_expect_success 'combine diff missing delete bug' '
index f577990..1c7d672 100755 (executable)
@@ -577,6 +577,18 @@ test_expect_success 'log.decorate configuration' '
 
 '
 
+test_expect_success 'log.decorate config parsing' '
+       git log --oneline --decorate=full >expect.full &&
+       git log --oneline --decorate=short >expect.short &&
+
+       test_config log.decorate full &&
+       test_config log.mailmap true &&
+       git log --oneline >actual &&
+       test_cmp expect.full actual &&
+       git log --oneline --decorate=short >actual &&
+       test_cmp expect.short actual
+'
+
 test_expect_success TTY 'log output on a TTY' '
        git log --oneline --decorate >expect.short &&
 
index 21eb8c8..18aa1b5 100755 (executable)
@@ -126,12 +126,12 @@ test_expect_success 'NUL separation with --stat' '
        test_i18ncmp expected actual
 '
 
-test_expect_failure 'NUL termination with --stat' '
+test_expect_failure C_LOCALE_OUTPUT '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 &&
        git log -z --stat --pretty="tformat:%s" >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'setup more commits' '
index 424bec7..20e2473 100755 (executable)
@@ -20,11 +20,13 @@ has_any () {
 }
 
 test_expect_success 'setup repo with moderate-sized history' '
-       for i in $(test_seq 1 10); do
+       for i in $(test_seq 1 10)
+       do
                test_commit $i
        done &&
        git checkout -b other HEAD~5 &&
-       for i in $(test_seq 1 10); do
+       for i in $(test_seq 1 10)
+       do
                test_commit side-$i
        done &&
        git checkout master &&
@@ -104,7 +106,8 @@ test_expect_success 'clone from bitmapped repository' '
 '
 
 test_expect_success 'setup further non-bitmapped commits' '
-       for i in $(test_seq 1 10); do
+       for i in $(test_seq 1 10)
+       do
                test_commit further-$i
        done
 '
@@ -289,4 +292,43 @@ test_expect_success 'splitting packs does not generate bogus bitmaps' '
        git -C no-bitmaps.git fetch .. HEAD
 '
 
+test_expect_success 'set up reusable pack' '
+       rm -f .git/objects/pack/*.keep &&
+       git repack -adb &&
+       reusable_pack () {
+               git for-each-ref --format="%(objectname)" |
+               git pack-objects --delta-base-offset --revs --stdout "$@"
+       }
+'
+
+test_expect_success 'pack reuse respects --honor-pack-keep' '
+       test_when_finished "rm -f .git/objects/pack/*.keep" &&
+       for i in .git/objects/pack/*.pack
+       do
+               >${i%.pack}.keep
+       done &&
+       reusable_pack --honor-pack-keep >empty.pack &&
+       git index-pack empty.pack &&
+       >expect &&
+       git show-index <empty.idx >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'pack reuse respects --local' '
+       mv .git/objects/pack/* alt.git/objects/pack/ &&
+       test_when_finished "mv alt.git/objects/pack/* .git/objects/pack/" &&
+       reusable_pack --local >empty.pack &&
+       git index-pack empty.pack &&
+       >expect &&
+       git show-index <empty.idx >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'pack reuse respects --incremental' '
+       reusable_pack --incremental >empty.pack &&
+       git index-pack empty.pack &&
+       >expect &&
+       git show-index <empty.idx >actual &&
+       test_cmp expect actual
+'
 test_done
index 37143ea..2ed479b 100755 (executable)
@@ -82,12 +82,16 @@ test_expect_success 'packing produces a long delta' '
        # Use --window=0 to make sure we are seeing reused deltas,
        # not computing a new long chain.
        pack=$(git pack-objects --all --window=0 </dev/null pack) &&
-       test 9 = "$(max_chain pack-$pack.pack)"
+       echo 9 >expect &&
+       max_chain pack-$pack.pack >actual &&
+       test_i18ncmp expect actual
 '
 
 test_expect_success '--depth limits depth' '
        pack=$(git pack-objects --all --depth=5 </dev/null pack) &&
-       test 5 = "$(max_chain pack-$pack.pack)"
+       echo 5 >expect &&
+       max_chain pack-$pack.pack >actual &&
+       test_i18ncmp expect actual
 '
 
 test_done
index 3331e0f..d375d71 100755 (executable)
@@ -288,7 +288,10 @@ test_expect_success 'receive-pack de-dupes .have lines' '
        $shared .have
        EOF
 
-       GIT_TRACE_PACKET=$(pwd)/trace git push fork HEAD:foo &&
+       GIT_TRACE_PACKET=$(pwd)/trace \
+           git push \
+               --receive-pack="unset GIT_TRACE_PACKET; git-receive-pack" \
+               fork HEAD:foo &&
        extract_ref_advertisement <trace >refs &&
        test_cmp expect refs
 '
index 57ba322..23c533e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-test_description='unpack-objects'
+test_description='test push with submodules'
 
 . ./test-lib.sh
 
@@ -27,7 +27,7 @@ test_expect_success setup '
        )
 '
 
-test_expect_success push '
+test_expect_success 'push works with recorded gitlink' '
        (
                cd work &&
                git push ../pub.git master
index ecb8d44..5bcb288 100755 (executable)
@@ -124,6 +124,43 @@ test_expect_success GPG 'signed push sends push certificate' '
        test_cmp expect dst/push-cert-status
 '
 
+test_expect_success GPG 'inconsistent push options in signed push not allowed' '
+       # First, invoke receive-pack with dummy input to obtain its preamble.
+       prepare_dst &&
+       git -C dst config receive.certnonceseed sekrit &&
+       git -C dst config receive.advertisepushoptions 1 &&
+       printf xxxx | test_might_fail git receive-pack dst >preamble &&
+
+       # Then, invoke push. Simulate a receive-pack that sends the preamble we
+       # obtained, followed by a dummy packet.
+       write_script myscript <<-\EOF &&
+               cat preamble &&
+               printf xxxx &&
+               cat >push
+       EOF
+       test_might_fail git push --push-option="foo" --push-option="bar" \
+               --receive-pack="\"$(pwd)/myscript\"" --signed dst --delete ff &&
+
+       # Replay the push output on a fresh dst, checking that ff is truly
+       # deleted.
+       prepare_dst &&
+       git -C dst config receive.certnonceseed sekrit &&
+       git -C dst config receive.advertisepushoptions 1 &&
+       git receive-pack dst <push &&
+       test_must_fail git -C dst rev-parse ff &&
+
+       # Tweak the push output to make the push option outside the cert
+       # different, then replay it on a fresh dst, checking that ff is not
+       # deleted.
+       perl -pe "s/([^ ])bar/\$1baz/" push >push.tweak &&
+       prepare_dst &&
+       git -C dst config receive.certnonceseed sekrit &&
+       git -C dst config receive.advertisepushoptions 1 &&
+       git receive-pack dst <push.tweak >out &&
+       git -C dst rev-parse ff &&
+       grep "inconsistent push options" out
+'
+
 test_expect_success GPG 'fail without key and heed user.signingkey' '
        prepare_dst &&
        mkdir -p dst/.git/hooks &&
index e4850b7..39329eb 100755 (executable)
@@ -19,6 +19,14 @@ test_expect_success 'clone -c can set multi-keys' '
        test_cmp expect actual
 '
 
+test_expect_success 'clone -c can set multi-keys, including some empty' '
+       rm -rf child &&
+       git clone -c credential.helper= -c credential.helper=hi . child &&
+       printf "%s\n" "" hi >expect &&
+       git --git-dir=child/.git config --get-all credential.helper >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'clone -c without a value is boolean true' '
        rm -rf child &&
        git clone -c core.foo . child &&
index fd401ca..99a8982 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_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 cat <<EOF >expect
@@ -30,7 +30,7 @@ EOF
 
 test_expect_success 'error message for path inside submodule from within submodule' '
        test_must_fail git -C sub add . 2>actual &&
-       test_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 test_done
index cf076dc..394b169 100755 (executable)
@@ -129,7 +129,7 @@ for repack in '' true; do
        '
 done
 
-test_expect_success 'do not complain about existing broken links' '
+test_expect_success 'do not complain about existing broken links (commit)' '
        cat >broken-commit <<-\EOF &&
        tree 0000000000000000000000000000000000000001
        parent 0000000000000000000000000000000000000002
@@ -144,4 +144,29 @@ test_expect_success 'do not complain about existing broken links' '
        test_must_be_empty stderr
 '
 
+test_expect_success 'do not complain about existing broken links (tree)' '
+       cat >broken-tree <<-\EOF &&
+       100644 blob 0000000000000000000000000000000000000003    foo
+       EOF
+       tree=$(git mktree --missing <broken-tree) &&
+       git gc 2>stderr &&
+       git cat-file -e $tree &&
+       test_must_be_empty stderr
+'
+
+test_expect_success 'do not complain about existing broken links (tag)' '
+       cat >broken-tag <<-\EOF &&
+       object 0000000000000000000000000000000000000004
+       type commit
+       tag broken
+       tagger whatever <whatever@example.com> 1234 -0000
+
+       this is a broken tag
+       EOF
+       tag=$(git hash-object -t tag -w broken-tag) &&
+       git gc 2>stderr &&
+       git cat-file -e $tag &&
+       test_must_be_empty stderr
+'
+
 test_done
index bb2e4d7..0ef7b94 100755 (executable)
@@ -87,7 +87,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_cmp expected actual
+       test_i18ncmp expected actual
 '
 
 test_expect_success 'annotated tag with --create-reflog has correct message' '
@@ -98,7 +98,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_cmp expected actual
+       test_i18ncmp expected actual
 '
 
 test_expect_success '--create-reflog does not create reflog on failure' '
index 1b8f1db..dcac364 100755 (executable)
@@ -281,7 +281,7 @@ test_expect_success 'submodule add with ./, /.. and // in path' '
        test_cmp empty untracked
 '
 
-test_expect_success 'submodule add with \\ in path' '
+test_expect_success !CYGWIN 'submodule add with \\ in path' '
        test_when_finished "rm -rf parent sub\\with\\backslash" &&
 
        # Initialize a repo with a backslash in its name
index 4ac386d..034914a 100755 (executable)
@@ -447,7 +447,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_cmp expect actual &&
+       test_i18ncmp expect actual &&
        git -C super submodule update --checkout
 '
 
index fb00e6d..5edcc6e 100755 (executable)
@@ -360,7 +360,7 @@ EOF
 test_expect_success 'status -s -b' '
 
        git status -s -b >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 
 '
 
@@ -370,7 +370,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_cmp expect output
+       test_i18ncmp expect output
 '
 
 test_expect_success 'setup dir3' '
@@ -687,7 +687,7 @@ EOF
 test_expect_success 'status -s -b with color.status' '
 
        git status -s -b | test_decode_color >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 
 '
 
index db9774e..ddef7ea 100755 (executable)
@@ -101,7 +101,7 @@ test_expect_success '--amend option with empty author' '
        echo "Empty author test" >>foo &&
        test_tick &&
        test_must_fail git commit -a -m "empty author" --amend 2>err &&
-       grep "empty ident" err
+       test_i18ngrep "empty ident" err
 '
 
 test_expect_success '--amend option with missing author' '
@@ -114,7 +114,7 @@ test_expect_success '--amend option with missing author' '
        echo "Missing author test" >>foo &&
        test_tick &&
        test_must_fail git commit -a -m "malformed author" --amend 2>err &&
-       grep "empty ident" err
+       test_i18ngrep "empty ident" err
 '
 
 test_expect_success '--reset-author makes the commit ours even with --amend option' '
index 4dd1d7c..0c6f91c 100755 (executable)
@@ -1258,4 +1258,21 @@ test_expect_success 'with no command and no key' '
        test_cmp expected actual
 '
 
+test_expect_success 'with cut line' '
+       cat >expected <<-\EOF &&
+               my subject
+
+               review: Brian
+               sign: A U Thor <author@example.com>
+               # ------------------------ >8 ------------------------
+               ignore this
+       EOF
+       git interpret-trailers --trailer review:Brian >actual <<-\EOF &&
+               my subject
+               # ------------------------ >8 ------------------------
+               ignore this
+       EOF
+       test_cmp expected actual
+'
+
 test_done
index 7f09867..668bbee 100755 (executable)
@@ -25,14 +25,14 @@ prompt_given ()
 
 test_expect_success 'basic usage requires no repo' '
        test_expect_code 129 git difftool -h >output &&
-       grep ^usage: output &&
+       test_i18ngrep ^usage: output &&
        # create a ceiling directory to prevent Git from finding a repo
        mkdir -p not/repo &&
        test_when_finished rm -r not &&
        test_expect_code 129 \
        env GIT_CEILING_DIRECTORIES="$(pwd)/not" \
        git -C not/repo difftool -h >output &&
-       grep ^usage: output
+       test_i18ngrep ^usage: output
 '
 
 # Create a file on master and change it on branch
index b5149fd..8dcb05c 100755 (executable)
@@ -70,7 +70,7 @@ test_expect_success 'iso-8859-1' '
 
        git config i18n.commitencoding ISO8859-1 &&
        # use author and committer name in ISO-8859-1 to match it.
-       . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
        test_tick &&
        echo rosten >file &&
        git commit -s -m den file &&
index 6d06ed9..cc8d463 100755 (executable)
@@ -519,7 +519,7 @@ test_expect_success \
 
 test_expect_success \
        'encode(commit): utf8' \
-       '. "$TEST_DIRECTORY"/t3901-utf8.txt &&
+       '. "$TEST_DIRECTORY"/t3901/utf8.txt &&
         test_when_finished "GIT_AUTHOR_NAME=\"A U Thor\"" &&
         test_when_finished "GIT_COMMITTER_NAME=\"C O Mitter\"" &&
         echo "UTF-8" >> file &&
@@ -529,7 +529,7 @@ test_expect_success \
 
 test_expect_success \
        'encode(commit): iso-8859-1' \
-       '. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+       '. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
         test_when_finished "GIT_AUTHOR_NAME=\"A U Thor\"" &&
         test_when_finished "GIT_COMMITTER_NAME=\"C O Mitter\"" &&
         echo "ISO-8859-1" >> file &&
index ff77605..f25a08f 100644 (file)
@@ -1075,7 +1075,7 @@ match_wildcards:
                 * later on.
                 * max_depth is ignored but we may consider support it
                 * in future, see
-                * http://thread.gmane.org/gmane.comp.version-control.git/163757/focus=163840
+                * https://public-inbox.org/git/7vmxo5l2g4.fsf@alter.siamese.dyndns.org/
                 */
                if (ps->recursive && S_ISDIR(entry->mode))
                        return entry_interesting;
index bae787c..89a81b1 100644 (file)
@@ -399,6 +399,7 @@ int submodule_uses_worktrees(const char *path)
 
        /* The env would be set for the superproject. */
        get_common_dir_noenv(&sb, submodule_gitdir);
+       free(submodule_gitdir);
 
        /*
         * The check below is only known to be good for repository format
@@ -418,7 +419,6 @@ int submodule_uses_worktrees(const char *path)
        /* See if there is any file inside the worktrees directory. */
        dir = opendir(sb.buf);
        strbuf_release(&sb);
-       free(submodule_gitdir);
 
        if (!dir)
                return 0;
index 0375484..068de38 100644 (file)
@@ -896,17 +896,18 @@ conclude:
        status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
 }
 
-void wt_status_truncate_message_at_cut_line(struct strbuf *buf)
+size_t wt_status_locate_end(const char *s, size_t len)
 {
        const char *p;
        struct strbuf pattern = STRBUF_INIT;
 
        strbuf_addf(&pattern, "\n%c %s", comment_line_char, cut_line);
-       if (starts_with(buf->buf, pattern.buf + 1))
-               strbuf_setlen(buf, 0);
-       else if ((p = strstr(buf->buf, pattern.buf)))
-               strbuf_setlen(buf, p - buf->buf + 1);
+       if (starts_with(s, pattern.buf + 1))
+               len = 0;
+       else if ((p = strstr(s, pattern.buf)))
+               len = p - s + 1;
        strbuf_release(&pattern);
+       return len;
 }
 
 void wt_status_add_cut_line(FILE *fp)
@@ -1082,29 +1083,29 @@ static char *read_line_from_git_path(const char *filename)
 static int split_commit_in_progress(struct wt_status *s)
 {
        int split_in_progress = 0;
-       char *head = read_line_from_git_path("HEAD");
-       char *orig_head = read_line_from_git_path("ORIG_HEAD");
-       char *rebase_amend = read_line_from_git_path("rebase-merge/amend");
-       char *rebase_orig_head = read_line_from_git_path("rebase-merge/orig-head");
+       char *head, *orig_head, *rebase_amend, *rebase_orig_head;
 
-       if (!head || !orig_head || !rebase_amend || !rebase_orig_head ||
+       if ((!s->amend && !s->nowarn && !s->workdir_dirty) ||
            !s->branch || strcmp(s->branch, "HEAD"))
-               return split_in_progress;
+               return 0;
 
-       if (!strcmp(rebase_amend, rebase_orig_head)) {
-               if (strcmp(head, rebase_amend))
-                       split_in_progress = 1;
-       } else if (strcmp(orig_head, rebase_orig_head)) {
-               split_in_progress = 1;
-       }
+       head = read_line_from_git_path("HEAD");
+       orig_head = read_line_from_git_path("ORIG_HEAD");
+       rebase_amend = read_line_from_git_path("rebase-merge/amend");
+       rebase_orig_head = read_line_from_git_path("rebase-merge/orig-head");
 
-       if (!s->amend && !s->nowarn && !s->workdir_dirty)
-               split_in_progress = 0;
+       if (!head || !orig_head || !rebase_amend || !rebase_orig_head)
+               ; /* fall through, no split in progress */
+       else if (!strcmp(rebase_amend, rebase_orig_head))
+               split_in_progress = !!strcmp(head, rebase_amend);
+       else if (strcmp(orig_head, rebase_orig_head))
+               split_in_progress = 1;
 
        free(head);
        free(orig_head);
        free(rebase_amend);
        free(rebase_orig_head);
+
        return split_in_progress;
 }
 
@@ -1168,6 +1169,7 @@ static int read_rebase_todolist(const char *fname, struct string_list *lines)
                abbrev_sha1_in_line(&line);
                string_list_append(lines, line.buf);
        }
+       fclose(f);
        return 0;
 }
 
index 6018c62..8a38647 100644 (file)
@@ -112,7 +112,7 @@ struct wt_status_state {
        unsigned char cherry_pick_head_sha1[20];
 };
 
-void wt_status_truncate_message_at_cut_line(struct strbuf *);
+size_t wt_status_locate_end(const char *s, size_t len);
 void wt_status_add_cut_line(FILE *fp);
 void wt_status_prepare(struct wt_status *s);
 void wt_status_print(struct wt_status *s);