]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'rd/typofix' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 22 Mar 2018 21:24:22 +0000 (14:24 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Mar 2018 21:24:22 +0000 (14:24 -0700)
Typofix.

* rd/typofix:
  Correct mispellings of ".gitmodule" to ".gitmodules"
  t/: correct obvious typo "detahced"

82 files changed:
.travis.yml
Documentation/RelNotes/2.16.2.txt [new file with mode: 0644]
Documentation/git-cat-file.txt
Documentation/git-commit.txt
Documentation/git-interpret-trailers.txt
Documentation/git-read-tree.txt
Documentation/git-show.txt
Documentation/git-status.txt
Documentation/git-submodule.txt
Documentation/git-update-index.txt
Documentation/git.txt
Documentation/gitignore.txt
Documentation/gitsubmodules.txt
GIT-VERSION-GEN
Makefile
RelNotes
bisect.c
builtin/checkout.c
builtin/clone.c
builtin/commit.c
builtin/describe.c
builtin/fsck.c
builtin/worktree.c
bundle.c
cache-tree.c
cache.h
ci/run-build-and-tests.sh [moved from ci/run-tests.sh with 54% similarity]
ci/run-build.sh [deleted file]
commit.c
commit.h
config.mak.uname
contrib/coccinelle/strbuf.cocci
contrib/completion/git-completion.bash
daemon.c
diff.c
git-add--interactive.perl
git-sh-i18n.sh
git-stash.sh
git-svn.perl
hashmap.h
http.c
mailinfo.c
merge-recursive.c
object.c
object.h
oidmap.c
read-cache.c
ref-filter.c
refs/files-backend.c
repository.c
revision.c
revision.h
split-index.c
submodule.c
t/README
t/lib-git-daemon.sh
t/lib-submodule-update.sh
t/perf/p7820-grep-engines.sh
t/perf/p7821-grep-engines-fixed.sh
t/t0205-gettext-poison.sh
t/t1700-split-index.sh
t/t2203-add-intent.sh
t/t3701-add-interactive.sh
t/t3903-stash.sh
t/t4001-diff-rename.sh
t/t5510-fetch.sh
t/t5536-fetch-conflicts.sh
t/t5541-http-push-smart.sh
t/t5551-http-fetch-smart.sh
t/t5570-git-daemon.sh
t/t5600-clone-fail-cleanup.sh
t/t5812-proto-disable-http.sh
t/t6022-merge-rename.sh
t/t6037-merge-ours-theirs.sh
t/t6120-describe.sh
t/t7500-commit.sh
t/t9001-send-email.sh
t/test-lib-functions.sh
t/test-lib.sh
unpack-trees.c
wt-status.c
wt-status.h

index 4684b3f4f30f78d5f1d5d0f7eb5bfea9b81861ba..5f5ee4f3bd86f3f7d6cfce4e99453f68f0673eab 100644 (file)
@@ -33,7 +33,6 @@ matrix:
       compiler:
       addons:
       before_install:
-      before_script:
       script:
         - >
           test "$TRAVIS_REPO_SLUG" != "git/git" ||
@@ -46,7 +45,6 @@ matrix:
       services:
         - docker
       before_install:
-      before_script:
       script: ci/run-linux32-docker.sh
     - env: jobname=StaticAnalysis
       os: linux
@@ -56,7 +54,6 @@ matrix:
           packages:
           - coccinelle
       before_install:
-      before_script:
       script: ci/run-static-analysis.sh
       after_failure:
     - env: jobname=Documentation
@@ -68,13 +65,11 @@ matrix:
           - asciidoc
           - xmlto
       before_install:
-      before_script:
       script: ci/test-documentation.sh
       after_failure:
 
 before_install: ci/install-dependencies.sh
-before_script: ci/run-build.sh
-script: ci/run-tests.sh
+script: ci/run-build-and-tests.sh
 after_failure: ci/print-test-failures.sh
 
 notifications:
diff --git a/Documentation/RelNotes/2.16.2.txt b/Documentation/RelNotes/2.16.2.txt
new file mode 100644 (file)
index 0000000..a216466
--- /dev/null
@@ -0,0 +1,30 @@
+Git v2.16.2 Release Notes
+=========================
+
+Fixes since v2.16.1
+-------------------
+
+ * An old regression in "git describe --all $annotated_tag^0" has been
+   fixed.
+
+ * "git svn dcommit" did not take into account the fact that a
+   svn+ssh:// URL with a username@ (typically used for pushing) refers
+   to the same SVN repository without the username@ and failed when
+   svn.pushmergeinfo option is set.
+
+ * "git merge -Xours/-Xtheirs" learned to use our/their version when
+   resolving a conflicting updates to a symbolic link.
+
+ * "git clone $there $here" is allowed even when here directory exists
+   as long as it is an empty directory, but the command incorrectly
+   removed it upon a failure of the operation.
+
+ * "git stash -- <pathspec>" incorrectly blew away untracked files in
+   the directory that matched the pathspec, which has been corrected.
+
+ * "git add -p" was taught to ignore local changes to submodules as
+   they do not interfere with the partial addition of regular changes
+   anyway.
+
+
+Also contains various documentation updates and code clean-ups.
index fb09cd69d63fec03ad1987970fdbdffe8d8a4339..f90f09b03fae578e867335d1be3ab85d83195f27 100644 (file)
@@ -42,8 +42,9 @@ OPTIONS
        <object>.
 
 -e::
-       Suppress all output; instead exit with zero status if <object>
-       exists and is a valid object.
+       Exit with zero status if <object> exists and is a valid
+       object. If <object> is of an invalid format exit with non-zero and
+       emits an error on stderr.
 
 -p::
        Pretty-print the contents of <object> based on its type.
@@ -168,7 +169,7 @@ If `-t` is specified, one of the <type>.
 
 If `-s` is specified, the size of the <object> in bytes.
 
-If `-e` is specified, no output.
+If `-e` is specified, no output, unless the <object> is malformed.
 
 If `-p` is specified, the contents of <object> are pretty-printed.
 
index 8c74a2ca035bf04c1838f584f450e7ec68e475d9..f970a43422b37159618a96d039e4e9e19804a3b7 100644 (file)
@@ -144,6 +144,8 @@ OPTIONS
        Use the given <msg> as the commit message.
        If multiple `-m` options are given, their values are
        concatenated as separate paragraphs.
++
+The `-m` option is mutually exclusive with `-c`, `-C`, and `-F`.
 
 -t <file>::
 --template=<file>::
index 9dd19a1dd9f126fbf54f1dc628b30fbe05445cf3..ff446f15f79f270a8979d1a398450a50ba4a4e95 100644 (file)
@@ -51,7 +51,7 @@ with only spaces at the end of the commit message part, one blank line
 will be added before the new trailer.
 
 Existing trailers are extracted from the input message by looking for
-a group of one or more lines that (i) are all trailers, or (ii) contains at
+a group of one or more lines that (i) is all trailers, or (ii) contains at
 least one Git-generated or user-configured trailer and consists of at
 least 25% trailers.
 The group must be preceded by one or more empty (or whitespace-only) lines.
index 72bd809fb8d59812d79e402f6b9608d09f0d52ec..f2a07d54d694b42657aa38e71dc0eeb5fc94e9a0 100644 (file)
@@ -81,12 +81,11 @@ OPTIONS
 * when both sides add a path identically.  The resolution
   is to add that path.
 
---prefix=<prefix>/::
+--prefix=<prefix>::
        Keep the current index contents, and read the contents
        of the named tree-ish under the directory at `<prefix>`.
        The command will refuse to overwrite entries that already
-       existed in the original index file. Note that the `<prefix>/`
-       value must end with a slash.
+       existed in the original index file.
 
 --exclude-per-directory=<gitignore>::
        When running the command with `-u` and `-m` options, the
index 82a4125a2da805e0b3c21e4e827bf203d5ac4532..e73ef540176b65f6c049a3b5fcfd7e8faa6a6b58 100644 (file)
@@ -9,7 +9,7 @@ git-show - Show various types of objects
 SYNOPSIS
 --------
 [verse]
-'git show' [options] <object>...
+'git show' [options] [<object>...]
 
 DESCRIPTION
 -----------
@@ -35,7 +35,7 @@ This manual page describes only the most frequently used options.
 OPTIONS
 -------
 <object>...::
-       The names of objects to show.
+       The names of objects to show (defaults to 'HEAD').
        For a more complete list of ways to spell object names, see
        "SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].
 
index 81cab9aefb014690d93f9602ebebc9058c3d168e..72bfb87f6658b209e9b45956e73e492e957971b7 100644 (file)
@@ -149,14 +149,15 @@ the status.relativePaths config option below.
 Short Format
 ~~~~~~~~~~~~
 
-In the short-format, the status of each path is shown as
+In the short-format, the status of each path is shown as one of these
+forms
 
-       XY PATH1 -> PATH2
+       XY PATH
+       XY ORIG_PATH -> PATH
 
-where `PATH1` is the path in the `HEAD`, and the " `-> PATH2`" part is
-shown only when `PATH1` corresponds to a different path in the
-index/worktree (i.e. the file is renamed). The `XY` is a two-letter
-status code.
+where `ORIG_PATH` is where the renamed/copied contents came
+from. `ORIG_PATH` is only shown when the entry is renamed or
+copied. The `XY` is a two-letter status code.
 
 The fields (including the `->`) are separated from each other by a
 single space. If a filename contains whitespace or other nonprintable
@@ -192,6 +193,8 @@ in which case `XY` are `!!`.
     [MARC]           index and work tree matches
     [ MARC]     M    work tree changed since index
     [ MARC]     D    deleted in work tree
+    [ D]        R    renamed in work tree
+    [ D]        C    copied in work tree
     -------------------------------------------------
     D           D    unmerged, both deleted
     A           U    unmerged, added by us
@@ -309,13 +312,13 @@ Renamed or copied entries have the following format:
                of similarity between the source and target of the
                move or copy). For example "R100" or "C75".
     <path>      The pathname.  In a renamed/copied entry, this
-               is the path in the index and in the working tree.
+               is the target path.
     <sep>       When the `-z` option is used, the 2 pathnames are separated
                with a NUL (ASCII 0x00) byte; otherwise, a tab (ASCII 0x09)
                byte separates them.
-    <origPath>  The pathname in the commit at HEAD.  This is only
-               present in a renamed/copied entry, and tells
-               where the renamed/copied contents came from.
+    <origPath>  The pathname in the commit at HEAD or in the index.
+               This is only present in a renamed/copied entry, and
+               tells where the renamed/copied contents came from.
     --------------------------------------------------------
 
 Unmerged entries have the following format; the first character is
index ff612001d23c05abe3a56c81eb5466699f9841ae..71c5618e82aacc8616522a6f498b1172910890e4 100644 (file)
@@ -70,8 +70,8 @@ status [--cached] [--recursive] [--] [<path>...]::
        Show the status of the submodules. This will print the SHA-1 of the
        currently checked out commit for each submodule, along with the
        submodule path and the output of 'git describe' for the
-       SHA-1. Each SHA-1 will be prefixed with `-` if the submodule is not
-       initialized, `+` if the currently checked out submodule commit
+       SHA-1. Each SHA-1 will possibly be prefixed with `-` if the submodule is
+       not initialized, `+` if the currently checked out submodule commit
        does not match the SHA-1 found in the index of the containing
        repository and `U` if the submodule has merge conflicts.
 +
@@ -132,15 +132,15 @@ expects by cloning missing submodules and updating the working tree of
 the submodules. The "updating" can be done in several ways depending
 on command line options and the value of `submodule.<name>.update`
 configuration variable. The command line option takes precedence over
-the configuration variable. if neither is given, a checkout is performed.
-update procedures supported both from the command line as well as setting
-`submodule.<name>.update`:
+the configuration variable. If neither is given, a 'checkout' is performed.
+The 'update' procedures supported both from the command line as well as
+through the `submodule.<name>.update` configuration are:
 
        checkout;; the commit recorded in the superproject will be
            checked out in the submodule on a detached HEAD.
 +
 If `--force` is specified, the submodule will be checked out (using
-`git checkout --force` if appropriate), even if the commit specified
+`git checkout --force`), even if the commit specified
 in the index of the containing repository already matches the commit
 checked out in the submodule.
 
@@ -150,8 +150,8 @@ checked out in the submodule.
        merge;; the commit recorded in the superproject will be merged
            into the current branch in the submodule.
 
-The following procedures are only available via the `submodule.<name>.update`
-configuration variable:
+The following 'update' procedures are only available via the
+`submodule.<name>.update` configuration variable:
 
        custom command;; arbitrary shell command that takes a single
            argument (the sha1 of the commit recorded in the
index bdb0342593229e32425bf73d17ad6fcdd0dd3732..ad2383d7ed2197ed517eab04eed6712440137fa2 100644 (file)
@@ -484,8 +484,8 @@ the `core.fsmonitor` configuration variable (see
 linkgit:git-config[1]) than using the `--fsmonitor` option to
 `git update-index` in each repository, especially if you want to do so
 across all repositories you use, because you can set the configuration
-variable to `true` (or `false`) in your `$HOME/.gitconfig` just once
-and have it affect all repositories you touch.
+variable in your `$HOME/.gitconfig` just once and have it affect all
+repositories you touch.
 
 When the `core.fsmonitor` configuration variable is changed, the
 file system monitor is added to or removed from the index the next time
index 3f4161a799300c55e17fec86e2debe503e6ec903..8163b5796b192ee5f5c0cb13fc85bdeff8202e64 100644 (file)
@@ -646,6 +646,16 @@ of clones and fetches.
        variable.
        See `GIT_TRACE` for available trace output options.
 
+`GIT_TRACE_CURL_NO_DATA`::
+       When a curl trace is enabled (see `GIT_TRACE_CURL` above), do not dump
+       data (that is, only dump info lines and headers).
+
+`GIT_REDACT_COOKIES`::
+       This can be set to a comma-separated list of strings. When a curl trace
+       is enabled (see `GIT_TRACE_CURL` above), whenever a "Cookies:" header
+       sent by the client is dumped, values of cookies whose key is in that
+       list (case-sensitive) are redacted.
+
 `GIT_LITERAL_PATHSPECS`::
        Setting this variable to `1` will cause Git to treat all
        pathspecs literally, rather than as glob patterns. For example,
index 63260f0056491308cb35677917530a987c21c8a2..ff5d7f9ed6f089646807f93d59e35a10763e46c2 100644 (file)
@@ -102,12 +102,11 @@ PATTERN FORMAT
    (relative to the toplevel of the work tree if not from a
    `.gitignore` file).
 
- - Otherwise, Git treats the pattern as a shell glob suitable
-   for consumption by fnmatch(3) with the FNM_PATHNAME flag:
-   wildcards in the pattern will not match a / in the pathname.
-   For example, "Documentation/{asterisk}.html" matches
-   "Documentation/git.html" but not "Documentation/ppc/ppc.html"
-   or "tools/perf/Documentation/perf.html".
+ - Otherwise, Git treats the pattern as a shell glob: "`*`" matches
+   anything except "`/`", "`?`" matches any one character except "`/`"
+   and "`[]`" matches one character in a selected range. See
+   fnmatch(3) and the FNM_PATHNAME flag for a more detailed
+   description.
 
  - A leading slash matches the beginning of the pathname.
    For example, "/{asterisk}.c" matches "cat-file.c" but not
index 46cf120f666df4d17f5a3090960d862e9da88b4d..4d6c17782f1d4c2f65cddefd899b9a93bace6142 100644 (file)
@@ -36,8 +36,8 @@ The `gitlink` entry contains the object name of the commit that the
 superproject expects the submodule’s working directory to be at.
 
 The section `submodule.foo.*` in the `.gitmodules` file gives additional
-hints to Gits porcelain layer such as where to obtain the submodule via
-the `submodule.foo.url` setting.
+hints to Git's porcelain layer. For example, the `submodule.foo.url`
+setting specifies where to obtain the submodule.
 
 Submodules can be used for at least two different use cases:
 
@@ -51,18 +51,21 @@ Submodules can be used for at least two different use cases:
 
 2. Splitting a (logically single) project into multiple
    repositories and tying them back together. This can be used to
-   overcome current limitations of Gits implementation to have
+   overcome current limitations of Git's implementation to have
    finer grained access:
 
-    * Size of the git repository:
+    * Size of the Git repository:
       In its current form Git scales up poorly for large repositories containing
       content that is not compressed by delta computation between trees.
-      However you can also use submodules to e.g. hold large binary assets
-      and these repositories are then shallowly cloned such that you do not
+      For example, you can use submodules to hold large binary assets
+      and these repositories can be shallowly cloned such that you do not
       have a large history locally.
     * Transfer size:
       In its current form Git requires the whole working tree present. It
       does not allow partial trees to be transferred in fetch or clone.
+      If the project you work on consists of multiple repositories tied
+      together as submodules in a superproject, you can avoid fetching the
+      working trees of the repositories you are not interested in.
     * Access control:
       By restricting user access to submodules, this can be used to implement
       read/write policies for different users.
@@ -73,9 +76,10 @@ The configuration of submodules
 Submodule operations can be configured using the following mechanisms
 (from highest to lowest precedence):
 
- * The command line for those commands that support taking submodule specs.
-   Most commands have a boolean flag '--recurse-submodules' whether to
-   recurse into submodules. Examples are `ls-files` or `checkout`.
+ * The command line for those commands that support taking submodules
+   as part of their pathspecs. Most commands have a boolean flag
+   `--recurse-submodules` which specify whether to recurse into submodules.
+   Examples are `grep` and `checkout`.
    Some commands take enums, such as `fetch` and `push`, where you can
    specify how submodules are affected.
 
@@ -87,8 +91,8 @@ Submodule operations can be configured using the following mechanisms
 For example an effect from the submodule's `.gitignore` file
 would be observed when you run `git status --ignore-submodules=none` in
 the superproject. This collects information from the submodule's working
-directory by running `status` in the submodule, which does pay attention
-to its `.gitignore` file.
+directory by running `status` in the submodule while paying attention
+to the `.gitignore` file of the submodule.
 +
 The submodule's `$GIT_DIR/config` file would come into play when running
 `git push --recurse-submodules=check` in the superproject, as this would
@@ -97,20 +101,20 @@ remotes are configured in the submodule as usual in the `$GIT_DIR/config`
 file.
 
  * The configuration file `$GIT_DIR/config` in the superproject.
-   Typical configuration at this place is controlling if a submodule
-   is recursed into at all via the `active` flag for example.
+   Git only recurses into active submodules (see "ACTIVE SUBMODULES"
+   section below).
 +
 If the submodule is not yet initialized, then the configuration
-inside the submodule does not exist yet, so configuration where to
+inside the submodule does not exist yet, so where to
 obtain the submodule from is configured here for example.
 
- * the `.gitmodules` file inside the superproject. Additionally to the
-   required mapping between submodule's name and path, a project usually
+ * The `.gitmodules` file inside the superproject. A project usually
    uses this file to suggest defaults for the upstream collection
-   of repositories.
+   of repositories for the mapping that is required between a
+   submodule's name and its path.
 +
-This file mainly serves as the mapping between name and path in
-the superproject, such that the submodule's git directory can be
+This file mainly serves as the mapping between the name and path of submodules
+in the superproject, such that the submodule's Git directory can be
 located.
 +
 If the submodule has never been initialized, this is the only place
@@ -137,8 +141,8 @@ directory is automatically moved to `$GIT_DIR/modules/<name>/`
 of the superproject.
 
  * Deinitialized submodule: A `gitlink`, and a `.gitmodules` entry,
-but no submodule working directory. The submodule’s git directory
-may be there as after deinitializing the git directory is kept around.
+but no submodule working directory. The submodule’s Git directory
+may be there as after deinitializing the Git directory is kept around.
 The directory which is supposed to be the working directory is empty instead.
 +
 A submodule can be deinitialized by running `git submodule deinit`.
@@ -160,6 +164,60 @@ from another repository.
 To completely remove a submodule, manually delete
 `$GIT_DIR/modules/<name>/`.
 
+ACTIVE SUBMODULES
+-----------------
+
+A submodule is considered active,
+
+  (a) if `submodule.<name>.active` is set to `true`
+     or
+  (b) if the submodule's path matches the pathspec in `submodule.active`
+     or
+  (c) if `submodule.<name>.url` is set.
+
+and these are evaluated in this order.
+
+For example:
+
+  [submodule "foo"]
+    active = false
+    url = https://example.org/foo
+  [submodule "bar"]
+    active = true
+    url = https://example.org/bar
+  [submodule "baz"]
+    url = https://example.org/baz
+
+In the above config only the submodule 'bar' and 'baz' are active,
+'bar' due to (a) and 'baz' due to (c). 'foo' is inactive because
+(a) takes precedence over (c)
+
+Note that (c) is a historical artefact and will be ignored if the
+(a) and (b) specify that the submodule is not active. In other words,
+if we have an `submodule.<name>.active` set to `false` or if the
+submodule's path is excluded in the pathspec in `submodule.active`, the
+url doesn't matter whether it is present or not. This is illustrated in
+the example that follows.
+
+  [submodule "foo"]
+    active = true
+    url = https://example.org/foo
+  [submodule "bar"]
+    url = https://example.org/bar
+  [submodule "baz"]
+    url = https://example.org/baz
+  [submodule "bob"]
+    ignore = true
+  [submodule]
+    active = b*
+    active = :(exclude) baz
+
+In here all submodules except 'baz' (foo, bar, bob) are active.
+'foo' due to its own active flag and all the others due to the
+submodule active pathspec, which specifies that any submodule
+starting with 'b' except 'baz' are also active, regardless of the
+presence of the .url field.
+
 Workflow for a third party library
 ----------------------------------
 
index 470f7b7b83c979e6130c7a308585699c49ab095f..19e45a7d30213821f873b912f52b9c34153ce1e8 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.16.1
+DEF_VER=v2.16.2
 
 LF='
 '
index 1a9b23b6793f91072760affefac3851ca457a2f5..7f40f76739e9c9eca58c2d6743a55c7d02bcab9c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2176,6 +2176,8 @@ gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
 http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SPARSE_FLAGS += \
        -DCURL_DISABLE_TYPECHECK
 
+pack-revindex.sp: SPARSE_FLAGS += -Wno-memcpy-max-count
+
 ifdef NO_EXPAT
 http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
 endif
index 0172894cc2b856fa6cf72654ca28ee400effe0e4..35c3c3221ac3ea4aca948fafbf56352bc3611d91 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/2.16.1.txt
\ No newline at end of file
+Documentation/RelNotes/2.16.2.txt
\ No newline at end of file
index 2f3008b07866fb7bda6c0e0bbb089b1be1271a1a..f6d05bd66f42bd9874a08f5585ae99337d22dad5 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -132,7 +132,7 @@ static void show_list(const char *debug, int counted, int nr,
                unsigned flags = commit->object.flags;
                enum object_type type;
                unsigned long size;
-               char *buf = read_sha1_file(commit->object.sha1, &type, &size);
+               char *buf = read_sha1_file(commit->object.oid.hash, &type, &size);
                const char *subject_start;
                int subject_len;
 
@@ -144,10 +144,10 @@ static void show_list(const char *debug, int counted, int nr,
                        fprintf(stderr, "%3d", weight(p));
                else
                        fprintf(stderr, "---");
-               fprintf(stderr, " %.*s", 8, sha1_to_hex(commit->object.sha1));
+               fprintf(stderr, " %.*s", 8, sha1_to_hex(commit->object.oid.hash));
                for (pp = commit->parents; pp; pp = pp->next)
                        fprintf(stderr, " %.*s", 8,
-                               sha1_to_hex(pp->item->object.sha1));
+                               sha1_to_hex(pp->item->object.oid.hash));
 
                subject_len = find_commit_subject(buf, &subject_start);
                if (subject_len)
@@ -792,11 +792,9 @@ static void handle_skipped_merge_base(const struct object_id *mb)
  * - If one is "skipped", we can't know but we should warn.
  * - If we don't know, we should check it out and ask the user to test.
  */
-static void check_merge_bases(int no_checkout)
+static void check_merge_bases(int rev_nr, struct commit **rev, int no_checkout)
 {
        struct commit_list *result;
-       int rev_nr;
-       struct commit **rev = get_bad_and_good_commits(&rev_nr);
 
        result = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1);
 
@@ -814,34 +812,21 @@ static void check_merge_bases(int no_checkout)
                }
        }
 
-       free(rev);
        free_commit_list(result);
 }
 
-static int check_ancestors(const char *prefix)
+static int check_ancestors(int rev_nr, struct commit **rev, const char *prefix)
 {
        struct rev_info revs;
-       struct object_array pending_copy;
        int res;
 
        bisect_rev_setup(&revs, prefix, "^%s", "%s", 0);
 
-       /* Save pending objects, so they can be cleaned up later. */
-       pending_copy = revs.pending;
-       revs.leak_pending = 1;
-
-       /*
-        * bisect_common calls prepare_revision_walk right away, which
-        * (together with .leak_pending = 1) makes us the sole owner of
-        * the list of pending objects.
-        */
        bisect_common(&revs);
        res = (revs.commits != NULL);
 
        /* Clean up objects used, as they will be reused. */
-       clear_commit_marks_for_object_array(&pending_copy, ALL_REV_FLAGS);
-
-       object_array_clear(&pending_copy);
+       clear_commit_marks_many(rev_nr, rev, ALL_REV_FLAGS);
 
        return res;
 }
@@ -858,7 +843,8 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
 {
        char *filename = git_pathdup("BISECT_ANCESTORS_OK");
        struct stat st;
-       int fd;
+       int fd, rev_nr;
+       struct commit **rev;
 
        if (!current_bad_oid)
                die(_("a %s revision is needed"), term_bad);
@@ -872,8 +858,10 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
                goto done;
 
        /* Check if all good revs are ancestor of the bad rev. */
-       if (check_ancestors(prefix))
-               check_merge_bases(no_checkout);
+       rev = get_bad_and_good_commits(&rev_nr);
+       if (check_ancestors(rev_nr, rev, prefix))
+               check_merge_bases(rev_nr, rev, no_checkout);
+       free(rev);
 
        /* Create file BISECT_ANCESTORS_OK. */
        fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0600);
index 8bdc927d3f561e62802ab53be0b3029325e6ebcd..c54c78df547c8c66377f023730958f7a95d3aea1 100644 (file)
@@ -791,7 +791,6 @@ static void orphaned_commit_warning(struct commit *old, struct commit *new)
 {
        struct rev_info revs;
        struct object *object = &old->object;
-       struct object_array refs;
 
        init_revisions(&revs, NULL);
        setup_revisions(0, NULL, &revs, NULL);
@@ -802,14 +801,6 @@ static void orphaned_commit_warning(struct commit *old, struct commit *new)
        for_each_ref(add_pending_uninteresting_ref, &revs);
        add_pending_oid(&revs, "HEAD", &new->object.oid, UNINTERESTING);
 
-       /* Save pending objects, so they can be cleaned up later. */
-       refs = revs.pending;
-       revs.leak_pending = 1;
-
-       /*
-        * prepare_revision_walk (together with .leak_pending = 1) makes us
-        * the sole owner of the list of pending objects.
-        */
        if (prepare_revision_walk(&revs))
                die(_("internal error in revision walk"));
        if (!(old->object.flags & UNINTERESTING))
@@ -818,9 +809,7 @@ static void orphaned_commit_warning(struct commit *old, struct commit *new)
                describe_detached_head(_("Previous HEAD position was"), old);
 
        /* Clean up objects used, as they will be reused. */
-       clear_commit_marks_for_object_array(&refs, ALL_REV_FLAGS);
-
-       object_array_clear(&refs);
+       clear_commit_marks_all(ALL_REV_FLAGS);
 }
 
 static int switch_branches(const struct checkout_opts *opts,
index 2da71db10752bf95647052dcd5b7c4b28e7a50ac..284651797e5402c9f7ef85003d7d1c4ea944e2d7 100644 (file)
@@ -473,7 +473,9 @@ static void clone_local(const char *src_repo, const char *dest_repo)
 }
 
 static const char *junk_work_tree;
+static int junk_work_tree_flags;
 static const char *junk_git_dir;
+static int junk_git_dir_flags;
 static enum {
        JUNK_LEAVE_NONE,
        JUNK_LEAVE_REPO,
@@ -502,12 +504,12 @@ static void remove_junk(void)
 
        if (junk_git_dir) {
                strbuf_addstr(&sb, junk_git_dir);
-               remove_dir_recursively(&sb, 0);
+               remove_dir_recursively(&sb, junk_git_dir_flags);
                strbuf_reset(&sb);
        }
        if (junk_work_tree) {
                strbuf_addstr(&sb, junk_work_tree);
-               remove_dir_recursively(&sb, 0);
+               remove_dir_recursively(&sb, junk_work_tree_flags);
        }
        strbuf_release(&sb);
 }
@@ -863,10 +865,15 @@ static void dissociate_from_references(void)
        free(alternates);
 }
 
+static int dir_exists(const char *path)
+{
+       struct stat sb;
+       return !stat(path, &sb);
+}
+
 int cmd_clone(int argc, const char **argv, const char *prefix)
 {
        int is_bundle = 0, is_local;
-       struct stat buf;
        const char *repo_name, *repo, *work_tree, *git_dir;
        char *path, *dir;
        int dest_exists;
@@ -938,7 +945,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                dir = guess_dir_name(repo_name, is_bundle, option_bare);
        strip_trailing_slashes(dir);
 
-       dest_exists = !stat(dir, &buf);
+       dest_exists = dir_exists(dir);
        if (dest_exists && !is_empty_dir(dir))
                die(_("destination path '%s' already exists and is not "
                        "an empty directory."), dir);
@@ -949,7 +956,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                work_tree = NULL;
        else {
                work_tree = getenv("GIT_WORK_TREE");
-               if (work_tree && !stat(work_tree, &buf))
+               if (work_tree && dir_exists(work_tree))
                        die(_("working tree '%s' already exists."), work_tree);
        }
 
@@ -967,14 +974,24 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                if (safe_create_leading_directories_const(work_tree) < 0)
                        die_errno(_("could not create leading directories of '%s'"),
                                  work_tree);
-               if (!dest_exists && mkdir(work_tree, 0777))
+               if (dest_exists)
+                       junk_work_tree_flags |= REMOVE_DIR_KEEP_TOPLEVEL;
+               else if (mkdir(work_tree, 0777))
                        die_errno(_("could not create work tree dir '%s'"),
                                  work_tree);
                junk_work_tree = work_tree;
                set_git_work_tree(work_tree);
        }
 
-       junk_git_dir = real_git_dir ? real_git_dir : git_dir;
+       if (real_git_dir) {
+               if (dir_exists(real_git_dir))
+                       junk_git_dir_flags |= REMOVE_DIR_KEEP_TOPLEVEL;
+               junk_git_dir = real_git_dir;
+       } else {
+               if (dest_exists)
+                       junk_git_dir_flags |= REMOVE_DIR_KEEP_TOPLEVEL;
+               junk_git_dir = git_dir;
+       }
        if (safe_create_leading_directories_const(git_dir) < 0)
                die(_("could not create leading directories of '%s'"), git_dir);
 
index 8a877014145435516930c787dec37b8c4ac3da90..4610e3d8e3e04a70678a102cc3e0e7472089a3cf 100644 (file)
@@ -701,7 +701,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                }
        }
 
-       if (have_option_m) {
+       if (have_option_m && !fixup_message) {
                strbuf_addbuf(&sb, &message);
                hook_arg1 = "message";
        } else if (logfile && !strcmp(logfile, "-")) {
@@ -731,6 +731,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                ctx.output_encoding = get_commit_output_encoding();
                format_commit_message(commit, "fixup! %s\n\n",
                                      &sb, &ctx);
+               if (have_option_m)
+                       strbuf_addbuf(&sb, &message);
                hook_arg1 = "message";
        } else if (!stat(git_path_merge_msg(), &statbuf)) {
                /*
@@ -1197,8 +1199,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
                f++;
        if (f > 1)
                die(_("Only one of -c/-C/-F/--fixup can be used."));
-       if (have_option_m && f > 0)
-               die((_("Option -m cannot be combined with -c/-C/-F/--fixup.")));
+       if (have_option_m && (edit_message || use_message || logfile))
+               die((_("Option -m cannot be combined with -c/-C/-F.")));
        if (f || have_option_m)
                template_file = NULL;
        if (edit_message)
@@ -1507,7 +1509,7 @@ static void print_summary(const char *prefix, const struct object_id *oid,
        rev.show_root_diff = 1;
        get_commit_format(format.buf, &rev);
        rev.always_show_header = 0;
-       rev.diffopt.detect_rename = 1;
+       rev.diffopt.detect_rename = DIFF_DETECT_RENAME;
        rev.diffopt.break_opt = 0;
        diff_setup_done(&rev.diffopt);
 
index 3b0b204b1e495626f3490d62f281291ee039ba42..c4289847063ac02ed061f890ffd71cd329d67109 100644 (file)
@@ -274,10 +274,13 @@ static void append_name(struct commit_name *n, struct strbuf *dst)
                n->name_checked = 1;
        }
 
-       if (n->tag)
+       if (n->tag) {
+               if (all)
+                       strbuf_addstr(dst, "tags/");
                strbuf_addstr(dst, n->tag->tag);
-       else
+       } else {
                strbuf_addstr(dst, n->path);
+       }
 }
 
 static void append_suffix(int depth, const struct object_id *oid, struct strbuf *dst)
@@ -380,7 +383,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
        if (!match_cnt) {
                struct object_id *cmit_oid = &cmit->object.oid;
                if (always) {
-                       strbuf_addstr(dst, find_unique_abbrev(cmit_oid->hash, abbrev));
+                       strbuf_add_unique_abbrev(dst, cmit_oid->hash, abbrev);
                        if (suffix)
                                strbuf_addstr(dst, suffix);
                        return;
index 04846d46f91d6cde14d379da8e0e3dd458c08dc5..92ce775a74d88036b024b24d74e3987da521ef41 100644 (file)
@@ -171,7 +171,13 @@ static void mark_object_reachable(struct object *obj)
 
 static int traverse_one_object(struct object *obj)
 {
-       return fsck_walk(obj, obj, &fsck_walk_options);
+       int result = fsck_walk(obj, obj, &fsck_walk_options);
+
+       if (obj->type == OBJ_TREE) {
+               struct tree *tree = (struct tree *)obj;
+               free_tree_buffer(tree);
+       }
+       return result;
 }
 
 static int traverse_reachable(void)
index 7cef5b120b7786d107282d03052c5e06d3a2c85a..9efdc224661b02192d06c6877e49c5585ddbcdca 100644 (file)
@@ -14,7 +14,7 @@
 #include "worktree.h"
 
 static const char * const worktree_usage[] = {
-       N_("git worktree add [<options>] <path> [<branch>]"),
+       N_("git worktree add [<options>] <path> [<commit-ish>]"),
        N_("git worktree list [<options>]"),
        N_("git worktree lock [<options>] <path>"),
        N_("git worktree prune [<options>]"),
index 93290962c95e6c27732f121f980d03289ac1ea6d..efe547e25fe2a53bd0ef7954cf3bec6d55218365 100644 (file)
--- a/bundle.c
+++ b/bundle.c
@@ -134,7 +134,6 @@ int verify_bundle(struct bundle_header *header, int verbose)
        struct ref_list *p = &header->prerequisites;
        struct rev_info revs;
        const char *argv[] = {NULL, "--all", NULL};
-       struct object_array refs;
        struct commit *commit;
        int i, ret = 0, req_nr;
        const char *message = _("Repository lacks these prerequisite commits:");
@@ -157,14 +156,6 @@ int verify_bundle(struct bundle_header *header, int verbose)
        req_nr = revs.pending.nr;
        setup_revisions(2, argv, &revs, NULL);
 
-       /* Save pending objects, so they can be cleaned up later. */
-       refs = revs.pending;
-       revs.leak_pending = 1;
-
-       /*
-        * prepare_revision_walk (together with .leak_pending = 1) makes us
-        * the sole owner of the list of pending objects.
-        */
        if (prepare_revision_walk(&revs))
                die(_("revision walk setup failed"));
 
@@ -173,18 +164,24 @@ int verify_bundle(struct bundle_header *header, int verbose)
                if (commit->object.flags & PREREQ_MARK)
                        i--;
 
-       for (i = 0; i < req_nr; i++)
-               if (!(refs.objects[i].item->flags & SHOWN)) {
-                       if (++ret == 1)
-                               error("%s", message);
-                       error("%s %s", oid_to_hex(&refs.objects[i].item->oid),
-                               refs.objects[i].name);
-               }
+       for (i = 0; i < p->nr; i++) {
+               struct ref_list_entry *e = p->list + i;
+               struct object *o = parse_object(&e->oid);
+               assert(o); /* otherwise we'd have returned early */
+               if (o->flags & SHOWN)
+                       continue;
+               if (++ret == 1)
+                       error("%s", message);
+               error("%s %s", oid_to_hex(&e->oid), e->name);
+       }
 
        /* Clean up objects used, as they will be reused. */
-       clear_commit_marks_for_object_array(&refs, ALL_REV_FLAGS);
-
-       object_array_clear(&refs);
+       for (i = 0; i < p->nr; i++) {
+               struct ref_list_entry *e = p->list + i;
+               commit = lookup_commit_reference_gently(&e->oid, 1);
+               if (commit)
+                       clear_commit_marks(commit, ALL_REV_FLAGS);
+       }
 
        if (verbose) {
                struct ref_list *r;
index e03e72c34a5c1fc618994ee63f38875d28d91886..0dd6292a94e55baff0a42df89c7006a757f61065 100644 (file)
@@ -608,7 +608,7 @@ int write_index_as_tree(unsigned char *sha1, struct index_state *index_state, co
 
        hold_lock_file_for_update(&lock_file, index_path, LOCK_DIE_ON_ERROR);
 
-       entries = read_index_from(index_state, index_path);
+       entries = read_index_from(index_state, index_path, get_git_dir());
        if (entries < 0) {
                ret = WRITE_TREE_UNREADABLE_INDEX;
                goto out;
diff --git a/cache.h b/cache.h
index d8b975a5715e8a5ec7c32e176958725cba61d67a..fd755c32cf5daf91115f6f534fdd9029609ee546 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -345,7 +345,8 @@ struct index_state {
        struct split_index *split_index;
        struct cache_time timestamp;
        unsigned name_hash_initialized : 1,
-                initialized : 1;
+                initialized : 1,
+                drop_cache_tree : 1;
        struct hashmap name_hash;
        struct hashmap dir_hash;
        unsigned char sha1[20];
@@ -371,7 +372,7 @@ extern void free_name_hash(struct index_state *istate);
 #define active_cache_tree (the_index.cache_tree)
 
 #define read_cache() read_index(&the_index)
-#define read_cache_from(path) read_index_from(&the_index, (path))
+#define read_cache_from(path) read_index_from(&the_index, (path), (get_git_dir()))
 #define read_cache_preload(pathspec) read_index_preload(&the_index, (pathspec))
 #define is_cache_unborn() is_index_unborn(&the_index)
 #define read_cache_unmerged() read_index_unmerged(&the_index)
@@ -616,7 +617,8 @@ extern int read_index(struct index_state *);
 extern int read_index_preload(struct index_state *, const struct pathspec *pathspec);
 extern int do_read_index(struct index_state *istate, const char *path,
                         int must_exist); /* for testting only! */
-extern int read_index_from(struct index_state *, const char *path);
+extern int read_index_from(struct index_state *, const char *path,
+                          const char *gitdir);
 extern int is_index_unborn(struct index_state *);
 extern int read_index_unmerged(struct index_state *);
 
similarity index 54%
rename from ci/run-tests.sh
rename to ci/run-build-and-tests.sh
index 22355f0091a0a3936472179249cf152d9f20fc17..3e23e65f9eed88d1251c9ae32cb9a24e28da8ebe 100755 (executable)
@@ -1,12 +1,18 @@
 #!/bin/sh
 #
-# Test Git
+# Build and test Git
 #
 
 . ${0%/*}/lib-travisci.sh
 
 ln -s $HOME/travis-cache/.prove t/.prove
+
+make --jobs=2
 make --quiet test
+if test "$jobname" = "linux-gcc"
+then
+       GIT_TEST_SPLIT_INDEX=YesPlease make --quiet test
+fi
 
 check_unignored_build_artifacts
 
diff --git a/ci/run-build.sh b/ci/run-build.sh
deleted file mode 100755 (executable)
index 4f940d1..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-#
-# Build Git
-#
-
-. ${0%/*}/lib-travisci.sh
-
-make --jobs=2
index cab8d4455bdbd6e4b87031613300be1112a19df5..ff51c9f34a975fdd3320f8c185f6e3c8b5176e81 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -547,7 +547,7 @@ void clear_commit_marks_many(int nr, struct commit **commit, unsigned int mark)
        struct commit_list *list = NULL;
 
        while (nr--) {
-               commit_list_insert(*commit, &list);
+               clear_commit_marks_1(&list, *commit, mark);
                commit++;
        }
        while (list)
@@ -559,20 +559,6 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
        clear_commit_marks_many(1, &commit, mark);
 }
 
-void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark)
-{
-       struct object *object;
-       struct commit *commit;
-       unsigned int i;
-
-       for (i = 0; i < a->nr; i++) {
-               object = a->objects[i].item;
-               commit = lookup_commit_reference_gently(&object->oid, 1);
-               if (commit)
-                       clear_commit_marks(commit, mark);
-       }
-}
-
 struct commit *pop_commit(struct commit_list **stack)
 {
        struct commit_list *top = *stack;
@@ -929,8 +915,7 @@ static int remove_redundant(struct commit **array, int cnt)
                        if (work[j]->object.flags & PARENT1)
                                redundant[filled_index[j]] = 1;
                clear_commit_marks(array[i], all_flags);
-               for (j = 0; j < filled; j++)
-                       clear_commit_marks(work[j], all_flags);
+               clear_commit_marks_many(filled, work, all_flags);
                free_commit_list(common);
        }
 
index 8c68ca1a5a18721538bb44fe37cdf94223f2a5b5..425f4027752fb47190a53ddc72a64ebf9d928633 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -140,7 +140,6 @@ struct commit *pop_commit(struct commit_list **stack);
 
 void clear_commit_marks(struct commit *commit, unsigned int mark);
 void clear_commit_marks_many(int nr, struct commit **commit, unsigned int mark);
-void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark);
 
 
 enum rev_sort_order {
index 685a80d13843800be3c633539b0a22e88652444a..6a1d0de0cc571f395eeeb8f149d4377a1a5e1602 100644 (file)
@@ -182,7 +182,6 @@ ifeq ($(uname_O),Cygwin)
        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
        X = .exe
        UNRELIABLE_FSTAT = UnfortunatelyYes
-       SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
        OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
        MMAP_PREVENTS_DELETE = UnfortunatelyYes
        COMPAT_OBJS += compat/cygwin.o
index 1d580e49b0ca3304ad7b3be62664df47ea84757d..ce2e92c6e95d90d490e958ddf820f44d1f51061e 100644 (file)
@@ -1,21 +1,6 @@
 @ strbuf_addf_with_format_only @
 expression E;
-constant fmt;
-@@
-  strbuf_addf(E,
-(
-  fmt
-|
-  _(fmt)
-)
-  );
-
-@ script:python @
-fmt << strbuf_addf_with_format_only.fmt;
-@@
-cocci.include_match("%" not in fmt)
-
-@ extends strbuf_addf_with_format_only @
+constant fmt !~ "%";
 @@
 - strbuf_addf
 + strbuf_addstr
index 3683c772c5586ccc1f6dfc8c047919d8d96aa891..88813e91244d820b4aa2c0fb5e60a44db03c3e59 100644 (file)
@@ -594,7 +594,7 @@ __git_is_configured_remote ()
 
 __git_list_merge_strategies ()
 {
-       git merge -s help 2>&1 |
+       LANG=C LC_ALL=C git merge -s help 2>&1 |
        sed -n -e '/[Aa]vailable strategies are: /,/^$/{
                s/\.$//
                s/.*://
index e37e343d0aec37fd74e7bdf694b99f59d022690a..72dfeaf6e296323db7baf9e4545e412c01878417 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -597,6 +597,7 @@ static char *parse_host_arg(struct hostinfo *hi, char *extra_args, int buflen)
                if (strncasecmp("host=", extra_args, 5) == 0) {
                        val = extra_args + 5;
                        vallen = strlen(val) + 1;
+                       loginfo("Extended attribute \"host\": %s", val);
                        if (*val) {
                                /* Split <host>:<port> at colon. */
                                char *host;
@@ -647,9 +648,11 @@ static void parse_extra_args(struct hostinfo *hi, struct argv_array *env,
                }
        }
 
-       if (git_protocol.len > 0)
+       if (git_protocol.len > 0) {
+               loginfo("Extended attribute \"protocol\": %s", git_protocol.buf);
                argv_array_pushf(env, GIT_PROTOCOL_ENVIRONMENT "=%s",
                                 git_protocol.buf);
+       }
        strbuf_release(&git_protocol);
 }
 
@@ -757,14 +760,8 @@ static int execute(void)
        alarm(0);
 
        len = strlen(line);
-       if (pktlen != len)
-               loginfo("Extended attributes (%d bytes) exist <%.*s>",
-                       (int) pktlen - len,
-                       (int) pktlen - len, line + len + 1);
-       if (len && line[len-1] == '\n') {
-               line[--len] = 0;
-               pktlen--;
-       }
+       if (len && line[len-1] == '\n')
+               line[len-1] = 0;
 
        /* parse additional args hidden behind a NUL byte */
        if (len != pktlen)
diff --git a/diff.c b/diff.c
index fb22b19f09ab13032b0484e64326fef92bb0681f..e9d0e38123a59f2ca54674115df4140836b98f18 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -246,7 +246,7 @@ static int parse_ws_error_highlight(const char *arg)
  */
 void init_diff_ui_defaults(void)
 {
-       diff_detect_rename_default = 1;
+       diff_detect_rename_default = DIFF_DETECT_RENAME;
 }
 
 int git_diff_heuristic_config(const char *var, const char *value, void *cb)
@@ -5454,6 +5454,7 @@ N_("you may want to set your %s variable to at least "
 
 void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc)
 {
+       fflush(stdout);
        if (degraded_cc)
                warning(_(degrade_cc_to_c_warning));
        else if (needed)
index 28b325d75481b74e8f7b16485e1fc18ad854161c..964c3a75420db4751cf11125b68b6904112632f1 100755 (executable)
@@ -262,7 +262,7 @@ sub list_modified {
                }
        }
 
-       for (run_cmd_pipe(qw(git diff-files --numstat --summary --raw --), @ARGV)) {
+       for (run_cmd_pipe(qw(git diff-files --ignore-submodules=dirty --numstat --summary --raw --), @ARGV)) {
                if (($add, $del, $file) =
                    /^([-\d]+)  ([-\d]+)        (.*)/) {
                        $file = unquote_path($file);
index 1ef1889dbd806494b8659023a091920b07692035..9d065fb4bf9a308e64fa2d4aa5dff294b116f1a9 100644 (file)
@@ -17,15 +17,15 @@ export TEXTDOMAINDIR
 
 # First decide what scheme to use...
 GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "$GIT_GETTEXT_POISON"
+then
+       GIT_INTERNAL_GETTEXT_SH_SCHEME=poison
+elif test -n "@@USE_GETTEXT_SCHEME@@"
 then
        GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
 elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
 then
        : no probing necessary
-elif test -n "$GIT_GETTEXT_POISON"
-then
-       GIT_INTERNAL_GETTEXT_SH_SCHEME=poison
 elif type gettext.sh >/dev/null 2>&1
 then
        # GNU libintl's gettext.sh
index 1114005ce2829011cde2e6de608a2b90df355fc9..fc8f8ae6401dddcceaa82f9e9c748f5c185536d6 100755 (executable)
@@ -322,10 +322,9 @@ push_stash () {
 
                if test $# != 0
                then
-                       git reset -q -- "$@"
-                       git ls-files -z --modified -- "$@" |
+                       git add -u -- "$@" |
                        git checkout-index -z --force --stdin
-                       git clean --force -q -d -- "$@"
+                       git diff-index -p --cached --binary HEAD -- "$@" | git apply --index -R
                else
                        git reset --hard -q
                fi
index aa242d4f4f4363736730ccfcb4c2694d5be9a670..a6b6c3e40c180e58186f9ef8af5c6fd6fc654080 100755 (executable)
@@ -931,6 +931,7 @@ sub cmd_dcommit {
                # information from different SVN repos, and paths
                # which are not underneath this repository root.
                my $rooturl = $gs->repos_root;
+               Git::SVN::remove_username($rooturl);
                foreach my $d (@$linear_refs) {
                        my %parentshash;
                        read_commit_parents(\%parentshash, $d);
@@ -1199,6 +1200,11 @@ sub cmd_branch {
        $ctx->copy($src, $rev, $dst)
                unless $_dry_run;
 
+       # Release resources held by ctx before creating another SVN::Ra
+       # so destruction is orderly.  This seems necessary with SVN 1.9.5
+       # to avoid segfaults.
+       $ctx = undef;
+
        $gs->fetch_all;
 }
 
index 7ce79f3f72c144063b56f44368ad00c34e6aa786..d375d9cce779952057e3c5dc6340edd12fb3f99d 100644 (file)
--- a/hashmap.h
+++ b/hashmap.h
@@ -400,7 +400,6 @@ static inline void hashmap_disable_item_counting(struct hashmap *map)
  */
 static inline void hashmap_enable_item_counting(struct hashmap *map)
 {
-       void *item;
        unsigned int n = 0;
        struct hashmap_iter iter;
 
@@ -408,7 +407,7 @@ static inline void hashmap_enable_item_counting(struct hashmap *map)
                return;
 
        hashmap_iter_init(map, &iter);
-       while ((item = hashmap_iter_next(&iter)))
+       while (hashmap_iter_next(&iter))
                n++;
 
        map->do_count_items = 1;
diff --git a/http.c b/http.c
index 5977712712b22d9076d8cd5ccda0fe12b3057d27..32a8238955a42a9f6fd86d7cd71d09129ab454a4 100644 (file)
--- a/http.c
+++ b/http.c
 #include "transport.h"
 #include "packfile.h"
 #include "protocol.h"
+#include "string-list.h"
 
 static struct trace_key trace_curl = TRACE_KEY_INIT(CURL);
+static int trace_curl_data = 1;
+static struct string_list cookies_to_redact = STRING_LIST_INIT_DUP;
 #if LIBCURL_VERSION_NUM >= 0x070a08
 long int git_curl_ipresolve = CURL_IPRESOLVE_WHATEVER;
 #else
@@ -575,6 +578,54 @@ static void redact_sensitive_header(struct strbuf *header)
                /* Everything else is opaque and possibly sensitive */
                strbuf_setlen(header,  sensitive_header - header->buf);
                strbuf_addstr(header, " <redacted>");
+       } else if (cookies_to_redact.nr &&
+                  skip_prefix(header->buf, "Cookie:", &sensitive_header)) {
+               struct strbuf redacted_header = STRBUF_INIT;
+               char *cookie;
+
+               while (isspace(*sensitive_header))
+                       sensitive_header++;
+
+               /*
+                * The contents of header starting from sensitive_header will
+                * subsequently be overridden, so it is fine to mutate this
+                * string (hence the assignment to "char *").
+                */
+               cookie = (char *) sensitive_header;
+
+               while (cookie) {
+                       char *equals;
+                       char *semicolon = strstr(cookie, "; ");
+                       if (semicolon)
+                               *semicolon = 0;
+                       equals = strchrnul(cookie, '=');
+                       if (!equals) {
+                               /* invalid cookie, just append and continue */
+                               strbuf_addstr(&redacted_header, cookie);
+                               continue;
+                       }
+                       *equals = 0; /* temporarily set to NUL for lookup */
+                       if (string_list_lookup(&cookies_to_redact, cookie)) {
+                               strbuf_addstr(&redacted_header, cookie);
+                               strbuf_addstr(&redacted_header, "=<redacted>");
+                       } else {
+                               *equals = '=';
+                               strbuf_addstr(&redacted_header, cookie);
+                       }
+                       if (semicolon) {
+                               /*
+                                * There are more cookies. (Or, for some
+                                * reason, the input string ends in "; ".)
+                                */
+                               strbuf_addstr(&redacted_header, "; ");
+                               cookie = semicolon + strlen("; ");
+                       } else {
+                               cookie = NULL;
+                       }
+               }
+
+               strbuf_setlen(header, sensitive_header - header->buf);
+               strbuf_addbuf(header, &redacted_header);
        }
 }
 
@@ -645,24 +696,32 @@ static int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size,
                curl_dump_header(text, (unsigned char *)data, size, DO_FILTER);
                break;
        case CURLINFO_DATA_OUT:
-               text = "=> Send data";
-               curl_dump_data(text, (unsigned char *)data, size);
+               if (trace_curl_data) {
+                       text = "=> Send data";
+                       curl_dump_data(text, (unsigned char *)data, size);
+               }
                break;
        case CURLINFO_SSL_DATA_OUT:
-               text = "=> Send SSL data";
-               curl_dump_data(text, (unsigned char *)data, size);
+               if (trace_curl_data) {
+                       text = "=> Send SSL data";
+                       curl_dump_data(text, (unsigned char *)data, size);
+               }
                break;
        case CURLINFO_HEADER_IN:
                text = "<= Recv header";
                curl_dump_header(text, (unsigned char *)data, size, NO_FILTER);
                break;
        case CURLINFO_DATA_IN:
-               text = "<= Recv data";
-               curl_dump_data(text, (unsigned char *)data, size);
+               if (trace_curl_data) {
+                       text = "<= Recv data";
+                       curl_dump_data(text, (unsigned char *)data, size);
+               }
                break;
        case CURLINFO_SSL_DATA_IN:
-               text = "<= Recv SSL data";
-               curl_dump_data(text, (unsigned char *)data, size);
+               if (trace_curl_data) {
+                       text = "<= Recv SSL data";
+                       curl_dump_data(text, (unsigned char *)data, size);
+               }
                break;
 
        default:                /* we ignore unknown types by default */
@@ -807,6 +866,13 @@ static CURL *get_curl_handle(void)
        if (getenv("GIT_CURL_VERBOSE"))
                curl_easy_setopt(result, CURLOPT_VERBOSE, 1L);
        setup_curl_trace(result);
+       if (getenv("GIT_TRACE_CURL_NO_DATA"))
+               trace_curl_data = 0;
+       if (getenv("GIT_REDACT_COOKIES")) {
+               string_list_split(&cookies_to_redact,
+                                 getenv("GIT_REDACT_COOKIES"), ',', -1);
+               string_list_sort(&cookies_to_redact);
+       }
 
        curl_easy_setopt(result, CURLOPT_USERAGENT,
                user_agent ? user_agent : git_user_agent());
index a89db22ab0c8ef50ae31d5811de5fc48d09224a2..d04142ccc76067e83f1839b6315b292268e90c58 100644 (file)
@@ -1167,11 +1167,13 @@ void clear_mailinfo(struct mailinfo *mi)
        strbuf_release(&mi->inbody_header_accum);
        free(mi->message_id);
 
-       for (i = 0; mi->p_hdr_data[i]; i++)
-               strbuf_release(mi->p_hdr_data[i]);
+       if (mi->p_hdr_data)
+               for (i = 0; mi->p_hdr_data[i]; i++)
+                       strbuf_release(mi->p_hdr_data[i]);
        free(mi->p_hdr_data);
-       for (i = 0; mi->s_hdr_data[i]; i++)
-               strbuf_release(mi->s_hdr_data[i]);
+       if (mi->s_hdr_data)
+               for (i = 0; mi->s_hdr_data[i]; i++)
+                       strbuf_release(mi->s_hdr_data[i]);
        free(mi->s_hdr_data);
 
        while (mi->content < mi->content_top) {
index 0fc580d8ca97c77d436f3351993300d19acd1ccc..cc5fa0a94965fad8821cdf81dfe84737f4dee043 100644 (file)
@@ -1026,10 +1026,19 @@ static int merge_file_1(struct merge_options *o,
                                                       &b->oid,
                                                       !o->call_depth);
                } else if (S_ISLNK(a->mode)) {
-                       oidcpy(&result->oid, &a->oid);
-
-                       if (!oid_eq(&a->oid, &b->oid))
-                               result->clean = 0;
+                       switch (o->recursive_variant) {
+                       case MERGE_RECURSIVE_NORMAL:
+                               oidcpy(&result->oid, &a->oid);
+                               if (!oid_eq(&a->oid, &b->oid))
+                                       result->clean = 0;
+                               break;
+                       case MERGE_RECURSIVE_OURS:
+                               oidcpy(&result->oid, &a->oid);
+                               break;
+                       case MERGE_RECURSIVE_THEIRS:
+                               oidcpy(&result->oid, &b->oid);
+                               break;
+                       }
                } else
                        die("BUG: unsupported object type in the tree");
        }
index b9a4a0e50172fb169226786b17134c6ab0627333..0afdfd19b784a541ad6d7237add2fbb1c9ec91ab 100644 (file)
--- a/object.c
+++ b/object.c
@@ -434,3 +434,14 @@ void clear_object_flags(unsigned flags)
                        obj->flags &= ~flags;
        }
 }
+
+void clear_commit_marks_all(unsigned int flags)
+{
+       int i;
+
+       for (i = 0; i < obj_hash_size; i++) {
+               struct object *obj = obj_hash[i];
+               if (obj && obj->type == OBJ_COMMIT)
+                       obj->flags &= ~flags;
+       }
+}
index f34461d4afde1b25c30fa8ac72428955c475c5b5..87563d90562b51859da8313b105a3e7785ed9d26 100644 (file)
--- a/object.h
+++ b/object.h
@@ -149,4 +149,9 @@ void object_array_clear(struct object_array *array);
 
 void clear_object_flags(unsigned flags);
 
+/*
+ * Clear the specified object flags from all in-core commit objects.
+ */
+extern void clear_commit_marks_all(unsigned int flags);
+
 #endif /* OBJECT_H */
index 6db4fffcdb272d2227c8a7779a19597dc6102971..d9fb19ba6a354e376780fa0a3624642532a2f6cf 100644 (file)
--- a/oidmap.c
+++ b/oidmap.c
@@ -33,12 +33,19 @@ void oidmap_free(struct oidmap *map, int free_entries)
 
 void *oidmap_get(const struct oidmap *map, const struct object_id *key)
 {
+       if (!map->map.cmpfn)
+               return NULL;
+
        return hashmap_get_from_hash(&map->map, hash(key), key);
 }
 
 void *oidmap_remove(struct oidmap *map, const struct object_id *key)
 {
        struct hashmap_entry entry;
+
+       if (!map->map.cmpfn)
+               oidmap_init(map, 0);
+
        hashmap_entry_init(&entry, hash(key));
        return hashmap_remove(&map->map, &entry, key);
 }
@@ -46,6 +53,10 @@ void *oidmap_remove(struct oidmap *map, const struct object_id *key)
 void *oidmap_put(struct oidmap *map, void *entry)
 {
        struct oidmap_entry *to_put = entry;
+
+       if (!map->map.cmpfn)
+               oidmap_init(map, 0);
+
        hashmap_entry_init(&to_put->internal_entry, hash(&to_put->oid));
        return hashmap_put(&map->map, to_put);
 }
index 2eb81a66b941325dc339d61a0ab804a60cbb8be2..198e72b6851a13bd5bf3f8b1dc417a732cd5b147 100644 (file)
@@ -1603,7 +1603,7 @@ int hold_locked_index(struct lock_file *lk, int lock_flags)
 
 int read_index(struct index_state *istate)
 {
-       return read_index_from(istate, get_index_file());
+       return read_index_from(istate, get_index_file(), get_git_dir());
 }
 
 static struct cache_entry *cache_entry_from_ondisk(struct ondisk_cache_entry *ondisk,
@@ -1863,20 +1863,19 @@ unmap:
  * This way, shared index can be removed if they have not been used
  * for some time.
  */
-static void freshen_shared_index(char *base_sha1_hex, int warn)
+static void freshen_shared_index(const char *shared_index, int warn)
 {
-       char *shared_index = git_pathdup("sharedindex.%s", base_sha1_hex);
        if (!check_and_freshen_file(shared_index, 1) && warn)
                warning("could not freshen shared index '%s'", shared_index);
-       free(shared_index);
 }
 
-int read_index_from(struct index_state *istate, const char *path)
+int read_index_from(struct index_state *istate, const char *path,
+                   const char *gitdir)
 {
        struct split_index *split_index;
        int ret;
        char *base_sha1_hex;
-       const char *base_path;
+       char *base_path;
 
        /* istate->initialized covers both .git/index and .git/sharedindex.xxx */
        if (istate->initialized)
@@ -1896,16 +1895,17 @@ int read_index_from(struct index_state *istate, const char *path)
                split_index->base = xcalloc(1, sizeof(*split_index->base));
 
        base_sha1_hex = sha1_to_hex(split_index->base_sha1);
-       base_path = git_path("sharedindex.%s", base_sha1_hex);
+       base_path = xstrfmt("%s/sharedindex.%s", gitdir, base_sha1_hex);
        ret = do_read_index(split_index->base, base_path, 1);
        if (hashcmp(split_index->base_sha1, split_index->base->sha1))
                die("broken index, expect %s in %s, got %s",
                    base_sha1_hex, base_path,
                    sha1_to_hex(split_index->base->sha1));
 
-       freshen_shared_index(base_sha1_hex, 0);
+       freshen_shared_index(base_path, 0);
        merge_base_index(istate);
        post_read_index_from(istate);
+       free(base_path);
        return ret;
 }
 
@@ -2243,7 +2243,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
        struct stat st;
        struct ondisk_cache_entry_extended ondisk;
        struct strbuf previous_name_buf = STRBUF_INIT, *previous_name;
-       int drop_cache_tree = 0;
+       int drop_cache_tree = istate->drop_cache_tree;
 
        for (i = removed = extended = 0; i < entries; i++) {
                if (cache[i]->ce_flags & CE_REMOVE)
@@ -2472,32 +2472,21 @@ static int clean_shared_index_files(const char *current_hex)
 }
 
 static int write_shared_index(struct index_state *istate,
-                             struct lock_file *lock, unsigned flags)
+                             struct tempfile **temp)
 {
-       struct tempfile *temp;
        struct split_index *si = istate->split_index;
        int ret;
 
-       temp = mks_tempfile(git_path("sharedindex_XXXXXX"));
-       if (!temp) {
-               hashclr(si->base_sha1);
-               return do_write_locked_index(istate, lock, flags);
-       }
        move_cache_to_base_index(istate);
-       ret = do_write_index(si->base, temp, 1);
-       if (ret) {
-               delete_tempfile(&temp);
+       ret = do_write_index(si->base, *temp, 1);
+       if (ret)
                return ret;
-       }
-       ret = adjust_shared_perm(get_tempfile_path(temp));
+       ret = adjust_shared_perm(get_tempfile_path(*temp));
        if (ret) {
-               int save_errno = errno;
-               error("cannot fix permission bits on %s", get_tempfile_path(temp));
-               delete_tempfile(&temp);
-               errno = save_errno;
+               error("cannot fix permission bits on %s", get_tempfile_path(*temp));
                return ret;
        }
-       ret = rename_tempfile(&temp,
+       ret = rename_tempfile(temp,
                              git_path("sharedindex.%s", sha1_to_hex(si->base->sha1)));
        if (!ret) {
                hashcpy(si->base_sha1, si->base->sha1);
@@ -2565,7 +2554,22 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
        new_shared_index = istate->cache_changed & SPLIT_INDEX_ORDERED;
 
        if (new_shared_index) {
-               ret = write_shared_index(istate, lock, flags);
+               struct tempfile *temp;
+               int saved_errno;
+
+               temp = mks_tempfile(git_path("sharedindex_XXXXXX"));
+               if (!temp) {
+                       hashclr(si->base_sha1);
+                       ret = do_write_locked_index(istate, lock, flags);
+                       goto out;
+               }
+               ret = write_shared_index(istate, &temp);
+
+               saved_errno = errno;
+               if (is_tempfile_active(temp))
+                       delete_tempfile(&temp);
+               errno = saved_errno;
+
                if (ret)
                        goto out;
        }
@@ -2573,8 +2577,11 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
        ret = write_split_index(istate, lock, flags);
 
        /* Freshen the shared index only if the split-index was written */
-       if (!ret && !new_shared_index)
-               freshen_shared_index(sha1_to_hex(si->base_sha1), 1);
+       if (!ret && !new_shared_index) {
+               const char *shared_index = git_path("sharedindex.%s",
+                                                   sha1_to_hex(si->base_sha1));
+               freshen_shared_index(shared_index, 1);
+       }
 
 out:
        if (flags & COMMIT_LOCK)
index 3f9161707e66be86eabaf7347da23a2450ffdd9f..f9e25aea7a97e18b5723c8fa379da859d6dc9fcf 100644 (file)
@@ -1995,8 +1995,7 @@ static void do_merge_filter(struct ref_filter_cbdata *ref_cbdata)
                        free_array_item(item);
        }
 
-       for (i = 0; i < old_nr; i++)
-               clear_commit_marks(to_clear[i], ALL_REV_FLAGS);
+       clear_commit_marks_many(old_nr, to_clear, ALL_REV_FLAGS);
        clear_commit_marks(filter->merge_commit, ALL_REV_FLAGS);
        free(to_clear);
 }
index f75d960e1982a2db5dc8828c6f1b10ffe64fda48..bec8e30e9e3e2995739dfff7cc971f8de623610d 100644 (file)
@@ -2931,13 +2931,12 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
 
        if (initial_ref_transaction_commit(packed_transaction, err)) {
                ret = TRANSACTION_GENERIC_ERROR;
-               goto cleanup;
        }
 
+       packed_refs_unlock(refs->packed_ref_store);
 cleanup:
        if (packed_transaction)
                ref_transaction_free(packed_transaction);
-       packed_refs_unlock(refs->packed_ref_store);
        transaction->state = REF_TRANSACTION_CLOSED;
        string_list_clear(&affected_refnames, 0);
        return ret;
index f66fcb13425ab53e15ca47407e7c54be5dcdfc8b..4ffbe9bc94edc18314cb49c945038e2f20a40922 100644 (file)
@@ -236,5 +236,5 @@ int repo_read_index(struct repository *repo)
        if (!repo->index)
                repo->index = xcalloc(1, sizeof(*repo->index));
 
-       return read_index_from(repo->index, repo->index_file);
+       return read_index_from(repo->index, repo->index_file, repo->gitdir);
 }
index 72f2b4572ee798f9e17d6f4fbc0d12cfcd2fe221..a2ba54459d42ba032cd3c16aecdef2eeff98562f 100644 (file)
@@ -1352,7 +1352,8 @@ void add_index_objects_to_pending(struct rev_info *revs, unsigned int flags)
                        continue; /* current index already taken care of */
 
                if (read_index_from(&istate,
-                                   worktree_git_path(wt, "index")) > 0)
+                                   worktree_git_path(wt, "index"),
+                                   get_worktree_git_dir(wt)) > 0)
                        do_add_index_objects_to_pending(revs, &istate);
                discard_index(&istate);
        }
@@ -2862,8 +2863,7 @@ int prepare_revision_walk(struct rev_info *revs)
                        }
                }
        }
-       if (!revs->leak_pending)
-               object_array_clear(&old_pending);
+       object_array_clear(&old_pending);
 
        /* Signal whether we need per-parent treesame decoration */
        if (revs->simplify_merges ||
index 19dc9bdddba20dfa6ef1bdaaee0e82db3bdf8bd8..d7a35c8c9e752cea0ea05ee7e13d696814470a83 100644 (file)
@@ -151,18 +151,6 @@ struct rev_info {
                        date_mode_explicit:1,
                        preserve_subject:1;
        unsigned int    disable_stdin:1;
-       /*
-        * Set `leak_pending` to prevent `prepare_revision_walk()` from clearing
-        * the array of pending objects (`pending`). It will still forget about
-        * the array and its entries, so they really are leaked. This can be
-        * useful if the `struct object_array` `pending` is copied before
-        * calling `prepare_revision_walk()`. By setting `leak_pending`, you
-        * effectively claim ownership of the old array, so you should most
-        * likely call `object_array_clear(&pending_copy)` once you are done.
-        * Observe that this is about ownership of the array and its entries,
-        * not the commits referenced by those entries.
-        */
-       unsigned int    leak_pending:1;
        /* --show-linear-break */
        unsigned int    track_linear:1,
                        track_first_time:1,
index 83e39ec8d7739816188ba909a4cb9da302d48f73..284d04d67f885d8905130e138c45cc4ff4fbdc30 100644 (file)
@@ -238,6 +238,8 @@ void prepare_to_write_split_index(struct index_state *istate)
                                ALLOC_GROW(entries, nr_entries+1, nr_alloc);
                                entries[nr_entries++] = ce;
                        }
+                       if (is_null_oid(&ce->oid))
+                               istate->drop_cache_tree = 1;
                }
        }
 
index 29677043174f8d77d6774bc2533b653d03adf990..47ddc9b2739bf52d9263ea9cd90edde6e9d1c738 100644 (file)
@@ -1657,7 +1657,9 @@ int submodule_move_head(const char *path,
        else
                argv_array_push(&cp.args, "-m");
 
-       argv_array_push(&cp.args, old ? old : EMPTY_TREE_SHA1_HEX);
+       if (!(flags & SUBMODULE_MOVE_HEAD_FORCE))
+               argv_array_push(&cp.args, old ? old : EMPTY_TREE_SHA1_HEX);
+
        argv_array_push(&cp.args, new ? new : EMPTY_TREE_SHA1_HEX);
 
        if (run_command(&cp)) {
index b3f7b449c366c2d7d7afd12139a54b7a588f9747..1a1361a8063b8e247b6a92b83b6e8876953f95bd 100644 (file)
--- a/t/README
+++ b/t/README
@@ -655,7 +655,7 @@ library for your script to use.
                test_expect_code 1 git merge "merge msg" B master
        '
 
- - test_must_fail <git-command>
+ - test_must_fail [<options>] <git-command>
 
    Run a git command and ensure it fails in a controlled way.  Use
    this instead of "! <git-command>".  When git-command dies due to a
@@ -663,11 +663,21 @@ library for your script to use.
    treats it as just another expected failure, which would let such a
    bug go unnoticed.
 
- - test_might_fail <git-command>
+   Accepts the following options:
+
+     ok=<signal-name>[,<...>]:
+       Don't treat an exit caused by the given signal as error.
+       Multiple signals can be specified as a comma separated list.
+       Currently recognized signal names are: sigpipe, success.
+       (Don't use 'success', use 'test_might_fail' instead.)
+
+ - test_might_fail [<options>] <git-command>
 
    Similar to test_must_fail, but tolerate success, too.  Use this
    instead of "<git-command> || :" to catch failures due to segv.
 
+   Accepts the same options as test_must_fail.
+
  - test_cmp <expected> <actual>
 
    Check whether the content of the <actual> file matches the
index 987d40680b4d23f9053c623529eaafa88da04616..edbea2d986134f36b86e044f307abae1457f8165 100644 (file)
@@ -32,7 +32,8 @@ LIB_GIT_DAEMON_PORT=${LIB_GIT_DAEMON_PORT-${this_test#t}}
 
 GIT_DAEMON_PID=
 GIT_DAEMON_DOCUMENT_ROOT_PATH="$PWD"/repo
-GIT_DAEMON_URL=git://127.0.0.1:$LIB_GIT_DAEMON_PORT
+GIT_DAEMON_HOST_PORT=127.0.0.1:$LIB_GIT_DAEMON_PORT
+GIT_DAEMON_URL=git://$GIT_DAEMON_HOST_PORT
 
 start_git_daemon() {
        if test -n "$GIT_DAEMON_PID"
@@ -53,11 +54,19 @@ start_git_daemon() {
                "$@" "$GIT_DAEMON_DOCUMENT_ROOT_PATH" \
                >&3 2>git_daemon_output &
        GIT_DAEMON_PID=$!
+       >daemon.log
        {
-               read line <&7
-               echo >&4 "$line"
-               cat <&7 >&4 &
-       } 7<git_daemon_output &&
+               read -r line <&7
+               printf "%s\n" "$line"
+               printf >&4 "%s\n" "$line"
+               (
+                       while read -r line <&7
+                       do
+                               printf "%s\n" "$line"
+                               printf >&4 "%s\n" "$line"
+                       done
+               ) &
+       } 7<git_daemon_output >>"$TRASH_DIRECTORY/daemon.log" &&
 
        # Check expected output
        if test x"$(expr "$line" : "\[[0-9]*\] \(.*\)")" != x"Ready to rumble"
@@ -90,3 +99,25 @@ stop_git_daemon() {
        GIT_DAEMON_PID=
        rm -f git_daemon_output
 }
+
+# A stripped-down version of a netcat client, that connects to a "host:port"
+# given in $1, sends its stdin followed by EOF, then dumps the response (until
+# EOF) to stdout.
+fake_nc() {
+       if ! test_declared_prereq FAKENC
+       then
+               echo >&4 "fake_nc: need to declare FAKENC prerequisite"
+               return 127
+       fi
+       perl -Mstrict -MIO::Socket::INET -e '
+               my $s = IO::Socket::INET->new(shift)
+                       or die "unable to open socket: $!";
+               print $s <STDIN>;
+               $s->shutdown(1);
+               print <$s>;
+       ' "$@"
+}
+
+test_lazy_prereq FAKENC '
+       perl -MIO::Socket::INET -e "exit 0"
+'
index 38dadd2c2902f3621d54168d32a54d7863497968..1f38a85371ab49790d14d3d4b82a0ee6e52789dd 100755 (executable)
@@ -664,8 +664,8 @@ test_submodule_recursing_with_args_common() {
                        cd submodule_update &&
                        git -C sub1 checkout -b keep_branch &&
                        git -C sub1 rev-parse HEAD >expect &&
-                       git branch -t check-keep origin/modify_sub1 &&
-                       $command check-keep &&
+                       git branch -t modify_sub1 origin/modify_sub1 &&
+                       $command modify_sub1 &&
                        test_superproject_content origin/modify_sub1 &&
                        test_submodule_content sub1 origin/modify_sub1 &&
                        git -C sub1 rev-parse keep_branch >actual &&
@@ -885,6 +885,7 @@ test_submodule_switch_recursing_with_args () {
                (
                        cd submodule_update &&
                        git branch -t replace_sub1_with_file origin/replace_sub1_with_file &&
+                       echo ignored >.git/modules/sub1/info/exclude &&
                        : >sub1/ignored &&
                        $command replace_sub1_with_file &&
                        test_superproject_content origin/replace_sub1_with_file &&
@@ -1014,4 +1015,18 @@ test_submodule_forced_switch_recursing_with_args () {
                        test_submodule_content sub1 origin/modify_sub1
                )
        '
+
+       test_expect_success "$command: changed submodule worktree is reset" '
+               prolog &&
+               reset_work_tree_to_interested add_sub1 &&
+               (
+                       cd submodule_update &&
+                       rm sub1/file1 &&
+                       : >sub1/new_file &&
+                       git -C sub1 add new_file &&
+                       $command HEAD &&
+                       test_path_is_file sub1/file1 &&
+                       test_path_is_missing sub1/new_file
+               )
+       '
 }
index 62aba19e7609678795d632d402dfd047d61d60bb..8b09c5bf328b880b7bbe10f37c7356b785473384 100755 (executable)
@@ -12,6 +12,9 @@ e.g. GIT_PERF_7820_GREP_OPTS=' -i'. Some options to try:
        -vi
        -vw
        -viw
+
+If GIT_PERF_GREP_THREADS is set to a list of threads (e.g. '1 4 8'
+etc.) we will test the patterns under those numbers of threads.
 "
 
 . ./perf-lib.sh
@@ -19,6 +22,11 @@ e.g. GIT_PERF_7820_GREP_OPTS=' -i'. Some options to try:
 test_perf_large_repo
 test_checkout_worktree
 
+if test -n "$GIT_PERF_GREP_THREADS"
+then
+       test_set_prereq PERF_GREP_ENGINES_THREADS
+fi
+
 for pattern in \
        'how.to' \
        '^how to' \
@@ -39,18 +47,42 @@ do
                else
                        prereq=""
                fi
-               test_perf $prereq "$engine grep$GIT_PERF_7820_GREP_OPTS '$pattern'" "
-                       git -c grep.patternType=$engine grep$GIT_PERF_7820_GREP_OPTS -- '$pattern' >'out.$engine' || :
-               "
-       done
-
-       test_expect_success "assert that all engines found the same for$GIT_PERF_7820_GREP_OPTS '$pattern'" '
-               test_cmp out.basic out.extended &&
-               if test_have_prereq PCRE
+               if ! test_have_prereq PERF_GREP_ENGINES_THREADS
                then
-                       test_cmp out.basic out.perl
+                       test_perf $prereq "$engine grep$GIT_PERF_7820_GREP_OPTS '$pattern'" "
+                               git -c grep.patternType=$engine grep$GIT_PERF_7820_GREP_OPTS -- '$pattern' >'out.$engine' || :
+                       "
+               else
+                       for threads in $GIT_PERF_GREP_THREADS
+                       do
+                               test_perf PTHREADS,$prereq "$engine grep$GIT_PERF_7820_GREP_OPTS '$pattern' with $threads threads" "
+                                       git -c grep.patternType=$engine -c grep.threads=$threads grep$GIT_PERF_7820_GREP_OPTS -- '$pattern' >'out.$engine.$threads' || :
+                               "
+                       done
                fi
-       '
+       done
+
+       if ! test_have_prereq PERF_GREP_ENGINES_THREADS
+       then
+               test_expect_success "assert that all engines found the same for$GIT_PERF_7820_GREP_OPTS '$pattern'" '
+                       test_cmp out.basic out.extended &&
+                       if test_have_prereq PCRE
+                       then
+                               test_cmp out.basic out.perl
+                       fi
+               '
+       else
+               for threads in $GIT_PERF_GREP_THREADS
+               do
+                       test_expect_success PTHREADS "assert that all engines found the same for$GIT_PERF_7820_GREP_OPTS '$pattern' under threading" "
+                               test_cmp out.basic.$threads out.extended.$threads &&
+                               if test_have_prereq PCRE
+                               then
+                                       test_cmp out.basic.$threads out.perl.$threads
+                               fi
+                       "
+               done
+       fi
 done
 
 test_done
index c7ef1e198fb9b803bcc5ed08fa553736ce5442d0..61e41b82cffa3721fbbc724fc699055c9457453a 100755 (executable)
@@ -6,6 +6,9 @@ Set GIT_PERF_7821_GREP_OPTS in the environment to pass options to
 git-grep. Make sure to include a leading space,
 e.g. GIT_PERF_7821_GREP_OPTS=' -w'. See p7820-grep-engines.sh for more
 options to try.
+
+If GIT_PERF_7821_THREADS is set to a list of threads (e.g. '1 4 8'
+etc.) we will test the patterns under those numbers of threads.
 "
 
 . ./perf-lib.sh
@@ -13,6 +16,11 @@ options to try.
 test_perf_large_repo
 test_checkout_worktree
 
+if test -n "$GIT_PERF_GREP_THREADS"
+then
+       test_set_prereq PERF_GREP_ENGINES_THREADS
+fi
+
 for pattern in 'int' 'uncommon' 'æ'
 do
        for engine in fixed basic extended perl
@@ -23,19 +31,44 @@ do
                else
                        prereq=""
                fi
-               test_perf $prereq "$engine grep$GIT_PERF_7821_GREP_OPTS $pattern" "
-                       git -c grep.patternType=$engine grep$GIT_PERF_7821_GREP_OPTS $pattern >'out.$engine' || :
-               "
-       done
-
-       test_expect_success "assert that all engines found the same for$GIT_PERF_7821_GREP_OPTS $pattern" '
-               test_cmp out.fixed out.basic &&
-               test_cmp out.fixed out.extended &&
-               if test_have_prereq PCRE
+               if ! test_have_prereq PERF_GREP_ENGINES_THREADS
                then
-                       test_cmp out.fixed out.perl
+                       test_perf $prereq "$engine grep$GIT_PERF_7821_GREP_OPTS $pattern" "
+                               git -c grep.patternType=$engine grep$GIT_PERF_7821_GREP_OPTS $pattern >'out.$engine' || :
+                       "
+               else
+                       for threads in $GIT_PERF_GREP_THREADS
+                       do
+                               test_perf PTHREADS,$prereq "$engine grep$GIT_PERF_7821_GREP_OPTS $pattern with $threads threads" "
+                                       git -c grep.patternType=$engine -c grep.threads=$threads grep$GIT_PERF_7821_GREP_OPTS $pattern >'out.$engine.$threads' || :
+                               "
+                       done
                fi
-       '
+       done
+
+       if ! test_have_prereq PERF_GREP_ENGINES_THREADS
+       then
+               test_expect_success "assert that all engines found the same for$GIT_PERF_7821_GREP_OPTS $pattern" '
+                       test_cmp out.fixed out.basic &&
+                       test_cmp out.fixed out.extended &&
+                       if test_have_prereq PCRE
+                       then
+                               test_cmp out.fixed out.perl
+                       fi
+               '
+       else
+               for threads in $GIT_PERF_GREP_THREADS
+               do
+                       test_expect_success PTHREADS "assert that all engines found the same for$GIT_PERF_7821_GREP_OPTS $pattern under threading" "
+                               test_cmp out.fixed.$threads out.basic.$threads &&
+                               test_cmp out.fixed.$threads out.extended.$threads &&
+                               if test_have_prereq PCRE
+                               then
+                                       test_cmp out.fixed.$threads out.perl.$threads
+                               fi
+                       "
+               done
+       fi
 done
 
 test_done
index 2361590d54856a1a284945e46fece2716487f624..438e778d6afa086e8823b2ac3d38c2a26f171dbd 100755 (executable)
@@ -7,10 +7,6 @@ test_description='Gettext Shell poison'
 
 . ./lib-gettext.sh
 
-test_expect_success GETTEXT_POISON "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '
-    test -n "$GIT_INTERNAL_GETTEXT_SH_SCHEME"
-'
-
 test_expect_success GETTEXT_POISON 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is poison' '
     test "$GIT_INTERNAL_GETTEXT_SH_SCHEME" = "poison"
 '
index af9b847761f3c25ddbda8d1e1e978d1a323fa561..a66936fe9bde2ba20ab0e57400b6286b0710212a 100755 (executable)
@@ -401,4 +401,42 @@ done <<\EOF
 0642 -rw-r---w-
 EOF
 
+test_expect_success POSIXPERM,SANITY 'graceful handling when splitting index is not allowed' '
+       test_create_repo ro &&
+       (
+               cd ro &&
+               test_commit initial &&
+               git update-index --split-index &&
+               test -f .git/sharedindex.*
+       ) &&
+       cp ro/.git/index new-index &&
+       test_when_finished "chmod u+w ro/.git" &&
+       chmod u-w ro/.git &&
+       GIT_INDEX_FILE="$(pwd)/new-index" git -C ro update-index --split-index &&
+       chmod u+w ro/.git &&
+       rm ro/.git/sharedindex.* &&
+       GIT_INDEX_FILE=new-index git ls-files >actual &&
+       echo initial.t >expected &&
+       test_cmp expected actual
+'
+
+test_expect_success 'writing split index with null sha1 does not write cache tree' '
+       git config core.splitIndex true &&
+       git config splitIndex.maxPercentChange 0 &&
+       git commit -m "commit" &&
+       {
+               git ls-tree HEAD &&
+               printf "160000 commit $_z40\\tbroken\\n"
+       } >broken-tree &&
+       echo "add broken entry" >msg &&
+
+       tree=$(git mktree <broken-tree) &&
+       test_tick &&
+       commit=$(git commit-tree $tree -p HEAD <msg) &&
+       git update-ref HEAD "$commit" &&
+       GIT_ALLOW_NULL_SHA1=1 git reset --hard &&
+       (test-dump-cache-tree >cache-tree.out || true) &&
+       test_line_count = 0 cache-tree.out
+'
+
 test_done
index 1bdf38e80dbe5322fc239371eb71b146a40586e0..78236dc7d851663c4488e7acae5e6997edd35f1c 100755 (executable)
@@ -25,6 +25,18 @@ test_expect_success 'git status' '
        test_cmp expect actual
 '
 
+test_expect_success 'git status with porcelain v2' '
+       git status --porcelain=v2 | grep -v "^?" >actual &&
+       nam1=d00491fd7e5bb6fa28c517a0bb32b8b506539d4d &&
+       nam2=ce013625030ba8dba906f756967f9e9ca394464a &&
+       cat >expect <<-EOF &&
+       1 DA N... 100644 000000 100644 $nam1 $_z40 1.t
+       1 A. N... 000000 100644 100644 $_z40 $nam2 elif
+       1 .A N... 000000 000000 100644 $_z40 $_z40 file
+       EOF
+       test_cmp expect actual
+'
+
 test_expect_success 'check result of "add -N"' '
        git ls-files -s file >actual &&
        empty=$(git hash-object --stdin </dev/null) &&
@@ -150,5 +162,65 @@ test_expect_success 'commit: ita entries ignored in empty commit check' '
        )
 '
 
+test_expect_success 'rename detection finds the right names' '
+       git init rename-detection &&
+       (
+               cd rename-detection &&
+               echo contents >first &&
+               git add first &&
+               git commit -m first &&
+               mv first third &&
+               git add -N third &&
+
+               git status | grep -v "^?" >actual.1 &&
+               test_i18ngrep "renamed: *first -> third" actual.1 &&
+
+               git status --porcelain | grep -v "^?" >actual.2 &&
+               cat >expected.2 <<-\EOF &&
+                R first -> third
+               EOF
+               test_cmp expected.2 actual.2 &&
+
+               hash=12f00e90b6ef79117ce6e650416b8cf517099b78 &&
+               git status --porcelain=v2 | grep -v "^?" >actual.3 &&
+               cat >expected.3 <<-EOF &&
+               2 .R N... 100644 100644 100644 $hash $hash R100 third   first
+               EOF
+               test_cmp expected.3 actual.3
+       )
+'
+
+test_expect_success 'double rename detection in status' '
+       git init rename-detection-2 &&
+       (
+               cd rename-detection-2 &&
+               echo contents >first &&
+               git add first &&
+               git commit -m first &&
+               git mv first second &&
+               mv second third &&
+               git add -N third &&
+
+               git status | grep -v "^?" >actual.1 &&
+               test_i18ngrep "renamed: *first -> second" actual.1 &&
+               test_i18ngrep "renamed: *second -> third" actual.1 &&
+
+               git status --porcelain | grep -v "^?" >actual.2 &&
+               cat >expected.2 <<-\EOF &&
+               R  first -> second
+                R second -> third
+               EOF
+               test_cmp expected.2 actual.2 &&
+
+               hash=12f00e90b6ef79117ce6e650416b8cf517099b78 &&
+               git status --porcelain=v2 | grep -v "^?" >actual.3 &&
+               cat >expected.3 <<-EOF &&
+               2 R. N... 100644 100644 100644 $hash $hash R100 second  first
+               2 .R N... 100644 100644 100644 $hash $hash R100 third   second
+               EOF
+               test_cmp expected.3 actual.3
+       )
+'
+
 test_done
 
index a49c12c79b28fac8545dffcbaba8e8905c8d6222..058698df6a4a9811b9db84fb5900472c47c61798 100755 (executable)
@@ -493,4 +493,52 @@ test_expect_success 'add -p works even with color.ui=always' '
        test_cmp expect actual
 '
 
+test_expect_success 'setup different kinds of dirty submodules' '
+       test_create_repo for-submodules &&
+       (
+               cd for-submodules &&
+               test_commit initial &&
+               test_create_repo dirty-head &&
+               (
+                       cd dirty-head &&
+                       test_commit initial
+               ) &&
+               cp -R dirty-head dirty-otherwise &&
+               cp -R dirty-head dirty-both-ways &&
+               git add dirty-head &&
+               git add dirty-otherwise dirty-both-ways &&
+               git commit -m initial &&
+
+               cd dirty-head &&
+               test_commit updated &&
+               cd ../dirty-both-ways &&
+               test_commit updated &&
+               echo dirty >>initial &&
+               : >untracked &&
+               cd ../dirty-otherwise &&
+               echo dirty >>initial &&
+               : >untracked
+       ) &&
+       git -C for-submodules diff-files --name-only >actual &&
+       cat >expected <<-\EOF &&
+       dirty-both-ways
+       dirty-head
+       dirty-otherwise
+       EOF
+       test_cmp expected actual &&
+       git -C for-submodules diff-files --name-only --ignore-submodules=dirty >actual &&
+       cat >expected <<-\EOF &&
+       dirty-both-ways
+       dirty-head
+       EOF
+       test_cmp expected actual
+'
+
+test_expect_success 'status ignores dirty submodules (except HEAD)' '
+       git -C for-submodules add -i </dev/null >output &&
+       grep dirty-head output &&
+       grep dirty-both-ways output &&
+       ! grep dirty-otherwise output
+'
+
 test_done
index 39c7f2ebd740db097d67b12a68fa35f3fa884fc8..aefde7b1726bdc8d71d2b78e313e29daa2b31a24 100755 (executable)
@@ -1064,4 +1064,36 @@ test_expect_success 'stash -k -- <pathspec> leaves unstaged files intact' '
        test foo,bar = $(cat foo),$(cat bar)
 '
 
+test_expect_success 'stash -- <subdir> leaves untracked files in subdir intact' '
+       git reset &&
+       >subdir/untracked &&
+       >subdir/tracked1 &&
+       >subdir/tracked2 &&
+       git add subdir/tracked* &&
+       git stash -- subdir/ &&
+       test_path_is_missing subdir/tracked1 &&
+       test_path_is_missing subdir/tracked2 &&
+       test_path_is_file subdir/untracked &&
+       git stash pop &&
+       test_path_is_file subdir/tracked1 &&
+       test_path_is_file subdir/tracked2 &&
+       test_path_is_file subdir/untracked
+'
+
+test_expect_success 'stash -- <subdir> works with binary files' '
+       git reset &&
+       >subdir/untracked &&
+       >subdir/tracked &&
+       cp "$TEST_DIRECTORY"/test-binary-1.png subdir/tracked-binary &&
+       git add subdir/tracked* &&
+       git stash -- subdir/ &&
+       test_path_is_missing subdir/tracked &&
+       test_path_is_missing subdir/tracked-binary &&
+       test_path_is_file subdir/untracked &&
+       git stash pop &&
+       test_path_is_file subdir/tracked &&
+       test_path_is_file subdir/tracked-binary &&
+       test_path_is_file subdir/untracked
+'
+
 test_done
index eadf4f62444350c711a313d2161c9fa17c7aa405..a07816d5605f30ccb7f7ce6fe83288fff535538c 100755 (executable)
@@ -134,11 +134,15 @@ test_expect_success 'favour same basenames over different ones' '
        git rm path1 &&
        mkdir subdir &&
        git mv another-path subdir/path1 &&
-       git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"'
+       git status >out &&
+       test_i18ngrep "renamed: .*path1 -> subdir/path1" out
+'
 
 test_expect_success 'favour same basenames even with minor differences' '
        git show HEAD:path1 | sed "s/15/16/" > subdir/path1 &&
-       git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"'
+       git status >out &&
+       test_i18ngrep "renamed: .*path1 -> subdir/path1" out
+'
 
 test_expect_success 'two files with same basename and same content' '
        git reset --hard &&
@@ -148,7 +152,8 @@ test_expect_success 'two files with same basename and same content' '
        git add dir &&
        git commit -m 2 &&
        git mv dir other-dir &&
-       git status | test_i18ngrep "renamed: .*dir/A/file -> other-dir/A/file"
+       git status >out &&
+       test_i18ngrep "renamed: .*dir/A/file -> other-dir/A/file" out
 '
 
 test_expect_success 'setup for many rename source candidates' '
index 668c54be41eb4fda17e9b43000081c7b374990c2..3debc87d4aefb2d0d5c77881a9485c06a2908858 100755 (executable)
@@ -222,12 +222,9 @@ test_expect_success 'fetch uses remote ref names to describe new refs' '
        (
                cd descriptive &&
                git fetch o 2>actual &&
-               grep " -> refs/crazyheads/descriptive-branch$" actual |
-               test_i18ngrep "new branch" &&
-               grep " -> descriptive-tag$" actual |
-               test_i18ngrep "new tag" &&
-               grep " -> crazy$" actual |
-               test_i18ngrep "new ref"
+               test_i18ngrep "new branch.* -> refs/crazyheads/descriptive-branch$" actual &&
+               test_i18ngrep "new tag.* -> descriptive-tag$" actual &&
+               test_i18ngrep "new ref.* -> crazy$" actual
        ) &&
        git checkout master
 '
index 2e42cf331648a8ba57b3806443e70b94b09eb382..644736b8a3b95c501bd8bb99850dd8de474b10d6 100755 (executable)
@@ -22,7 +22,7 @@ verify_stderr () {
        cat >expected &&
        # We're not interested in the error
        # "fatal: The remote end hung up unexpectedly":
-       test_i18ngrep -E '^(fatal|warning):' <error | grep -v 'hung up' >actual | sort &&
+       test_i18ngrep -E '^(fatal|warning):' error | grep -v 'hung up' >actual | sort &&
        test_i18ncmp expected actual
 }
 
index d38bf32470c592f89cbd31aa08a3c1de6fffe540..21340e89c9650e43fda9a6176c6fe814360edb8b 100755 (executable)
@@ -234,7 +234,7 @@ test_expect_success TTY 'push --no-progress silences progress but not status' '
        test_commit no-progress &&
        test_terminal git push --no-progress >output 2>&1 &&
        test_i18ngrep "^To http" output &&
-       test_i18ngrep ! "^Writing objects"
+       test_i18ngrep ! "^Writing objects" output
 '
 
 test_expect_success 'push --progress shows progress to non-tty' '
index a51b7e20d32158d4b6609ba954e2ed59edaa6342..f5721b4a59ea4a3333cc0e74d8ab9ad2f182dd5b 100755 (executable)
@@ -364,5 +364,38 @@ test_expect_success 'custom http headers' '
                submodule update sub
 '
 
+test_expect_success 'GIT_REDACT_COOKIES redacts cookies' '
+       rm -rf clone &&
+       echo "Set-Cookie: Foo=1" >cookies &&
+       echo "Set-Cookie: Bar=2" >>cookies &&
+       GIT_TRACE_CURL=true GIT_REDACT_COOKIES=Bar,Baz \
+               git -c "http.cookieFile=$(pwd)/cookies" clone \
+               $HTTPD_URL/smart/repo.git clone 2>err &&
+       grep "Cookie:.*Foo=1" err &&
+       grep "Cookie:.*Bar=<redacted>" err &&
+       ! grep "Cookie:.*Bar=2" err
+'
+
+test_expect_success 'GIT_REDACT_COOKIES handles empty values' '
+       rm -rf clone &&
+       echo "Set-Cookie: Foo=" >cookies &&
+       GIT_TRACE_CURL=true GIT_REDACT_COOKIES=Foo \
+               git -c "http.cookieFile=$(pwd)/cookies" clone \
+               $HTTPD_URL/smart/repo.git clone 2>err &&
+       grep "Cookie:.*Foo=<redacted>" err
+'
+
+test_expect_success 'GIT_TRACE_CURL_NO_DATA prevents data from being traced' '
+       rm -rf clone &&
+       GIT_TRACE_CURL=true \
+               git clone $HTTPD_URL/smart/repo.git clone 2>err &&
+       grep "=> Send data" err &&
+
+       rm -rf clone &&
+       GIT_TRACE_CURL=true GIT_TRACE_CURL_NO_DATA=1 \
+               git clone $HTTPD_URL/smart/repo.git clone 2>err &&
+       ! grep "=> Send data" err
+'
+
 stop_httpd
 test_done
index 225a022e8a8fe063bc9cb8b8b282323f95bb18e3..755b05a8ae9de940be8d9ad4c89473d836dcdf20 100755 (executable)
@@ -167,23 +167,48 @@ test_expect_success 'access repo via interpolated hostname' '
        git init --bare "$repo" &&
        git push "$repo" HEAD &&
        >"$repo"/git-daemon-export-ok &&
-       rm -rf tmp.git &&
        GIT_OVERRIDE_VIRTUAL_HOST=localhost \
-               git clone --bare "$GIT_DAEMON_URL/interp.git" tmp.git &&
-       rm -rf tmp.git &&
+               git ls-remote "$GIT_DAEMON_URL/interp.git" &&
        GIT_OVERRIDE_VIRTUAL_HOST=LOCALHOST \
-               git clone --bare "$GIT_DAEMON_URL/interp.git" tmp.git
+               git ls-remote "$GIT_DAEMON_URL/interp.git"
 '
 
 test_expect_success 'hostname cannot break out of directory' '
-       rm -rf tmp.git &&
        repo="$GIT_DAEMON_DOCUMENT_ROOT_PATH/../escape.git" &&
        git init --bare "$repo" &&
        git push "$repo" HEAD &&
        >"$repo"/git-daemon-export-ok &&
        test_must_fail \
                env GIT_OVERRIDE_VIRTUAL_HOST=.. \
-               git clone --bare "$GIT_DAEMON_URL/escape.git" tmp.git
+               git ls-remote "$GIT_DAEMON_URL/escape.git"
+'
+
+test_expect_success 'daemon log records all attributes' '
+       cat >expect <<-\EOF &&
+       Extended attribute "host": localhost
+       Extended attribute "protocol": version=1
+       EOF
+       >daemon.log &&
+       GIT_OVERRIDE_VIRTUAL_HOST=localhost \
+               git -c protocol.version=1 \
+                       ls-remote "$GIT_DAEMON_URL/interp.git" &&
+       grep -i extended.attribute daemon.log | cut -d" " -f2- >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success FAKENC 'hostname interpolation works after LF-stripping' '
+       {
+               printf "git-upload-pack /interp.git\n\0host=localhost" | packetize
+               printf "0000"
+       } >input &&
+       fake_nc "$GIT_DAEMON_HOST_PORT" <input >output &&
+       depacketize <output >output.raw &&
+
+       # just pick out the value of master, which avoids any protocol
+       # particulars
+       perl -lne "print \$1 if m{^(\\S+) refs/heads/master}" <output.raw >actual &&
+       git -C "$repo" rev-parse master >expect &&
+       test_cmp expect actual
 '
 
 stop_git_daemon
index 4435693bb2ca48d053003c87fccd8f8612d8b4a9..4a1a912e032983383a3449d60753ced741680153 100755 (executable)
@@ -7,46 +7,94 @@ test_description='test git clone to cleanup after failure
 
 This test covers the fact that if git clone fails, it should remove
 the directory it created, to avoid the user having to manually
-remove the directory before attempting a clone again.'
+remove the directory before attempting a clone again.
+
+Unless the directory already exists, in which case we clean up only what we
+wrote.
+'
 
 . ./test-lib.sh
 
-test_expect_success \
-    'clone of non-existent source should fail' \
-    'test_must_fail git clone foo bar'
+corrupt_repo () {
+       test_when_finished "rmdir foo/.git/objects.bak" &&
+       mkdir foo/.git/objects.bak/ &&
+       test_when_finished "mv foo/.git/objects.bak/* foo/.git/objects/" &&
+       mv foo/.git/objects/* foo/.git/objects.bak/
+}
 
-test_expect_success \
-    'failed clone should not leave a directory' \
-    '! test -d bar'
+test_expect_success 'clone of non-existent source should fail' '
+       test_must_fail git clone foo bar
+'
 
-# Need a repo to clone
-test_create_repo foo
+test_expect_success 'failed clone should not leave a directory' '
+       test_path_is_missing bar
+'
 
-# clone doesn't like it if there is no HEAD. Is that a bug?
-(cd foo && touch file && git add file && git commit -m 'add file' >/dev/null 2>&1)
+test_expect_success 'create a repo to clone' '
+       test_create_repo foo
+'
+
+test_expect_success 'create objects in repo for later corruption' '
+       test_commit -C foo file
+'
 
 # source repository given to git clone should be relative to the
 # current path not to the target dir
-test_expect_success \
-    'clone of non-existent (relative to $PWD) source should fail' \
-    'test_must_fail git clone ../foo baz'
+test_expect_success 'clone of non-existent (relative to $PWD) source should fail' '
+       test_must_fail git clone ../foo baz
+'
 
-test_expect_success \
-    'clone should work now that source exists' \
-    'git clone foo bar'
+test_expect_success 'clone should work now that source exists' '
+       git clone foo bar
+'
 
-test_expect_success \
-    'successful clone must leave the directory' \
-    'test -d bar'
+test_expect_success 'successful clone must leave the directory' '
+       test_path_is_dir bar
+'
 
 test_expect_success 'failed clone --separate-git-dir should not leave any directories' '
-       mkdir foo/.git/objects.bak/ &&
-       mv foo/.git/objects/* foo/.git/objects.bak/ &&
+       corrupt_repo &&
        test_must_fail git clone --separate-git-dir gitdir foo worktree &&
-       test_must_fail test -e gitdir &&
-       test_must_fail test -e worktree &&
-       mv foo/.git/objects.bak/* foo/.git/objects/ &&
-       rmdir foo/.git/objects.bak
+       test_path_is_missing gitdir &&
+       test_path_is_missing worktree
+'
+
+test_expect_success 'failed clone into empty leaves directory (vanilla)' '
+       mkdir -p empty &&
+       corrupt_repo &&
+       test_must_fail git clone foo empty &&
+       test_dir_is_empty empty
+'
+
+test_expect_success 'failed clone into empty leaves directory (bare)' '
+       mkdir -p empty &&
+       corrupt_repo &&
+       test_must_fail git clone --bare foo empty &&
+       test_dir_is_empty empty
+'
+
+test_expect_success 'failed clone into empty leaves directory (separate)' '
+       mkdir -p empty-git empty-wt &&
+       corrupt_repo &&
+       test_must_fail git clone --separate-git-dir empty-git foo empty-wt &&
+       test_dir_is_empty empty-git &&
+       test_dir_is_empty empty-wt
+'
+
+test_expect_success 'failed clone into empty leaves directory (separate, git)' '
+       mkdir -p empty-git &&
+       corrupt_repo &&
+       test_must_fail git clone --separate-git-dir empty-git foo no-wt &&
+       test_dir_is_empty empty-git &&
+       test_path_is_missing no-wt
+'
+
+test_expect_success 'failed clone into empty leaves directory (separate, wt)' '
+       mkdir -p empty-wt &&
+       corrupt_repo &&
+       test_must_fail git clone --separate-git-dir no-git foo empty-wt &&
+       test_path_is_missing no-git &&
+       test_dir_is_empty empty-wt
 '
 
 test_done
index d911afd24cd7d43fc412adb34144b90b66082b73..872788ac8ca4ecc0a54c14a04e3f72661306f1d3 100755 (executable)
@@ -20,10 +20,7 @@ test_expect_success 'curl redirects respect whitelist' '
        test_must_fail env GIT_ALLOW_PROTOCOL=http:https \
                           GIT_SMART_HTTP=0 \
                git clone "$HTTPD_URL/ftp-redir/repo.git" 2>stderr &&
-       {
-               test_i18ngrep "ftp.*disabled" stderr ||
-               test_i18ngrep "your curl version is too old"
-       }
+       test_i18ngrep -E "(ftp.*disabled|your curl version is too old)" stderr
 '
 
 test_expect_success 'curl limits redirects' '
index 05ebba7afa29977196370d178af728ec1d0d9a81..c01f721f13dba71fae681d6ba5100e02e58de4d8 100755 (executable)
@@ -242,10 +242,12 @@ test_expect_success 'merge of identical changes in a renamed file' '
        rm -f A M N &&
        git reset --hard &&
        git checkout change+rename &&
-       GIT_MERGE_VERBOSITY=3 git merge change | test_i18ngrep "^Skipped B" &&
+       GIT_MERGE_VERBOSITY=3 git merge change >out &&
+       test_i18ngrep "^Skipped B" out &&
        git reset --hard HEAD^ &&
        git checkout change &&
-       GIT_MERGE_VERBOSITY=3 git merge change+rename | test_i18ngrep "^Skipped B"
+       GIT_MERGE_VERBOSITY=3 git merge change+rename >out &&
+       test_i18ngrep "^Skipped B" out
 '
 
 test_expect_success 'setup for rename + d/f conflicts' '
index 3889eca4ae8524cd62eaf45b4d7a2394e53da429..0aebc6c028e06c8d98600ecbe37c0b0989a89bd8 100755 (executable)
@@ -73,4 +73,36 @@ test_expect_success 'pull passes -X to underlying merge' '
        git reset --hard master && test_must_fail git pull -s recursive -X bork . side
 '
 
+test_expect_success SYMLINKS 'symlink with -Xours/-Xtheirs' '
+       git reset --hard master &&
+       git checkout -b two master &&
+       ln -s target-zero link &&
+       git add link &&
+       git commit -m "add link pointing to zero" &&
+
+       ln -f -s target-two link &&
+       git commit -m "add link pointing to two" link &&
+
+       git checkout -b one HEAD^ &&
+       ln -f -s target-one link &&
+       git commit -m "add link pointing to one" link &&
+
+       # we expect symbolic links not to resolve automatically, of course
+       git checkout one^0 &&
+       test_must_fail git merge -s recursive two &&
+
+       # favor theirs to resolve to target-two?
+       git reset --hard &&
+       git checkout one^0 &&
+       git merge -s recursive -X theirs two &&
+       git diff --exit-code two HEAD link &&
+
+       # favor ours to resolve to target-one?
+       git reset --hard &&
+       git checkout one^0 &&
+       git merge -s recursive -X ours two &&
+       git diff --exit-code one HEAD link
+
+'
+
 test_done
index 3e3fb462a098c01c72270acbb276abd2df225a66..a5d901502414f25616a474152ee0f5816465bd37 100755 (executable)
@@ -122,7 +122,7 @@ test_expect_success 'describe --contains defaults to HEAD without commit-ish' '
 '
 
 : >err.expect
-check_describe A --all A^0
+check_describe tags/A --all A^0
 test_expect_success 'no warning was displayed for A' '
        test_cmp err.expect err.actual
 '
@@ -374,4 +374,8 @@ test_expect_success ULIMIT_STACK_SIZE 'describe works in a deep repo' '
        test_cmp expect actual
 '
 
+check_describe tags/A --all A
+check_describe tags/c --all c
+check_describe heads/branch_A --all --match='branch_*' branch_A
+
 test_done
index 1d33c5feb3e23744a5709e2f9bf429d23f49101f..170b4810e052cc8092cea4ead4f3c098707f0f38 100755 (executable)
@@ -272,6 +272,14 @@ test_expect_success 'commit --fixup provides correct one-line commit message' '
        commit_msg_is "fixup! target message subject line"
 '
 
+test_expect_success 'commit --fixup -m"something" -m"extra"' '
+       commit_for_rebase_autosquash_setup &&
+       git commit --fixup HEAD~1 -m"something" -m"extra" &&
+       commit_msg_is "fixup! target message subject linesomething
+
+extra"
+'
+
 test_expect_success 'commit --squash works with -F' '
        commit_for_rebase_autosquash_setup &&
        echo "log message from file" >msgfile &&
@@ -325,7 +333,6 @@ test_expect_success 'invalid message options when using --fixup' '
        test_must_fail git commit --fixup HEAD~1 --squash HEAD~2 &&
        test_must_fail git commit --fixup HEAD~1 -C HEAD~2 &&
        test_must_fail git commit --fixup HEAD~1 -c HEAD~2 &&
-       test_must_fail git commit --fixup HEAD~1 -m "cmdline message" &&
        test_must_fail git commit --fixup HEAD~1 -F log
 '
 
index 4d261c2a9c2a8081b07ee8db39d0983f0a470341..81869d89133a55b8e2d1fe676ff217636466f66f 100755 (executable)
@@ -6,6 +6,12 @@ test_description='git send-email'
 # May be altered later in the test
 PREREQ="PERL"
 
+replace_variable_fields () {
+       sed     -e "s/^\(Date:\).*/\1 DATE-STRING/" \
+               -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
+               -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/"
+}
+
 test_expect_success $PREREQ 'prepare reference tree' '
        echo "1A quick brown fox jumps over the" >file &&
        echo "lazy dog" >>file &&
@@ -296,10 +302,7 @@ test_expect_success $PREREQ 'Show all headers' '
                --bcc=bcc@example.com \
                --in-reply-to="<unique-message-id@example.com>" \
                --smtp-server relay.example.com \
-               $patches |
-       sed     -e "s/^\(Date:\).*/\1 DATE-STRING/" \
-               -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
-               -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
+               $patches | replace_variable_fields \
                >actual-show-all-headers &&
        test_cmp expected-show-all-headers actual-show-all-headers
 '
@@ -554,12 +557,6 @@ Result: OK
 EOF
 "
 
-replace_variable_fields () {
-       sed     -e "s/^\(Date:\).*/\1 DATE-STRING/" \
-               -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
-               -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/"
-}
-
 test_suppression () {
        git send-email \
                --dry-run \
index 1701fe2a06057530d845b91b4fd4cce99b4521a2..8a8a9329eeaa322121ecdbb3cd1f5fa6c9ecc94c 100644 (file)
@@ -610,6 +610,14 @@ list_contains () {
 #
 # Writing this as "! git checkout ../outerspace" is wrong, because
 # the failure could be due to a segv.  We want a controlled failure.
+#
+# Accepts the following options:
+#
+#   ok=<signal-name>[,<...>]:
+#     Don't treat an exit caused by the given signal as error.
+#     Multiple signals can be specified as a comma separated list.
+#     Currently recognized signal names are: sigpipe, success.
+#     (Don't use 'success', use 'test_might_fail' instead.)
 
 test_must_fail () {
        case "$1" in
@@ -656,6 +664,8 @@ test_must_fail () {
 #
 # Writing "git config --unset all.configuration || :" would be wrong,
 # because we want to notice if it fails due to segv.
+#
+# Accepts the same options as test_must_fail.
 
 test_might_fail () {
        test_must_fail ok=success "$@"
@@ -705,6 +715,60 @@ test_cmp_bin() {
        cmp "$@"
 }
 
+# Use this instead of test_cmp to compare files that contain expected and
+# actual output from git commands that can be translated.  When running
+# under GETTEXT_POISON this pretends that the command produced expected
+# results.
+test_i18ncmp () {
+       test -n "$GETTEXT_POISON" || test_cmp "$@"
+}
+
+# Use this instead of "grep expected-string actual" to see if the
+# output from a git command that can be translated either contains an
+# expected string, or does not contain an unwanted one.  When running
+# under GETTEXT_POISON this pretends that the command produced expected
+# results.
+test_i18ngrep () {
+       eval "last_arg=\${$#}"
+
+       test -f "$last_arg" ||
+       error "bug in the test script: test_i18ngrep requires a file" \
+             "to read as the last parameter"
+
+       if test $# -lt 2 ||
+          { test "x!" = "x$1" && test $# -lt 3 ; }
+       then
+               error "bug in the test script: too few parameters to test_i18ngrep"
+       fi
+
+       if test -n "$GETTEXT_POISON"
+       then
+               # pretend success
+               return 0
+       fi
+
+       if test "x!" = "x$1"
+       then
+               shift
+               ! grep "$@" && return 0
+
+               echo >&2 "error: '! grep $@' did find a match in:"
+       else
+               grep "$@" && return 0
+
+               echo >&2 "error: 'grep $@' didn't find a match in:"
+       fi
+
+       if test -s "$last_arg"
+       then
+               cat >&2 "$last_arg"
+       else
+               echo >&2 "<File '$last_arg' is empty>"
+       fi
+
+       return 1
+}
+
 # Call any command "$@" but be more verbose about its
 # failure. This is handy for commands like "test" which do
 # not output anything when they fail.
@@ -1020,3 +1084,37 @@ nongit () {
                "$@"
        )
 }
+
+# convert stdin to pktline representation; note that empty input becomes an
+# empty packet, not a flush packet (for that you can just print 0000 yourself).
+packetize() {
+       cat >packetize.tmp &&
+       len=$(wc -c <packetize.tmp) &&
+       printf '%04x%s' "$(($len + 4))" &&
+       cat packetize.tmp &&
+       rm -f packetize.tmp
+}
+
+# Parse the input as a series of pktlines, writing the result to stdout.
+# Sideband markers are removed automatically, and the output is routed to
+# stderr if appropriate.
+#
+# NUL bytes are converted to "\\0" for ease of parsing with text tools.
+depacketize () {
+       perl -e '
+               while (read(STDIN, $len, 4) == 4) {
+                       if ($len eq "0000") {
+                               print "FLUSH\n";
+                       } else {
+                               read(STDIN, $buf, hex($len) - 4);
+                               $buf =~ s/\0/\\0/g;
+                               if ($buf =~ s/^[\x2\x3]//) {
+                                       print STDERR $buf;
+                               } else {
+                                       $buf =~ s/^\x1//;
+                                       print $buf;
+                               }
+                       }
+               }
+       '
+}
index 9a0a21f49ae7bef3d0a1b653cce811d12499672e..852b22c80ab4c38183391813c333185e6050a664 100644 (file)
@@ -1062,32 +1062,6 @@ else
        test_set_prereq C_LOCALE_OUTPUT
 fi
 
-# Use this instead of test_cmp to compare files that contain expected and
-# actual output from git commands that can be translated.  When running
-# under GETTEXT_POISON this pretends that the command produced expected
-# results.
-test_i18ncmp () {
-       test -n "$GETTEXT_POISON" || test_cmp "$@"
-}
-
-# Use this instead of "grep expected-string actual" to see if the
-# output from a git command that can be translated either contains an
-# expected string, or does not contain an unwanted one.  When running
-# under GETTEXT_POISON this pretends that the command produced expected
-# results.
-test_i18ngrep () {
-       if test -n "$GETTEXT_POISON"
-       then
-           : # pretend success
-       elif test "x!" = "x$1"
-       then
-               shift
-               ! grep "$@"
-       else
-               grep "$@"
-       fi
-}
-
 test_lazy_prereq PIPE '
        # test whether the filesystem supports FIFOs
        test_have_prereq !MINGW,!CYGWIN &&
index bf8b6029013c31000d83d6292f83ce0d0021d5d4..96c3327f19de4b1060ed43ef291a57a76ff2b8cc 100644 (file)
@@ -2139,6 +2139,9 @@ int oneway_merge(const struct cache_entry * const *src,
                            ie_match_stat(o->src_index, old, &st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE))
                                update |= CE_UPDATE;
                }
+               if (o->update && S_ISGITLINK(old->ce_mode) &&
+                   should_update_submodules() && !verify_uptodate(old, o))
+                       update |= CE_UPDATE;
                add_entry(o, old, update, 0);
                return 0;
        }
index ef26f0744632fdcca919e68ffc58bf414b29e597..f5debcd2b4f05c50d5e70efc95d10d95ca6372cd 100644 (file)
@@ -360,8 +360,6 @@ static void wt_longstatus_print_change_data(struct wt_status *s,
        switch (change_type) {
        case WT_STATUS_UPDATED:
                status = d->index_status;
-               if (d->head_path)
-                       one_name = d->head_path;
                break;
        case WT_STATUS_CHANGED:
                if (d->new_submodule_commits || d->dirty_submodule) {
@@ -382,6 +380,14 @@ static void wt_longstatus_print_change_data(struct wt_status *s,
                    change_type);
        }
 
+       /*
+        * Only pick up the rename it's relevant. If the rename is for
+        * the changed section and we're printing the updated section,
+        * ignore it.
+        */
+       if (d->rename_status == status)
+               one_name = d->rename_source;
+
        one = quote_path(one_name, s->prefix, &onebuf);
        two = quote_path(two_name, s->prefix, &twobuf);
 
@@ -391,7 +397,7 @@ static void wt_longstatus_print_change_data(struct wt_status *s,
                die("BUG: unhandled diff status %c", status);
        len = label_width - utf8_strwidth(what);
        assert(len >= 0);
-       if (status == DIFF_STATUS_COPIED || status == DIFF_STATUS_RENAMED)
+       if (one_name != two_name)
                status_printf_more(s, c, "%s%.*s%s -> %s",
                                   what, len, padding, one, two);
        else
@@ -406,7 +412,8 @@ static void wt_longstatus_print_change_data(struct wt_status *s,
        strbuf_release(&twobuf);
 }
 
-static char short_submodule_status(struct wt_status_change_data *d) {
+static char short_submodule_status(struct wt_status_change_data *d)
+{
        if (d->new_submodule_commits)
                return 'M';
        if (d->dirty_submodule & DIRTY_SUBMODULE_MODIFIED)
@@ -432,7 +439,7 @@ static void wt_status_collect_changed_cb(struct diff_queue_struct *q,
                struct wt_status_change_data *d;
 
                p = q->queue[i];
-               it = string_list_insert(&s->change, p->one->path);
+               it = string_list_insert(&s->change, p->two->path);
                d = it->util;
                if (!d) {
                        d = xcalloc(1, sizeof(*d));
@@ -459,6 +466,14 @@ static void wt_status_collect_changed_cb(struct diff_queue_struct *q,
                        /* mode_worktree is zero for a delete. */
                        break;
 
+               case DIFF_STATUS_COPIED:
+               case DIFF_STATUS_RENAMED:
+                       if (d->rename_status)
+                               die("BUG: multiple renames on the same target? how?");
+                       d->rename_source = xstrdup(p->one->path);
+                       d->rename_score = p->score * 100 / MAX_SCORE;
+                       d->rename_status = p->status;
+                       /* fallthru */
                case DIFF_STATUS_MODIFIED:
                case DIFF_STATUS_TYPE_CHANGED:
                case DIFF_STATUS_UNMERGED:
@@ -467,8 +482,8 @@ static void wt_status_collect_changed_cb(struct diff_queue_struct *q,
                        oidcpy(&d->oid_index, &p->one->oid);
                        break;
 
-               case DIFF_STATUS_UNKNOWN:
-                       die("BUG: worktree status unknown???");
+               default:
+                       die("BUG: unhandled diff-files status '%c'", p->status);
                        break;
                }
 
@@ -530,8 +545,11 @@ static void wt_status_collect_updated_cb(struct diff_queue_struct *q,
 
                case DIFF_STATUS_COPIED:
                case DIFF_STATUS_RENAMED:
-                       d->head_path = xstrdup(p->one->path);
-                       d->score = p->score * 100 / MAX_SCORE;
+                       if (d->rename_status)
+                               die("BUG: multiple renames on the same target? how?");
+                       d->rename_source = xstrdup(p->one->path);
+                       d->rename_score = p->score * 100 / MAX_SCORE;
+                       d->rename_status = p->status;
                        /* fallthru */
                case DIFF_STATUS_MODIFIED:
                case DIFF_STATUS_TYPE_CHANGED:
@@ -548,6 +566,10 @@ static void wt_status_collect_updated_cb(struct diff_queue_struct *q,
                         * values in these fields.
                         */
                        break;
+
+               default:
+                       die("BUG: unhandled diff-index status '%c'", p->status);
+                       break;
                }
        }
 }
@@ -602,7 +624,7 @@ static void wt_status_collect_changes_index(struct wt_status *s)
        rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
        rev.diffopt.format_callback = wt_status_collect_updated_cb;
        rev.diffopt.format_callback_data = s;
-       rev.diffopt.detect_rename = 1;
+       rev.diffopt.detect_rename = DIFF_DETECT_RENAME;
        rev.diffopt.rename_limit = 200;
        rev.diffopt.break_opt = 0;
        copy_pathspec(&rev.prune_data, &s->pathspec);
@@ -962,7 +984,7 @@ static void wt_longstatus_print_verbose(struct wt_status *s)
        setup_revisions(0, NULL, &rev, &opt);
 
        rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
-       rev.diffopt.detect_rename = 1;
+       rev.diffopt.detect_rename = DIFF_DETECT_RENAME;
        rev.diffopt.file = s->fp;
        rev.diffopt.close_file = 0;
        /*
@@ -1719,13 +1741,14 @@ static void wt_shortstatus_status(struct string_list_item *it,
        putchar(' ');
        if (s->null_termination) {
                fprintf(stdout, "%s%c", it->string, 0);
-               if (d->head_path)
-                       fprintf(stdout, "%s%c", d->head_path, 0);
+               if (d->rename_source)
+                       fprintf(stdout, "%s%c", d->rename_source, 0);
        } else {
                struct strbuf onebuf = STRBUF_INIT;
                const char *one;
-               if (d->head_path) {
-                       one = quote_path(d->head_path, s->prefix, &onebuf);
+
+               if (d->rename_source) {
+                       one = quote_path(d->rename_source, s->prefix, &onebuf);
                        if (*one != '"' && strchr(one, ' ') != NULL) {
                                putchar('"');
                                strbuf_addch(&onebuf, '"');
@@ -2030,10 +2053,10 @@ static void wt_porcelain_v2_print_changed_entry(
        struct wt_status *s)
 {
        struct wt_status_change_data *d = it->util;
-       struct strbuf buf_index = STRBUF_INIT;
-       struct strbuf buf_head = STRBUF_INIT;
-       const char *path_index = NULL;
-       const char *path_head = NULL;
+       struct strbuf buf = STRBUF_INIT;
+       struct strbuf buf_from = STRBUF_INIT;
+       const char *path = NULL;
+       const char *path_from = NULL;
        char key[3];
        char submodule_token[5];
        char sep_char, eol_char;
@@ -2052,8 +2075,8 @@ static void wt_porcelain_v2_print_changed_entry(
                 */
                sep_char = '\0';
                eol_char = '\0';
-               path_index = it->string;
-               path_head = d->head_path;
+               path = it->string;
+               path_from = d->rename_source;
        } else {
                /*
                 * Path(s) are C-quoted if necessary. Current path is ALWAYS first.
@@ -2063,27 +2086,27 @@ static void wt_porcelain_v2_print_changed_entry(
                 */
                sep_char = '\t';
                eol_char = '\n';
-               path_index = quote_path(it->string, s->prefix, &buf_index);
-               if (d->head_path)
-                       path_head = quote_path(d->head_path, s->prefix, &buf_head);
+               path = quote_path(it->string, s->prefix, &buf);
+               if (d->rename_source)
+                       path_from = quote_path(d->rename_source, s->prefix, &buf_from);
        }
 
-       if (path_head)
+       if (path_from)
                fprintf(s->fp, "2 %s %s %06o %06o %06o %s %s %c%d %s%c%s%c",
                                key, submodule_token,
                                d->mode_head, d->mode_index, d->mode_worktree,
                                oid_to_hex(&d->oid_head), oid_to_hex(&d->oid_index),
-                               key[0], d->score,
-                               path_index, sep_char, path_head, eol_char);
+                               d->rename_status, d->rename_score,
+                               path, sep_char, path_from, eol_char);
        else
                fprintf(s->fp, "1 %s %s %06o %06o %06o %s %s %s%c",
                                key, submodule_token,
                                d->mode_head, d->mode_index, d->mode_worktree,
                                oid_to_hex(&d->oid_head), oid_to_hex(&d->oid_index),
-                               path_index, eol_char);
+                               path, eol_char);
 
-       strbuf_release(&buf_index);
-       strbuf_release(&buf_head);
+       strbuf_release(&buf);
+       strbuf_release(&buf_from);
 }
 
 /*
index fe27b465e220bb720dfd0b4d52ddeae74a942707..3f84d5c29ff270596a894e2d42843b03d7aa37c5 100644 (file)
@@ -44,10 +44,11 @@ struct wt_status_change_data {
        int worktree_status;
        int index_status;
        int stagemask;
-       int score;
        int mode_head, mode_index, mode_worktree;
        struct object_id oid_head, oid_index;
-       char *head_path;
+       int rename_status;
+       int rename_score;
+       char *rename_source;
        unsigned dirty_submodule       : 2;
        unsigned new_submodule_commits : 1;
 };