Imported Upstream version 2.9.3 upstream/2.9.3
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 3 Mar 2021 06:15:52 +0000 (15:15 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 3 Mar 2021 06:15:52 +0000 (15:15 +0900)
185 files changed:
.gitattributes
.travis.yml
Documentation/CodingGuidelines
Documentation/RelNotes/2.9.3.txt [new file with mode: 0644]
Documentation/config.txt
Documentation/diff-config.txt
Documentation/diff-format.txt
Documentation/diff-generate-patch.txt
Documentation/diff-options.txt
Documentation/fetch-options.txt
Documentation/git-am.txt
Documentation/git-bisect.txt
Documentation/git-branch.txt
Documentation/git-cat-file.txt
Documentation/git-checkout.txt
Documentation/git-cherry-pick.txt
Documentation/git-clean.txt
Documentation/git-commit-tree.txt
Documentation/git-commit.txt
Documentation/git-config.txt
Documentation/git-credential-store.txt
Documentation/git-cvsimport.txt
Documentation/git-cvsserver.txt
Documentation/git-daemon.txt
Documentation/git-describe.txt
Documentation/git-diff-index.txt
Documentation/git-diff-tree.txt
Documentation/git-difftool.txt
Documentation/git-fast-import.txt
Documentation/git-fetch-pack.txt
Documentation/git-filter-branch.txt
Documentation/git-for-each-ref.txt
Documentation/git-fsck.txt
Documentation/git-grep.txt
Documentation/git-gui.txt
Documentation/git-help.txt
Documentation/git-http-push.txt
Documentation/git-interpret-trailers.txt
Documentation/git-ls-files.txt
Documentation/git-ls-tree.txt
Documentation/git-mktree.txt
Documentation/git-mv.txt
Documentation/git-notes.txt
Documentation/git-p4.txt
Documentation/git-push.txt
Documentation/git-rebase.txt
Documentation/git-remote.txt
Documentation/git-repack.txt
Documentation/git-revert.txt
Documentation/git-send-email.txt
Documentation/git-send-pack.txt
Documentation/git-shell.txt
Documentation/git-show-branch.txt
Documentation/git-show-ref.txt
Documentation/git-svn.txt
Documentation/git-tag.txt
Documentation/git-update-index.txt
Documentation/git-web--browse.txt
Documentation/git.txt
Documentation/gitattributes.txt
Documentation/gitcore-tutorial.txt
Documentation/gitdiffcore.txt
Documentation/gitk.txt
Documentation/gitmodules.txt
Documentation/gitremote-helpers.txt
Documentation/howto/new-command.txt
Documentation/rev-list-options.txt
Documentation/revisions.txt
Documentation/technical/api-hashmap.txt
Documentation/technical/pack-protocol.txt
GIT-VERSION-GEN
Makefile
RelNotes
builtin/am.c
builtin/blame.c
builtin/cat-file.c
builtin/commit.c
builtin/fmt-merge-msg.c
builtin/fsck.c
builtin/gc.c
builtin/grep.c
builtin/index-pack.c
builtin/pack-objects.c
builtin/reset.c
builtin/rev-parse.c
builtin/revert.c
builtin/rm.c
cache-tree.c
cache.h
color.h
commit.c
commit.h
compat/mingw.h
compat/nedmalloc/nedmalloc.c
config.mak.uname
configure.ac
contrib/completion/git-completion.bash
contrib/persistent-https/Makefile
contrib/subtree/git-subtree.sh
contrib/subtree/t/t7900-subtree.sh
daemon.c
diff.c
diffcore-pickaxe.c
dir.c
gettext.c
gettext.h
git-difftool.perl
git-rebase--interactive.sh
git-submodule.sh
gitweb/gitweb.perl
grep.c
grep.h
http-push.c
http.c
ident.c
notes-merge.c
pack-check.c
pack.h
parse-options-cb.c
parse-options.h
path.c
pretty.c
quote.c
quote.h
revision.c
send-pack.c
sequencer.c
sha1_file.c
sideband.c
sideband.h
strbuf.c
strbuf.h
submodule-config.c
t/helper/test-regex.c
t/helper/test-run-command.c
t/helper/test-submodule-config.c
t/lib-git-daemon.sh
t/t0000-basic.sh
t/t0005-signals.sh
t/t0021-conversion.sh
t/t0070-fundamental.sh
t/t1011-read-tree-sparse-checkout.sh
t/t1050-large.sh
t/t1100-commit-tree-options.sh
t/t1700-split-index.sh
t/t2203-add-intent.sh
t/t3102-ls-tree-wildcards.sh
t/t3404-rebase-interactive.sh
t/t3420-rebase-autostash.sh
t/t3427-rebase-subtree.sh [new file with mode: 0755]
t/t4010-diff-pathspec.sh
t/t4033-diff-patience.sh
t/t4054-diff-bogus-tree.sh
t/t4130-apply-criss-cross-rename.sh
t/t4202-log.sh
t/t4205-log-pretty-formats.sh
t/t5504-fetch-receive-strict.sh
t/t5541-http-push-smart.sh
t/t7011-skip-worktree-reading.sh
t/t7012-skip-worktree-writing.sh
t/t7060-wtstatus.sh
t/t7063-status-untracked-cache.sh
t/t7411-submodule-config.sh
t/t7508-status.sh
t/t7512-status-help.sh
t/t7607-merge-overwrite.sh
t/t7609-merge-co-error-msgs.sh
t/t7610-mergetool.sh
t/t7800-difftool.sh
t/t7810-grep.sh
t/t7812-grep-icase-non-ascii.sh [new file with mode: 0755]
t/t7813-grep-icase-iso.sh [new file with mode: 0755]
t/t8003-blame-corner-cases.sh
t/t8008-blame-formats.sh
t/test-lib-functions.sh
t/test-lib.sh
transport.c
unpack-trees.c
upload-pack.c
worktree.c
wrapper.c
write_or_die.c
wt-status.c
xdiff/xpatience.c
xdiff/xutils.c

index 5e98806..320e33c 100644 (file)
@@ -1,3 +1,3 @@
 * whitespace=!indent,trail,space
-*.[ch] whitespace=indent,trail,space
+*.[ch] whitespace=indent,trail,space diff=cpp
 *.sh whitespace=indent,trail,space
index c2b76f9..477c3d2 100644 (file)
@@ -19,6 +19,7 @@ addons:
     packages:
     - language-pack-is
     - git-svn
+    - apache2
 
 env:
   global:
@@ -31,6 +32,7 @@ env:
     - DEFAULT_TEST_TARGET=prove
     - GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
     - GIT_TEST_OPTS="--verbose --tee"
+    - GIT_TEST_HTTPD=true
     - GIT_TEST_CLONE_2GB=YesPlease
     # t9810 occasionally fails on Travis CI OS X
     # t9816 occasionally fails with "TAP out of sequence errors" on Travis CI OS X
index 7f4769a..4cd95da 100644 (file)
@@ -527,12 +527,13 @@ Writing Documentation:
  or commands:
 
  Literal examples (e.g. use of command-line options, command names,
- configuration and environment variables) must be typeset in monospace (i.e.
- wrapped with backticks):
+ branch names, configuration and environment variables) must be
typeset in monospace (i.e. wrapped with backticks):
    `--pretty=oneline`
    `git rev-list`
    `remote.pushDefault`
    `GIT_DIR`
+   `HEAD`
 
  An environment variable must be prefixed with "$" only when referring to its
  value and not when referring to the variable itself, in this case there is
diff --git a/Documentation/RelNotes/2.9.3.txt b/Documentation/RelNotes/2.9.3.txt
new file mode 100644 (file)
index 0000000..695b86f
--- /dev/null
@@ -0,0 +1,170 @@
+Git v2.9.3 Release Notes
+========================
+
+Fixes since v2.9.2
+------------------
+
+ * A helper function that takes the contents of a commit object and
+   finds its subject line did not ignore leading blank lines, as is
+   commonly done by other codepaths.  Make it ignore leading blank
+   lines to match.
+
+ * Git does not know what the contents in the index should be for a
+   path added with "git add -N" yet, so "git grep --cached" should not
+   show hits (or show lack of hits, with -L) in such a path, but that
+   logic does not apply to "git grep", i.e. searching in the working
+   tree files.  But we did so by mistake, which has been corrected.
+
+ * "git rebase -i --autostash" did not restore the auto-stashed change
+   when the operation was aborted.
+
+ * "git commit --amend --allow-empty-message -S" for a commit without
+   any message body could have misidentified where the header of the
+   commit object ends.
+
+ * More mark-up updates to typeset strings that are expected to
+   literally typed by the end user in fixed-width font.
+
+ * For a long time, we carried an in-code comment that said our
+   colored output would work only when we use fprintf/fputs on
+   Windows, which no longer is the case for the past few years.
+
+ * "gc.autoPackLimit" when set to 1 should not trigger a repacking
+   when there is only one pack, but the code counted poorly and did
+   so.
+
+ * One part of "git am" had an oddball helper function that called
+   stuff from outside "his" as opposed to calling what we have "ours",
+   which was not gender-neutral and also inconsistent with the rest of
+   the system where outside stuff is usuall called "theirs" in
+   contrast to "ours".
+
+ * The test framework learned a new helper test_match_signal to
+   check an exit code from getting killed by an expected signal.
+
+ * "git blame -M" missed a single line that was moved within the file.
+
+ * Fix recently introduced codepaths that are involved in parallel
+   submodule operations, which gave up on reading too early, and
+   could have wasted CPU while attempting to write under a corner
+   case condition.
+
+ * "git grep -i" has been taught to fold case in non-ascii locales
+   correctly.
+
+ * A test that unconditionally used "mktemp" learned that the command
+   is not necessarily available everywhere.
+
+ * "git blame file" allowed the lineage of lines in the uncommitted,
+   unadded contents of "file" to be inspected, but it refused when
+   "file" did not appear in the current commit.  When "file" was
+   created by renaming an existing file (but the change has not been
+   committed), this restriction was unnecessarily tight.
+
+ * "git add -N dir/file && git write-tree" produced an incorrect tree
+   when there are other paths in the same directory that sorts after
+   "file".
+
+ * "git fetch http://user:pass@host/repo..." scrubbed the userinfo
+   part, but "git push" didn't.
+
+ * An age old bug that caused "git diff --ignore-space-at-eol"
+   misbehave has been fixed.
+
+ * "git notes merge" had a code to see if a path exists (and fails if
+   it does) and then open the path for writing (when it doesn't).
+   Replace it with open with O_EXCL.
+
+ * "git pack-objects" and "git index-pack" mostly operate with off_t
+   when talking about the offset of objects in a packfile, but there
+   were a handful of places that used "unsigned long" to hold that
+   value, leading to an unintended truncation.
+
+ * Recent update to "git daemon" tries to enable the socket-level
+   KEEPALIVE, but when it is spawned via inetd, the standard input
+   file descriptor may not necessarily be connected to a socket.
+   Suppress an ENOTSOCK error from setsockopt().
+
+ * Recent FreeBSD stopped making perl available at /usr/bin/perl;
+   switch the default the built-in path to /usr/local/bin/perl on not
+   too ancient FreeBSD releases.
+
+ * "git status" learned to suggest "merge --abort" during a conflicted
+   merge, just like it already suggests "rebase --abort" during a
+   conflicted rebase.
+
+ * The .c/.h sources are marked as such in our .gitattributes file so
+   that "git diff -W" and friends would work better.
+
+ * Existing autoconf generated test for the need to link with pthread
+   library did not check all the functions from pthread libraries;
+   recent FreeBSD has some functions in libc but not others, and we
+   mistakenly thought linking with libc is enough when it is not.
+
+ * Allow http daemon tests in Travis CI tests.
+
+ * Users of the parse_options_concat() API function need to allocate
+   extra slots in advance and fill them with OPT_END() when they want
+   to decide the set of supported options dynamically, which makes the
+   code error-prone and hard to read.  This has been corrected by tweaking
+   the API to allocate and return a new copy of "struct option" array.
+
+ * The use of strbuf in "git rm" to build filename to remove was a bit
+   suboptimal, which has been fixed.
+
+ * "git commit --help" said "--no-verify" is only about skipping the
+   pre-commit hook, and failed to say that it also skipped the
+   commit-msg hook.
+
+ * "git merge" in Git v2.9 was taught to forbid merging an unrelated
+   lines of history by default, but that is exactly the kind of thing
+   the "--rejoin" mode of "git subtree" (in contrib/) wants to do.
+   "git subtree" has been taught to use the "--allow-unrelated-histories"
+   option to override the default.
+
+ * The build procedure for "git persistent-https" helper (in contrib/)
+   has been updated so that it can be built with more recent versions
+   of Go.
+
+ * There is an optimization used in "git diff $treeA $treeB" to borrow
+   an already checked-out copy in the working tree when it is known to
+   be the same as the blob being compared, expecting that open/mmap of
+   such a file is faster than reading it from the object store, which
+   involves inflating and applying delta.  This however kicked in even
+   when the checked-out copy needs to go through the convert-to-git
+   conversion (including the clean filter), which defeats the whole
+   point of the optimization.  The optimization has been disabled when
+   the conversion is necessary.
+
+ * "git -c grep.patternType=extended log --basic-regexp" misbehaved
+   because the internal API to access the grep machinery was not
+   designed well.
+
+ * Windows port was failing some tests in t4130, due to the lack of
+   inum in the returned values by its lstat(2) emulation.
+
+ * The characters in the label shown for tags/refs for commits in
+   "gitweb" output are now properly escaped for proper HTML output.
+
+ * FreeBSD can lie when asked mtime of a directory, which made the
+   untracked cache code to fall back to a slow-path, which in turn
+   caused tests in t7063 to fail because it wanted to verify the
+   behaviour of the fast-path.
+
+ * Squelch compiler warnings for netmalloc (in compat/) library.
+
+ * The API documentation for hashmap was unclear if hashmap_entry
+   can be safely discarded without any other consideration.  State
+   that it is safe to do so.
+
+ * Not-so-recent rewrite of "git am" that started making internal
+   calls into the commit machinery had an unintended regression, in
+   that no matter how many seconds it took to apply many patches, the
+   resulting committer timestamp for the resulting commits were all
+   the same.
+
+ * "git difftool <paths>..." started in a subdirectory failed to
+   interpret the paths relative to that directory, which has been
+   fixed.
+
+Also contains minor documentation updates and code clean-ups.
index 4f41840..6ad3eb6 100644 (file)
@@ -140,7 +140,7 @@ boolean::
        false;; Boolean false can be spelled as `no`, `off`,
                `false`, or `0`.
 +
-When converting value to the canonical form using '--bool' type
+When converting value to the canonical form using `--bool` type
 specifier; 'git config' will ensure that the output is "true" or
 "false" (spelled in lowercase).
 
@@ -481,7 +481,7 @@ core.worktree::
        If `GIT_COMMON_DIR` environment variable is set, core.worktree
        is ignored and not used for determining the root of working tree.
        This can be overridden by the `GIT_WORK_TREE` environment
-       variable and the '--work-tree' command-line option.
+       variable and the `--work-tree` command-line option.
        The value can be an absolute path or relative to the path to
        the .git directory, which is either specified by --git-dir
        or GIT_DIR, or automatically discovered.
@@ -779,7 +779,7 @@ core.abbrev::
 add.ignoreErrors::
 add.ignore-errors (deprecated)::
        Tells 'git add' to continue adding files when some files cannot be
-       added due to indexing errors. Equivalent to the '--ignore-errors'
+       added due to indexing errors. Equivalent to the `--ignore-errors`
        option of linkgit:git-add[1].  `add.ignore-errors` is deprecated,
        as it does not follow the usual naming convention for configuration
        variables.
@@ -805,9 +805,9 @@ from the original current directory. See linkgit:git-rev-parse[1].
 
 am.keepcr::
        If true, git-am will call git-mailsplit for patches in mbox format
-       with parameter '--keep-cr'. In this case git-mailsplit will
+       with parameter `--keep-cr`. In this case git-mailsplit will
        not remove `\r` from lines ending with `\r\n`. Can be overridden
-       by giving '--no-keep-cr' from the command line.
+       by giving `--no-keep-cr` from the command line.
        See linkgit:git-am[1], linkgit:git-mailsplit[1].
 
 am.threeWay::
@@ -820,7 +820,7 @@ am.threeWay::
 
 apply.ignoreWhitespace::
        When set to 'change', tells 'git apply' to ignore changes in
-       whitespace, in the same way as the '--ignore-space-change'
+       whitespace, in the same way as the `--ignore-space-change`
        option.
        When set to one of: no, none, never, false tells 'git apply' to
        respect all whitespace differences.
@@ -828,7 +828,7 @@ apply.ignoreWhitespace::
 
 apply.whitespace::
        Tells 'git apply' how to handle whitespaces, in the same way
-       as the '--whitespace' option. See linkgit:git-apply[1].
+       as the `--whitespace` option. See linkgit:git-apply[1].
 
 branch.autoSetupMerge::
        Tells 'git branch' and 'git checkout' to set up new branches
@@ -930,7 +930,7 @@ browser.<tool>.cmd::
 
 browser.<tool>.path::
        Override the path for the given tool that may be used to
-       browse HTML help (see '-w' option in linkgit:git-help[1]) or a
+       browse HTML help (see `-w` option in linkgit:git-help[1]) or a
        working repository in gitweb (see linkgit:git-instaweb[1]).
 
 clean.requireForce::
@@ -1420,9 +1420,9 @@ gitcvs.logFile::
 
 gitcvs.usecrlfattr::
        If true, the server will look up the end-of-line conversion
-       attributes for files to determine the '-k' modes to use. If
+       attributes for files to determine the `-k` modes to use. If
        the attributes force Git to treat a file as text,
-       the '-k' mode will be left blank so CVS clients will
+       the `-k` mode will be left blank so CVS clients will
        treat it as text. If they suppress text conversion, the file
        will be set with '-kb' mode, which suppresses any newline munging
        the client might otherwise do. If the attributes do not allow
@@ -1492,16 +1492,16 @@ gitweb.snapshot::
        See linkgit:gitweb.conf[5] for description.
 
 grep.lineNumber::
-       If set to true, enable '-n' option by default.
+       If set to true, enable `-n` option by default.
 
 grep.patternType::
        Set the default matching behavior. Using a value of 'basic', 'extended',
-       'fixed', or 'perl' will enable the '--basic-regexp', '--extended-regexp',
-       '--fixed-strings', or '--perl-regexp' option accordingly, while the
+       'fixed', or 'perl' will enable the `--basic-regexp`, `--extended-regexp`,
+       `--fixed-strings`, or `--perl-regexp` option accordingly, while the
        value 'default' will return to the default matching behavior.
 
 grep.extendedRegexp::
-       If set to true, enable '--extended-regexp' option by default. This
+       If set to true, enable `--extended-regexp` option by default. This
        option is ignored when the `grep.patternType` option is set to a value
        other than 'default'.
 
@@ -1958,7 +1958,7 @@ log.decorate::
        specified, the full ref name (including prefix) will be printed.
        If 'auto' is specified, then if the output is going to a terminal,
        the ref names are shown as if 'short' were given, otherwise no ref
-       names are shown. This is the same as the '--decorate' option
+       names are shown. This is the same as the `--decorate` option
        of the `git log`.
 
 log.follow::
@@ -2341,16 +2341,16 @@ new default).
 --
 
 push.followTags::
-       If set to true enable '--follow-tags' option by default.  You
+       If set to true enable `--follow-tags` option by default.  You
        may override this configuration at time of push by specifying
-       '--no-follow-tags'.
+       `--no-follow-tags`.
 
 push.gpgSign::
        May be set to a boolean value, or the string 'if-asked'. A true
-       value causes all pushes to be GPG signed, as if '--signed' is
+       value causes all pushes to be GPG signed, as if `--signed` is
        passed to linkgit:git-push[1]. The string 'if-asked' causes
        pushes to be signed if the server supports it, as if
-       '--signed=if-asked' is passed to 'git push'. A false value may
+       `--signed=if-asked` is passed to 'git push'. A false value may
        override a value from a lower-priority config file. An explicit
        command-line flag always overrides this config option.
 
@@ -2373,7 +2373,7 @@ rebase.stat::
        rebase. False by default.
 
 rebase.autoSquash::
-       If set to true enable '--autosquash' option by default.
+       If set to true enable `--autosquash` option by default.
 
 rebase.autoStash::
        When set to true, automatically create a temporary stash
index f1101c7..d5a5b17 100644 (file)
@@ -105,7 +105,7 @@ diff.orderFile::
 
 diff.renameLimit::
        The number of files to consider when performing the copy/rename
-       detection; equivalent to the 'git diff' option '-l'.
+       detection; equivalent to the 'git diff' option `-l`.
 
 diff.renames::
        Whether and how Git detects renames.  If set to "false",
index 85b0890..cf52626 100644 (file)
@@ -46,11 +46,11 @@ That is, from the left to the right:
 . sha1 for "dst"; 0\{40\} if creation, unmerged or "look at work tree".
 . a space.
 . status, followed by optional "score" number.
-. a tab or a NUL when '-z' option is used.
+. a tab or a NUL when `-z` option is used.
 . path for "src"
-. a tab or a NUL when '-z' option is used; only exists for C or R.
+. a tab or a NUL when `-z` option is used; only exists for C or R.
 . path for "dst"; only exists for C or R.
-. an LF or a NUL when '-z' option is used, to terminate the record.
+. an LF or a NUL when `-z` option is used, to terminate the record.
 
 Possible status letters are:
 
@@ -86,7 +86,7 @@ diff format for merges
 ----------------------
 
 "git-diff-tree", "git-diff-files" and "git-diff --raw"
-can take '-c' or '--cc' option
+can take `-c` or `--cc` option
 to generate diff output also for merge commits.  The output differs
 from the format described above in the following way:
 
index c91afee..d2a7ff5 100644 (file)
@@ -2,7 +2,7 @@ Generating patches with -p
 --------------------------
 
 When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
-with a '-p' option, "git diff" without the '--raw' option, or
+with a `-p` option, "git diff" without the `--raw` option, or
 "git log" with the "-p" option, they
 do not produce the output described above; instead they produce a
 patch file.  You can customize the creation of such patches via the
@@ -114,11 +114,11 @@ index fabadb8,cc95eb0..4866510
 ------------
 
 1.   It is preceded with a "git diff" header, that looks like
-     this (when '-c' option is used):
+     this (when `-c` option is used):
 
        diff --combined file
 +
-or like this (when '--cc' option is used):
+or like this (when `--cc` option is used):
 
        diff --cc file
 
index d9ae681..705a873 100644 (file)
@@ -419,6 +419,9 @@ ifndef::git-format-patch[]
        paths are selected if there is any file that matches
        other criteria in the comparison; if there is no file
        that matches other criteria, nothing is selected.
++
+Also, these upper-case letters can be downcased to exclude.  E.g.
+`--diff-filter=ad` excludes added and deleted paths.
 
 -S<string>::
        Look for differences that change the number of occurrences of
index b05a834..9eab1f5 100644 (file)
@@ -88,7 +88,7 @@ ifndef::git-pull[]
        to whatever else would otherwise be fetched.  Using this
        option alone does not subject tags to pruning, even if --prune
        is used (though tags may be pruned anyway if they are also the
-       destination of an explicit refspec; see '--prune').
+       destination of an explicit refspec; see `--prune`).
 
 --recurse-submodules[=yes|on-demand|no]::
        This option controls if and under what conditions new commits of
@@ -110,7 +110,7 @@ ifndef::git-pull[]
 
 --no-recurse-submodules::
        Disable recursive fetching of submodules (this has the same effect as
-       using the '--recurse-submodules=no' option).
+       using the `--recurse-submodules=no` option).
 
 --submodule-prefix=<path>::
        Prepend <path> to paths printed in informative messages
@@ -137,7 +137,7 @@ endif::git-pull[]
 
 --upload-pack <upload-pack>::
        When given, and the repository to fetch from is handled
-       by 'git fetch-pack', '--exec=<upload-pack>' is passed to
+       by 'git fetch-pack', `--exec=<upload-pack>` is passed to
        the command to specify non-default path for the command
        run on the other end.
 
index 13cdd7f..8dd9e4f 100644 (file)
@@ -198,12 +198,12 @@ When initially invoking `git am`, you give it the names of the mailboxes
 to process.  Upon seeing the first patch that does not apply, it
 aborts in the middle.  You can recover from this in one of two ways:
 
-. skip the current patch by re-running the command with the '--skip'
+. skip the current patch by re-running the command with the `--skip`
   option.
 
 . hand resolve the conflict in the working directory, and update
   the index file to bring it into a state that the patch should
-  have produced.  Then run the command with the '--continue' option.
+  have produced.  Then run the command with the `--continue` option.
 
 The command refuses to process new mailboxes until the current
 operation is finished, so if you decide to start over from scratch,
index d9f960b..2bb9a57 100644 (file)
@@ -358,7 +358,7 @@ OPTIONS
 --no-checkout::
 +
 Do not checkout the new working tree at each iteration of the bisection
-process. Instead just update a special reference named 'BISECT_HEAD' to make
+process. Instead just update a special reference named `BISECT_HEAD` to make
 it point to the commit that should be tested.
 +
 This option may be useful when the test you would perform in each step
index 4a7037f..1fe7344 100644 (file)
@@ -39,10 +39,10 @@ named commit).  With `--merged`, only branches merged into the named
 commit (i.e. the branches whose tip commits are reachable from the named
 commit) will be listed.  With `--no-merged` only branches not merged into
 the named commit will be listed.  If the <commit> argument is missing it
-defaults to 'HEAD' (i.e. the tip of the current branch).
+defaults to `HEAD` (i.e. the tip of the current branch).
 
 The command's second form creates a new branch head named <branchname>
-which points to the current 'HEAD', or <start-point> if given.
+which points to the current `HEAD`, or <start-point> if given.
 
 Note that this will create the new branch, but it will not switch the
 working tree to it; use "git checkout <newbranch>" to switch to the
@@ -172,7 +172,7 @@ This option is only applicable in non-verbose mode.
 +
 This behavior is the default when the start point is a remote-tracking branch.
 Set the branch.autoSetupMerge configuration variable to `false` if you
-want `git checkout` and `git branch` to always behave as if '--no-track'
+want `git checkout` and `git branch` to always behave as if `--no-track`
 were given. Set it to `always` if you want this behavior when the
 start-point is either a local or remote-tracking branch.
 
index eb3d694..18d03d8 100644 (file)
@@ -15,8 +15,8 @@ SYNOPSIS
 DESCRIPTION
 -----------
 In its first form, the command provides the content or the type of an object in
-the repository. The type is required unless '-t' or '-p' is used to find the
-object type, or '-s' is used to find the object size, or '--textconv' is used
+the repository. The type is required unless `-t` or `-p` is used to find the
+object type, or `-s` is used to find the object size, or `--textconv` is used
 (which implies type "blob").
 
 In the second form, a list of objects (separated by linefeeds) is provided on
@@ -144,13 +144,13 @@ respectively print:
 
 OUTPUT
 ------
-If '-t' is specified, one of the <type>.
+If `-t` is specified, one of the <type>.
 
-If '-s' is specified, the size of the <object> in bytes.
+If `-s` is specified, the size of the <object> in bytes.
 
-If '-e' is specified, no output.
+If `-e` is specified, no output.
 
-If '-p' is specified, the contents of <object> are pretty-printed.
+If `-p` is specified, the contents of <object> are pretty-printed.
 
 If <type> is specified, the raw (though uncompressed) contents of the <object>
 will be returned.
index 5e5273e..7a2201b 100644 (file)
@@ -157,7 +157,7 @@ of it").
        When creating a new branch, set up "upstream" configuration. See
        "--track" in linkgit:git-branch[1] for details.
 +
-If no '-b' option is given, the name of the new branch will be
+If no `-b` option is given, the name of the new branch will be
 derived from the remote-tracking branch, by looking at the local part of
 the refspec configured for the corresponding remote, and then stripping
 the initial part up to the "*".
@@ -165,7 +165,7 @@ This would tell us to use "hack" as the local branch when branching
 off of "origin/hack" (or "remotes/origin/hack", or even
 "refs/remotes/origin/hack").  If the given name has no slash, or the above
 guessing results in an empty name, the guessing is aborted.  You can
-explicitly give a name with '-b' in such a case.
+explicitly give a name with `-b` in such a case.
 
 --no-track::
        Do not set up "upstream" configuration, even if the
index c104a59..d35d771 100644 (file)
@@ -47,7 +47,7 @@ OPTIONS
        For a more complete list of ways to spell commits, see
        linkgit:gitrevisions[7].
        Sets of commits can be passed but no traversal is done by
-       default, as if the '--no-walk' option was specified, see
+       default, as if the `--no-walk` option was specified, see
        linkgit:git-rev-list[1]. Note that specifying a range will
        feed all <commit>... arguments to a single revision walk
        (see a later example that uses 'maint master..next').
index 51a7e26..03056da 100644 (file)
@@ -16,7 +16,7 @@ DESCRIPTION
 Cleans the working tree by recursively removing files that are not
 under version control, starting from the current directory.
 
-Normally, only files unknown to Git are removed, but if the '-x'
+Normally, only files unknown to Git are removed, but if the `-x`
 option is specified, ignored files are also removed. This can, for
 example, be useful to remove all build products.
 
index cb69faa..002dae6 100644 (file)
@@ -44,7 +44,7 @@ OPTIONS
        An existing tree object
 
 -p <parent>::
-       Each '-p' indicates the id of a parent commit object.
+       Each `-p` indicates the id of a parent commit object.
 
 -m <message>::
        A paragraph in the commit log message. This can be given more than
index e704953..b0a294d 100644 (file)
@@ -75,7 +75,7 @@ OPTIONS
 
 -c <commit>::
 --reedit-message=<commit>::
-       Like '-C', but with '-c' the editor is invoked, so that
+       Like '-C', but with `-c` the editor is invoked, so that
        the user can further edit the commit message.
 
 --fixup=<commit>::
@@ -260,7 +260,7 @@ FROM UPSTREAM REBASE" section in linkgit:git-rebase[1].)
        staged for other paths. This is the default mode of operation of
        'git commit' if any paths are given on the command line,
        in which case this option can be omitted.
-       If this option is specified together with '--amend', then
+       If this option is specified together with `--amend`, then
        no paths need to be specified, which can be used to amend
        the last commit without committing changes that have
        already been staged.
index a89c304..f163113 100644 (file)
@@ -31,29 +31,29 @@ You can query/set/replace/unset options with this command. The name is
 actually the section and the key separated by a dot, and the value will be
 escaped.
 
-Multiple lines can be added to an option by using the '--add' option.
+Multiple lines can be added to an option by using the `--add` option.
 If you want to update or unset an option which can occur on multiple
 lines, a POSIX regexp `value_regex` needs to be given.  Only the
 existing values that match the regexp are updated or unset.  If
 you want to handle the lines that do *not* match the regex, just
 prepend a single exclamation mark in front (see also <<EXAMPLES>>).
 
-The type specifier can be either '--int' or '--bool', to make
+The type specifier can be either `--int` or `--bool`, to make
 'git config' ensure that the variable(s) are of the given type and
 convert the value to the canonical form (simple decimal number for int,
-a "true" or "false" string for bool), or '--path', which does some
-path expansion (see '--path' below).  If no type specifier is passed, no
+a "true" or "false" string for bool), or `--path`, which does some
+path expansion (see `--path` below).  If no type specifier is passed, no
 checks or transformations are performed on the value.
 
 When reading, the values are read from the system, global and
 repository local configuration files by default, and options
-'--system', '--global', '--local' and '--file <filename>' can be
+`--system`, `--global`, `--local` and `--file <filename>` can be
 used to tell the command to read from only that location (see <<FILES>>).
 
 When writing, the new value is written to the repository local
-configuration file by default, and options '--system', '--global',
-'--file <filename>' can be used to tell the command to write to
-that location (you can say '--local' but that is the default).
+configuration file by default, and options `--system`, `--global`,
+`--file <filename>` can be used to tell the command to write to
+that location (you can say `--local` but that is the default).
 
 This command will fail with non-zero status upon error.  Some exit
 codes are:
@@ -138,7 +138,7 @@ See also <<FILES>>.
        Use the given config file instead of the one specified by GIT_CONFIG.
 
 --blob blob::
-       Similar to '--file' but use the given blob instead of a file. E.g.
+       Similar to `--file` but use the given blob instead of a file. E.g.
        you can use 'master:.gitmodules' to read values from the file
        '.gitmodules' in the master branch. See "SPECIFYING REVISIONS"
        section in linkgit:gitrevisions[7] for a more complete list of
@@ -220,7 +220,7 @@ See also <<FILES>>.
 -e::
 --edit::
        Opens an editor to modify the specified config file; either
-       '--system', '--global', or repository (default).
+       `--system`, `--global`, or repository (default).
 
 --[no-]includes::
        Respect `include.*` directives in config files when looking up
@@ -232,7 +232,7 @@ See also <<FILES>>.
 FILES
 -----
 
-If not set explicitly with '--file', there are four files where
+If not set explicitly with `--file`, there are four files where
 'git config' will search for configuration options:
 
 $(prefix)/etc/gitconfig::
@@ -264,11 +264,11 @@ precedence over values read earlier.  When multiple values are taken then all
 values of a key from all files will be used.
 
 All writing options will per default write to the repository specific
-configuration file. Note that this also affects options like '--replace-all'
-and '--unset'. *'git config' will only ever change one file at a time*.
+configuration file. Note that this also affects options like `--replace-all`
+and `--unset`. *'git config' will only ever change one file at a time*.
 
 You can override these rules either by command-line options or by environment
-variables. The '--global' and the '--system' options will limit the file used
+variables. The `--global` and the `--system` options will limit the file used
 to the global or system-wide file respectively. The `GIT_CONFIG` environment
 variable has a similar effect, but you can specify any filename you want.
 
index e3c8f27..25fb963 100644 (file)
@@ -44,7 +44,7 @@ OPTIONS
 FILES
 -----
 
-If not set explicitly with '--file', there are two files where
+If not set explicitly with `--file`, there are two files where
 git-credential-store will search for credentials in order of precedence:
 
 ~/.git-credentials::
index 00a0679..41207a2 100644 (file)
@@ -74,10 +74,10 @@ OPTIONS
        akin to the way 'git clone' uses 'origin' by default.
 
 -o <branch-for-HEAD>::
-       When no remote is specified (via -r) the 'HEAD' branch
+       When no remote is specified (via -r) the `HEAD` branch
        from CVS is imported to the 'origin' branch within the Git
-       repository, as 'HEAD' already has a special meaning for Git.
-       When a remote is specified the 'HEAD' branch is named
+       repository, as `HEAD` already has a special meaning for Git.
+       When a remote is specified the `HEAD` branch is named
        remotes/<remote>/master mirroring 'git clone' behaviour.
        Use this option if you want to import into a different
        branch.
@@ -103,7 +103,7 @@ the old cvs2git tool.
 
 -p <options-for-cvsps>::
        Additional options for cvsps.
-       The options '-u' and '-A' are implicit and should not be used here.
+       The options `-u` and '-A' are implicit and should not be used here.
 +
 If you need to pass multiple options, separate them with a comma.
 
@@ -122,7 +122,7 @@ If you need to pass multiple options, separate them with a comma.
 
 -M <regex>::
        Attempt to detect merges based on the commit message with a custom
-       regex. It can be used with '-m' to enable the default regexes
+       regex. It can be used with `-m` to enable the default regexes
        as well. You must escape forward slashes.
 +
 The regex must capture the source branch name in $1.
@@ -186,7 +186,7 @@ messages, bug-tracking systems, email archives, and the like.
 
 OUTPUT
 ------
-If '-v' is specified, the script reports what it is doing.
+If `-v` is specified, the script reports what it is doing.
 
 Otherwise, success is indicated the Unix way, i.e. by simply exiting with
 a zero exit status.
index db4d7a9..a336ae5 100644 (file)
@@ -54,7 +54,7 @@ Print usage information and exit
 You can specify a list of allowed directories. If no directories
 are given, all are allowed. This is an additional restriction, gitcvs
 access still needs to be enabled by the `gitcvs.enabled` config option
-unless '--export-all' was given, too.
+unless `--export-all` was given, too.
 
 
 DESCRIPTION
@@ -332,7 +332,7 @@ To get a checkout with the Eclipse CVS client:
 3. Browse the 'modules' available. It will give you a list of the heads in
    the repository. You will not be able to browse the tree from there. Only
    the heads.
-4. Pick 'HEAD' when it asks what branch/tag to check out. Untick the
+4. Pick `HEAD` when it asks what branch/tag to check out. Untick the
    "launch commit wizard" to avoid committing the .project file.
 
 Protocol notes: If you are using anonymous access via pserver, just select that.
@@ -402,12 +402,12 @@ Exports and tagging (tags and branches) are not supported at this stage.
 CRLF Line Ending Conversions
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-By default the server leaves the '-k' mode blank for all files,
+By default the server leaves the `-k` mode blank for all files,
 which causes the CVS client to treat them as a text files, subject
 to end-of-line conversion on some platforms.
 
 You can make the server use the end-of-line conversion attributes to
-set the '-k' modes for files by setting the `gitcvs.usecrlfattr`
+set the `-k` modes for files by setting the `gitcvs.usecrlfattr`
 config variable.  See linkgit:gitattributes[5] for more information
 about end-of-line conversion.
 
@@ -415,9 +415,9 @@ Alternatively, if `gitcvs.usecrlfattr` config is not enabled
 or the attributes do not allow automatic detection for a filename, then
 the server uses the `gitcvs.allBinary` config for the default setting.
 If `gitcvs.allBinary` is set, then file not otherwise
-specified will default to '-kb' mode. Otherwise the '-k' mode
+specified will default to '-kb' mode. Otherwise the `-k` mode
 is left blank. But if `gitcvs.allBinary` is set to "guess", then
-the correct '-k' mode will be guessed based on the contents of
+the correct `-k` mode will be guessed based on the contents of
 the file.
 
 For best consistency with 'cvs', it is probably best to override the
index dc20275..3c91db7 100644 (file)
@@ -30,7 +30,7 @@ that service if it is enabled.
 
 It verifies that the directory has the magic file "git-daemon-export-ok", and
 it will refuse to export any Git directory that hasn't explicitly been marked
-for export this way (unless the '--export-all' parameter is specified). If you
+for export this way (unless the `--export-all` parameter is specified). If you
 pass some directory paths as 'git daemon' arguments, you can further restrict
 the offers to a whitelist comprising of those.
 
@@ -90,10 +90,10 @@ OPTIONS
        is not supported, then --listen=hostname is also not supported and
        --listen must be given an IPv4 address.
        Can be given more than once.
-       Incompatible with '--inetd' option.
+       Incompatible with `--inetd` option.
 
 --port=<n>::
-       Listen on an alternative port.  Incompatible with '--inetd' option.
+       Listen on an alternative port.  Incompatible with `--inetd` option.
 
 --init-timeout=<n>::
        Timeout (in seconds) between the moment the connection is established
@@ -296,7 +296,7 @@ they correspond to these IP addresses.
 selectively enable/disable services per repository::
        To enable 'git archive --remote' and disable 'git fetch' against
        a repository, have the following in the configuration file in the
-       repository (that is the file 'config' next to 'HEAD', 'refs' and
+       repository (that is the file 'config' next to `HEAD`, 'refs' and
        'objects').
 +
 ----------------------------------------------------------------
index c8f28c8..e4ac448 100644 (file)
@@ -154,7 +154,7 @@ is found, its name will be output and searching will stop.
 If an exact match was not found, 'git describe' will walk back
 through the commit history to locate an ancestor commit which
 has been tagged.  The ancestor's tag will be output along with an
-abbreviation of the input commit-ish's SHA-1. If '--first-parent' was
+abbreviation of the input commit-ish's SHA-1. If `--first-parent` was
 specified then the walk will only consider the first parent of each
 commit.
 
index a86cf62..a171506 100644 (file)
@@ -40,13 +40,13 @@ include::diff-format.txt[]
 Operating Modes
 ---------------
 You can choose whether you want to trust the index file entirely
-(using the '--cached' flag) or ask the diff logic to show any files
+(using the `--cached` flag) or ask the diff logic to show any files
 that don't match the stat state as being "tentatively changed".  Both
 of these operations are very useful indeed.
 
 Cached Mode
 -----------
-If '--cached' is specified, it allows you to ask:
+If `--cached` is specified, it allows you to ask:
 
        show me the differences between HEAD and the current index
        contents (the ones I'd write using 'git write-tree')
index 1439486..7870e17 100644 (file)
@@ -43,11 +43,11 @@ include::diff-options.txt[]
        show tree entry itself as well as subtrees.  Implies -r.
 
 --root::
-       When '--root' is specified the initial commit will be shown as a big
+       When `--root` is specified the initial commit will be shown as a big
        creation event. This is equivalent to a diff against the NULL tree.
 
 --stdin::
-       When '--stdin' is specified, the command does not take
+       When `--stdin` is specified, the command does not take
        <tree-ish> arguments from the command line.  Instead, it
        reads lines containing either two <tree>, one <commit>, or a
        list of <commit> from its standard input.  (Use a single space
@@ -70,13 +70,13 @@ commits (but not trees).
        By default, 'git diff-tree --stdin' does not show
        differences for merge commits.  With this flag, it shows
        differences to that commit from all of its parents. See
-       also '-c'.
+       also `-c`.
 
 -s::
        By default, 'git diff-tree --stdin' shows differences,
-       either in machine-readable form (without '-p') or in patch
-       form (with '-p').  This output can be suppressed.  It is
-       only useful with '-v' flag.
+       either in machine-readable form (without `-p`) or in patch
+       form (with `-p`).  This output can be suppressed.  It is
+       only useful with `-v` flag.
 
 -v::
        This flag causes 'git diff-tree --stdin' to also show
@@ -91,17 +91,17 @@ include::pretty-options.txt[]
 -c::
        This flag changes the way a merge commit is displayed
        (which means it is useful only when the command is given
-       one <tree-ish>, or '--stdin').  It shows the differences
+       one <tree-ish>, or `--stdin`).  It shows the differences
        from each of the parents to the merge result simultaneously
        instead of showing pairwise diff between a parent and the
-       result one at a time (which is what the '-m' option does).
+       result one at a time (which is what the `-m` option does).
        Furthermore, it lists only files which were modified
        from all parents.
 
 --cc::
        This flag changes the way a merge commit patch is displayed,
-       in a similar way to the '-c' option. It implies the '-c'
-       and '-p' options and further compresses the patch output
+       in a similar way to the `-c` option. It implies the `-c`
+       and `-p` options and further compresses the patch output
        by omitting uninteresting hunks whose the contents in the parents
        have only two variants and the merge result picks one of them
        without modification.  When all hunks are uninteresting, the commit
index 333cf6f..224fb30 100644 (file)
@@ -98,7 +98,7 @@ instead.  `--no-symlinks` is the default on Windows.
        invoked diff tool returns a non-zero exit code.
 +
 'git-difftool' will forward the exit code of the invoked tool when
-'--trust-exit-code' is used.
+`--trust-exit-code` is used.
 
 See linkgit:git-diff[1] for the full list of supported options.
 
index 66910aa..c105f21 100644 (file)
@@ -1054,7 +1054,7 @@ relative-marks::
 no-relative-marks::
 force::
        Act as though the corresponding command-line option with
-       a leading '--' was passed on the command line
+       a leading `--` was passed on the command line
        (see OPTIONS, above).
 
 import-marks::
@@ -1105,7 +1105,7 @@ options the user may specify to git fast-import itself.
 
 The `<option>` part of the command may contain any of the options
 listed in the OPTIONS section that do not change import semantics,
-without the leading '--' and is treated in the same way.
+without the leading `--` and is treated in the same way.
 
 Option commands must be the first commands on the input (not counting
 feature commands), to give an option command after any non-option
index 239623c..24417ee 100644 (file)
@@ -41,13 +41,13 @@ OPTIONS
        option, then the refs from stdin are processed after those
        on the command line.
 +
-If '--stateless-rpc' is specified together with this option then
+If `--stateless-rpc` is specified together with this option then
 the list of refs must be in packet format (pkt-line). Each ref must
 be in a separate packet, and the list must end with a flush packet.
 
 -q::
 --quiet::
-       Pass '-q' flag to 'git unpack-objects'; this makes the
+       Pass `-q` flag to 'git unpack-objects'; this makes the
        cloning process less verbose.
 
 -k::
index bd560d3..0a09698 100644 (file)
@@ -52,7 +52,7 @@ if different from the rewritten ones, will be stored in the namespace
 
 Note that since this operation is very I/O expensive, it might
 be a good idea to redirect the temporary directory off-disk with the
-'-d' option, e.g. on tmpfs.  Reportedly the speedup is very noticeable.
+`-d` option, e.g. on tmpfs.  Reportedly the speedup is very noticeable.
 
 
 Filters
@@ -171,7 +171,7 @@ to other tags will be rewritten to point to the underlying commit.
        untouched.  This switch allow git-filter-branch to ignore such
        commits.  Though, this switch only applies for commits that have one
        and only one parent, it will hence keep merges points. Also, this
-       option is not compatible with the use of '--commit-filter'. Though you
+       option is not compatible with the use of `--commit-filter`. Though you
        just need to use the function 'git_commit_non_empty_tree "$@"' instead
        of the `git commit-tree "$@"` idiom in your commit filter to make that
        happen.
@@ -197,7 +197,7 @@ to other tags will be rewritten to point to the underlying commit.
 <rev-list options>...::
        Arguments for 'git rev-list'.  All positive refs included by
        these options are rewritten.  You may also specify options
-       such as '--all', but you must use '--' to separate them from
+       such as `--all`, but you must use `--` to separate them from
        the 'git filter-branch' options. Implies <<Remap_to_ancestor>>.
 
 
index d9d406d..f57e69b 100644 (file)
@@ -142,7 +142,7 @@ align::
        <width> and <position> used instead.  For instance,
        `%(align:<width>,<position>)`. If the contents length is more
        than the width then no alignment is performed. If used with
-       '--quote' everything in between %(align:...) and %(end) is
+       `--quote` everything in between %(align:...) and %(end) is
        quoted, but if nested then only the topmost level performs
        quoting.
 
index 84ee92e..7fc68eb 100644 (file)
@@ -95,7 +95,7 @@ DISCUSSION
 git-fsck tests SHA-1 and general object sanity, and it does full tracking
 of the resulting reachability and everything else. It prints out any
 corruption it finds (missing or bad objects), and if you use the
-'--unreachable' flag it will also print out objects that exist but that
+`--unreachable` flag it will also print out objects that exist but that
 aren't reachable from any of the specified head nodes (or the default
 set, as mentioned above).
 
index 40cfe37..0ecea6e 100644 (file)
@@ -41,16 +41,16 @@ CONFIGURATION
 -------------
 
 grep.lineNumber::
-       If set to true, enable '-n' option by default.
+       If set to true, enable `-n` option by default.
 
 grep.patternType::
        Set the default matching behavior. Using a value of 'basic', 'extended',
-       'fixed', or 'perl' will enable the '--basic-regexp', '--extended-regexp',
-       '--fixed-strings', or '--perl-regexp' option accordingly, while the
+       'fixed', or 'perl' will enable the `--basic-regexp`, `--extended-regexp`,
+       `--fixed-strings`, or `--perl-regexp` option accordingly, while the
        value 'default' will return to the default matching behavior.
 
 grep.extendedRegexp::
-       If set to true, enable '--extended-regexp' option by default. This
+       If set to true, enable `--extended-regexp` option by default. This
        option is ignored when the `grep.patternType` option is set to a value
        other than 'default'.
 
@@ -59,7 +59,7 @@ grep.threads::
        8 threads are used by default (for now).
 
 grep.fullName::
-       If set to true, enable '--full-name' option by default.
+       If set to true, enable `--full-name` option by default.
 
 grep.fallbackToNoIndex::
        If set to true, fall back to git grep --no-index if git grep
index 8144527..c1a3e8b 100644 (file)
@@ -35,7 +35,7 @@ blame::
 
 browser::
        Start a tree browser showing all files in the specified
-       commit (or 'HEAD' by default).  Files selected through the
+       commit (or `HEAD` by default).  Files selected through the
        browser are opened in the blame viewer.
 
 citool::
index 338b8d6..40d328a 100644 (file)
@@ -18,10 +18,10 @@ With no options and no COMMAND or GUIDE given, the synopsis of the 'git'
 command and a list of the most commonly used Git commands are printed
 on the standard output.
 
-If the option '--all' or '-a' is given, all available commands are
+If the option `--all` or `-a` is given, all available commands are
 printed on the standard output.
 
-If the option '--guide' or '-g' is given, a list of the useful
+If the option `--guide` or `-g` is given, a list of the useful
 Git guides is also printed on the standard output.
 
 If a command, or a guide, is given, a manual page for that command or
@@ -176,7 +176,7 @@ Note about git config --global
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Note that all these configuration variables should probably be set
-using the '--global' flag, for example like this:
+using the `--global` flag, for example like this:
 
 ------------------------------------------------
 $ git config --global help.format web
index 2e67362..2aceb6f 100644 (file)
@@ -81,13 +81,13 @@ destination side.
      exist in the set of remote refs; the ref matched <src>
      locally is used as the name of the destination.
 
-Without '--force', the <src> ref is stored at the remote only if
+Without `--force`, the <src> ref is stored at the remote only if
 <dst> does not exist, or <dst> is a proper subset (i.e. an
 ancestor) of <src>.  This check, known as "fast-forward check",
 is performed in order to avoid accidentally overwriting the
 remote ref and lose other peoples' commits from there.
 
-With '--force', the fast-forward check is disabled for all refs.
+With `--force`, the fast-forward check is disabled for all refs.
 
 Optionally, a <ref> parameter can be prefixed with a plus '+' sign
 to disable the fast-forward check only on that ref.
index a77b901..93d1db6 100644 (file)
@@ -219,7 +219,7 @@ Signed-off-by: Alice <alice@example.com>
 Signed-off-by: Bob <bob@example.com>
 ------------
 
-* Use the '--in-place' option to edit a message file in place:
+* Use the `--in-place` option to edit a message file in place:
 +
 ------------
 $ cat msg.txt
index 75c3f41..078b556 100644 (file)
@@ -175,7 +175,7 @@ followed by the  ("attr/<eolattr>").
 
 Output
 ------
-'git ls-files' just outputs the filenames unless '--stage' is specified in
+'git ls-files' just outputs the filenames unless `--stage` is specified in
 which case it outputs:
 
         [<tag> ]<mode> <object> <stage> <file>
index 16e87fd..dbc91f9 100644 (file)
@@ -20,16 +20,16 @@ in the current working directory.  Note that:
 
  - the behaviour is slightly different from that of "/bin/ls" in that the
    '<path>' denotes just a list of patterns to match, e.g. so specifying
-   directory name (without '-r') will behave differently, and order of the
+   directory name (without `-r`) will behave differently, and order of the
    arguments does not matter.
 
  - the behaviour is similar to that of "/bin/ls" in that the '<path>' is
    taken as relative to the current working directory.  E.g. when you are
    in a directory 'sub' that has a directory 'dir', you can run 'git
    ls-tree -r HEAD dir' to list the contents of the tree (that is
-   'sub/dir' in 'HEAD').  You don't want to give a tree that is not at the
+   'sub/dir' in `HEAD`).  You don't want to give a tree that is not at the
    root level (e.g. `git ls-tree -r HEAD:sub dir`) in this case, as that
-   would result in asking for 'sub/sub/dir' in the 'HEAD' commit.
+   would result in asking for 'sub/sub/dir' in the `HEAD` commit.
    However, the current working directory can be ignored by passing
    --full-tree option.
 
@@ -46,7 +46,7 @@ OPTIONS
 
 -t::
        Show tree entries even when going to recurse them. Has no effect
-       if '-r' was not passed. '-d' implies '-t'.
+       if `-r` was not passed. `-d` implies `-t`.
 
 -l::
 --long::
index 5c6ebdf..c3616e7 100644 (file)
@@ -32,7 +32,7 @@ OPTIONS
 --batch::
        Allow building of more than one tree object before exiting.  Each
        tree is separated by as single blank line. The final new-line is
-       optional.  Note - if the '-z' option is used, lines are terminated
+       optional.  Note - if the `-z` option is used, lines are terminated
        with NUL.
 
 GIT
index e453132..79449bf 100644 (file)
@@ -32,10 +32,10 @@ OPTIONS
 --force::
        Force renaming or moving of a file even if the target exists
 -k::
-        Skip move or rename actions which would lead to an error
+       Skip move or rename actions which would lead to an error
        condition. An error happens when a source is neither existing nor
        controlled by Git, or when it would overwrite an existing
-        file unless '-f' is given.
+       file unless `-f` is given.
 -n::
 --dry-run::
        Do nothing; only show what would happen
index 02a10bc..be7db30 100644 (file)
@@ -152,7 +152,7 @@ OPTIONS
 
 -c <object>::
 --reedit-message=<object>::
-       Like '-C', but with '-c' the editor is invoked, so that
+       Like '-C', but with `-c` the editor is invoked, so that
        the user can further edit the note message.
 
 --allow-empty::
index 9d4f151..c83aaf3 100644 (file)
@@ -104,7 +104,7 @@ $ git p4 sync //path/in/your/perforce/depot
 ------------
 This imports the specified depot into
 'refs/remotes/p4/master' in an existing Git repository.  The
-'--branch' option can be used to specify a different branch to
+`--branch` option can be used to specify a different branch to
 be used for the p4 content.
 
 If a Git repository includes branches 'refs/remotes/origin/p4', these
@@ -114,7 +114,7 @@ from a Git remote, this can be useful in a multi-developer environment.
 
 If there are multiple branches, doing 'git p4 sync' will automatically
 use the "BRANCH DETECTION" algorithm to try to partition new changes
-into the right branch.  This can be overridden with the '--branch'
+into the right branch.  This can be overridden with the `--branch`
 option to specify just a single branch to update.
 
 
@@ -150,10 +150,10 @@ $ git p4 submit topicbranch
 ------------
 
 The upstream reference is generally 'refs/remotes/p4/master', but can
-be overridden using the '--origin=' command-line option.
+be overridden using the `--origin=` command-line option.
 
 The p4 changes will be created as the user invoking 'git p4 submit'. The
-'--preserve-user' option will cause ownership to be modified
+`--preserve-user` option will cause ownership to be modified
 according to the author of the Git commit.  This option requires admin
 privileges in p4, which can be granted using 'p4 protect'.
 
@@ -221,7 +221,7 @@ Git repository:
        where they will be treated as remote-tracking branches by
        linkgit:git-branch[1] and other commands.  This option instead
        puts p4 branches in 'refs/heads/p4/'.  Note that future
-       sync operations must specify '--import-local' as well so that
+       sync operations must specify `--import-local` as well so that
        they can find the p4 branches in refs/heads.
 
 --max-changes <n>::
@@ -245,7 +245,7 @@ Git repository:
        default, involves removing the entire depot path.  With this
        option, the full p4 depot path is retained in Git.  For example,
        path '//depot/main/foo/bar.c', when imported from
-       '//depot/main/', becomes 'foo/bar.c'.  With '--keep-path', the
+       '//depot/main/', becomes 'foo/bar.c'.  With `--keep-path`, the
        Git path is instead 'depot/main/foo/bar.c'.
 
 --use-client-spec::
@@ -275,7 +275,7 @@ These options can be used to modify 'git p4 submit' behavior.
 --origin <commit>::
        Upstream location from which commits are identified to submit to
        p4.  By default, this is the most recent p4 commit reachable
-       from 'HEAD'.
+       from `HEAD`.
 
 -M::
        Detect renames.  See linkgit:git-diff[1].  Renames will be
@@ -341,7 +341,7 @@ p4 revision specifier on the end:
     Import all changes from both named depot paths into a single
     repository.  Only files below these directories are included.
     There is not a subdirectory in Git for each "proj1" and "proj2".
-    You must use the '--destination' option when specifying more
+    You must use the `--destination` option when specifying more
     than one depot path.  The revision specifier must be specified
     identically on each depot path.  If there are files in the
     depot paths with the same name, the path with the most recently
@@ -355,7 +355,7 @@ CLIENT SPEC
 The p4 client specification is maintained with the 'p4 client' command
 and contains among other fields, a View that specifies how the depot
 is mapped into the client repository.  The 'clone' and 'sync' commands
-can consult the client spec when given the '--use-client-spec' option or
+can consult the client spec when given the `--use-client-spec` option or
 when the useClientSpec variable is true.  After 'git p4 clone', the
 useClientSpec variable is automatically set in the repository
 configuration file.  This allows future 'git p4 submit' commands to
@@ -390,7 +390,7 @@ different areas in the tree, and indicate related content.  'git p4'
 can use these mappings to determine branch relationships.
 
 If you have a repository where all the branches of interest exist as
-subdirectories of a single depot path, you can use '--detect-branches'
+subdirectories of a single depot path, you can use `--detect-branches`
 when cloning or syncing to have 'git p4' automatically find
 subdirectories in p4, and to generate these as branches in Git.
 
@@ -507,7 +507,7 @@ git-p4.labelImportRegexp::
 git-p4.useClientSpec::
        Specify that the p4 client spec should be used to identify p4
        depot paths of interest.  This is equivalent to specifying the
-       option '--use-client-spec'.  See the "CLIENT SPEC" section above.
+       option `--use-client-spec`.  See the "CLIENT SPEC" section above.
        This variable is a boolean, not the name of a p4 client.
 
 git-p4.pathEncoding::
index 19f46b6..93c3527 100644 (file)
@@ -275,7 +275,7 @@ origin +master` to force a push to the `master` branch). See the
        all submodules that changed in the revisions to be pushed will be
        pushed. If on-demand was not able to push all necessary revisions
        it will also be aborted and exit with non-zero status. A value of
-       'no' or using '--no-recurse-submodules' can be used to override the
+       'no' or using `--no-recurse-submodules` can be used to override the
        push.recurseSubmodules configuration variable when no submodule
        recursion is required.
 
index 0387b40..de222c8 100644 (file)
@@ -208,10 +208,10 @@ rebase.stat::
        rebase. False by default.
 
 rebase.autoSquash::
-       If set to true enable '--autosquash' option by default.
+       If set to true enable `--autosquash` option by default.
 
 rebase.autoStash::
-       If set to true enable '--autostash' option by default.
+       If set to true enable `--autostash` option by default.
 
 rebase.missingCommitsCheck::
        If set to "warn", print warnings about removed commits in
@@ -220,7 +220,7 @@ rebase.missingCommitsCheck::
        done. "ignore" by default.
 
 rebase.instructionFormat::
-       Custom commit list format to use during an '--interactive' rebase.
+       Custom commit list format to use during an `--interactive` rebase.
 
 OPTIONS
 -------
@@ -428,9 +428,9 @@ without an explicit `--interactive`.
        "fixup! " or "squash! " after the first, in case you referred to an
        earlier fixup/squash with `git commit --fixup/--squash`.
 +
-This option is only valid when the '--interactive' option is used.
+This option is only valid when the `--interactive` option is used.
 +
-If the '--autosquash' option is enabled by default using the
+If the `--autosquash` option is enabled by default using the
 configuration variable `rebase.autoSquash`, this option can be
 used to override and disable this setting.
 
index 1d7ecea..577b969 100644 (file)
@@ -137,9 +137,9 @@ branches, adds to that list.
 Retrieves the URLs for a remote. Configurations for `insteadOf` and
 `pushInsteadOf` are expanded here. By default, only the first URL is listed.
 +
-With '--push', push URLs are queried rather than fetch URLs.
+With `--push`, push URLs are queried rather than fetch URLs.
 +
-With '--all', all URLs for the remote will be listed.
+With `--all`, all URLs for the remote will be listed.
 
 'set-url'::
 
@@ -147,11 +147,11 @@ Changes URLs for the remote. Sets first URL for remote <name> that matches
 regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If
 <oldurl> doesn't match any URL, an error occurs and nothing is changed.
 +
-With '--push', push URLs are manipulated instead of fetch URLs.
+With `--push`, push URLs are manipulated instead of fetch URLs.
 +
-With '--add', instead of changing existing URLs, new URL is added.
+With `--add`, instead of changing existing URLs, new URL is added.
 +
-With '--delete', instead of changing existing URLs, all URLs matching
+With `--delete`, instead of changing existing URLs, all URLs matching
 regex <url> are deleted for remote <name>.  Trying to delete all
 non-push URLs is an error.
 +
index b9c02ce..0c03eec 100644 (file)
@@ -33,7 +33,7 @@ OPTIONS
        pack everything referenced into a single pack.
        Especially useful when packing a repository that is used
        for private development. Use
-       with '-d'.  This will clean up the objects that `git prune`
+       with `-d`.  This will clean up the objects that `git prune`
        leaves behind, but `git fsck --full --dangling` shows as
        dangling.
 +
@@ -42,7 +42,7 @@ whole new pack in order to get any contained object, no matter how many
 other objects in that pack they already have locally.
 
 -A::
-       Same as `-a`, unless '-d' is used.  Then any unreachable
+       Same as `-a`, unless `-d` is used.  Then any unreachable
        objects in a previous pack become loose, unpacked objects,
        instead of being left in the old pack.  Unreachable objects
        are never intentionally added to a pack, even when repacking.
index 573616a..837707a 100644 (file)
@@ -24,7 +24,7 @@ from the HEAD commit).
 Note: 'git revert' is used to record some new commits to reverse the
 effect of some earlier commits (often only a faulty one).  If you want to
 throw away all uncommitted changes in your working directory, you
-should see linkgit:git-reset[1], particularly the '--hard' option.  If
+should see linkgit:git-reset[1], particularly the `--hard` option.  If
 you want to extract specific files as they were in another commit, you
 should see linkgit:git-checkout[1], specifically the `git checkout
 <commit> -- <filename>` syntax.  Take care with these alternatives as
@@ -37,7 +37,7 @@ OPTIONS
        For a more complete list of ways to spell commit names, see
        linkgit:gitrevisions[7].
        Sets of commits can also be given but no traversal is done by
-       default, see linkgit:git-rev-list[1] and its '--no-walk'
+       default, see linkgit:git-rev-list[1] and its `--no-walk`
        option.
 
 -e::
index d0b38b4..642d0ef 100644 (file)
@@ -66,7 +66,7 @@ This option may be specified multiple times.
        Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1])
        to edit an introductory message for the patch series.
 +
-When '--compose' is used, git send-email will use the From, Subject, and
+When `--compose` is used, git send-email will use the From, Subject, and
 In-Reply-To headers specified in the message. If the body of the message
 (what you type after the headers and a blank line) only contains blank
 (or Git: prefixed) lines, the summary won't be sent, but From, Subject,
@@ -182,19 +182,19 @@ $ git send-email --smtp-auth="PLAIN LOGIN GSSAPI" ...
 +
 If at least one of the specified mechanisms matches the ones advertised by the
 SMTP server and if it is supported by the utilized SASL library, the mechanism
-is used for authentication. If neither 'sendemail.smtpAuth' nor '--smtp-auth'
+is used for authentication. If neither 'sendemail.smtpAuth' nor `--smtp-auth`
 is specified, all mechanisms supported by the SASL library can be used.
 
 --smtp-pass[=<password>]::
        Password for SMTP-AUTH. The argument is optional: If no
        argument is specified, then the empty string is used as
        the password. Default is the value of `sendemail.smtpPass`,
-       however '--smtp-pass' always overrides this value.
+       however `--smtp-pass` always overrides this value.
 +
 Furthermore, passwords need not be specified in configuration files
 or on the command line. If a username has been specified (with
-'--smtp-user' or a `sendemail.smtpUser`), but no password has been
-specified (with '--smtp-pass' or `sendemail.smtpPass`), then
+`--smtp-user` or a `sendemail.smtpUser`), but no password has been
+specified (with `--smtp-pass` or `sendemail.smtpPass`), then
 a password is obtained using 'git-credential'.
 
 --smtp-server=<host>::
@@ -240,7 +240,7 @@ must be used for each option.
 
 --smtp-user=<user>::
        Username for SMTP-AUTH. Default is the value of `sendemail.smtpUser`;
-       if a username is not specified (with '--smtp-user' or `sendemail.smtpUser`),
+       if a username is not specified (with `--smtp-user` or `sendemail.smtpUser`),
        then authentication is not attempted.
 
 --smtp-debug=0|1::
@@ -364,8 +364,8 @@ have been specified, in which case default to 'compose'.
 
 --[no-]format-patch::
        When an argument may be understood either as a reference or as a file name,
-       choose to understand it as a format-patch argument ('--format-patch')
-       or as a file name ('--no-format-patch'). By default, when such a conflict
+       choose to understand it as a format-patch argument (`--format-patch`)
+       or as a file name (`--no-format-patch`). By default, when such a conflict
        occurs, git send-email will fail.
 
 --quiet::
@@ -382,7 +382,7 @@ have been specified, in which case default to 'compose'.
 --
 +
 Default is the value of `sendemail.validate`; if this is not set,
-default to '--validate'.
+default to `--validate`.
 
 --force::
        Send emails even if safety checks would prevent it.
@@ -428,13 +428,13 @@ sendmail;;
 
 sendemail.multiEdit::
        If true (default), a single editor instance will be spawned to edit
-       files you have to edit (patches when '--annotate' is used, and the
-       summary when '--compose' is used). If false, files will be edited one
+       files you have to edit (patches when `--annotate` is used, and the
+       summary when `--compose` is used). If false, files will be edited one
        after the other, spawning a new editor each time.
 
 sendemail.confirm::
        Sets the default for whether to confirm before sending. Must be
-       one of 'always', 'never', 'cc', 'compose', or 'auto'. See '--confirm'
+       one of 'always', 'never', 'cc', 'compose', or 'auto'. See `--confirm`
        in the previous section for the meaning of these values.
 
 EXAMPLE
index 6aa91e8..a831dd0 100644 (file)
@@ -44,7 +44,7 @@ OPTIONS
        option, then the refs from stdin are processed after those
        on the command line.
 +
-If '--stateless-rpc' is specified together with this option then
+If `--stateless-rpc` is specified together with this option then
 the list of refs must be in packet format (pkt-line). Each ref must
 be in a separate packet, and the list must end with a flush packet.
 
@@ -99,11 +99,11 @@ Specifying the Refs
 There are three ways to specify which refs to update on the
 remote end.
 
-With '--all' flag, all refs that exist locally are transferred to
+With `--all` flag, all refs that exist locally are transferred to
 the remote side.  You cannot specify any '<ref>' if you use
 this flag.
 
-Without '--all' and without any '<ref>', the heads that exist
+Without `--all` and without any '<ref>', the heads that exist
 both on the local side and on the remote side are updated.
 
 When one or more '<ref>' are specified explicitly (whether on the
@@ -134,13 +134,13 @@ name. See linkgit:git-rev-parse[1].
      exist in the set of remote refs; the ref matched <src>
      locally is used as the name of the destination.
 
-Without '--force', the <src> ref is stored at the remote only if
+Without `--force`, the <src> ref is stored at the remote only if
 <dst> does not exist, or <dst> is a proper subset (i.e. an
 ancestor) of <src>.  This check, known as "fast-forward check",
 is performed in order to avoid accidentally overwriting the
 remote ref and lose other peoples' commits from there.
 
-With '--force', the fast-forward check is disabled for all refs.
+With `--force`, the fast-forward check is disabled for all refs.
 
 Optionally, a <ref> parameter can be prefixed with a plus '+' sign
 to disable the fast-forward check only on that ref.
index e4bdd22..2e30a3e 100644 (file)
@@ -24,7 +24,7 @@ named `git-shell-commands` in the user's home directory.
 COMMANDS
 --------
 
-'git shell' accepts the following commands after the '-c' option:
+'git shell' accepts the following commands after the `-c` option:
 
 'git receive-pack <argument>'::
 'git upload-pack <argument>'::
@@ -43,7 +43,7 @@ directory.
 INTERACTIVE USE
 ---------------
 
-By default, the commands above can be executed only with the '-c'
+By default, the commands above can be executed only with the `-c`
 option; the shell is not interactive.
 
 If a `~/git-shell-commands` directory is present, 'git shell'
index b91d4e5..7818e0f 100644 (file)
@@ -60,7 +60,7 @@ OPTIONS
         are shown before their parents).
 
 --date-order::
-       This option is similar to '--topo-order' in the sense that no
+       This option is similar to `--topo-order` in the sense that no
        parent comes before all of its children, but otherwise commits
        are ordered according to their commit date.
 
index 3a32451..c0aa871 100644 (file)
@@ -60,7 +60,7 @@ OPTIONS
 
        Enable stricter reference checking by requiring an exact ref path.
        Aside from returning an error code of 1, it will also print an error
-       message if '--quiet' was not specified.
+       message if `--quiet` was not specified.
 
 --abbrev[=<n>]::
 
@@ -70,7 +70,7 @@ OPTIONS
 -q::
 --quiet::
 
-       Do not print any results to stdout. When combined with '--verify' this
+       Do not print any results to stdout. When combined with `--verify` this
        can be used to silently check if a reference exists.
 
 --exclude-existing[=<pattern>]::
@@ -134,7 +134,7 @@ use:
 This will show "refs/heads/master" but also "refs/remote/other-repo/master",
 if such references exists.
 
-When using the '--verify' flag, the command requires an exact path:
+When using the `--verify` flag, the command requires an exact path:
 
 -----------------------------------------------------------------------------
        git show-ref --verify refs/heads/master
index 698a668..7e17cad 100644 (file)
@@ -98,11 +98,11 @@ your Perl's Getopt::Long is < v2.37).
 --ignore-paths=<regex>;;
        When passed to 'init' or 'clone' this regular expression will
        be preserved as a config key.  See 'fetch' for a description
-       of '--ignore-paths'.
+       of `--ignore-paths`.
 --include-paths=<regex>;;
        When passed to 'init' or 'clone' this regular expression will
        be preserved as a config key.  See 'fetch' for a description
-       of '--include-paths'.
+       of `--include-paths`.
 --no-minimize-url;;
        When tracking multiple directories (using --stdlayout,
        --branches, or --tags options), git svn will attempt to connect
@@ -110,7 +110,7 @@ your Perl's Getopt::Long is < v2.37).
        repository.  This default allows better tracking of history if
        entire projects are moved within a repository, but may cause
        issues on repositories where read access restrictions are in
-       place.  Passing '--no-minimize-url' will allow git svn to
+       place.  Passing `--no-minimize-url` will allow git svn to
        accept URLs as-is without attempting to connect to a higher
        level directory.  This option is off by default when only
        one URL/branch is tracked (it would do little good).
@@ -141,7 +141,7 @@ the same local time zone.
 --ignore-paths=<regex>;;
        This allows one to specify a Perl regular expression that will
        cause skipping of all matching paths from checkout from SVN.
-       The '--ignore-paths' option should match for every 'fetch'
+       The `--ignore-paths` option should match for every 'fetch'
        (including automatic fetches due to 'clone', 'dcommit',
        'rebase', etc) on a given repository.
 +
@@ -170,10 +170,10 @@ Skip "branches" and "tags" of first level directories;;
 --include-paths=<regex>;;
        This allows one to specify a Perl regular expression that will
        cause the inclusion of only matching paths from checkout from SVN.
-       The '--include-paths' option should match for every 'fetch'
+       The `--include-paths` option should match for every 'fetch'
        (including automatic fetches due to 'clone', 'dcommit',
-       'rebase', etc) on a given repository. '--ignore-paths' takes
-       precedence over '--include-paths'.
+       'rebase', etc) on a given repository. `--ignore-paths` takes
+       precedence over `--include-paths`.
 +
 [verse]
 config key: svn-remote.<name>.include-paths
@@ -191,7 +191,7 @@ config key: svn-remote.<name>.include-paths
        or if a second argument is passed; it will create a directory
        and work within that.  It accepts all arguments that the
        'init' and 'fetch' commands accept; with the exception of
-       '--fetch-all' and '--parent'.  After a repository is cloned,
+       `--fetch-all` and `--parent`.  After a repository is cloned,
        the 'fetch' command will be able to update revisions without
        affecting the working tree; and the 'rebase' command will be
        able to update the working tree with the latest changes.
@@ -216,7 +216,7 @@ it preserves linear history with 'git rebase' instead of
 'git merge' for ease of dcommitting with 'git svn'.
 +
 This accepts all options that 'git svn fetch' and 'git rebase'
-accept.  However, '--fetch-all' only fetches from the current
+accept.  However, `--fetch-all` only fetches from the current
 [svn-remote], and not all [svn-remote] definitions.
 +
 Like 'git rebase'; this requires that the working tree be clean
@@ -919,7 +919,7 @@ parent of the branch. However, it is possible that there is no suitable
 Git commit to serve as parent.  This will happen, among other reasons,
 if the SVN branch is a copy of a revision that was not fetched by 'git
 svn' (e.g. because it is an old revision that was skipped with
-'--revision'), or if in SVN a directory was copied that is not tracked
+`--revision`), or if in SVN a directory was copied that is not tracked
 by 'git svn' (such as a branch that is not tracked at all, or a
 subdirectory of a tracked branch). In these cases, 'git svn' will still
 create a Git branch, but instead of using an existing Git commit as the
@@ -996,12 +996,12 @@ directories in the working copy.  While this is the easiest way to get a
 copy of a complete repository, for projects with many branches it will
 lead to a working copy many times larger than just the trunk. Thus for
 projects using the standard directory structure (trunk/branches/tags),
-it is recommended to clone with option '--stdlayout'. If the project
+it is recommended to clone with option `--stdlayout`. If the project
 uses a non-standard structure, and/or if branches and tags are not
 required, it is easiest to only clone one directory (typically trunk),
 without giving any repository layout options.  If the full history with
-branches and tags is required, the options '--trunk' / '--branches' /
-'--tags' must be used.
+branches and tags is required, the options `--trunk` / `--branches` /
+`--tags` must be used.
 
 When using multiple --branches or --tags, 'git svn' does not automatically
 handle name collisions (for example, if two branches from different paths have
index 6b89393..7ecca8e 100644 (file)
@@ -167,7 +167,7 @@ This option is only applicable when listing tags without annotation lines.
 
 --[no-]merged [<commit>]::
        Only list tags whose tips are reachable, or not reachable
-       if '--no-merged' is used, from the specified commit ('HEAD'
+       if `--no-merged` is used, from the specified commit (`HEAD`
        if not specified).
 
 CONFIGURATION
index c6cbed1..7386c93 100644 (file)
@@ -102,7 +102,7 @@ thus, in case the assumed-untracked file is changed upstream,
 you will need to handle the situation manually.
 
 --really-refresh::
-       Like '--refresh', but checks stat information unconditionally,
+       Like `--refresh`, but checks stat information unconditionally,
        without regard to the "assume unchanged" setting.
 
 --[no-]skip-worktree::
@@ -211,7 +211,7 @@ will remove the intended effect of the option.
 
 Using --refresh
 ---------------
-'--refresh' does not calculate a new sha1 file or bring the index
+`--refresh` does not calculate a new sha1 file or bring the index
 up-to-date for mode/content changes. But what it *does* do is to
 "re-match" the stat information of a file with the index, so that you
 can refresh the index for a file that hasn't been changed but where
@@ -222,7 +222,7 @@ up the stat index details with the proper files.
 
 Using --cacheinfo or --info-only
 --------------------------------
-'--cacheinfo' is used to register a file that is not in the
+`--cacheinfo` is used to register a file that is not in the
 current working directory.  This is useful for minimum-checkout
 merging.
 
@@ -232,12 +232,12 @@ To pretend you have a file with mode and sha1 at path, say:
 $ git update-index --cacheinfo <mode>,<sha1>,<path>
 ----------------
 
-'--info-only' is used to register files without placing them in the object
+`--info-only` is used to register files without placing them in the object
 database.  This is useful for status-only repositories.
 
-Both '--cacheinfo' and '--info-only' behave similarly: the index is updated
-but the object database isn't.  '--cacheinfo' is useful when the object is
-in the database but the file isn't available locally.  '--info-only' is
+Both `--cacheinfo` and `--info-only` behave similarly: the index is updated
+but the object database isn't.  `--cacheinfo` is useful when the object is
+in the database but the file isn't available locally.  `--info-only` is
 useful when the file is available, but you do not wish to update the
 object database.
 
index 7daa28f..2d6b09a 100644 (file)
@@ -110,7 +110,7 @@ Note about git-config --global
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Note that these configuration variables should probably be set using
-the '--global' flag, for example like this:
+the `--global` flag, for example like this:
 
 ------------------------------------------------
 $ git config --global web.browser firefox
index 4ee0b36..923aa49 100644 (file)
@@ -43,9 +43,10 @@ unreleased) version of Git, that is available from the 'master'
 branch of the `git.git` repository.
 Documentation for older releases are available here:
 
-* link:v2.9.2/git.html[documentation for release 2.9.2]
+* link:v2.9.3/git.html[documentation for release 2.9.3]
 
 * release notes for
+  link:RelNotes/2.9.3.txt[2.9.3],
   link:RelNotes/2.9.2.txt[2.9.2],
   link:RelNotes/2.9.1.txt[2.9.1],
   link:RelNotes/2.9.0.txt[2.9].
@@ -515,7 +516,7 @@ OPTIONS
 
 --help::
        Prints the synopsis and a list of the most commonly used
-       commands. If the option '--all' or '-a' is given then all
+       commands. If the option `--all` or `-a` is given then all
        available commands are printed. If a Git command is named this
        option will bring up the manual page for that command.
 +
@@ -857,16 +858,16 @@ Git so take care if using a foreign front-end.
        If the `GIT_DIR` environment variable is set then it
        specifies a path to use instead of the default `.git`
        for the base of the repository.
-       The '--git-dir' command-line option also sets this value.
+       The `--git-dir` command-line option also sets this value.
 
 `GIT_WORK_TREE`::
        Set the path to the root of the working tree.
-       This can also be controlled by the '--work-tree' command-line
+       This can also be controlled by the `--work-tree` command-line
        option and the core.worktree configuration variable.
 
 `GIT_NAMESPACE`::
        Set the Git namespace; see linkgit:gitnamespaces[7] for details.
-       The '--namespace' command-line option also sets this value.
+       The `--namespace` command-line option also sets this value.
 
 `GIT_CEILING_DIRECTORIES`::
        This should be a colon-separated list of absolute paths.  If
@@ -981,7 +982,7 @@ other
        The command will be given exactly two or four arguments: the
        'username@host' (or just 'host') from the URL and the shell
        command to execute on that remote system, optionally preceded by
-       '-p' (literally) and the 'port' from the URL when it specifies
+       `-p` (literally) and the 'port' from the URL when it specifies
        something other than the default SSH port.
 +
 `$GIT_SSH_COMMAND` takes precedence over `$GIT_SSH`, and is interpreted
index e3b1de8..145dd10 100644 (file)
@@ -374,6 +374,11 @@ substitution.  For example:
        smudge = git-p4-filter --smudge %f
 ------------------------
 
+Note that "%f" is the name of the path that is being worked on. Depending
+on the version that is being filtered, the corresponding file on disk may
+not exist, or may have different contents. So, smudge and clean commands
+should not try to access the file on disk, but only act as filters on the
+content provided to them on standard input.
 
 Interaction between checkin/checkout attributes
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
index 15b3bfa..4546fa0 100644 (file)
@@ -949,7 +949,7 @@ for details.
 [NOTE]
 If there were more commits on the 'master' branch after the merge, the
 merge commit itself would not be shown by 'git show-branch' by
-default.  You would need to provide '--sparse' option to make the
+default.  You would need to provide `--sparse` option to make the
 merge commit visible in this case.
 
 Now, let's pretend you are the one who did all the work in
index c579593..08cf622 100644 (file)
@@ -28,8 +28,8 @@ The 'git diff-{asterisk}' family works by first comparing two sets of
 files:
 
  - 'git diff-index' compares contents of a "tree" object and the
-   working directory (when '--cached' flag is not used) or a
-   "tree" object and the index file (when '--cached' flag is
+   working directory (when `--cached` flag is not used) or a
+   "tree" object and the index file (when `--cached` flag is
    used);
 
  - 'git diff-files' compares contents of the index file and the
index 6ade002..a68d860 100644 (file)
@@ -82,7 +82,7 @@ linkgit:git-rev-list[1] for a complete list.
 
 --simplify-merges::
 
-       Additional option to '--full-history' to remove some needless
+       Additional option to `--full-history` to remove some needless
        merges from the resulting history, as there are no selected
        commits contributing to this merge.  (See "History
        simplification" in linkgit:git-log[1] for a more detailed
index ac70eca..07cdd73 100644 (file)
@@ -19,7 +19,7 @@ of linkgit:git-config[1].
 
 The file contains one subsection per submodule, and the subsection value
 is the name of the submodule. The name is set to the path where the
-submodule has been added unless it was customized with the '--name'
+submodule has been added unless it was customized with the `--name`
 option of 'git submodule add'. Each submodule section also contains the
 following required keys:
 
index 1e86594..a4de50a 100644 (file)
@@ -210,17 +210,17 @@ the remote repository.
 'export-marks' <file>::
        This modifies the 'export' capability, instructing Git to dump the
        internal marks table to <file> when complete. For details,
-       read up on '--export-marks=<file>' in linkgit:git-fast-export[1].
+       read up on `--export-marks=<file>` in linkgit:git-fast-export[1].
 
 'import-marks' <file>::
        This modifies the 'export' capability, instructing Git to load the
        marks specified in <file> before processing any input. For details,
-       read up on '--import-marks=<file>' in linkgit:git-fast-export[1].
+       read up on `--import-marks=<file>` in linkgit:git-fast-export[1].
 
 'signed-tags'::
        This modifies the 'export' capability, instructing Git to pass
-       '--signed-tags=verbatim' to linkgit:git-fast-export[1].  In the
-       absence of this capability, Git will use '--signed-tags=warn-strip'.
+       `--signed-tags=verbatim` to linkgit:git-fast-export[1].  In the
+       absence of this capability, Git will use `--signed-tags=warn-strip`.
 
 
 
@@ -298,7 +298,7 @@ Supported if the helper has the "fetch" capability.
        is followed by a blank line). For example, the following would
        be two batches of 'push', the first asking the remote-helper
        to push the local ref 'master' to the remote ref 'master' and
-       the local 'HEAD' to the remote 'branch', and the second
+       the local `HEAD` to the remote 'branch', and the second
        asking to push ref 'foo' to ref 'bar' (forced update requested
        by the '+').
 +
index 6d772bd..15a4c80 100644 (file)
@@ -94,7 +94,7 @@ your language, document it in the INSTALL file.
 6. There is a file command-list.txt in the distribution main directory
 that categorizes commands by type, so they can be listed in appropriate
 subsections in the documentation's summary command list.  Add an entry
-for yours.  To understand the categories, look at git-commands.txt
+for yours.  To understand the categories, look at command-list.txt
 in the main directory.  If the new command is part of the typical Git
 workflow and you believe it common enough to be mentioned in 'git help',
 map this command to a common group in the column [common].
index 4f009d4..c5bd218 100644 (file)
@@ -193,7 +193,7 @@ endif::git-rev-list[]
 
 --stdin::
        In addition to the '<commit>' listed on the command
-       line, read them from the standard input. If a '--' separator is
+       line, read them from the standard input. If a `--` separator is
        seen, stop reading commits and start reading paths to limit the
        result.
 
index 19314e3..abae363 100644 (file)
@@ -28,8 +28,8 @@ blobs contained in a commit.
   first match in the following rules:
 
   . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually
-    useful only for 'HEAD', 'FETCH_HEAD', 'ORIG_HEAD', 'MERGE_HEAD'
-    and 'CHERRY_PICK_HEAD');
+    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`
+    and `CHERRY_PICK_HEAD`);
 
   . otherwise, 'refs/<refname>' if it exists;
 
@@ -41,16 +41,16 @@ blobs contained in a commit.
 
   . otherwise, 'refs/remotes/<refname>/HEAD' if it exists.
 +
-'HEAD' names the commit on which you based the changes in the working tree.
-'FETCH_HEAD' records the branch which you fetched from a remote repository
+`HEAD` names the commit on which you based the changes in the working tree.
+`FETCH_HEAD` records the branch which you fetched from a remote repository
 with your last `git fetch` invocation.
-'ORIG_HEAD' is created by commands that move your 'HEAD' in a drastic
-way, to record the position of the 'HEAD' before their operation, so that
+`ORIG_HEAD` is created by commands that move your `HEAD` in a drastic
+way, to record the position of the `HEAD` before their operation, so that
 you can easily change the tip of the branch back to the state before you ran
 them.
-'MERGE_HEAD' records the commit(s) which you are merging into your branch
+`MERGE_HEAD` records the commit(s) which you are merging into your branch
 when you run `git merge`.
-'CHERRY_PICK_HEAD' records the commit which you are cherry-picking
+`CHERRY_PICK_HEAD` records the commit which you are cherry-picking
 when you run `git cherry-pick`.
 +
 Note that any of the 'refs/*' cases above may come either from
@@ -59,7 +59,7 @@ While the ref name encoding is unspecified, UTF-8 is preferred as
 some output processing may assume ref names in UTF-8.
 
 '@'::
-  '@' alone is a shortcut for 'HEAD'.
+  '@' alone is a shortcut for `HEAD`.
 
 '<refname>@{<date>}', e.g. 'master@\{yesterday\}', 'HEAD@{5 minutes ago}'::
   A ref followed by the suffix '@' with a date specification
@@ -71,7 +71,7 @@ some output processing may assume ref names in UTF-8.
   existing log ('$GIT_DIR/logs/<ref>'). Note that this looks up the state
   of your *local* ref at a given time; e.g., what was in your local
   'master' branch last week. If you want to look at commits made during
-  certain times, see '--since' and '--until'.
+  certain times, see `--since` and `--until`.
 
 '<refname>@{<n>}', e.g. 'master@\{1\}'::
   A ref followed by the suffix '@' with an ordinal specification
@@ -101,7 +101,7 @@ some output processing may assume ref names in UTF-8.
 '<branchname>@\{push\}', e.g. 'master@\{push\}', '@\{push\}'::
   The suffix '@\{push}' reports the branch "where we would push to" if
   `git push` were run while `branchname` was checked out (or the current
-  'HEAD' if no branchname is specified). Since our push destination is
+  `HEAD` if no branchname is specified). Since our push destination is
   in a remote repository, of course, we report the local tracking branch
   that corresponds to that branch (i.e., something in 'refs/remotes/').
 +
@@ -283,12 +283,12 @@ To summarize:
 '<rev1>..<rev2>'::
        Include commits that are reachable from <rev2> but exclude
        those that are reachable from <rev1>.  When either <rev1> or
-       <rev2> is omitted, it defaults to 'HEAD'.
+       <rev2> is omitted, it defaults to `HEAD`.
 
 '<rev1>\...<rev2>'::
        Include commits that are reachable from either <rev1> or
        <rev2> but exclude those that are reachable from both.  When
-       either <rev1> or <rev2> is omitted, it defaults to 'HEAD'.
+       either <rev1> or <rev2> is omitted, it defaults to `HEAD`.
 
 '<rev>{caret}@', e.g. 'HEAD{caret}@'::
   A suffix '{caret}' followed by an at sign is the same as listing
index ad7a5bd..28f5a8b 100644 (file)
@@ -104,6 +104,11 @@ If `free_entries` is true, each hashmap_entry in the map is freed as well
 `entry` points to the entry to initialize.
 +
 `hash` is the hash code of the entry.
++
+The hashmap_entry structure does not hold references to external resources,
+and it is safe to just discard it once you are done with it (i.e. if
+your structure was allocated with xmalloc(), you can just free(3) it,
+and if it is on stack, you can just let it go out of scope).
 
 `void *hashmap_get(const struct hashmap *map, const void *key, const void *keydata)`::
 
index 8b36343..d40ab65 100644 (file)
@@ -307,7 +307,7 @@ In multi_ack mode:
     ready to make a packfile, it will blindly ACK all 'have' obj-ids
     back to the client.
 
-  * the server will then send a 'NACK' and then wait for another response
+  * the server will then send a 'NAK' and then wait for another response
     from the client - either a 'done' or another list of 'have' lines.
 
 In multi_ack_detailed mode:
index 09f1228..0011c3f 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.9.2
+DEF_VER=v2.9.3
 
 LF='
 '
index de5a030..4579eab 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2225,17 +2225,9 @@ perf: all
 
 .PHONY: test perf
 
-t/helper/test-ctype$X: ctype.o
+t/helper/test-line-buffer$X: $(VCSSVN_LIB)
 
-t/helper/test-date$X: date.o ctype.o
-
-t/helper/test-delta$X: diff-delta.o patch-delta.o
-
-t/helper/test-line-buffer$X: vcs-svn/lib.a
-
-t/helper/test-parse-options$X: parse-options.o parse-options-cb.o
-
-t/helper/test-svn-fe$X: vcs-svn/lib.a
+t/helper/test-svn-fe$X: $(VCSSVN_LIB)
 
 .PRECIOUS: $(TEST_OBJS)
 
index 0d0afeb..779efe8 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/2.9.2.txt
\ No newline at end of file
+Documentation/RelNotes/2.9.3.txt
\ No newline at end of file
index 3dfe70b..00e4a09 100644 (file)
@@ -1578,14 +1578,14 @@ static int build_fake_ancestor(const struct am_state *state, const char *index_f
 }
 
 /**
- * Do the three-way merge using fake ancestor, his tree constructed
+ * Do the three-way merge using fake ancestor, their tree constructed
  * from the fake ancestor and the postimage of the patch, and our
  * state.
  */
 static int run_fallback_merge_recursive(const struct am_state *state,
                                        unsigned char *orig_tree,
                                        unsigned char *our_tree,
-                                       unsigned char *his_tree)
+                                       unsigned char *their_tree)
 {
        struct child_process cp = CHILD_PROCESS_INIT;
        int status;
@@ -1593,7 +1593,7 @@ static int run_fallback_merge_recursive(const struct am_state *state,
        cp.git_cmd = 1;
 
        argv_array_pushf(&cp.env_array, "GITHEAD_%s=%.*s",
-                        sha1_to_hex(his_tree), linelen(state->msg), state->msg);
+                        sha1_to_hex(their_tree), linelen(state->msg), state->msg);
        if (state->quiet)
                argv_array_push(&cp.env_array, "GIT_MERGE_VERBOSITY=0");
 
@@ -1601,7 +1601,7 @@ static int run_fallback_merge_recursive(const struct am_state *state,
        argv_array_push(&cp.args, sha1_to_hex(orig_tree));
        argv_array_push(&cp.args, "--");
        argv_array_push(&cp.args, sha1_to_hex(our_tree));
-       argv_array_push(&cp.args, sha1_to_hex(his_tree));
+       argv_array_push(&cp.args, sha1_to_hex(their_tree));
 
        status = run_command(&cp) ? (-1) : 0;
        discard_cache();
@@ -1614,7 +1614,7 @@ static int run_fallback_merge_recursive(const struct am_state *state,
  */
 static int fall_back_threeway(const struct am_state *state, const char *index_path)
 {
-       unsigned char orig_tree[GIT_SHA1_RAWSZ], his_tree[GIT_SHA1_RAWSZ],
+       unsigned char orig_tree[GIT_SHA1_RAWSZ], their_tree[GIT_SHA1_RAWSZ],
                      our_tree[GIT_SHA1_RAWSZ];
 
        if (get_sha1("HEAD", our_tree) < 0)
@@ -1651,7 +1651,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
                return error(_("Did you hand edit your patch?\n"
                                "It does not apply to blobs recorded in its index."));
 
-       if (write_index_as_tree(his_tree, &the_index, index_path, 0, NULL))
+       if (write_index_as_tree(their_tree, &the_index, index_path, 0, NULL))
                return error("could not write tree");
 
        say(state, stdout, _("Falling back to patching base and 3-way merge..."));
@@ -1661,13 +1661,13 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
 
        /*
         * This is not so wrong. Depending on which base we picked, orig_tree
-        * may be wildly different from ours, but his_tree has the same set of
+        * may be wildly different from ours, but their_tree has the same set of
         * wildly different changes in parts the patch did not touch, so
         * recursive ends up canceling them, saying that we reverted all those
         * changes.
         */
 
-       if (run_fallback_merge_recursive(state, orig_tree, our_tree, his_tree)) {
+       if (run_fallback_merge_recursive(state, orig_tree, our_tree, their_tree)) {
                rerere(state->allow_rerere_autoupdate);
                return error(_("Failed to merge in the changes."));
        }
@@ -1839,6 +1839,8 @@ static void am_run(struct am_state *state, int resume)
                const char *mail = am_path(state, msgnum(state));
                int apply_status;
 
+               reset_ident_date();
+
                if (!file_exists(mail))
                        goto next;
 
index 7417edf..d123e2e 100644 (file)
@@ -134,7 +134,7 @@ struct progress_info {
        int blamed_lines;
 };
 
-static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,
+static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b,
                      xdl_emit_hunk_consume_func_t hunk_func, void *cb_data)
 {
        xpparam_t xpp = {0};
@@ -142,7 +142,6 @@ static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,
        xdemitcb_t ecb = {NULL};
 
        xpp.flags = xdl_opts;
-       xecfg.ctxlen = ctxlen;
        xecfg.hunk_func = hunk_func;
        ecb.priv = cb_data;
        return xdi_diff(file_a, file_b, &xpp, &xecfg, &ecb);
@@ -980,7 +979,7 @@ static void pass_blame_to_parent(struct scoreboard *sb,
        fill_origin_blob(&sb->revs->diffopt, target, &file_o);
        num_get_patch++;
 
-       if (diff_hunks(&file_p, &file_o, 0, blame_chunk_cb, &d))
+       if (diff_hunks(&file_p, &file_o, blame_chunk_cb, &d))
                die("unable to generate diff (%s -> %s)",
                    oid_to_hex(&parent->commit->object.oid),
                    oid_to_hex(&target->commit->object.oid));
@@ -1129,7 +1128,7 @@ static void find_copy_in_blob(struct scoreboard *sb,
         * file_p partially may match that image.
         */
        memset(split, 0, sizeof(struct blame_entry [3]));
-       if (diff_hunks(file_p, &file_o, 1, handle_split_cb, &d))
+       if (diff_hunks(file_p, &file_o, handle_split_cb, &d))
                die("unable to generate diff (%s)",
                    oid_to_hex(&parent->commit->object.oid));
        /* remainder, if any, all match the preimage */
@@ -2230,6 +2229,7 @@ static int git_blame_config(const char *var, const char *value, void *cb)
 static void verify_working_tree_path(struct commit *work_tree, const char *path)
 {
        struct commit_list *parents;
+       int pos;
 
        for (parents = work_tree->parents; parents; parents = parents->next) {
                const unsigned char *commit_sha1 = parents->item->object.oid.hash;
@@ -2240,7 +2240,14 @@ static void verify_working_tree_path(struct commit *work_tree, const char *path)
                    sha1_object_info(blob_sha1, NULL) == OBJ_BLOB)
                        return;
        }
-       die("no such path '%s' in HEAD", path);
+
+       pos = cache_name_pos(path, strlen(path));
+       if (pos >= 0)
+               ; /* path is in the index */
+       else if (!strcmp(active_cache[-1 - pos]->name, path))
+               ; /* path is in the index, unmerged */
+       else
+               die("no such path '%s' in HEAD", path);
 }
 
 static struct commit_list **append_parent(struct commit_list **tail, const unsigned char *sha1)
index 618103f..2dfe626 100644 (file)
@@ -131,7 +131,7 @@ struct expand_data {
        unsigned char sha1[20];
        enum object_type type;
        unsigned long size;
-       unsigned long disk_size;
+       off_t disk_size;
        const char *rest;
        unsigned char delta_base_sha1[20];
 
@@ -191,7 +191,7 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len,
                if (data->mark_query)
                        data->info.disk_sizep = &data->disk_size;
                else
-                       strbuf_addf(sb, "%lu", data->disk_size);
+                       strbuf_addf(sb, "%"PRIuMAX, (uintmax_t)data->disk_size);
        } else if (is_atom("rest", atom, len)) {
                if (data->mark_query)
                        data->split_on_whitespace = 1;
index 163dbca..77e3dc8 100644 (file)
@@ -92,8 +92,9 @@ N_("If you wish to skip this commit, use:\n"
 "Then \"git cherry-pick --continue\" will resume cherry-picking\n"
 "the remaining commits.\n");
 
+static GIT_PATH_FUNC(git_path_commit_editmsg, "COMMIT_EDITMSG")
+
 static const char *use_message_buffer;
-static const char commit_editmsg[] = "COMMIT_EDITMSG";
 static struct lock_file index_lock; /* real index */
 static struct lock_file false_lock; /* used only for partial commits */
 static enum {
@@ -714,7 +715,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                char *buffer;
                buffer = strstr(use_message_buffer, "\n\n");
                if (buffer)
-                       strbuf_addstr(&sb, buffer + 2);
+                       strbuf_addstr(&sb, skip_blank_lines(buffer + 2));
                hook_arg1 = "commit";
                hook_arg2 = use_message;
        } else if (fixup_message) {
@@ -772,9 +773,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                hook_arg2 = "";
        }
 
-       s->fp = fopen_for_writing(git_path(commit_editmsg));
+       s->fp = fopen_for_writing(git_path_commit_editmsg());
        if (s->fp == NULL)
-               die_errno(_("could not open '%s'"), git_path(commit_editmsg));
+               die_errno(_("could not open '%s'"), git_path_commit_editmsg());
 
        /* Ignore status.displayCommentPrefix: we do need comments in COMMIT_EDITMSG. */
        old_display_comment_prefix = s->display_comment_prefix;
@@ -951,7 +952,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
        }
 
        if (run_commit_hook(use_editor, index_file, "prepare-commit-msg",
-                           git_path(commit_editmsg), hook_arg1, hook_arg2, NULL))
+                           git_path_commit_editmsg(), hook_arg1, hook_arg2, NULL))
                return 0;
 
        if (use_editor) {
@@ -959,7 +960,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                const char *env[2] = { NULL };
                env[0] =  index;
                snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
-               if (launch_editor(git_path(commit_editmsg), NULL, env)) {
+               if (launch_editor(git_path_commit_editmsg(), NULL, env)) {
                        fprintf(stderr,
                        _("Please supply the message using either -m or -F option.\n"));
                        exit(1);
@@ -967,7 +968,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
        }
 
        if (!no_verify &&
-           run_commit_hook(use_editor, index_file, "commit-msg", git_path(commit_editmsg), NULL)) {
+           run_commit_hook(use_editor, index_file, "commit-msg", git_path_commit_editmsg(), NULL)) {
                return 0;
        }
 
@@ -1616,7 +1617,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "interactive", &interactive, N_("interactively add files")),
                OPT_BOOL('p', "patch", &patch_interactive, N_("interactively add changes")),
                OPT_BOOL('o', "only", &only, N_("commit only specified files")),
-               OPT_BOOL('n', "no-verify", &no_verify, N_("bypass pre-commit hook")),
+               OPT_BOOL('n', "no-verify", &no_verify, N_("bypass pre-commit and commit-msg hooks")),
                OPT_BOOL(0, "dry-run", &dry_run, N_("show what would be committed")),
                OPT_SET_INT(0, "short", &status_format, N_("show status concisely"),
                            STATUS_FORMAT_SHORT),
@@ -1738,7 +1739,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 
        /* Finally, get the commit message */
        strbuf_reset(&sb);
-       if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) {
+       if (strbuf_read_file(&sb, git_path_commit_editmsg(), 0) < 0) {
                int saved_errno = errno;
                rollback_index_files();
                die(_("could not read commit message: %s"), strerror(saved_errno));
index e5658c3..ac84e99 100644 (file)
@@ -272,7 +272,7 @@ static int cmp_string_list_util_as_integral(const void *a_, const void *b_)
 static void add_people_count(struct strbuf *out, struct string_list *people)
 {
        if (people->nr == 1)
-               strbuf_addf(out, "%s", people->items[0].string);
+               strbuf_addstr(out, people->items[0].string);
        else if (people->nr == 2)
                strbuf_addf(out, "%s (%d) and %s (%d)",
                            people->items[0].string,
index 3f27456..9923b10 100644 (file)
@@ -356,6 +356,10 @@ static int fsck_sha1(const unsigned char *sha1)
 static int fsck_obj_buffer(const unsigned char *sha1, enum object_type type,
                           unsigned long size, void *buffer, int *eaten)
 {
+       /*
+        * Note, buffer may be NULL if type is OBJ_BLOB. See
+        * verify_packfile(), data_valid variable for details.
+        */
        struct object *obj;
        obj = parse_object_buffer(sha1, type, size, buffer, eaten);
        if (!obj) {
index c583aad..332bcf7 100644 (file)
@@ -177,7 +177,7 @@ static int too_many_packs(void)
                 */
                cnt++;
        }
-       return gc_auto_pack_limit <= cnt;
+       return gc_auto_pack_limit < cnt;
 }
 
 static void add_repack_all_option(void)
index 462e607..ae73831 100644 (file)
@@ -386,7 +386,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int
 
        for (nr = 0; nr < active_nr; nr++) {
                const struct cache_entry *ce = active_cache[nr];
-               if (!S_ISREG(ce->ce_mode) || ce_intent_to_add(ce))
+               if (!S_ISREG(ce->ce_mode))
                        continue;
                if (!ce_path_match(ce, pathspec, NULL))
                        continue;
@@ -396,7 +396,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int
                 * cache version instead
                 */
                if (cached || (ce->ce_flags & CE_VALID) || ce_skip_worktree(ce)) {
-                       if (ce_stage(ce))
+                       if (ce_stage(ce) || ce_intent_to_add(ce))
                                continue;
                        hit |= grep_sha1(opt, ce->sha1, ce->name, 0, ce->name);
                }
index e8c71fc..1008d7f 100644 (file)
@@ -338,10 +338,10 @@ static void parse_pack_header(void)
        use(sizeof(struct pack_header));
 }
 
-static NORETURN void bad_object(unsigned long offset, const char *format,
+static NORETURN void bad_object(off_t offset, const char *format,
                       ...) __attribute__((format (printf, 2, 3)));
 
-static NORETURN void bad_object(unsigned long offset, const char *format, ...)
+static NORETURN void bad_object(off_t offset, const char *format, ...)
 {
        va_list params;
        char buf[1024];
@@ -349,7 +349,8 @@ static NORETURN void bad_object(unsigned long offset, const char *format, ...)
        va_start(params, format);
        vsnprintf(buf, sizeof(buf), format, params);
        va_end(params);
-       die(_("pack has bad object at offset %lu: %s"), offset, buf);
+       die(_("pack has bad object at offset %"PRIuMAX": %s"),
+           (uintmax_t)offset, buf);
 }
 
 static inline struct thread_local *get_thread_data(void)
@@ -429,7 +430,7 @@ static int is_delta_type(enum object_type type)
        return (type == OBJ_REF_DELTA || type == OBJ_OFS_DELTA);
 }
 
-static void *unpack_entry_data(unsigned long offset, unsigned long size,
+static void *unpack_entry_data(off_t offset, unsigned long size,
                               enum object_type type, unsigned char *sha1)
 {
        static char fixed_buf[8192];
@@ -549,13 +550,13 @@ static void *unpack_data(struct object_entry *obj,
                         void *cb_data)
 {
        off_t from = obj[0].idx.offset + obj[0].hdr_size;
-       unsigned long len = obj[1].idx.offset - from;
+       off_t len = obj[1].idx.offset - from;
        unsigned char *data, *inbuf;
        git_zstream stream;
        int status;
 
        data = xmallocz(consume ? 64*1024 : obj->size);
-       inbuf = xmalloc((len < 64*1024) ? len : 64*1024);
+       inbuf = xmalloc((len < 64*1024) ? (int)len : 64*1024);
 
        memset(&stream, 0, sizeof(stream));
        git_inflate_init(&stream);
@@ -563,15 +564,15 @@ static void *unpack_data(struct object_entry *obj,
        stream.avail_out = consume ? 64*1024 : obj->size;
 
        do {
-               ssize_t n = (len < 64*1024) ? len : 64*1024;
+               ssize_t n = (len < 64*1024) ? (ssize_t)len : 64*1024;
                n = xpread(get_thread_data()->pack_fd, inbuf, n, from);
                if (n < 0)
                        die_errno(_("cannot pread pack file"));
                if (!n)
-                       die(Q_("premature end of pack file, %lu byte missing",
-                              "premature end of pack file, %lu bytes missing",
-                              len),
-                           len);
+                       die(Q_("premature end of pack file, %"PRIuMAX" byte missing",
+                              "premature end of pack file, %"PRIuMAX" bytes missing",
+                              (unsigned int)len),
+                           (uintmax_t)len);
                from += n;
                len -= n;
                stream.next_in = inbuf;
index 8f5e358..f854ca4 100644 (file)
@@ -341,15 +341,15 @@ static unsigned long write_no_reuse_object(struct sha1file *f, struct object_ent
 }
 
 /* Return 0 if we will bust the pack-size limit */
-static unsigned long write_reuse_object(struct sha1file *f, struct object_entry *entry,
-                                       unsigned long limit, int usable_delta)
+static off_t write_reuse_object(struct sha1file *f, struct object_entry *entry,
+                               unsigned long limit, int usable_delta)
 {
        struct packed_git *p = entry->in_pack;
        struct pack_window *w_curs = NULL;
        struct revindex_entry *revidx;
        off_t offset;
        enum object_type type = entry->type;
-       unsigned long datalen;
+       off_t datalen;
        unsigned char header[10], dheader[10];
        unsigned hdrlen;
 
@@ -415,11 +415,12 @@ static unsigned long write_reuse_object(struct sha1file *f, struct object_entry
 }
 
 /* Return 0 if we will bust the pack-size limit */
-static unsigned long write_object(struct sha1file *f,
-                                 struct object_entry *entry,
-                                 off_t write_offset)
+static off_t write_object(struct sha1file *f,
+                         struct object_entry *entry,
+                         off_t write_offset)
 {
-       unsigned long limit, len;
+       unsigned long limit;
+       off_t len;
        int usable_delta, to_reuse;
 
        if (!pack_to_stdout)
@@ -491,7 +492,7 @@ static enum write_one_status write_one(struct sha1file *f,
                                       struct object_entry *e,
                                       off_t *offset)
 {
-       unsigned long size;
+       off_t size;
        int recursing;
 
        /*
index 092c3a5..e8c5767 100644 (file)
@@ -103,7 +103,7 @@ static void print_new_head_line(struct commit *commit)
        if (body) {
                const char *eol;
                size_t len;
-               body += 2;
+               body = skip_blank_lines(body + 2);
                eol = strchr(body, '\n');
                len = eol ? eol - body : strlen(body);
                printf(" %.*s\n", (int) len, body);
index c961b74..76cf05e 100644 (file)
@@ -469,7 +469,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
                        (stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0) |
                        PARSE_OPT_SHELL_EVAL);
 
-       strbuf_addf(&parsed, " --");
+       strbuf_addstr(&parsed, " --");
        sq_quote_argv(&parsed, argv, 0);
        puts(parsed.buf);
        return 0;
index 56a2c36..4e69380 100644 (file)
@@ -76,7 +76,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
        const char * const * usage_str = revert_or_cherry_pick_usage(opts);
        const char *me = action_name(opts);
        int cmd = 0;
-       struct option options[] = {
+       struct option base_options[] = {
                OPT_CMDMODE(0, "quit", &cmd, N_("end revert or cherry-pick sequence"), 'q'),
                OPT_CMDMODE(0, "continue", &cmd, N_("resume revert or cherry-pick sequence"), 'c'),
                OPT_CMDMODE(0, "abort", &cmd, N_("cancel revert or cherry-pick sequence"), 'a'),
@@ -91,13 +91,9 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
                        N_("option for merge strategy"), option_parse_x),
                { OPTION_STRING, 'S', "gpg-sign", &opts->gpg_sign, N_("key-id"),
                  N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
-               OPT_END(),
-               OPT_END(),
-               OPT_END(),
-               OPT_END(),
-               OPT_END(),
-               OPT_END(),
+               OPT_END()
        };
+       struct option *options = base_options;
 
        if (opts->action == REPLAY_PICK) {
                struct option cp_extra[] = {
@@ -108,8 +104,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
                        OPT_BOOL(0, "keep-redundant-commits", &opts->keep_redundant_commits, N_("keep redundant, empty commits")),
                        OPT_END(),
                };
-               if (parse_options_concat(options, ARRAY_SIZE(options), cp_extra))
-                       die(_("program error"));
+               options = parse_options_concat(options, cp_extra);
        }
 
        argc = parse_options(argc, argv, NULL, options, usage_str,
index 8abb020..b2fee3e 100644 (file)
@@ -387,6 +387,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
         */
        if (!index_only) {
                int removed = 0, gitmodules_modified = 0;
+               struct strbuf buf = STRBUF_INIT;
                for (i = 0; i < list.nr; i++) {
                        const char *path = list.entry[i].name;
                        if (list.entry[i].is_submodule) {
@@ -398,7 +399,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
                                                continue;
                                        }
                                } else {
-                                       struct strbuf buf = STRBUF_INIT;
+                                       strbuf_reset(&buf);
                                        strbuf_addstr(&buf, path);
                                        if (!remove_dir_recursively(&buf, 0)) {
                                                removed = 1;
@@ -410,7 +411,6 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
                                                /* Submodule was removed by user */
                                                if (!remove_path_from_gitmodules(path))
                                                        gitmodules_modified = 1;
-                                       strbuf_release(&buf);
                                        /* Fallthrough and let remove_path() fail. */
                                }
                        }
@@ -421,6 +421,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
                        if (!removed)
                                die_errno("git rm: '%s'", path);
                }
+               strbuf_release(&buf);
                if (gitmodules_modified)
                        stage_updated_gitmodules();
        }
index ddf0cc9..f28b1f4 100644 (file)
@@ -319,12 +319,13 @@ static int update_one(struct cache_tree *it,
        i = 0;
        while (i < entries) {
                const struct cache_entry *ce = cache[i];
-               struct cache_tree_sub *sub;
+               struct cache_tree_sub *sub = NULL;
                const char *path, *slash;
                int pathlen, entlen;
                const unsigned char *sha1;
                unsigned mode;
                int expected_missing = 0;
+               int contains_ita = 0;
 
                path = ce->name;
                pathlen = ce_namelen(ce);
@@ -341,7 +342,8 @@ static int update_one(struct cache_tree *it,
                        i += sub->count;
                        sha1 = sub->cache_tree->sha1;
                        mode = S_IFDIR;
-                       if (sub->cache_tree->entry_count < 0) {
+                       contains_ita = sub->cache_tree->entry_count < 0;
+                       if (contains_ita) {
                                to_invalidate = 1;
                                expected_missing = 1;
                        }
@@ -375,11 +377,17 @@ static int update_one(struct cache_tree *it,
                 * they are not part of generated trees. Invalidate up
                 * to root to force cache-tree users to read elsewhere.
                 */
-               if (ce_intent_to_add(ce)) {
+               if (!sub && ce_intent_to_add(ce)) {
                        to_invalidate = 1;
                        continue;
                }
 
+               /*
+                * "sub" can be an empty tree if all subentries are i-t-a.
+                */
+               if (contains_ita && !hashcmp(sha1, EMPTY_TREE_SHA1_BIN))
+                       continue;
+
                strbuf_grow(&buffer, entlen + 100);
                strbuf_addf(&buffer, "%o %.*s%c", mode, entlen, path + baselen, '\0');
                strbuf_add(&buffer, sha1, 20);
diff --git a/cache.h b/cache.h
index c73becb..c141b3c 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1262,6 +1262,7 @@ extern const char *ident_default_email(void);
 extern const char *git_editor(void);
 extern const char *git_pager(int stdout_is_tty);
 extern int git_ident_config(const char *, const char *, void *);
+extern void reset_ident_date(void);
 
 struct ident_split {
        const char *name_begin;
@@ -1508,7 +1509,7 @@ struct object_info {
        /* Request */
        enum object_type *typep;
        unsigned long *sizep;
-       unsigned long *disk_sizep;
+       off_t *disk_sizep;
        unsigned char *delta_base_sha1;
        struct strbuf *typename;
 
@@ -1721,7 +1722,6 @@ extern int copy_file(const char *dst, const char *src, int mode);
 extern int copy_file_with_time(const char *dst, const char *src, int mode);
 
 extern void write_or_die(int fd, const void *buf, size_t count);
-extern int write_or_whine(int fd, const void *buf, size_t count, const char *msg);
 extern int write_or_whine_pipe(int fd, const void *buf, size_t count, const char *msg);
 extern void fsync_or_die(int fd, const char *);
 
diff --git a/color.h b/color.h
index e155d13..b9ead16 100644 (file)
--- a/color.h
+++ b/color.h
@@ -18,11 +18,6 @@ struct strbuf;
  */
 #define COLOR_MAXLEN 70
 
-/*
- * IMPORTANT: Due to the way these color codes are emulated on Windows,
- * write them only using printf(), fprintf(), and fputs(). In particular,
- * do not use puts() or write().
- */
 #define GIT_COLOR_NORMAL       ""
 #define GIT_COLOR_RESET                "\033[m"
 #define GIT_COLOR_BOLD         "\033[1m"
index 3f4f371..2a90e37 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -414,7 +414,7 @@ int find_commit_subject(const char *commit_buffer, const char **subject)
        while (*p && (*p != '\n' || p[1] != '\n'))
                p++;
        if (*p) {
-               p += 2;
+               p = skip_blank_lines(p + 2);
                for (eol = p; *eol && *eol != '\n'; eol++)
                        ; /* do nothing */
        } else
@@ -1092,9 +1092,14 @@ static int do_sign_commit(struct strbuf *buf, const char *keyid)
 {
        struct strbuf sig = STRBUF_INIT;
        int inspos, copypos;
+       const char *eoh;
 
        /* find the end of the header */
-       inspos = strstr(buf->buf, "\n\n") - buf->buf + 1;
+       eoh = strstr(buf->buf, "\n\n");
+       if (!eoh)
+               inspos = buf->len;
+       else
+               inspos = eoh - buf->buf + 1;
 
        if (!keyid || !*keyid)
                keyid = get_signing_key();
index 0c923f0..adf57d6 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -178,6 +178,7 @@ extern const char *format_subject(struct strbuf *sb, const char *msg,
                                  const char *line_separator);
 extern void userformat_find_requirements(const char *fmt, struct userformat_want *w);
 extern int commit_format_is_empty(enum cmit_fmt);
+extern const char *skip_blank_lines(const char *msg);
 extern void format_commit_message(const struct commit *commit,
                                  const char *format, struct strbuf *sb,
                                  const struct pretty_print_context *context);
index 9a8803b..ef22cbb 100644 (file)
@@ -73,6 +73,9 @@ typedef int pid_t;
 #ifndef ECONNABORTED
 #define ECONNABORTED WSAECONNABORTED
 #endif
+#ifndef ENOTSOCK
+#define ENOTSOCK WSAENOTSOCK
+#endif
 
 struct passwd {
        char *pw_name;
index a0a16eb..2d4ef59 100644 (file)
@@ -938,10 +938,10 @@ void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **
        void **ret;
        threadcache *tc;
        int mymspace;
-    size_t i, *adjustedsizes=(size_t *) alloca(elems*sizeof(size_t));
-    if(!adjustedsizes) return 0;
-    for(i=0; i<elems; i++)
-       adjustedsizes[i]=sizes[i]<sizeof(threadcacheblk) ? sizeof(threadcacheblk) : sizes[i];
+       size_t i, *adjustedsizes=(size_t *) alloca(elems*sizeof(size_t));
+       if(!adjustedsizes) return 0;
+       for(i=0; i<elems; i++)
+               adjustedsizes[i]=sizes[i]<sizeof(threadcacheblk) ? sizeof(threadcacheblk) : sizes[i];
        GetThreadCache(&p, &tc, &mymspace, 0);
        GETMSPACE(m, p, tc, mymspace, 0,
              ret=mspace_independent_comalloc(m, elems, adjustedsizes, chunks));
@@ -955,12 +955,11 @@ void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **
  */
 char *strdup(const char *s1)
 {
-       char *s2 = 0;
-       if (s1) {
-               size_t len = strlen(s1) + 1;
-               s2 = malloc(len);
+       size_t len = strlen(s1) + 1;
+       char *s2 = malloc(len);
+
+       if (s2)
                memcpy(s2, s1, len);
-       }
        return s2;
 }
 #endif
index a88f139..4cd62bd 100644 (file)
@@ -203,6 +203,7 @@ ifeq ($(uname_S),FreeBSD)
                NO_STRTOUMAX = YesPlease
        endif
        PYTHON_PATH = /usr/local/bin/python
+       PERL_PATH = /usr/local/bin/perl
        HAVE_PATHS_H = YesPlease
        GMTIME_UNRELIABLE_ERRORS = UnfortunatelyYes
        HAVE_BSD_SYSCTL = YesPlease
index c279025..aa9c91d 100644 (file)
@@ -1108,14 +1108,19 @@ GIT_CONF_SUBST([HAVE_BSD_SYSCTL])
 AC_DEFUN([PTHREADTEST_SRC], [
 AC_LANG_PROGRAM([[
 #include <pthread.h>
+static void *noop(void *ignore) { return ignore; }
 ]], [[
        pthread_mutex_t test_mutex;
        pthread_key_t test_key;
+       pthread_t th;
        int retcode = 0;
+       void *ret = (void *)0;
        retcode |= pthread_key_create(&test_key, (void *)0);
        retcode |= pthread_mutex_init(&test_mutex,(void *)0);
        retcode |= pthread_mutex_lock(&test_mutex);
        retcode |= pthread_mutex_unlock(&test_mutex);
+       retcode |= pthread_create(&th, ret, noop, ret);
+       retcode |= pthread_join(th, &ret);
        return retcode;
 ]])])
 
index 3402475..bd25b0a 100644 (file)
@@ -1092,6 +1092,7 @@ _git_clone ()
                        --depth
                        --single-branch
                        --branch
+                       --recurse-submodules
                        "
                return
                ;;
index 92baa3b..52b84ba 100644 (file)
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-BUILD_LABEL=$(shell date +"%s")
+BUILD_LABEL=$(shell cut -d" " -f3 ../../GIT-VERSION-FILE)
 TAR_OUT=$(shell go env GOOS)_$(shell go env GOARCH).tar.gz
 
 all: git-remote-persistent-https git-remote-persistent-https--proxy \
@@ -25,8 +25,10 @@ git-remote-persistent-http: git-remote-persistent-https
        ln -f -s git-remote-persistent-https git-remote-persistent-http
 
 git-remote-persistent-https:
+       case $$(go version) in \
+       "go version go"1.[0-5].*) EQ=" " ;; *) EQ="=" ;; esac && \
        go build -o git-remote-persistent-https \
-               -ldflags "-X main._BUILD_EMBED_LABEL $(BUILD_LABEL)"
+               -ldflags "-X main._BUILD_EMBED_LABEL$${EQ}$(BUILD_LABEL)"
 
 clean:
        rm -f git-remote-persistent-http* *.tar.gz
index 7a39b30..b567eae 100755 (executable)
@@ -662,6 +662,7 @@ cmd_split()
                debug "Merging split branch into HEAD..."
                latest_old=$(cache_get latest_old)
                git merge -s ours \
+                       --allow-unrelated-histories \
                        -m "$(rejoin_msg "$dir" $latest_old $latest_new)" \
                        $latest_new >&2 || exit $?
        fi
index 3bf96a9..9751cfe 100755 (executable)
@@ -16,16 +16,16 @@ export TEST_DIRECTORY
 
 subtree_test_create_repo()
 {
-       test_create_repo "$1"
+       test_create_repo "$1" &&
        (
-               cd $1
+               cd "$1" &&
                git config log.date relative
        )
 }
 
 create()
 {
-       echo "$1" >"$1"
+       echo "$1" >"$1" &&
        git add "$1"
 }
 
@@ -71,12 +71,12 @@ join_commits()
 }
 
 test_create_commit() (
-       repo=$1
-       commit=$2
-       cd "$repo"
-       mkdir -p $(dirname "$commit") \
+       repo=$1 &&
+       commit=$2 &&
+       cd "$repo" &&
+       mkdir -p "$(dirname "$commit")" \
        || error "Could not create directory for commit"
-       echo "$commit" >"$commit"
+       echo "$commit" >"$commit" &&
        git add "$commit" || error "Could not add commit"
        git commit -m "$commit" || error "Could not commit"
 )
@@ -347,6 +347,22 @@ test_expect_success 'split sub dir/ with --rejoin' '
  '
 
 next_test
+test_expect_success 'split sub dir/ with --rejoin from scratch' '
+       subtree_test_create_repo "$subtree_test_count" &&
+       test_create_commit "$subtree_test_count" main1 &&
+       (
+               cd "$subtree_test_count" &&
+               mkdir "sub dir" &&
+               echo file >"sub dir"/file &&
+               git add "sub dir/file" &&
+               git commit -m"sub dir file" &&
+               split_hash=$(git subtree split --prefix="sub dir" --rejoin) &&
+               git subtree split --prefix="sub dir" --rejoin &&
+               check_equal "$(last_commit_message)" "Split '\''sub dir/'\'' into commit '\''$split_hash'\''"
+       )
+ '
+
+next_test
 test_expect_success 'split sub dir/ with --rejoin and --message' '
        subtree_test_create_repo "$subtree_test_count" &&
        subtree_test_create_repo "$subtree_test_count/sub proj" &&
index 46dddac..a844951 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -673,9 +673,11 @@ static void set_keep_alive(int sockfd)
 {
        int ka = 1;
 
-       if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0)
-               logerror("unable to set SO_KEEPALIVE on socket: %s",
-                       strerror(errno));
+       if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0) {
+               if (errno != ENOTSOCK)
+                       logerror("unable to set SO_KEEPALIVE on socket: %s",
+                               strerror(errno));
+       }
 }
 
 static int execute(void)
diff --git a/diff.c b/diff.c
index fa78fc1..abff2ee 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -2682,6 +2682,13 @@ static int reuse_worktree_file(const char *name, const unsigned char *sha1, int
        if (!FAST_WORKING_DIRECTORY && !want_file && has_sha1_pack(sha1))
                return 0;
 
+       /*
+        * Similarly, if we'd have to convert the file contents anyway, that
+        * makes the optimization not worthwhile.
+        */
+       if (!want_file && would_convert_to_git(name))
+               return 0;
+
        len = strlen(name);
        pos = cache_name_pos(name, len);
        if (pos < 0)
index 7715c13..55067ca 100644 (file)
@@ -7,6 +7,8 @@
 #include "diffcore.h"
 #include "xdiff-interface.h"
 #include "kwset.h"
+#include "commit.h"
+#include "quote.h"
 
 typedef int (*pickaxe_fn)(mmfile_t *one, mmfile_t *two,
                          struct diff_options *o,
@@ -198,6 +200,18 @@ static void pickaxe(struct diff_queue_struct *q, struct diff_options *o,
        *q = outq;
 }
 
+static void regcomp_or_die(regex_t *regex, const char *needle, int cflags)
+{
+       int err = regcomp(regex, needle, cflags);
+       if (err) {
+               /* The POSIX.2 people are surely sick */
+               char errbuf[1024];
+               regerror(err, regex, errbuf, 1024);
+               regfree(regex);
+               die("invalid regex: %s", errbuf);
+       }
+}
+
 void diffcore_pickaxe(struct diff_options *o)
 {
        const char *needle = o->pickaxe;
@@ -206,18 +220,19 @@ void diffcore_pickaxe(struct diff_options *o)
        kwset_t kws = NULL;
 
        if (opts & (DIFF_PICKAXE_REGEX | DIFF_PICKAXE_KIND_G)) {
-               int err;
                int cflags = REG_EXTENDED | REG_NEWLINE;
                if (DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE))
                        cflags |= REG_ICASE;
-               err = regcomp(&regex, needle, cflags);
-               if (err) {
-                       /* The POSIX.2 people are surely sick */
-                       char errbuf[1024];
-                       regerror(err, &regex, errbuf, 1024);
-                       regfree(&regex);
-                       die("invalid regex: %s", errbuf);
-               }
+               regcomp_or_die(&regex, needle, cflags);
+               regexp = &regex;
+       } else if (DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE) &&
+                  has_non_ascii(needle)) {
+               struct strbuf sb = STRBUF_INIT;
+               int cflags = REG_NEWLINE | REG_ICASE;
+
+               basic_regex_quote_buf(&sb, needle);
+               regcomp_or_die(&regex, sb.buf, cflags);
+               strbuf_release(&sb);
                regexp = &regex;
        } else {
                kws = kwsalloc(DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE)
diff --git a/dir.c b/dir.c
index 6172b34..0ea235f 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -2364,7 +2364,7 @@ void write_untracked_extension(struct strbuf *out, struct untracked_cache *untra
 
        varint_len = encode_varint(untracked->ident.len, varbuf);
        strbuf_add(out, varbuf, varint_len);
-       strbuf_add(out, untracked->ident.buf, untracked->ident.len);
+       strbuf_addbuf(out, &untracked->ident);
 
        strbuf_add(out, ouc, ouc_size(len));
        free(ouc);
index a268a2c..db727ea 100644 (file)
--- a/gettext.c
+++ b/gettext.c
@@ -18,6 +18,8 @@
 #      endif
 #endif
 
+static const char *charset;
+
 /*
  * Guess the user's preferred languages from the value in LANGUAGE environment
  * variable and LC_MESSAGES locale category if NO_GETTEXT is not defined.
@@ -65,7 +67,6 @@ static int test_vsnprintf(const char *fmt, ...)
        return ret;
 }
 
-static const char *charset;
 static void init_gettext_charset(const char *domain)
 {
        /*
@@ -172,8 +173,27 @@ int gettext_width(const char *s)
 {
        static int is_utf8 = -1;
        if (is_utf8 == -1)
-               is_utf8 = !strcmp(charset, "UTF-8");
+               is_utf8 = is_utf8_locale();
 
        return is_utf8 ? utf8_strwidth(s) : strlen(s);
 }
 #endif
+
+int is_utf8_locale(void)
+{
+#ifdef NO_GETTEXT
+       if (!charset) {
+               const char *env = getenv("LC_ALL");
+               if (!env || !*env)
+                       env = getenv("LC_CTYPE");
+               if (!env || !*env)
+                       env = getenv("LANG");
+               if (!env)
+                       env = "";
+               if (strchr(env, '.'))
+                       env = strchr(env, '.') + 1;
+               charset = xstrdup(env);
+       }
+#endif
+       return is_encoding_utf8(charset);
+}
index 33696a4..7eee64a 100644 (file)
--- a/gettext.h
+++ b/gettext.h
@@ -90,5 +90,6 @@ const char *Q_(const char *msgid, const char *plu, unsigned long n)
 #endif
 
 const char *get_preferred_languages(void);
+extern int is_utf8_locale(void);
 
 #endif
index ebd13ba..a5790d0 100755 (executable)
@@ -37,14 +37,6 @@ USAGE
        exit($exitcode);
 }
 
-sub find_worktree
-{
-       # Git->repository->wc_path() does not honor changes to the working
-       # tree location made by $ENV{GIT_WORK_TREE} or the 'core.worktree'
-       # config variable.
-       return Git::command_oneline('rev-parse', '--show-toplevel');
-}
-
 sub print_tool_help
 {
        # See the comment at the bottom of file_diff() for the reason behind
@@ -67,14 +59,14 @@ sub exit_cleanup
 
 sub use_wt_file
 {
-       my ($repo, $workdir, $file, $sha1) = @_;
+       my ($workdir, $file, $sha1) = @_;
        my $null_sha1 = '0' x 40;
 
        if (-l "$workdir/$file" || ! -e _) {
                return (0, $null_sha1);
        }
 
-       my $wt_sha1 = $repo->command_oneline('hash-object', "$workdir/$file");
+       my $wt_sha1 = Git::command_oneline('hash-object', "$workdir/$file");
        my $use = ($sha1 eq $null_sha1) || ($sha1 eq $wt_sha1);
        return ($use, $wt_sha1);
 }
@@ -83,20 +75,17 @@ sub changed_files
 {
        my ($repo_path, $index, $worktree) = @_;
        $ENV{GIT_INDEX_FILE} = $index;
-       $ENV{GIT_WORK_TREE} = $worktree;
-       my $must_unset_git_dir = 0;
-       if (not defined($ENV{GIT_DIR})) {
-               $must_unset_git_dir = 1;
-               $ENV{GIT_DIR} = $repo_path;
-       }
 
-       my @refreshargs = qw/update-index --really-refresh -q --unmerged/;
-       my @gitargs = qw/diff-files --name-only -z/;
+       my @gitargs = ('--git-dir', $repo_path, '--work-tree', $worktree);
+       my @refreshargs = (
+               @gitargs, 'update-index',
+               '--really-refresh', '-q', '--unmerged');
        try {
                Git::command_oneline(@refreshargs);
        } catch Git::Error::Command with {};
 
-       my $line = Git::command_oneline(@gitargs);
+       my @diffargs = (@gitargs, 'diff-files', '--name-only', '-z');
+       my $line = Git::command_oneline(@diffargs);
        my @files;
        if (defined $line) {
                @files = split('\0', $line);
@@ -105,26 +94,15 @@ sub changed_files
        }
 
        delete($ENV{GIT_INDEX_FILE});
-       delete($ENV{GIT_WORK_TREE});
-       delete($ENV{GIT_DIR}) if ($must_unset_git_dir);
 
        return map { $_ => 1 } @files;
 }
 
 sub setup_dir_diff
 {
-       my ($repo, $workdir, $symlinks) = @_;
-
-       # Run the diff; exit immediately if no diff found
-       # 'Repository' and 'WorkingCopy' must be explicitly set to insure that
-       # if $GIT_DIR and $GIT_WORK_TREE are set in ENV, they are actually used
-       # by Git->repository->command*.
-       my $repo_path = $repo->repo_path();
-       my %repo_args = (Repository => $repo_path, WorkingCopy => $workdir);
-       my $diffrepo = Git->repository(%repo_args);
-
+       my ($workdir, $symlinks) = @_;
        my @gitargs = ('diff', '--raw', '--no-abbrev', '-z', @ARGV);
-       my $diffrtn = $diffrepo->command_oneline(@gitargs);
+       my $diffrtn = Git::command_oneline(@gitargs);
        exit(0) unless defined($diffrtn);
 
        # Build index info for left and right sides of the diff
@@ -176,12 +154,12 @@ EOF
 
                if ($lmode eq $symlink_mode) {
                        $symlink{$src_path}{left} =
-                               $diffrepo->command_oneline('show', "$lsha1");
+                               Git::command_oneline('show', $lsha1);
                }
 
                if ($rmode eq $symlink_mode) {
                        $symlink{$dst_path}{right} =
-                               $diffrepo->command_oneline('show', "$rsha1");
+                               Git::command_oneline('show', $rsha1);
                }
 
                if ($lmode ne $null_mode and $status !~ /^C/) {
@@ -193,8 +171,8 @@ EOF
                        if ($working_tree_dups{$dst_path}++) {
                                next;
                        }
-                       my ($use, $wt_sha1) = use_wt_file($repo, $workdir,
-                                                         $dst_path, $rsha1);
+                       my ($use, $wt_sha1) =
+                               use_wt_file($workdir, $dst_path, $rsha1);
                        if ($use) {
                                push @working_tree, $dst_path;
                                $wtindex .= "$rmode $wt_sha1\t$dst_path\0";
@@ -211,44 +189,34 @@ EOF
        mkpath($ldir) or exit_cleanup($tmpdir, 1);
        mkpath($rdir) or exit_cleanup($tmpdir, 1);
 
-       # If $GIT_DIR is not set prior to calling 'git update-index' and
-       # 'git checkout-index', then those commands will fail if difftool
-       # is called from a directory other than the repo root.
-       my $must_unset_git_dir = 0;
-       if (not defined($ENV{GIT_DIR})) {
-               $must_unset_git_dir = 1;
-               $ENV{GIT_DIR} = $repo_path;
-       }
-
        # Populate the left and right directories based on each index file
        my ($inpipe, $ctx);
        $ENV{GIT_INDEX_FILE} = "$tmpdir/lindex";
        ($inpipe, $ctx) =
-               $repo->command_input_pipe(qw(update-index -z --index-info));
+               Git::command_input_pipe('update-index', '-z', '--index-info');
        print($inpipe $lindex);
-       $repo->command_close_pipe($inpipe, $ctx);
+       Git::command_close_pipe($inpipe, $ctx);
 
        my $rc = system('git', 'checkout-index', '--all', "--prefix=$ldir/");
        exit_cleanup($tmpdir, $rc) if $rc != 0;
 
        $ENV{GIT_INDEX_FILE} = "$tmpdir/rindex";
        ($inpipe, $ctx) =
-               $repo->command_input_pipe(qw(update-index -z --index-info));
+               Git::command_input_pipe('update-index', '-z', '--index-info');
        print($inpipe $rindex);
-       $repo->command_close_pipe($inpipe, $ctx);
+       Git::command_close_pipe($inpipe, $ctx);
 
        $rc = system('git', 'checkout-index', '--all', "--prefix=$rdir/");
        exit_cleanup($tmpdir, $rc) if $rc != 0;
 
        $ENV{GIT_INDEX_FILE} = "$tmpdir/wtindex";
        ($inpipe, $ctx) =
-               $repo->command_input_pipe(qw(update-index --info-only -z --index-info));
+               Git::command_input_pipe('update-index', '--info-only', '-z', '--index-info');
        print($inpipe $wtindex);
-       $repo->command_close_pipe($inpipe, $ctx);
+       Git::command_close_pipe($inpipe, $ctx);
 
        # If $GIT_DIR was explicitly set just for the update/checkout
        # commands, then it should be unset before continuing.
-       delete($ENV{GIT_DIR}) if ($must_unset_git_dir);
        delete($ENV{GIT_INDEX_FILE});
 
        # Changes in the working tree need special treatment since they are
@@ -415,9 +383,9 @@ sub dir_diff
        my $rc;
        my $error = 0;
        my $repo = Git->repository();
-       my $workdir = find_worktree();
-       my ($a, $b, $tmpdir, @worktree) =
-               setup_dir_diff($repo, $workdir, $symlinks);
+       my $repo_path = $repo->repo_path();
+       my $workdir = $repo->wc_path();
+       my ($a, $b, $tmpdir, @worktree) = setup_dir_diff($workdir, $symlinks);
 
        if (defined($extcmd)) {
                $rc = system($extcmd, $a, $b);
@@ -443,10 +411,10 @@ sub dir_diff
                next if ! -f "$b/$file";
 
                if (!$indices_loaded) {
-                       %wt_modified = changed_files($repo->repo_path(),
-                               "$tmpdir/wtindex", "$workdir");
-                       %tmp_modified = changed_files($repo->repo_path(),
-                               "$tmpdir/wtindex", "$b");
+                       %wt_modified = changed_files(
+                               $repo_path, "$tmpdir/wtindex", $workdir);
+                       %tmp_modified = changed_files(
+                               $repo_path, "$tmpdir/wtindex", $b);
                        $indices_loaded = 1;
                }
 
index 05f22e4..4f499d2 100644 (file)
@@ -212,6 +212,7 @@ exit_with_patch () {
 }
 
 die_abort () {
+       apply_autostash
        rm -rf "$state_dir"
        die "$1"
 }
index 7fe8a51..78fdac9 100755 (executable)
@@ -379,8 +379,6 @@ cmd_init()
 #
 # Unregister submodules from .git/config and remove their work tree
 #
-# $@ = requested paths (use '.' to deinit all submodules)
-#
 cmd_deinit()
 {
        # parse $args after "submodule ... deinit".
index 2fddf75..33d701d 100755 (executable)
@@ -2090,7 +2090,7 @@ sub format_ref_marker {
                                -href => href(
                                        action=>$dest_action,
                                        hash=>$dest
-                               )}, $name);
+                               )}, esc_html($name));
 
                        $markers .= " <span class=\"".esc_attr($class)."\" title=\"".esc_attr($ref)."\">" .
                                $link . "</span>";
diff --git a/grep.c b/grep.c
index 1e15b62..58d599e 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -4,6 +4,8 @@
 #include "xdiff-interface.h"
 #include "diff.h"
 #include "diffcore.h"
+#include "commit.h"
+#include "quote.h"
 
 static int grep_source_load(struct grep_source *gs);
 static int grep_source_is_binary(struct grep_source *gs);
@@ -161,17 +163,7 @@ void grep_init(struct grep_opt *opt, const char *prefix)
        color_set(opt->color_sep, def->color_sep);
 }
 
-void grep_commit_pattern_type(enum grep_pattern_type pattern_type, struct grep_opt *opt)
-{
-       if (pattern_type != GREP_PATTERN_TYPE_UNSPECIFIED)
-               grep_set_pattern_type_option(pattern_type, opt);
-       else if (opt->pattern_type_option != GREP_PATTERN_TYPE_UNSPECIFIED)
-               grep_set_pattern_type_option(opt->pattern_type_option, opt);
-       else if (opt->extended_regexp_option)
-               grep_set_pattern_type_option(GREP_PATTERN_TYPE_ERE, opt);
-}
-
-void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, struct grep_opt *opt)
+static void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, struct grep_opt *opt)
 {
        switch (pattern_type) {
        case GREP_PATTERN_TYPE_UNSPECIFIED:
@@ -203,6 +195,16 @@ void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, struct gr
        }
 }
 
+void grep_commit_pattern_type(enum grep_pattern_type pattern_type, struct grep_opt *opt)
+{
+       if (pattern_type != GREP_PATTERN_TYPE_UNSPECIFIED)
+               grep_set_pattern_type_option(pattern_type, opt);
+       else if (opt->pattern_type_option != GREP_PATTERN_TYPE_UNSPECIFIED)
+               grep_set_pattern_type_option(opt->pattern_type_option, opt);
+       else if (opt->extended_regexp_option)
+               grep_set_pattern_type_option(GREP_PATTERN_TYPE_ERE, opt);
+}
+
 static struct grep_pat *create_grep_pat(const char *pat, size_t patlen,
                                        const char *origin, int no,
                                        enum grep_pat_token t,
@@ -322,11 +324,16 @@ static void compile_pcre_regexp(struct grep_pat *p, const struct grep_opt *opt)
        int erroffset;
        int options = PCRE_MULTILINE;
 
-       if (opt->ignore_case)
+       if (opt->ignore_case) {
+               if (has_non_ascii(p->pattern))
+                       p->pcre_tables = pcre_maketables();
                options |= PCRE_CASELESS;
+       }
+       if (is_utf8_locale() && has_non_ascii(p->pattern))
+               options |= PCRE_UTF8;
 
        p->pcre_regexp = pcre_compile(p->pattern, options, &error, &erroffset,
-                       NULL);
+                                     p->pcre_tables);
        if (!p->pcre_regexp)
                compile_regexp_failed(p, error);
 
@@ -360,6 +367,7 @@ static void free_pcre_regexp(struct grep_pat *p)
 {
        pcre_free(p->pcre_regexp);
        pcre_free(p->pcre_extra_info);
+       pcre_free((void *)p->pcre_tables);
 }
 #else /* !USE_LIBPCRE */
 static void compile_pcre_regexp(struct grep_pat *p, const struct grep_opt *opt)
@@ -396,26 +404,68 @@ static int is_fixed(const char *s, size_t len)
        return 1;
 }
 
+static void compile_fixed_regexp(struct grep_pat *p, struct grep_opt *opt)
+{
+       struct strbuf sb = STRBUF_INIT;
+       int err;
+       int regflags;
+
+       basic_regex_quote_buf(&sb, p->pattern);
+       regflags = opt->regflags & ~REG_EXTENDED;
+       if (opt->ignore_case)
+               regflags |= REG_ICASE;
+       err = regcomp(&p->regexp, sb.buf, regflags);
+       if (opt->debug)
+               fprintf(stderr, "fixed %s\n", sb.buf);
+       strbuf_release(&sb);
+       if (err) {
+               char errbuf[1024];
+               regerror(err, &p->regexp, errbuf, sizeof(errbuf));
+               regfree(&p->regexp);
+               compile_regexp_failed(p, errbuf);
+       }
+}
+
 static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
 {
+       int icase, ascii_only;
        int err;
 
        p->word_regexp = opt->word_regexp;
        p->ignore_case = opt->ignore_case;
+       icase          = opt->regflags & REG_ICASE || p->ignore_case;
+       ascii_only     = !has_non_ascii(p->pattern);
 
+       /*
+        * Even when -F (fixed) asks us to do a non-regexp search, we
+        * may not be able to correctly case-fold when -i
+        * (ignore-case) is asked (in which case, we'll synthesize a
+        * regexp to match the pattern that matches regexp special
+        * characters literally, while ignoring case differences).  On
+        * the other hand, even without -F, if the pattern does not
+        * have any regexp special characters and there is no need for
+        * case-folding search, we can internally turn it into a
+        * simple string match using kws.  p->fixed tells us if we
+        * want to use kws.
+        */
        if (opt->fixed || is_fixed(p->pattern, p->patternlen))
-               p->fixed = 1;
+               p->fixed = !icase || ascii_only;
        else
                p->fixed = 0;
 
        if (p->fixed) {
-               if (opt->regflags & REG_ICASE || p->ignore_case)
-                       p->kws = kwsalloc(tolower_trans_tbl);
-               else
-                       p->kws = kwsalloc(NULL);
+               p->kws = kwsalloc(icase ? tolower_trans_tbl : NULL);
                kwsincr(p->kws, p->pattern, p->patternlen);
                kwsprep(p->kws);
                return;
+       } else if (opt->fixed) {
+               /*
+                * We come here when the pattern has the non-ascii
+                * characters we cannot case-fold, and asked to
+                * ignore-case.
+                */
+               compile_fixed_regexp(p, opt);
+               return;
        }
 
        if (opt->pcre) {
diff --git a/grep.h b/grep.h
index 95f197a..5856a23 100644 (file)
--- a/grep.h
+++ b/grep.h
@@ -48,6 +48,7 @@ struct grep_pat {
        regex_t regexp;
        pcre *pcre_regexp;
        pcre_extra *pcre_extra_info;
+       const unsigned char *pcre_tables;
        kwset_t kws;
        unsigned fixed:1;
        unsigned ignore_case:1;
@@ -144,7 +145,6 @@ struct grep_opt {
 extern void init_grep_defaults(void);
 extern int grep_config(const char *var, const char *value, void *);
 extern void grep_init(struct grep_opt *, const char *prefix);
-void grep_set_pattern_type_option(enum grep_pattern_type, struct grep_opt *opt);
 void grep_commit_pattern_type(enum grep_pattern_type, struct grep_opt *opt);
 
 extern void append_grep_pat(struct grep_opt *opt, const char *pat, size_t patlen, const char *origin, int no, enum grep_pat_token t);
index a092f02..d0b29ac 100644 (file)
@@ -1137,7 +1137,7 @@ static void remote_ls(const char *path, int flags,
        ls.userData = userData;
        ls.userFunc = userFunc;
 
-       strbuf_addf(&out_buffer.buf, PROPFIND_ALL_REQUEST);
+       strbuf_addstr(&out_buffer.buf, PROPFIND_ALL_REQUEST);
 
        dav_headers = curl_slist_append(dav_headers, "Depth: 1");
        dav_headers = curl_slist_append(dav_headers, "Content-Type: text/xml");
diff --git a/http.c b/http.c
index df6dd01..d8e427b 100644 (file)
--- a/http.c
+++ b/http.c
@@ -1105,7 +1105,7 @@ void append_remote_object_url(struct strbuf *buf, const char *url,
 
        strbuf_addf(buf, "objects/%.*s/", 2, hex);
        if (!only_two_digit_prefix)
-               strbuf_addf(buf, "%s", hex+2);
+               strbuf_addstr(buf, hex + 2);
 }
 
 char *get_remote_object_url(const char *url, const char *hex,
diff --git a/ident.c b/ident.c
index 139c528..e20a772 100644 (file)
--- a/ident.c
+++ b/ident.c
@@ -184,6 +184,11 @@ static const char *ident_default_date(void)
        return git_default_date.buf;
 }
 
+void reset_ident_date(void)
+{
+       strbuf_reset(&git_default_date);
+}
+
 static int crud(unsigned char c)
 {
        return  c <= 32  ||
index 34bfac0..f000595 100644 (file)
@@ -298,12 +298,8 @@ static void write_buf_to_worktree(const unsigned char *obj,
        char *path = git_pathdup(NOTES_MERGE_WORKTREE "/%s", sha1_to_hex(obj));
        if (safe_create_leading_directories_const(path))
                die_errno("unable to create directory for '%s'", path);
-       if (file_exists(path))
-               die("found existing file at '%s'", path);
 
-       fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, 0666);
-       if (fd < 0)
-               die_errno("failed to open '%s'", path);
+       fd = xopen(path, O_WRONLY | O_EXCL | O_CREAT, 0666);
 
        while (size > 0) {
                long ret = write_in_full(fd, buf, size);
index 1da89a4..d123846 100644 (file)
@@ -105,6 +105,8 @@ static int verify_packfile(struct packed_git *p,
                void *data;
                enum object_type type;
                unsigned long size;
+               off_t curpos;
+               int data_valid;
 
                if (p->index_version > 1) {
                        off_t offset = entries[i].offset;
@@ -116,8 +118,25 @@ static int verify_packfile(struct packed_git *p,
                                            sha1_to_hex(entries[i].sha1),
                                            p->pack_name, (uintmax_t)offset);
                }
-               data = unpack_entry(p, entries[i].offset, &type, &size);
-               if (!data)
+
+               curpos = entries[i].offset;
+               type = unpack_object_header(p, w_curs, &curpos, &size);
+               unuse_pack(w_curs);
+
+               if (type == OBJ_BLOB && big_file_threshold <= size) {
+                       /*
+                        * Let check_sha1_signature() check it with
+                        * the streaming interface; no point slurping
+                        * the data in-core only to discard.
+                        */
+                       data = NULL;
+                       data_valid = 0;
+               } else {
+                       data = unpack_entry(p, entries[i].offset, &type, &size);
+                       data_valid = 1;
+               }
+
+               if (data_valid && !data)
                        err = error("cannot unpack %s from %s at offset %"PRIuMAX"",
                                    sha1_to_hex(entries[i].sha1), p->pack_name,
                                    (uintmax_t)entries[i].offset);
diff --git a/pack.h b/pack.h
index 3223f5a..0e77429 100644 (file)
--- a/pack.h
+++ b/pack.h
@@ -74,6 +74,7 @@ struct pack_idx_entry {
 
 
 struct progress;
+/* Note, the data argument could be NULL if object type is blob */
 typedef int (*verify_fn)(const unsigned char*, enum object_type, unsigned long, void*, int*);
 
 extern const char *write_idx_file(const char *index_name, struct pack_idx_entry **objects, int nr_objects, const struct pack_idx_option *, const unsigned char *sha1);
index 239898d..2d87520 100644 (file)
@@ -117,19 +117,24 @@ int parse_opt_tertiary(const struct option *opt, const char *arg, int unset)
        return 0;
 }
 
-int parse_options_concat(struct option *dst, size_t dst_size, struct option *src)
+struct option *parse_options_concat(struct option *a, struct option *b)
 {
-       int i, j;
-
-       for (i = 0; i < dst_size; i++)
-               if (dst[i].type == OPTION_END)
-                       break;
-       for (j = 0; i < dst_size; i++, j++) {
-               dst[i] = src[j];
-               if (src[j].type == OPTION_END)
-                       return 0;
-       }
-       return -1;
+       struct option *ret;
+       size_t i, a_len = 0, b_len = 0;
+
+       for (i = 0; a[i].type != OPTION_END; i++)
+               a_len++;
+       for (i = 0; b[i].type != OPTION_END; i++)
+               b_len++;
+
+       ALLOC_ARRAY(ret, st_add3(a_len, b_len, 1));
+       for (i = 0; i < a_len; i++)
+               ret[i] = a[i];
+       for (i = 0; i < b_len; i++)
+               ret[a_len + i] = b[i];
+       ret[a_len + b_len] = b[b_len]; /* final OPTION_END */
+
+       return ret;
 }
 
 int parse_opt_string_list(const struct option *opt, const char *arg, int unset)
index ea4af92..78f8384 100644 (file)
@@ -215,7 +215,7 @@ extern int parse_options_step(struct parse_opt_ctx_t *ctx,
 
 extern int parse_options_end(struct parse_opt_ctx_t *ctx);
 
-extern int parse_options_concat(struct option *dst, size_t, struct option *src);
+extern struct option *parse_options_concat(struct option *a, struct option *b);
 
 /*----- some often used options -----*/
 extern int parse_opt_abbrev_cb(const struct option *, const char *, int);
diff --git a/path.c b/path.c
index 259aeed..17551c4 100644 (file)
--- a/path.c
+++ b/path.c
@@ -483,7 +483,7 @@ static void do_submodule_path(struct strbuf *buf, const char *path,
                strbuf_addstr(buf, git_dir);
        }
        strbuf_addch(buf, '/');
-       strbuf_addstr(&git_submodule_dir, buf->buf);
+       strbuf_addbuf(&git_submodule_dir, buf);
 
        strbuf_vaddf(buf, fmt, args);
 
index 8d18247..b271656 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -507,7 +507,7 @@ void pp_user_info(struct pretty_print_context *pp,
        }
 }
 
-static int is_empty_line(const char *line, int *len_p)
+static int is_blank_line(const char *line, int *len_p)
 {
        int len = *len_p;
        while (len && isspace(line[len - 1]))
@@ -516,14 +516,14 @@ static int is_empty_line(const char *line, int *len_p)
        return !len;
 }
 
-static const char *skip_empty_lines(const char *msg)
+const char *skip_blank_lines(const char *msg)
 {
        for (;;) {
                int linelen = get_one_line(msg);
                int ll = linelen;
                if (!linelen)
                        break;
-               if (!is_empty_line(msg, &ll))
+               if (!is_blank_line(msg, &ll))
                        break;
                msg += linelen;
        }
@@ -875,7 +875,7 @@ const char *format_subject(struct strbuf *sb, const char *msg,
                int linelen = get_one_line(line);
 
                msg += linelen;
-               if (!linelen || is_empty_line(line, &linelen))
+               if (!linelen || is_blank_line(line, &linelen))
                        break;
 
                if (!sb)
@@ -894,11 +894,11 @@ static void parse_commit_message(struct format_commit_context *c)
        const char *msg = c->message + c->message_off;
        const char *start = c->message;
 
-       msg = skip_empty_lines(msg);
+       msg = skip_blank_lines(msg);
        c->subject_off = msg - start;
 
        msg = format_subject(NULL, msg, NULL);
-       msg = skip_empty_lines(msg);
+       msg = skip_blank_lines(msg);
        c->body_off = msg - start;
 
        c->commit_message_parsed = 1;
@@ -1718,7 +1718,7 @@ void pp_remainder(struct pretty_print_context *pp,
                if (!linelen)
                        break;
 
-               if (is_empty_line(line, &linelen)) {
+               if (is_blank_line(line, &linelen)) {
                        if (first)
                                continue;
                        if (pp->fmt == CMIT_FMT_SHORT)
@@ -1789,7 +1789,7 @@ void pretty_print_commit(struct pretty_print_context *pp,
        }
 
        /* Skip excess blank lines at the beginning of body, if any... */
-       msg = skip_empty_lines(msg);
+       msg = skip_blank_lines(msg);
 
        /* These formats treat the title line specially. */
        if (pp->fmt == CMIT_FMT_ONELINE || pp->fmt == CMIT_FMT_EMAIL)
diff --git a/quote.c b/quote.c
index b281a8f..53b98a5 100644 (file)
--- a/quote.c
+++ b/quote.c
@@ -453,3 +453,40 @@ void tcl_quote_buf(struct strbuf *sb, const char *src)
        }
        strbuf_addch(sb, '"');
 }
+
+void basic_regex_quote_buf(struct strbuf *sb, const char *src)
+{
+       char c;
+
+       if (*src == '^') {
+               /* only beginning '^' is special and needs quoting */
+               strbuf_addch(sb, '\\');
+               strbuf_addch(sb, *src++);
+       }
+       if (*src == '*')
+               /* beginning '*' is not special, no quoting */
+               strbuf_addch(sb, *src++);
+
+       while ((c = *src++)) {
+               switch (c) {
+               case '[':
+               case '.':
+               case '\\':
+               case '*':
+                       strbuf_addch(sb, '\\');
+                       strbuf_addch(sb, c);
+                       break;
+
+               case '$':
+                       /* only the end '$' is special and needs quoting */
+                       if (*src == '\0')
+                               strbuf_addch(sb, '\\');
+                       strbuf_addch(sb, c);
+                       break;
+
+               default:
+                       strbuf_addch(sb, c);
+                       break;
+               }
+       }
+}
diff --git a/quote.h b/quote.h
index 6c53a2c..66f5644 100644 (file)
--- a/quote.h
+++ b/quote.h
@@ -70,5 +70,6 @@ extern char *quote_path_relative(const char *in, const char *prefix,
 extern void perl_quote_buf(struct strbuf *sb, const char *src);
 extern void python_quote_buf(struct strbuf *sb, const char *src);
 extern void tcl_quote_buf(struct strbuf *sb, const char *src);
+extern void basic_regex_quote_buf(struct strbuf *sb, const char *src);
 
 #endif
index d30d1c4..fe0f3a4 100644 (file)
@@ -1971,16 +1971,16 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
        } else if (!strcmp(arg, "--grep-debug")) {
                revs->grep_filter.debug = 1;
        } else if (!strcmp(arg, "--basic-regexp")) {
-               grep_set_pattern_type_option(GREP_PATTERN_TYPE_BRE, &revs->grep_filter);
+               revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_BRE;
        } else if (!strcmp(arg, "--extended-regexp") || !strcmp(arg, "-E")) {
-               grep_set_pattern_type_option(GREP_PATTERN_TYPE_ERE, &revs->grep_filter);
+               revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_ERE;
        } else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) {
                revs->grep_filter.regflags |= REG_ICASE;
                DIFF_OPT_SET(&revs->diffopt, PICKAXE_IGNORE_CASE);
        } else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) {
-               grep_set_pattern_type_option(GREP_PATTERN_TYPE_FIXED, &revs->grep_filter);
+               revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_FIXED;
        } else if (!strcmp(arg, "--perl-regexp")) {
-               grep_set_pattern_type_option(GREP_PATTERN_TYPE_PCRE, &revs->grep_filter);
+               revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_PCRE;
        } else if (!strcmp(arg, "--all-match")) {
                revs->grep_filter.all_match = 1;
        } else if (!strcmp(arg, "--invert-grep")) {
index 37ee04e..1f85c56 100644 (file)
@@ -36,18 +36,15 @@ int option_parse_push_signed(const struct option *opt,
        die("bad %s argument: %s", opt->long_name, arg);
 }
 
-static int feed_object(const unsigned char *sha1, int fd, int negative)
+static void feed_object(const unsigned char *sha1, FILE *fh, int negative)
 {
-       char buf[42];
-
        if (negative && !has_sha1_file(sha1))
-               return 1;
+               return;
 
-       memcpy(buf + negative, sha1_to_hex(sha1), 40);
        if (negative)
-               buf[0] = '^';
-       buf[40 + negative] = '\n';
-       return write_or_whine(fd, buf, 41 + negative, "send-pack: send refs");
+               putc('^', fh);
+       fputs(sha1_to_hex(sha1), fh);
+       putc('\n', fh);
 }
 
 /*
@@ -73,6 +70,7 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
                NULL,
        };
        struct child_process po = CHILD_PROCESS_INIT;
+       FILE *po_in;
        int i;
 
        i = 4;
@@ -97,21 +95,22 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
         * We feed the pack-objects we just spawned with revision
         * parameters by writing to the pipe.
         */
+       po_in = xfdopen(po.in, "w");
        for (i = 0; i < extra->nr; i++)
-               if (!feed_object(extra->sha1[i], po.in, 1))
-                       break;
+               feed_object(extra->sha1[i], po_in, 1);
 
        while (refs) {
-               if (!is_null_oid(&refs->old_oid) &&
-                   !feed_object(refs->old_oid.hash, po.in, 1))
-                       break;
-               if (!is_null_oid(&refs->new_oid) &&
-                   !feed_object(refs->new_oid.hash, po.in, 0))
-                       break;
+               if (!is_null_oid(&refs->old_oid))
+                       feed_object(refs->old_oid.hash, po_in, 1);
+               if (!is_null_oid(&refs->new_oid))
+                       feed_object(refs->new_oid.hash, po_in, 0);
                refs = refs->next;
        }
 
-       close(po.in);
+       fflush(po_in);
+       if (ferror(po_in))
+               die_errno("error writing to pack-objects");
+       fclose(po_in);
 
        if (args->stateless_rpc) {
                char *buf = xmalloc(LARGE_PACKET_MAX);
@@ -266,7 +265,7 @@ static int generate_push_cert(struct strbuf *req_buf,
        struct strbuf cert = STRBUF_INIT;
        int update_seen = 0;
 
-       strbuf_addf(&cert, "certificate version 0.1\n");
+       strbuf_addstr(&cert, "certificate version 0.1\n");
        strbuf_addf(&cert, "pusher %s ", signing_key);
        datestamp(&cert);
        strbuf_addch(&cert, '\n');
index c6362d6..80a17bb 100644 (file)
@@ -112,7 +112,7 @@ static void remove_sequencer_state(void)
 {
        struct strbuf seq_dir = STRBUF_INIT;
 
-       strbuf_addf(&seq_dir, "%s", git_path(SEQ_DIR));
+       strbuf_addstr(&seq_dir, git_path(SEQ_DIR));
        remove_dir_recursively(&seq_dir, 0);
        strbuf_release(&seq_dir);
 }
@@ -544,10 +544,8 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
                 * information followed by "\n\n".
                 */
                p = strstr(msg.message, "\n\n");
-               if (p) {
-                       p += 2;
-                       strbuf_addstr(&msgbuf, p);
-               }
+               if (p)
+                       strbuf_addstr(&msgbuf, skip_blank_lines(p + 2));
 
                if (opts->record_origin) {
                        if (!has_conforming_footer(&msgbuf, NULL, 0))
index d5e1121..cb571ac 100644 (file)
@@ -2281,7 +2281,7 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
 
                if (do_check_packed_object_crc && p->index_version > 1) {
                        struct revindex_entry *revidx = find_pack_revindex(p, obj_offset);
-                       unsigned long len = revidx[1].offset - obj_offset;
+                       off_t len = revidx[1].offset - obj_offset;
                        if (check_pack_crc(p, &w_curs, obj_offset, len, revidx->nr)) {
                                const unsigned char *sha1 =
                                        nth_packed_object_sha1(p, revidx->nr);
index fde8adc..1e4d684 100644 (file)
  * the remote died unexpectedly.  A flush() concludes the stream.
  */
 
-#define PREFIX "remote:"
+#define PREFIX "remote: "
 
 #define ANSI_SUFFIX "\033[K"
 #define DUMB_SUFFIX "        "
 
-#define FIX_SIZE 10  /* large enough for any of the above */
-
 int recv_sideband(const char *me, int in_stream, int out)
 {
-       unsigned pf = strlen(PREFIX);
-       unsigned sf;
-       char buf[LARGE_PACKET_MAX + 2*FIX_SIZE];
-       char *suffix, *term;
-       int skip_pf = 0;
+       const char *term, *suffix;
+       char buf[LARGE_PACKET_MAX + 1];
+       struct strbuf outbuf = STRBUF_INIT;
+       int retval = 0;
 
-       memcpy(buf, PREFIX, pf);
        term = getenv("TERM");
        if (isatty(2) && term && strcmp(term, "dumb"))
                suffix = ANSI_SUFFIX;
        else
                suffix = DUMB_SUFFIX;
-       sf = strlen(suffix);
 
-       while (1) {
+       while (!retval) {
+               const char *b, *brk;
                int band, len;
-               len = packet_read(in_stream, NULL, NULL, buf + pf, LARGE_PACKET_MAX, 0);
+               len = packet_read(in_stream, NULL, NULL, buf, LARGE_PACKET_MAX, 0);
                if (len == 0)
                        break;
                if (len < 1) {
-                       fprintf(stderr, "%s: protocol error: no band designator\n", me);
-                       return SIDEBAND_PROTOCOL_ERROR;
+                       strbuf_addf(&outbuf,
+                                   "%s%s: protocol error: no band designator",
+                                   outbuf.len ? "\n" : "", me);
+                       retval = SIDEBAND_PROTOCOL_ERROR;
+                       break;
                }
-               band = buf[pf] & 0xff;
+               band = buf[0] & 0xff;
+               buf[len] = '\0';
                len--;
                switch (band) {
                case 3:
-                       buf[pf] = ' ';
-                       buf[pf+1+len] = '\0';
-                       fprintf(stderr, "%s\n", buf);
-                       return SIDEBAND_REMOTE_ERROR;
+                       strbuf_addf(&outbuf, "%s%s%s", outbuf.len ? "\n" : "",
+                                   PREFIX, buf + 1);
+                       retval = SIDEBAND_REMOTE_ERROR;
+                       break;
                case 2:
-                       buf[pf] = ' ';
-                       do {
-                               char *b = buf;
-                               int brk = 0;
+                       b = buf + 1;
 
-                               /*
-                                * If the last buffer didn't end with a line
-                                * break then we should not print a prefix
-                                * this time around.
-                                */
-                               if (skip_pf) {
-                                       b += pf+1;
-                               } else {
-                                       len += pf+1;
-                                       brk += pf+1;
-                               }
-
-                               /* Look for a line break. */
-                               for (;;) {
-                                       brk++;
-                                       if (brk > len) {
-                                               brk = 0;
-                                               break;
-                                       }
-                                       if (b[brk-1] == '\n' ||
-                                           b[brk-1] == '\r')
-                                               break;
-                               }
+                       /*
+                        * Append a suffix to each nonempty line to clear the
+                        * end of the screen line.
+                        *
+                        * The output is accumulated in a buffer and
+                        * each line is printed to stderr using
+                        * write(2) to ensure inter-process atomicity.
+                        */
+                       while ((brk = strpbrk(b, "\n\r"))) {
+                               int linelen = brk - b;
 
-                               /*
-                                * Let's insert a suffix to clear the end
-                                * of the screen line if a line break was
-                                * found.  Also, if we don't skip the
-                                * prefix, then a non-empty string must be
-                                * present too.
-                                */
-                               if (brk > (skip_pf ? 0 : (pf+1 + 1))) {
-                                       char save[FIX_SIZE];
-                                       memcpy(save, b + brk, sf);
-                                       b[brk + sf - 1] = b[brk - 1];
-                                       memcpy(b + brk - 1, suffix, sf);
-                                       fprintf(stderr, "%.*s", brk + sf, b);
-                                       memcpy(b + brk, save, sf);
-                                       len -= brk;
+                               if (!outbuf.len)
+                                       strbuf_addstr(&outbuf, PREFIX);
+                               if (linelen > 0) {
+                                       strbuf_addf(&outbuf, "%.*s%s%c",
+                                                   linelen, b, suffix, *brk);
                                } else {
-                                       int l = brk ? brk : len;
-                                       fprintf(stderr, "%.*s", l, b);
-                                       len -= l;
+                                       strbuf_addch(&outbuf, *brk);
                                }
+                               xwrite(2, outbuf.buf, outbuf.len);
+                               strbuf_reset(&outbuf);
 
-                               skip_pf = !brk;
-                               memmove(buf + pf+1, b + brk, len);
-                       } while (len);
-                       continue;
+                               b = brk + 1;
+                       }
+
+                       if (*b)
+                               strbuf_addf(&outbuf, "%s%s",
+                                           outbuf.len ? "" : PREFIX, b);
+                       break;
                case 1:
-                       write_or_die(out, buf + pf+1, len);
-                       continue;
+                       write_or_die(out, buf + 1, len);
+                       break;
                default:
-                       fprintf(stderr, "%s: protocol error: bad band #%d\n",
-                               me, band);
-                       return SIDEBAND_PROTOCOL_ERROR;
+                       strbuf_addf(&outbuf, "%s%s: protocol error: bad band #%d",
+                                   outbuf.len ? "\n" : "", me, band);
+                       retval = SIDEBAND_PROTOCOL_ERROR;
+                       break;
                }
        }
-       return 0;
+
+       if (outbuf.len) {
+               strbuf_addch(&outbuf, '\n');
+               xwrite(2, outbuf.buf, outbuf.len);
+       }
+       strbuf_release(&outbuf);
+       return retval;
 }
 
 /*
  * fd is connected to the remote side; send the sideband data
  * over multiplexed packet stream.
  */
-ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
+void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
 {
-       ssize_t ssz = sz;
        const char *p = data;
 
        while (sz) {
@@ -148,5 +131,4 @@ ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet
                p += n;
                sz -= n;
        }
-       return ssz;
 }
index e46bed0..7a8146f 100644 (file)
@@ -5,6 +5,6 @@
 #define SIDEBAND_REMOTE_ERROR -1
 
 int recv_sideband(const char *me, int in_stream, int out);
-ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max);
+void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max);
 
 #endif
index 1ba600b..f3bd571 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
@@ -197,6 +197,13 @@ void strbuf_add(struct strbuf *sb, const void *data, size_t len)
        strbuf_setlen(sb, sb->len + len);
 }
 
+void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2)
+{
+       strbuf_grow(sb, sb2->len);
+       memcpy(sb->buf + sb->len, sb2->buf, sb2->len);
+       strbuf_setlen(sb, sb->len + sb2->len);
+}
+
 void strbuf_adddup(struct strbuf *sb, size_t pos, size_t len)
 {
        strbuf_grow(sb, len);
index 83c5c98..ba8d5f1 100644 (file)
--- a/strbuf.h
+++ b/strbuf.h
@@ -263,11 +263,7 @@ static inline void strbuf_addstr(struct strbuf *sb, const char *s)
 /**
  * Copy the contents of another buffer at the end of the current one.
  */
-static inline void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2)
-{
-       strbuf_grow(sb, sb2->len);
-       strbuf_add(sb, sb2->buf, sb2->len);
-}
+extern void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2);
 
 /**
  * Copy part of the buffer from a given position till a given length to the
index debab29..93dd364 100644 (file)
@@ -362,9 +362,9 @@ static int parse_config(const char *var, const char *value, void *data)
 }
 
 static int gitmodule_sha1_from_commit(const unsigned char *commit_sha1,
-                                     unsigned char *gitmodules_sha1)
+                                     unsigned char *gitmodules_sha1,
+                                     struct strbuf *rev)
 {
-       struct strbuf rev = STRBUF_INIT;
        int ret = 0;
 
        if (is_null_sha1(commit_sha1)) {
@@ -372,11 +372,10 @@ static int gitmodule_sha1_from_commit(const unsigned char *commit_sha1,
                return 1;
        }
 
-       strbuf_addf(&rev, "%s:.gitmodules", sha1_to_hex(commit_sha1));
-       if (get_sha1(rev.buf, gitmodules_sha1) >= 0)
+       strbuf_addf(rev, "%s:.gitmodules", sha1_to_hex(commit_sha1));
+       if (get_sha1(rev->buf, gitmodules_sha1) >= 0)
                ret = 1;
 
-       strbuf_release(&rev);
        return ret;
 }
 
@@ -390,7 +389,7 @@ static const struct submodule *config_from(struct submodule_cache *cache,
 {
        struct strbuf rev = STRBUF_INIT;
        unsigned long config_size;
-       char *config;
+       char *config = NULL;
        unsigned char sha1[20];
        enum object_type type;
        const struct submodule *submodule = NULL;
@@ -411,8 +410,8 @@ static const struct submodule *config_from(struct submodule_cache *cache,
                return entry->config;
        }
 
-       if (!gitmodule_sha1_from_commit(commit_sha1, sha1))
-               return NULL;
+       if (!gitmodule_sha1_from_commit(commit_sha1, sha1, &rev))
+               goto out;
 
        switch (lookup_type) {
        case lookup_name:
@@ -423,16 +422,11 @@ static const struct submodule *config_from(struct submodule_cache *cache,
                break;
        }
        if (submodule)
-               return submodule;
+               goto out;
 
        config = read_sha1_file(sha1, &type, &config_size);
-       if (!config)
-               return NULL;
-
-       if (type != OBJ_BLOB) {
-               free(config);
-               return NULL;
-       }
+       if (!config || type != OBJ_BLOB)
+               goto out;
 
        /* fill the submodule config into the cache */
        parameter.cache = cache;
@@ -441,6 +435,7 @@ static const struct submodule *config_from(struct submodule_cache *cache,
        parameter.overwrite = 0;
        git_config_from_mem(parse_config, "submodule-blob", rev.buf,
                        config, config_size, &parameter);
+       strbuf_release(&rev);
        free(config);
 
        switch (lookup_type) {
@@ -451,6 +446,11 @@ static const struct submodule *config_from(struct submodule_cache *cache,
        default:
                return NULL;
        }
+
+out:
+       strbuf_release(&rev);
+       free(config);
+       return submodule;
 }
 
 static const struct submodule *config_from_path(struct submodule_cache *cache,
index 0dc598e..eff26f5 100644 (file)
@@ -1,6 +1,23 @@
 #include "git-compat-util.h"
+#include "gettext.h"
 
-int main(int argc, char **argv)
+struct reg_flag {
+       const char *name;
+       int flag;
+};
+
+static struct reg_flag reg_flags[] = {
+       { "EXTENDED",    REG_EXTENDED   },
+       { "NEWLINE",     REG_NEWLINE    },
+       { "ICASE",       REG_ICASE      },
+       { "NOTBOL",      REG_NOTBOL     },
+#ifdef REG_STARTEND
+       { "STARTEND",    REG_STARTEND   },
+#endif
+       { NULL, 0 }
+};
+
+static int test_regex_bug(void)
 {
        char *pat = "[^={} \t]+";
        char *str = "={}\nfred";
@@ -16,5 +33,43 @@ int main(int argc, char **argv)
        if (m[0].rm_so == 3) /* matches '\n' when it should not */
                die("regex bug confirmed: re-build git with NO_REGEX=1");
 
-       exit(0);
+       return 0;
+}
+
+int main(int argc, char **argv)
+{
+       const char *pat;
+       const char *str;
+       int flags = 0;
+       regex_t r;
+       regmatch_t m[1];
+
+       if (argc == 2 && !strcmp(argv[1], "--bug"))
+               return test_regex_bug();
+       else if (argc < 3)
+               usage("test-regex --bug\n"
+                     "test-regex <pattern> <string> [<options>]");
+
+       argv++;
+       pat = *argv++;
+       str = *argv++;
+       while (*argv) {
+               struct reg_flag *rf;
+               for (rf = reg_flags; rf->name; rf++)
+                       if (!strcmp(*argv, rf->name)) {
+                               flags |= rf->flag;
+                               break;
+                       }
+               if (!rf->name)
+                       die("do not recognize %s", *argv);
+               argv++;
+       }
+       git_setup_gettext();
+
+       if (regcomp(&r, pat, flags))
+               die("failed regcomp() for pattern '%s'", pat);
+       if (regexec(&r, str, 1, m, 0))
+               return 1;
+
+       return 0;
 }
index 30a64a9..6bb53da 100644 (file)
@@ -26,7 +26,7 @@ static int parallel_next(struct child_process *cp,
                return 0;
 
        argv_array_pushv(&cp->args, d->argv);
-       strbuf_addf(err, "preloaded output of a child\n");
+       strbuf_addstr(err, "preloaded output of a child\n");
        number_callbacks++;
        return 1;
 }
@@ -36,7 +36,7 @@ static int no_job(struct child_process *cp,
                  void *cb,
                  void **task_cb)
 {
-       strbuf_addf(err, "no further jobs available\n");
+       strbuf_addstr(err, "no further jobs available\n");
        return 0;
 }
 
@@ -45,7 +45,7 @@ static int task_finished(int result,
                         void *pp_cb,
                         void *pp_task_cb)
 {
-       strbuf_addf(err, "asking for a quick stop\n");
+       strbuf_addstr(err, "asking for a quick stop\n");
        return 1;
 }
 
index dab8c27..a4e4098 100644 (file)
@@ -23,7 +23,7 @@ int main(int argc, char **argv)
 
        arg++;
        my_argc--;
-       while (starts_with(arg[0], "--")) {
+       while (arg[0] && starts_with(arg[0], "--")) {
                if (!strcmp(arg[0], "--url"))
                        output_url = 1;
                if (!strcmp(arg[0], "--name"))
index 340534c..f9cbd47 100644 (file)
@@ -82,8 +82,7 @@ stop_git_daemon() {
        kill "$GIT_DAEMON_PID"
        wait "$GIT_DAEMON_PID" >&3 2>&4
        ret=$?
-       # expect exit with status 143 = 128+15 for signal TERM=15
-       if test $ret -ne 143
+       if test_match_signal 15 $?
        then
                error "git daemon exited with status: $ret"
        fi
index 60811a3..1aa5093 100755 (executable)
@@ -834,7 +834,7 @@ test_expect_success 'git write-tree should be able to write an empty tree' '
 '
 
 test_expect_success 'validate object ID of a known tree' '
-       test "$tree" = 4b825dc642cb6eb9a060e54bf8d69288fbee4904
+       test "$tree" = $EMPTY_TREE
 '
 
 # Various types of objects
index e7f27eb..46042f1 100755 (executable)
@@ -11,12 +11,13 @@ EOF
 
 test_expect_success 'sigchain works' '
        { test-sigchain >actual; ret=$?; } &&
-       case "$ret" in
-       143) true ;; # POSIX w/ SIGTERM=15
-       271) true ;; # ksh w/ SIGTERM=15
-         3) true ;; # Windows
-         *) false ;;
-       esac &&
+       {
+               # Signal death by raise() on Windows acts like exit(3),
+               # regardless of the signal number. So we must allow that
+               # as well as the normal signal check.
+               test_match_signal 15 "$ret" ||
+               test "$ret" = 3
+       } &&
        test_cmp expect actual
 '
 
@@ -41,12 +42,12 @@ test_expect_success 'create blob' '
 
 test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '
        OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
-       test "$OUT" -eq 141
+       test_match_signal 13 "$OUT"
 '
 
 test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '
        OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 ) &&
-       test "$OUT" -eq 141
+       test_match_signal 13 "$OUT"
 '
 
 test_done
index 7bac2bc..e799e59 100755 (executable)
@@ -268,4 +268,15 @@ test_expect_success 'disable filter with empty override' '
        test_must_be_empty err
 '
 
+test_expect_success 'diff does not reuse worktree files that need cleaning' '
+       test_config filter.counter.clean "echo . >>count; sed s/^/clean:/" &&
+       echo "file filter=counter" >.gitattributes &&
+       test_commit one file &&
+       test_commit two file &&
+
+       >count &&
+       git diff-tree -p HEAD &&
+       test_line_count = 0 count
+'
+
 test_done
index 5ed69a6..991ed2a 100755 (executable)
@@ -31,7 +31,7 @@ test_expect_success 'git_mkstemps_mode does not fail if fd 0 is not open' '
 
 test_expect_success 'check for a bug in the regex routines' '
        # if this test fails, re-build git with NO_REGEX=1
-       test-regex
+       test-regex --bug
 '
 
 test_done
index 0c74bee..81e85e0 100755 (executable)
@@ -15,11 +15,11 @@ test_description='sparse checkout tests
 . "$TEST_DIRECTORY"/lib-read-tree.sh
 
 test_expect_success 'setup' '
-       cat >expected <<-\EOF &&
+       cat >expected <<-EOF &&
        100644 77f0ba1734ed79d12881f81b36ee134de6a3327b 0       init.t
-       100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       sub/added
-       100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       sub/addedtoo
-       100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       subsub/added
+       100644 $EMPTY_BLOB 0    sub/added
+       100644 $EMPTY_BLOB 0    sub/addedtoo
+       100644 $EMPTY_BLOB 0    subsub/added
        EOF
        cat >expected.swt <<-\EOF &&
        H init.t
@@ -244,7 +244,7 @@ test_expect_success 'print errors when failed to update worktree' '
 error: The following untracked working tree files would be overwritten by checkout:
        sub/added
        sub/addedtoo
-Please move or remove them before you can switch branches.
+Please move or remove them before you switch branches.
 Aborting
 EOF
        test_cmp expected actual
index f9f3d13..096dbff 100755 (executable)
@@ -177,10 +177,9 @@ test_expect_success 'zip achiving, deflate' '
        git archive --format=zip HEAD >/dev/null
 '
 
-test_expect_success 'fsck' '
-       test_must_fail git fsck 2>err &&
-       n=$(grep "error: attempting to allocate .* over limit" err | wc -l) &&
-       test "$n" -gt 1
+test_expect_success 'fsck large blobs' '
+       git fsck 2>err &&
+       test_must_be_empty err
 '
 
 test_done
index b7e9b4f..ae66ba5 100755 (executable)
@@ -15,7 +15,7 @@ Also make sure that command line parser understands the normal
 . ./test-lib.sh
 
 cat >expected <<EOF
-tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
+tree $EMPTY_TREE
 author Author Name <author@email> 1117148400 +0000
 committer Committer Name <committer@email> 1117150200 +0000
 
index 8aef49f..292a072 100755 (executable)
@@ -33,14 +33,14 @@ test_expect_success 'add one file' '
        git update-index --add one &&
        git ls-files --stage >ls-files.actual &&
        cat >ls-files.expect <<EOF &&
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      one
+100644 $EMPTY_BLOB 0   one
 EOF
        test_cmp ls-files.expect ls-files.actual &&
 
        test-dump-split-index .git/index | sed "/^own/d" >actual &&
        cat >expect <<EOF &&
 base $base
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      one
+100644 $EMPTY_BLOB 0   one
 replacements:
 deletions:
 EOF
@@ -51,7 +51,7 @@ test_expect_success 'disable split index' '
        git update-index --no-split-index &&
        git ls-files --stage >ls-files.actual &&
        cat >ls-files.expect <<EOF &&
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      one
+100644 $EMPTY_BLOB 0   one
 EOF
        test_cmp ls-files.expect ls-files.actual &&
 
@@ -67,7 +67,7 @@ test_expect_success 'enable split index again, "one" now belongs to base index"'
        git update-index --split-index &&
        git ls-files --stage >ls-files.actual &&
        cat >ls-files.expect <<EOF &&
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      one
+100644 $EMPTY_BLOB 0   one
 EOF
        test_cmp ls-files.expect ls-files.actual &&
 
@@ -105,7 +105,7 @@ test_expect_success 'add another file, which stays index' '
        git ls-files --stage >ls-files.actual &&
        cat >ls-files.expect <<EOF &&
 100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0      one
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      two
+100644 $EMPTY_BLOB 0   two
 EOF
        test_cmp ls-files.expect ls-files.actual &&
 
@@ -113,7 +113,7 @@ EOF
        q_to_tab >expect <<EOF &&
 $BASE
 100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      two
+100644 $EMPTY_BLOB 0   two
 replacements: 0
 deletions:
 EOF
@@ -159,14 +159,14 @@ test_expect_success 'add original file back' '
        git update-index --add one &&
        git ls-files --stage >ls-files.actual &&
        cat >ls-files.expect <<EOF &&
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      one
+100644 $EMPTY_BLOB 0   one
 EOF
        test_cmp ls-files.expect ls-files.actual &&
 
        test-dump-split-index .git/index | sed "/^own/d" >actual &&
        cat >expect <<EOF &&
 $BASE
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      one
+100644 $EMPTY_BLOB 0   one
 replacements:
 deletions: 0
 EOF
@@ -178,8 +178,8 @@ test_expect_success 'add new file' '
        git update-index --add two &&
        git ls-files --stage >actual &&
        cat >expect <<EOF &&
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      one
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      two
+100644 $EMPTY_BLOB 0   one
+100644 $EMPTY_BLOB 0   two
 EOF
        test_cmp expect actual
 '
@@ -188,8 +188,8 @@ test_expect_success 'unify index, two files remain' '
        git update-index --no-split-index &&
        git ls-files --stage >ls-files.actual &&
        cat >ls-files.expect <<EOF &&
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      one
-100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0      two
+100644 $EMPTY_BLOB 0   one
+100644 $EMPTY_BLOB 0   two
 EOF
        test_cmp ls-files.expect ls-files.actual &&
 
index 2a4a749..8f22c43 100755 (executable)
@@ -82,5 +82,36 @@ test_expect_success 'cache-tree invalidates i-t-a paths' '
        test_cmp expect actual
 '
 
+test_expect_success 'cache-tree does not ignore dir that has i-t-a entries' '
+       git init ita-in-dir &&
+       (
+               cd ita-in-dir &&
+               mkdir 2 &&
+               for f in 1 2/1 2/2 3
+               do
+                       echo "$f" >"$f"
+               done &&
+               git add 1 2/2 3 &&
+               git add -N 2/1 &&
+               git commit -m committed &&
+               git ls-tree -r HEAD >actual &&
+               grep 2/2 actual
+       )
+'
+
+test_expect_success 'cache-tree does skip dir that becomes empty' '
+       rm -fr ita-in-dir &&
+       git init ita-in-dir &&
+       (
+               cd ita-in-dir &&
+               mkdir -p 1/2/3 &&
+               echo 4 >1/2/3/4 &&
+               git add -N 1/2/3/4 &&
+               git write-tree >actual &&
+               echo $EMPTY_TREE >expected &&
+               test_cmp expected actual
+       )
+'
+
 test_done
 
index 4d4b02e..e804377 100755 (executable)
@@ -12,16 +12,16 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'ls-tree a[a] matches literally' '
-       cat >expect <<-\EOF &&
-       100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391    a[a]/three
+       cat >expect <<-EOF &&
+       100644 blob $EMPTY_BLOB a[a]/three
        EOF
        git ls-tree -r HEAD "a[a]" >actual &&
        test_cmp expect actual
 '
 
 test_expect_success 'ls-tree outside prefix' '
-       cat >expect <<-\EOF &&
-       100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391    ../a[a]/three
+       cat >expect <<-EOF &&
+       100644 blob $EMPTY_BLOB ../a[a]/three
        EOF
        ( cd aa && git ls-tree -r HEAD "../a[a]"; ) >actual &&
        test_cmp expect actual
index 66348f1..c7ea8ba 100755 (executable)
@@ -60,7 +60,7 @@ test_expect_success 'setup' '
        test_commit P fileP
 '
 
-# "exec" commands are ran with the user shell by default, but this may
+# "exec" commands are run with the user shell by default, but this may
 # be non-POSIX. For example, if SHELL=zsh then ">file" doesn't work
 # to create a file. Unsetting SHELL avoids such non-portable behavior
 # in tests. It must be exported for it to take effect where needed.
index 944154b..532ff5c 100755 (executable)
@@ -192,4 +192,35 @@ test_expect_success 'abort rebase -i with --autostash' '
        test_cmp expected file0
 '
 
+test_expect_success 'restore autostash on editor failure' '
+       test_when_finished "git reset --hard" &&
+       echo uncommitted-content >file0 &&
+       (
+               test_set_editor "false" &&
+               test_must_fail git rebase -i --autostash HEAD^
+       ) &&
+       echo uncommitted-content >expected &&
+       test_cmp expected file0
+'
+
+test_expect_success 'autostash is saved on editor failure with conflict' '
+       test_when_finished "git reset --hard" &&
+       echo uncommitted-content >file0 &&
+       (
+               write_script abort-editor.sh <<-\EOF &&
+                       echo conflicting-content >file0
+                       exit 1
+               EOF
+               test_set_editor "$(pwd)/abort-editor.sh" &&
+               test_must_fail git rebase -i --autostash HEAD^ &&
+               rm -f abort-editor.sh
+       ) &&
+       echo conflicting-content >expected &&
+       test_cmp expected file0 &&
+       git checkout file0 &&
+       git stash pop &&
+       echo uncommitted-content >expected &&
+       test_cmp expected file0
+'
+
 test_done
diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh
new file mode 100755 (executable)
index 0000000..3780877
--- /dev/null
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+test_description='git rebase tests for -Xsubtree
+
+This test runs git rebase and tests the subtree strategy.
+'
+. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-rebase.sh
+
+commit_message() {
+       git log --pretty=format:%s -1 "$1"
+}
+
+test_expect_success 'setup' '
+       test_commit README &&
+       mkdir files &&
+       (
+               cd files &&
+               git init &&
+               test_commit master1 &&
+               test_commit master2 &&
+               test_commit master3
+       ) &&
+       git fetch files master &&
+       git branch files-master FETCH_HEAD &&
+       git read-tree --prefix=files_subtree files-master &&
+       git checkout -- files_subtree &&
+       tree=$(git write-tree) &&
+       head=$(git rev-parse HEAD) &&
+       rev=$(git rev-parse --verify files-master^0) &&
+       commit=$(git commit-tree -p $head -p $rev -m "Add subproject master" $tree) &&
+       git update-ref HEAD $commit &&
+       (
+               cd files_subtree &&
+               test_commit master4
+       ) &&
+       test_commit files_subtree/master5
+'
+
+# FAILURE: Does not preserve master4.
+test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit 4' '
+       reset_rebase &&
+       git checkout -b rebase-preserve-merges-4 master &&
+       git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+       git commit -m "Empty commit" --allow-empty &&
+       git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
+       verbose test "$(commit_message HEAD~)" = "files_subtree/master4"
+'
+
+# FAILURE: Does not preserve master5.
+test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit 5' '
+       reset_rebase &&
+       git checkout -b rebase-preserve-merges-5 master &&
+       git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+       git commit -m "Empty commit" --allow-empty &&
+       git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
+       verbose test "$(commit_message HEAD)" = "files_subtree/master5"
+'
+
+# FAILURE: Does not preserve master4.
+test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 4' '
+       reset_rebase &&
+       git checkout -b rebase-keep-empty-4 master &&
+       git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+       git commit -m "Empty commit" --allow-empty &&
+       git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
+       verbose test "$(commit_message HEAD~2)" = "files_subtree/master4"
+'
+
+# FAILURE: Does not preserve master5.
+test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 5' '
+       reset_rebase &&
+       git checkout -b rebase-keep-empty-5 master &&
+       git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+       git commit -m "Empty commit" --allow-empty &&
+       git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
+       verbose test "$(commit_message HEAD~)" = "files_subtree/master5"
+'
+
+# FAILURE: Does not preserve Empty.
+test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto empty commit' '
+       reset_rebase &&
+       git checkout -b rebase-keep-empty-empty master &&
+       git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+       git commit -m "Empty commit" --allow-empty &&
+       git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
+       verbose test "$(commit_message HEAD)" = "Empty commit"
+'
+
+# FAILURE: fatal: Could not parse object
+test_expect_failure 'Rebase -Xsubtree --onto commit 4' '
+       reset_rebase &&
+       git checkout -b rebase-onto-4 master &&
+       git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+       git commit -m "Empty commit" --allow-empty &&
+       git rebase -Xsubtree=files_subtree --onto files-master master &&
+       verbose test "$(commit_message HEAD~2)" = "files_subtree/master4"
+'
+
+# FAILURE: fatal: Could not parse object
+test_expect_failure 'Rebase -Xsubtree --onto commit 5' '
+       reset_rebase &&
+       git checkout -b rebase-onto-5 master &&
+       git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+       git commit -m "Empty commit" --allow-empty &&
+       git rebase -Xsubtree=files_subtree --onto files-master master &&
+       verbose test "$(commit_message HEAD~)" = "files_subtree/master5"
+'
+# FAILURE: fatal: Could not parse object
+test_expect_failure 'Rebase -Xsubtree --onto empty commit' '
+       reset_rebase &&
+       git checkout -b rebase-onto-empty master &&
+       git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+       git commit -m "Empty commit" --allow-empty &&
+       git rebase -Xsubtree=files_subtree --onto files-master master &&
+       verbose test "$(commit_message HEAD)" = "Empty commit"
+'
+
+test_done
index 43c488b..35b35a8 100755 (executable)
@@ -78,8 +78,6 @@ test_expect_success 'diff-tree pathspec' '
        test_cmp expected current
 '
 
-EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
-
 test_expect_success 'diff-tree with wildcard shows dir also matches' '
        git diff-tree --name-only $EMPTY_TREE $tree -- "f*" >result &&
        echo file0 >expected &&
index 3c9932e..113304d 100755 (executable)
@@ -5,6 +5,14 @@ test_description='patience diff algorithm'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-diff-alternative.sh
 
+test_expect_success '--ignore-space-at-eol with a single appended character' '
+       printf "a\nb\nc\n" >pre &&
+       printf "a\nbX\nc\n" >post &&
+       test_must_fail git diff --no-index \
+               --patience --ignore-space-at-eol pre post >diff &&
+       grep "^+.*X" diff
+'
+
 test_diff_frobnitz "patience"
 
 test_diff_unique "patience"
index 1d6efab..18f42c5 100755 (executable)
@@ -3,8 +3,6 @@
 test_description='test diff with a bogus tree containing the null sha1'
 . ./test-lib.sh
 
-empty_tree=4b825dc642cb6eb9a060e54bf8d69288fbee4904
-
 test_expect_success 'create bogus tree' '
        bogus_tree=$(
                printf "100644 fooQQQQQQQQQQQQQQQQQQQQQ" |
@@ -22,13 +20,13 @@ test_expect_success 'create tree with matching file' '
 
 test_expect_success 'raw diff shows null sha1 (addition)' '
        echo ":000000 100644 $_z40 $_z40 A      foo" >expect &&
-       git diff-tree $empty_tree $bogus_tree >actual &&
+       git diff-tree $EMPTY_TREE $bogus_tree >actual &&
        test_cmp expect actual
 '
 
 test_expect_success 'raw diff shows null sha1 (removal)' '
        echo ":100644 000000 $_z40 $_z40 D      foo" >expect &&
-       git diff-tree $bogus_tree $empty_tree >actual &&
+       git diff-tree $bogus_tree $EMPTY_TREE >actual &&
        test_cmp expect actual
 '
 
@@ -57,11 +55,11 @@ test_expect_success 'raw diff shows null sha1 (index)' '
 '
 
 test_expect_success 'patch fails due to bogus sha1 (addition)' '
-       test_must_fail git diff-tree -p $empty_tree $bogus_tree
+       test_must_fail git diff-tree -p $EMPTY_TREE $bogus_tree
 '
 
 test_expect_success 'patch fails due to bogus sha1 (removal)' '
-       test_must_fail git diff-tree -p $bogus_tree $empty_tree
+       test_must_fail git diff-tree -p $bogus_tree $EMPTY_TREE
 '
 
 test_expect_success 'patch fails due to bogus sha1 (modification)' '
index d173acd..f8a313b 100755 (executable)
@@ -13,9 +13,13 @@ create_file() {
 }
 
 test_expect_success 'setup' '
-       create_file file1 "File1 contents" &&
-       create_file file2 "File2 contents" &&
-       create_file file3 "File3 contents" &&
+       # Ensure that file sizes are different, because on Windows
+       # lstat() does not discover inode numbers, and we need
+       # other properties to discover swapped files
+       # (mtime is not always different, either).
+       create_file file1 "some content" &&
+       create_file file2 "some other content" &&
+       create_file file3 "again something else" &&
        git add file1 file2 file3 &&
        git commit -m 1
 '
index 128ba93..0b53e56 100755 (executable)
@@ -255,6 +255,20 @@ test_expect_success 'log -F -E --grep=<ere> uses ere' '
        test_cmp expect actual
 '
 
+test_expect_success 'log with grep.patternType configuration' '
+       >expect &&
+       git -c grep.patterntype=fixed \
+       log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'log with grep.patternType configuration and command line' '
+       echo second >expect &&
+       git -c grep.patterntype=fixed \
+       log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual &&
+       test_cmp expect actual
+'
+
 cat > expect <<EOF
 * Second
 * sixth
index d9f6242..f5435fd 100755 (executable)
@@ -145,199 +145,199 @@ test_expect_success 'setup more commits' '
 
 test_expect_success 'left alignment formatting' '
        git log --pretty="tformat:%<(40)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-message two                            Z
-message one                            Z
-add bar                                Z
-$(commit_msg)                    Z
-EOF
+       qz_to_tab_space <<-EOF >expected &&
+       message two                            Z
+       message one                            Z
+       add bar                                Z
+       $(commit_msg)                    Z
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(40)%s" >actual &&
-       qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-message two                            Z
-message one                            Z
-add bar                                Z
-$(commit_msg)                    Z
-EOF
+       qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       message two                            Z
+       message one                            Z
+       add bar                                Z
+       $(commit_msg)                    Z
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting at the nth column' '
        git log --pretty="tformat:%h %<|(40)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-$head1 message two                    Z
-$head2 message one                    Z
-$head3 add bar                        Z
-$head4 $(commit_msg)            Z
-EOF
+       qz_to_tab_space <<-EOF >expected &&
+       $head1 message two                    Z
+       $head2 message one                    Z
+       $head3 add bar                        Z
+       $head4 $(commit_msg)            Z
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting at the nth column' '
        COLUMNS=50 git log --pretty="tformat:%h %<|(-10)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-$head1 message two                    Z
-$head2 message one                    Z
-$head3 add bar                        Z
-$head4 $(commit_msg)            Z
-EOF
+       qz_to_tab_space <<-EOF >expected &&
+       $head1 message two                    Z
+       $head2 message one                    Z
+       $head3 add bar                        Z
+       $head4 $(commit_msg)            Z
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting at the nth column. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %<|(40)%s" >actual &&
-       qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-$head1 message two                    Z
-$head2 message one                    Z
-$head3 add bar                        Z
-$head4 $(commit_msg)            Z
-EOF
+       qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       $head1 message two                    Z
+       $head2 message one                    Z
+       $head3 add bar                        Z
+       $head4 $(commit_msg)            Z
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting with no padding' '
        git log --pretty="tformat:%<(1)%s" >actual &&
-       cat <<EOF >expected &&
-message two
-message one
-add bar
-$(commit_msg)
-EOF
+       cat <<-EOF >expected &&
+       message two
+       message one
+       add bar
+       $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting with no padding. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(1)%s" >actual &&
-       cat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-message two
-message one
-add bar
-$(commit_msg)
-EOF
+       cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       message two
+       message one
+       add bar
+       $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting with trunc' '
        git log --pretty="tformat:%<(10,trunc)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-message ..
-message ..
-add bar  Z
-initial...
-EOF
+       qz_to_tab_space <<-\EOF >expected &&
+       message ..
+       message ..
+       add bar  Z
+       initial...
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s" >actual &&
-       qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-message ..
-message ..
-add bar  Z
-initial...
-EOF
+       qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       message ..
+       message ..
+       add bar  Z
+       initial...
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting with ltrunc' '
        git log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-..sage two
-..sage one
-add bar  Z
-..${sample_utf8_part}lich
-EOF
+       qz_to_tab_space <<-EOF >expected &&
+       ..sage two
+       ..sage one
+       add bar  Z
+       ..${sample_utf8_part}lich
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
-       qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-..sage two
-..sage one
-add bar  Z
-..${sample_utf8_part}lich
-EOF
+       qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       ..sage two
+       ..sage one
+       add bar  Z
+       ..${sample_utf8_part}lich
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting with mtrunc' '
        git log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-mess.. two
-mess.. one
-add bar  Z
-init..lich
-EOF
+       qz_to_tab_space <<-\EOF >expected &&
+       mess.. two
+       mess.. one
+       add bar  Z
+       init..lich
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
-       qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-mess.. two
-mess.. one
-add bar  Z
-init..lich
-EOF
+       qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       mess.. two
+       mess.. one
+       add bar  Z
+       init..lich
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'right alignment formatting' '
        git log --pretty="tformat:%>(40)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-Z                            message two
-Z                            message one
-Z                                add bar
-Z                    $(commit_msg)
-EOF
+       qz_to_tab_space <<-EOF >expected &&
+       Z                            message two
+       Z                            message one
+       Z                                add bar
+       Z                    $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'right alignment formatting. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(40)%s" >actual &&
-       qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-Z                            message two
-Z                            message one
-Z                                add bar
-Z                    $(commit_msg)
-EOF
+       qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       Z                            message two
+       Z                            message one
+       Z                                add bar
+       Z                    $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'right alignment formatting at the nth column' '
        git log --pretty="tformat:%h %>|(40)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-$head1                      message two
-$head2                      message one
-$head3                          add bar
-$head4              $(commit_msg)
-EOF
+       qz_to_tab_space <<-EOF >expected &&
+       $head1                      message two
+       $head2                      message one
+       $head3                          add bar
+       $head4              $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'right alignment formatting at the nth column' '
        COLUMNS=50 git log --pretty="tformat:%h %>|(-10)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-$head1                      message two
-$head2                      message one
-$head3                          add bar
-$head4              $(commit_msg)
-EOF
+       qz_to_tab_space <<-EOF >expected &&
+       $head1                      message two
+       $head2                      message one
+       $head3                          add bar
+       $head4              $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'right alignment formatting at the nth column. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %>|(40)%s" >actual &&
-       qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-$head1                      message two
-$head2                      message one
-$head3                          add bar
-$head4              $(commit_msg)
-EOF
+       qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       $head1                      message two
+       $head2                      message one
+       $head3                          add bar
+       $head4              $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
@@ -345,110 +345,110 @@ EOF
 # as in previous test.
 test_expect_success 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --graph --pretty="tformat:%h %>|(40)%s" >actual &&
-       iconv -f utf-8 -t $test_encoding >expected <<EOF&&
-* $head1                    message two
-* $head2                    message one
-* $head3                        add bar
-* $head4            $(commit_msg)
-EOF
+       iconv -f utf-8 -t $test_encoding >expected <<-EOF &&
+       * $head1                    message two
+       * $head2                    message one
+       * $head3                        add bar
+       * $head4            $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'right alignment formatting with no padding' '
        git log --pretty="tformat:%>(1)%s" >actual &&
-       cat <<EOF >expected &&
-message two
-message one
-add bar
-$(commit_msg)
-EOF
+       cat <<-EOF >expected &&
+       message two
+       message one
+       add bar
+       $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'right alignment formatting with no padding and with --graph' '
        git log --graph --pretty="tformat:%>(1)%s" >actual &&
-       cat <<EOF >expected &&
-* message two
-* message one
-* add bar
-* $(commit_msg)
-EOF
+       cat <<-EOF >expected &&
+       * message two
+       * message one
+       * add bar
+       * $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(1)%s" >actual &&
-       cat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-message two
-message one
-add bar
-$(commit_msg)
-EOF
+       cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       message two
+       message one
+       add bar
+       $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'center alignment formatting' '
        git log --pretty="tformat:%><(40)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-Z             message two              Z
-Z             message one              Z
-Z               add bar                Z
-Z         $(commit_msg)          Z
-EOF
+       qz_to_tab_space <<-EOF >expected &&
+       Z             message two              Z
+       Z             message one              Z
+       Z               add bar                Z
+       Z         $(commit_msg)          Z
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'center alignment formatting. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(40)%s" >actual &&
-       qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-Z             message two              Z
-Z             message one              Z
-Z               add bar                Z
-Z         $(commit_msg)          Z
-EOF
+       qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       Z             message two              Z
+       Z             message one              Z
+       Z               add bar                Z
+       Z         $(commit_msg)          Z
+       EOF
        test_cmp expected actual
 '
 test_expect_success 'center alignment formatting at the nth column' '
        git log --pretty="tformat:%h %><|(40)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-$head1           message two          Z
-$head2           message one          Z
-$head3             add bar            Z
-$head4       $(commit_msg)      Z
-EOF
+       qz_to_tab_space <<-EOF >expected &&
+       $head1           message two          Z
+       $head2           message one          Z
+       $head3             add bar            Z
+       $head4       $(commit_msg)      Z
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'center alignment formatting at the nth column' '
        COLUMNS=70 git log --pretty="tformat:%h %><|(-30)%s" >actual &&
-       qz_to_tab_space <<EOF >expected &&
-$head1           message two          Z
-$head2           message one          Z
-$head3             add bar            Z
-$head4       $(commit_msg)      Z
-EOF
+       qz_to_tab_space <<-EOF >expected &&
+       $head1           message two          Z
+       $head2           message one          Z
+       $head3             add bar            Z
+       $head4       $(commit_msg)      Z
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'center alignment formatting at the nth column. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %><|(40)%s" >actual &&
-       qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-$head1           message two          Z
-$head2           message one          Z
-$head3             add bar            Z
-$head4       $(commit_msg)      Z
-EOF
+       qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       $head1           message two          Z
+       $head2           message one          Z
+       $head3             add bar            Z
+       $head4       $(commit_msg)      Z
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'center alignment formatting with no padding' '
        git log --pretty="tformat:%><(1)%s" >actual &&
-       cat <<EOF >expected &&
-message two
-message one
-add bar
-$(commit_msg)
-EOF
+       cat <<-EOF >expected &&
+       message two
+       message one
+       add bar
+       $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
@@ -457,34 +457,34 @@ EOF
 old_head1=$(git rev-parse --verify HEAD~0)
 test_expect_success 'center alignment formatting with no padding. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(1)%s" >actual &&
-       cat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-message two
-message one
-add bar
-$(commit_msg)
-EOF
+       cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       message two
+       message one
+       add bar
+       $(commit_msg)
+       EOF
        test_cmp expected actual
 '
 
 test_expect_success 'left/right alignment formatting with stealing' '
        git commit --amend -m short --author "long long long <long@me.com>" &&
        git log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual &&
-       cat <<EOF >expected &&
-short long  long long
-message ..   A U Thor
-add bar      A U Thor
-initial...   A U Thor
-EOF
+       cat <<-\EOF >expected &&
+       short long  long long
+       message ..   A U Thor
+       add bar      A U Thor
+       initial...   A U Thor
+       EOF
        test_cmp expected actual
 '
 test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '
        git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual &&
-       cat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&
-short long  long long
-message ..   A U Thor
-add bar      A U Thor
-initial...   A U Thor
-EOF
+       cat <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
+       short long  long long
+       message ..   A U Thor
+       add bar      A U Thor
+       initial...   A U Thor
+       EOF
        test_cmp expected actual
 '
 
@@ -504,8 +504,10 @@ test_expect_success 'ISO and ISO-strict date formats display the same values' '
 '
 
 # get new digests (with no abbreviations)
-head1=$(git rev-parse --verify HEAD~0) &&
-head2=$(git rev-parse --verify HEAD~1) &&
+test_expect_success 'set up log decoration tests' '
+       head1=$(git rev-parse --verify HEAD~0) &&
+       head2=$(git rev-parse --verify HEAD~1)
+'
 
 test_expect_success 'log decoration properly follows tag chain' '
        git tag -a tag1 -m tag1 &&
@@ -513,22 +515,22 @@ test_expect_success 'log decoration properly follows tag chain' '
        git tag -d tag1 &&
        git commit --amend -m shorter &&
        git log --no-walk --tags --pretty="%H %d" --decorate=full >actual &&
-       cat <<EOF >expected &&
-$head1  (tag: refs/tags/tag2)
-$head2  (tag: refs/tags/message-one)
-$old_head1  (tag: refs/tags/message-two)
-EOF
+       cat <<-EOF >expected &&
+       $head1  (tag: refs/tags/tag2)
+       $head2  (tag: refs/tags/message-one)
+       $old_head1  (tag: refs/tags/message-two)
+       EOF
        sort actual >actual1 &&
        test_cmp expected actual1
 '
 
 test_expect_success 'clean log decoration' '
        git log --no-walk --tags --pretty="%H %D" --decorate=full >actual &&
-       cat >expected <<EOF &&
-$head1 tag: refs/tags/tag2
-$head2 tag: refs/tags/message-one
-$old_head1 tag: refs/tags/message-two
-EOF
+       cat >expected <<-EOF &&
+       $head1 tag: refs/tags/tag2
+       $head2 tag: refs/tags/message-one
+       $old_head1 tag: refs/tags/message-two
+       EOF
        sort actual >actual1 &&
        test_cmp expected actual1
 '
index 44f3d5f..9b19cff 100755 (executable)
@@ -115,8 +115,8 @@ test_expect_success 'push with transfer.fsckobjects' '
        test_cmp exp act
 '
 
-cat >bogus-commit <<\EOF
-tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
+cat >bogus-commit <<EOF
+tree $EMPTY_TREE
 author Bugs Bunny 1234567890 +0000
 committer Bugs Bunny <bugs@bun.ni> 1234567890 +0000
 
index fd7d06b..9593fc1 100755 (executable)
@@ -368,5 +368,14 @@ test_expect_success GPG 'push with post-receive to inspect certificate' '
        test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH/push-cert-status"
 '
 
+test_expect_success 'push status output scrubs password' '
+       cd "$ROOT_PATH/test_repo_clone" &&
+       git push --porcelain \
+               "$HTTPD_URL_USER_PASS/smart/test_repo.git" \
+               +HEAD:scrub >status &&
+       # should have been scrubbed down to vanilla URL
+       grep "^To $HTTPD_URL/smart/test_repo.git" status
+'
+
 stop_httpd
 test_done
index 88d60c1..84f4145 100755 (executable)
@@ -23,17 +23,15 @@ S sub/1
 H sub/2
 EOF
 
-NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
-
 setup_absent() {
        test -f 1 && rm 1
        git update-index --remove 1 &&
-       git update-index --add --cacheinfo 100644 $NULL_SHA1 1 &&
+       git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 &&
        git update-index --skip-worktree 1
 }
 
 test_absent() {
-       echo "100644 $NULL_SHA1 0       1" > expected &&
+       echo "100644 $EMPTY_BLOB 0      1" > expected &&
        git ls-files --stage 1 > result &&
        test_cmp expected result &&
        test ! -f 1
@@ -42,12 +40,12 @@ test_absent() {
 setup_dirty() {
        git update-index --force-remove 1 &&
        echo dirty > 1 &&
-       git update-index --add --cacheinfo 100644 $NULL_SHA1 1 &&
+       git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 &&
        git update-index --skip-worktree 1
 }
 
 test_dirty() {
-       echo "100644 $NULL_SHA1 0       1" > expected &&
+       echo "100644 $EMPTY_BLOB 0      1" > expected &&
        git ls-files --stage 1 > result &&
        test_cmp expected result &&
        echo dirty > expected
@@ -120,7 +118,7 @@ test_expect_success 'grep with skip-worktree file' '
        test "$(git grep --no-ext-grep test)" = "1:test"
 '
 
-echo ":000000 100644 $_z40 $NULL_SHA1 A        1" > expected
+echo ":000000 100644 $_z40 $EMPTY_BLOB A       1" > expected
 test_expect_success 'diff-index does not examine skip-worktree absent entries' '
        setup_absent &&
        git diff-index HEAD -- 1 > result &&
index 9ceaa40..9d1abe5 100755 (executable)
@@ -53,17 +53,15 @@ test_expect_success 'read-tree removes worktree, dirty case' '
        git update-index --no-skip-worktree added
 '
 
-NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
-
 setup_absent() {
        test -f 1 && rm 1
        git update-index --remove 1 &&
-       git update-index --add --cacheinfo 100644 $NULL_SHA1 1 &&
+       git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 &&
        git update-index --skip-worktree 1
 }
 
 test_absent() {
-       echo "100644 $NULL_SHA1 0       1" > expected &&
+       echo "100644 $EMPTY_BLOB 0      1" > expected &&
        git ls-files --stage 1 > result &&
        test_cmp expected result &&
        test ! -f 1
@@ -72,12 +70,12 @@ test_absent() {
 setup_dirty() {
        git update-index --force-remove 1 &&
        echo dirty > 1 &&
-       git update-index --add --cacheinfo 100644 $NULL_SHA1 1 &&
+       git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 &&
        git update-index --skip-worktree 1
 }
 
 test_dirty() {
-       echo "100644 $NULL_SHA1 0       1" > expected &&
+       echo "100644 $EMPTY_BLOB 0      1" > expected &&
        git ls-files --stage 1 > result &&
        test_cmp expected result &&
        echo dirty > expected
index 44bf1d8..4d17363 100755 (executable)
@@ -34,6 +34,7 @@ test_expect_success 'M/D conflict does not segfault' '
 On branch side
 You have unmerged paths.
   (fix conflicts and run "git commit")
+  (use "git merge --abort" to abort the merge)
 
 Unmerged paths:
   (use "git add/rm <file>..." as appropriate to mark resolution)
@@ -138,6 +139,7 @@ test_expect_success 'status when conflicts with add and rm advice (deleted by th
 On branch master
 You have unmerged paths.
   (fix conflicts and run "git commit")
+  (use "git merge --abort" to abort the merge)
 
 Unmerged paths:
   (use "git add/rm <file>..." as appropriate to mark resolution)
@@ -171,6 +173,7 @@ test_expect_success 'status when conflicts with add and rm advice (both deleted)
 On branch conflict_second
 You have unmerged paths.
   (fix conflicts and run "git commit")
+  (use "git merge --abort" to abort the merge)
 
 Unmerged paths:
   (use "git add/rm <file>..." as appropriate to mark resolution)
@@ -195,6 +198,7 @@ test_expect_success 'status when conflicts with only rm advice (both deleted)' '
 On branch conflict_second
 You have unmerged paths.
   (fix conflicts and run "git commit")
+  (use "git merge --abort" to abort the merge)
 
 Changes to be committed:
 
index a971884..4e1e290 100755 (executable)
@@ -4,6 +4,20 @@ test_description='test untracked cache'
 
 . ./test-lib.sh
 
+# On some filesystems (e.g. FreeBSD's ext2 and ufs) directory mtime
+# is updated lazily after contents in the directory changes, which
+# forces the untracked cache code to take the slow path.  A test
+# that wants to make sure that the fast path works correctly should
+# call this helper to make mtime of the containing directory in sync
+# with the reality before checking the fast path behaviour.
+#
+# See <20160803174522.5571-1-pclouds@gmail.com> if you want to know
+# more.
+
+sync_mtime () {
+       find . -type d -ls >/dev/null
+}
+
 avoid_racy() {
        sleep 1
 }
@@ -53,7 +67,7 @@ A  two
 EOF
 
 cat >../dump.expect <<EOF &&
-info/exclude e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+info/exclude $EMPTY_BLOB
 core.excludesfile 0000000000000000000000000000000000000000
 exclude_per_dir .gitignore
 flags 00000006
@@ -137,7 +151,7 @@ EOF
 test_expect_success 'verify untracked cache dump' '
        test-dump-untracked-cache >../actual &&
        cat >../expect <<EOF &&
-info/exclude e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+info/exclude $EMPTY_BLOB
 core.excludesfile 0000000000000000000000000000000000000000
 exclude_per_dir .gitignore
 flags 00000006
@@ -184,7 +198,7 @@ EOF
 test_expect_success 'verify untracked cache dump' '
        test-dump-untracked-cache >../actual &&
        cat >../expect <<EOF &&
-info/exclude e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+info/exclude $EMPTY_BLOB
 core.excludesfile 0000000000000000000000000000000000000000
 exclude_per_dir .gitignore
 flags 00000006
@@ -416,7 +430,8 @@ test_expect_success 'create/modify files, some of which are gitignored' '
        echo four >done/four && # four is gitignored at a higher level
        echo five >done/five && # five is not gitignored
        echo test >base && #we need to ensure that the root dir is touched
-       rm base
+       rm base &&
+       sync_mtime
 '
 
 test_expect_success 'test sparse status with untracked cache' '
index fc97c33..400e2b1 100755 (executable)
@@ -82,6 +82,17 @@ test_expect_success 'error in one submodule config lets continue' '
        )
 '
 
+test_expect_success 'error message contains blob reference' '
+       (cd super &&
+               sha1=$(git rev-parse HEAD) &&
+               test-submodule-config \
+                       HEAD b \
+                       HEAD submodule \
+                               2>actual_err &&
+               grep "submodule-blob $sha1:.gitmodules" actual_err >/dev/null
+       )
+'
+
 cat >super/expect_url <<EOF
 Submodule url: 'git@somewhere.else.net:a.git' for path 'b'
 Submodule url: 'git@somewhere.else.net:submodule.git' for path 'submodule'
index c3ed7cb..a42aef8 100755 (executable)
@@ -803,7 +803,7 @@ EOF
 '
 
 cat >expect <<EOF
-:100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M     dir1/modified
+:100644 100644 $EMPTY_BLOB 0000000000000000000000000000000000000000 M  dir1/modified
 EOF
 test_expect_success 'status refreshes the index' '
        touch dir2/added &&
index 49d19a3..5c3db65 100755 (executable)
@@ -29,6 +29,7 @@ test_expect_success 'status when conflicts unresolved' '
 On branch conflicts
 You have unmerged paths.
   (fix conflicts and run "git commit")
+  (use "git merge --abort" to abort the merge)
 
 Unmerged paths:
   (use "git add <file>..." to mark resolution)
index 758a623..1c59349 100755 (executable)
@@ -115,7 +115,7 @@ cat >expect <<\EOF
 error: The following untracked working tree files would be overwritten by merge:
        sub
        sub2
-Please move or remove them before you can merge.
+Please move or remove them before you merge.
 Aborting
 EOF
 
index 6729cb3..f80bdb8 100755 (executable)
@@ -31,7 +31,7 @@ error: The following untracked working tree files would be overwritten by merge:
        four
        three
        two
-Please move or remove them before you can merge.
+Please move or remove them before you merge.
 Aborting
 EOF
 
@@ -53,10 +53,10 @@ error: Your local changes to the following files would be overwritten by merge:
        four
        three
        two
-Please commit your changes or stash them before you can merge.
+Please commit your changes or stash them before you merge.
 error: The following untracked working tree files would be overwritten by merge:
        five
-Please move or remove them before you can merge.
+Please move or remove them before you merge.
 Aborting
 EOF
 
@@ -72,7 +72,7 @@ cat >expect <<\EOF
 error: Your local changes to the following files would be overwritten by checkout:
        rep/one
        rep/two
-Please commit your changes or stash them before you can switch branches.
+Please commit your changes or stash them before you switch branches.
 Aborting
 EOF
 
@@ -94,7 +94,7 @@ cat >expect <<\EOF
 error: Your local changes to the following files would be overwritten by checkout:
        rep/one
        rep/two
-Please commit your changes or stash them before you can switch branches.
+Please commit your changes or stash them before you switch branches.
 Aborting
 EOF
 
index 76306cf..7217f39 100755 (executable)
@@ -589,7 +589,12 @@ test_expect_success 'filenames seen by tools start with ./' '
        git reset --hard master >/dev/null 2>&1
 '
 
-test_expect_success 'temporary filenames are used with mergetool.writeToTemp' '
+test_lazy_prereq MKTEMP '
+       tempdir=$(mktemp -d -t foo.XXXXXX) &&
+       test -d "$tempdir"
+'
+
+test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '
        git checkout -b test16 branch1 &&
        test_config mergetool.writeToTemp true &&
        test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
index 42a2929..2974900 100755 (executable)
@@ -412,6 +412,20 @@ run_dir_diff_test 'difftool --dir-diff from subdirectory' '
        )
 '
 
+run_dir_diff_test 'difftool --dir-diff from subdirectory with GIT_DIR set' '
+       (
+               GIT_DIR=$(pwd)/.git &&
+               export GIT_DIR &&
+               GIT_WORK_TREE=$(pwd) &&
+               export GIT_WORK_TREE &&
+               cd sub &&
+               git difftool --dir-diff $symlinks --extcmd ls \
+                       branch -- sub >output &&
+               grep sub output &&
+               ! grep file output
+       )
+'
+
 run_dir_diff_test 'difftool --dir-diff when worktree file is missing' '
        test_when_finished git reset --hard &&
        rm file2 &&
index bd8ea11..cf3f9ec 100755 (executable)
@@ -177,7 +177,7 @@ do
 
        test_expect_success "grep -c $L (no /dev/null)" '
                ! git grep -c test $H | grep /dev/null
-        '
+       '
 
        test_expect_success "grep --max-depth -1 $L" '
                {
@@ -1377,4 +1377,62 @@ test_expect_success 'grep --color -e A --and -e B -p with context' '
        test_cmp expected actual
 '
 
+test_expect_success 'grep can find things only in the work tree' '
+       : >work-tree-only &&
+       git add work-tree-only &&
+       test_when_finished "git rm -f work-tree-only" &&
+       echo "find in work tree" >work-tree-only &&
+       git grep --quiet "find in work tree" &&
+       test_must_fail git grep --quiet --cached "find in work tree" &&
+       test_must_fail git grep --quiet "find in work tree" HEAD
+'
+
+test_expect_success 'grep can find things only in the work tree (i-t-a)' '
+       echo "intend to add this" >intend-to-add &&
+       git add -N intend-to-add &&
+       test_when_finished "git rm -f intend-to-add" &&
+       git grep --quiet "intend to add this" &&
+       test_must_fail git grep --quiet --cached "intend to add this" &&
+       test_must_fail git grep --quiet "intend to add this" HEAD
+'
+
+test_expect_success 'grep does not search work tree with assume unchanged' '
+       echo "intend to add this" >intend-to-add &&
+       git add -N intend-to-add &&
+       git update-index --assume-unchanged intend-to-add &&
+       test_when_finished "git rm -f intend-to-add" &&
+       test_must_fail git grep --quiet "intend to add this" &&
+       test_must_fail git grep --quiet --cached "intend to add this" &&
+       test_must_fail git grep --quiet "intend to add this" HEAD
+'
+
+test_expect_success 'grep can find things only in the index' '
+       echo "only in the index" >cache-this &&
+       git add cache-this &&
+       rm cache-this &&
+       test_when_finished "git rm --cached cache-this" &&
+       test_must_fail git grep --quiet "only in the index" &&
+       git grep --quiet --cached "only in the index" &&
+       test_must_fail git grep --quiet "only in the index" HEAD
+'
+
+test_expect_success 'grep does not report i-t-a with -L --cached' '
+       echo "intend to add this" >intend-to-add &&
+       git add -N intend-to-add &&
+       test_when_finished "git rm -f intend-to-add" &&
+       git ls-files | grep -v "^intend-to-add\$" >expected &&
+       git grep -L --cached "nonexistent_string" >actual &&
+       test_cmp expected actual
+'
+
+test_expect_success 'grep does not report i-t-a and assume unchanged with -L' '
+       echo "intend to add this" >intend-to-add-assume-unchanged &&
+       git add -N intend-to-add-assume-unchanged &&
+       test_when_finished "git rm -f intend-to-add-assume-unchanged" &&
+       git update-index --assume-unchanged intend-to-add-assume-unchanged &&
+       git ls-files | grep -v "^intend-to-add-assume-unchanged\$" >expected &&
+       git grep -L "nonexistent_string" >actual &&
+       test_cmp expected actual
+'
+
 test_done
diff --git a/t/t7812-grep-icase-non-ascii.sh b/t/t7812-grep-icase-non-ascii.sh
new file mode 100755 (executable)
index 0000000..169fd8d
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+test_description='grep icase on non-English locales'
+
+. ./lib-gettext.sh
+
+test_expect_success GETTEXT_LOCALE 'setup' '
+       test_write_lines "TILRAUN: Halló Heimur!" >file &&
+       git add file &&
+       LC_ALL="$is_IS_locale" &&
+       export LC_ALL
+'
+
+test_have_prereq GETTEXT_LOCALE &&
+test-regex "HALLÓ" "Halló" ICASE &&
+test_set_prereq REGEX_LOCALE
+
+test_expect_success REGEX_LOCALE 'grep literal string, no -F' '
+       git grep -i "TILRAUN: Halló Heimur!" &&
+       git grep -i "TILRAUN: HALLÓ HEIMUR!"
+'
+
+test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8 icase' '
+       git grep --perl-regexp    "TILRAUN: H.lló Heimur!" &&
+       git grep --perl-regexp -i "TILRAUN: H.lló Heimur!" &&
+       git grep --perl-regexp -i "TILRAUN: H.LLÓ HEIMUR!"
+'
+
+test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8 string with "+"' '
+       test_write_lines "TILRAUN: Hallóó Heimur!" >file2 &&
+       git add file2 &&
+       git grep -l --perl-regexp "TILRAUN: H.lló+ Heimur!" >actual &&
+       echo file >expected &&
+       echo file2 >>expected &&
+       test_cmp expected actual
+'
+
+test_expect_success REGEX_LOCALE 'grep literal string, with -F' '
+       git grep --debug -i -F "TILRAUN: Halló Heimur!"  2>&1 >/dev/null |
+                grep fixed >debug1 &&
+       test_write_lines "fixed TILRAUN: Halló Heimur!" >expect1 &&
+       test_cmp expect1 debug1 &&
+
+       git grep --debug -i -F "TILRAUN: HALLÓ HEIMUR!"  2>&1 >/dev/null |
+                grep fixed >debug2 &&
+       test_write_lines "fixed TILRAUN: HALLÓ HEIMUR!" >expect2 &&
+       test_cmp expect2 debug2
+'
+
+test_expect_success REGEX_LOCALE 'grep string with regex, with -F' '
+       test_write_lines "^*TILR^AUN:.* \\Halló \$He[]imur!\$" >file &&
+
+       git grep --debug -i -F "^*TILR^AUN:.* \\Halló \$He[]imur!\$" 2>&1 >/dev/null |
+                grep fixed >debug1 &&
+       test_write_lines "fixed \\^*TILR^AUN:\\.\\* \\\\Halló \$He\\[]imur!\\\$" >expect1 &&
+       test_cmp expect1 debug1 &&
+
+       git grep --debug -i -F "^*TILR^AUN:.* \\HALLÓ \$HE[]IMUR!\$"  2>&1 >/dev/null |
+                grep fixed >debug2 &&
+       test_write_lines "fixed \\^*TILR^AUN:\\.\\* \\\\HALLÓ \$HE\\[]IMUR!\\\$" >expect2 &&
+       test_cmp expect2 debug2
+'
+
+test_expect_success REGEX_LOCALE 'pickaxe -i on non-ascii' '
+       git commit -m first &&
+       git log --format=%f -i -S"TILRAUN: HALLÓ HEIMUR!" >actual &&
+       echo first >expected &&
+       test_cmp expected actual
+'
+
+test_done
diff --git a/t/t7813-grep-icase-iso.sh b/t/t7813-grep-icase-iso.sh
new file mode 100755 (executable)
index 0000000..efef7fb
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+test_description='grep icase on non-English locales'
+
+. ./lib-gettext.sh
+
+test_expect_success GETTEXT_ISO_LOCALE 'setup' '
+       printf "TILRAUN: Halló Heimur!" >file &&
+       git add file &&
+       LC_ALL="$is_IS_iso_locale" &&
+       export LC_ALL
+'
+
+test_expect_success GETTEXT_ISO_LOCALE,LIBPCRE 'grep pcre string' '
+       git grep --perl-regexp -i "TILRAUN: H.lló Heimur!" &&
+       git grep --perl-regexp -i "TILRAUN: H.LLÓ HEIMUR!"
+'
+
+test_done
index a9b266f..e48370d 100755 (executable)
@@ -41,12 +41,12 @@ test_expect_success setup '
        test_tick &&
        GIT_AUTHOR_NAME=Fourth git commit -m Fourth &&
 
-       {
-               echo ABC
-               echo DEF
-               echo XXXX
-               echo GHIJK
-       } >cow &&
+       cat >cow <<-\EOF &&
+       ABC
+       DEF
+       XXXX
+       GHIJK
+       EOF
        git add cow &&
        test_tick &&
        GIT_AUTHOR_NAME=Fifth git commit -m Fifth
@@ -115,11 +115,11 @@ test_expect_success 'append with -C -C -C' '
 test_expect_success 'blame wholesale copy' '
 
        git blame -f -C -C1 HEAD^ -- cow | sed -e "$pick_fc" >current &&
-       {
-               echo mouse-Initial
-               echo mouse-Second
-               echo mouse-Third
-       } >expected &&
+       cat >expected <<-\EOF &&
+       mouse-Initial
+       mouse-Second
+       mouse-Third
+       EOF
        test_cmp expected current
 
 '
@@ -127,16 +127,61 @@ test_expect_success 'blame wholesale copy' '
 test_expect_success 'blame wholesale copy and more' '
 
        git blame -f -C -C1 HEAD -- cow | sed -e "$pick_fc" >current &&
-       {
-               echo mouse-Initial
-               echo mouse-Second
-               echo cow-Fifth
-               echo mouse-Third
-       } >expected &&
+       cat >expected <<-\EOF &&
+       mouse-Initial
+       mouse-Second
+       cow-Fifth
+       mouse-Third
+       EOF
        test_cmp expected current
 
 '
 
+test_expect_success 'blame wholesale copy and more in the index' '
+
+       cat >horse <<-\EOF &&
+       ABC
+       DEF
+       XXXX
+       YYYY
+       GHIJK
+       EOF
+       git add horse &&
+       test_when_finished "git rm -f horse" &&
+       git blame -f -C -C1 -- horse | sed -e "$pick_fc" >current &&
+       cat >expected <<-\EOF &&
+       mouse-Initial
+       mouse-Second
+       cow-Fifth
+       horse-Not
+       mouse-Third
+       EOF
+       test_cmp expected current
+
+'
+
+test_expect_success 'blame during cherry-pick with file rename conflict' '
+
+       test_when_finished "git reset --hard && git checkout master" &&
+       git checkout HEAD~3 &&
+       echo MOUSE >> mouse &&
+       git mv mouse rodent &&
+       git add rodent &&
+       GIT_AUTHOR_NAME=Rodent git commit -m "rodent" &&
+       git checkout --detach master &&
+       (git cherry-pick HEAD@{1} || test $? -eq 1) &&
+       git show HEAD@{1}:rodent > rodent &&
+       git add rodent &&
+       git blame -f -C -C1 rodent | sed -e "$pick_fc" >current &&
+       cat current &&
+       cat >expected <<-\EOF &&
+       mouse-Initial
+       mouse-Second
+       rodent-Not
+       EOF
+       test_cmp expected current
+'
+
 test_expect_success 'blame path that used to be a directory' '
        mkdir path &&
        echo A A A A A >path/file &&
index 29f84a6..92c8e79 100755 (executable)
@@ -87,4 +87,21 @@ test_expect_success 'blame --line-porcelain output' '
        test_cmp expect actual
 '
 
+test_expect_success '--porcelain detects first non-blank line as subject' '
+       (
+               GIT_INDEX_FILE=.git/tmp-index &&
+               export GIT_INDEX_FILE &&
+               echo "This is it" >single-file &&
+               git add single-file &&
+               tree=$(git write-tree) &&
+               commit=$(printf "%s\n%s\n%s\n\n\n  \noneline\n\nbody\n" \
+                       "tree $tree" \
+                       "author A <a@b.c> 123456789 +0000" \
+                       "committer C <c@d.e> 123456789 +0000" |
+               git hash-object -w -t commit --stdin) &&
+               git blame --porcelain $commit -- single-file >output &&
+               grep "^summary oneline$" output
+       )
+'
+
 test_done
index 48884d5..ca40a12 100644 (file)
@@ -612,7 +612,7 @@ test_must_fail () {
        then
                echo >&2 "test_must_fail: command succeeded: $*"
                return 1
-       elif test $exit_code -eq 141 && list_contains "$_test_ok" sigpipe
+       elif test_match_signal 13 $exit_code && list_contains "$_test_ok" sigpipe
        then
                return 0
        elif test $exit_code -gt 129 && test $exit_code -le 192
@@ -961,3 +961,18 @@ test_env () {
                done
        )
 }
+
+# Returns true if the numeric exit code in "$2" represents the expected signal
+# in "$1". Signals should be given numerically.
+test_match_signal () {
+       if test "$2" = "$((128 + $1))"
+       then
+               # POSIX
+               return 0
+       elif test "$2" = "$((256 + $1))"
+       then
+               # ksh
+               return 0
+       fi
+       return 1
+}
index 11201e9..d731d66 100644 (file)
@@ -162,6 +162,9 @@ _x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
 # Zero SHA-1
 _z40=0000000000000000000000000000000000000000
 
+EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+EMPTY_BLOB=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+
 # Line feed
 LF='
 '
@@ -170,7 +173,7 @@ LF='
 # when case-folding filenames
 u200c=$(printf '\342\200\214')
 
-export _x05 _x40 _z40 LF u200c
+export _x05 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB
 
 # Each test should start with something like this, after copyright notices:
 #
@@ -798,7 +801,7 @@ then
        # override all git executables in TEST_DIRECTORY/..
        GIT_VALGRIND=$TEST_DIRECTORY/valgrind
        mkdir -p "$GIT_VALGRIND"/bin
-       for file in $GIT_BUILD_DIR/git* $GIT_BUILD_DIR/test-*
+       for file in $GIT_BUILD_DIR/git* $GIT_BUILD_DIR/t/helper/test-*
        do
                make_valgrind_symlink $file
        done
index 095e61f..be4a63e 100644 (file)
@@ -359,8 +359,11 @@ static void print_ok_ref_status(struct ref *ref, int porcelain)
 
 static int print_one_push_status(struct ref *ref, const char *dest, int count, int porcelain)
 {
-       if (!count)
-               fprintf(porcelain ? stdout : stderr, "To %s\n", dest);
+       if (!count) {
+               char *url = transport_anonymize_url(dest);
+               fprintf(porcelain ? stdout : stderr, "To %s\n", url);
+               free(url);
+       }
 
        switch(ref->status) {
        case REF_STATUS_NONE:
index 6bc9512..11c37fb 100644 (file)
@@ -62,17 +62,17 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
        if (!strcmp(cmd, "checkout"))
                msg = advice_commit_before_merge
                      ? _("Your local changes to the following files would be overwritten by checkout:\n%%s"
-                         "Please commit your changes or stash them before you can switch branches.")
+                         "Please commit your changes or stash them before you switch branches.")
                      : _("Your local changes to the following files would be overwritten by checkout:\n%%s");
        else if (!strcmp(cmd, "merge"))
                msg = advice_commit_before_merge
                      ? _("Your local changes to the following files would be overwritten by merge:\n%%s"
-                         "Please commit your changes or stash them before you can merge.")
+                         "Please commit your changes or stash them before you merge.")
                      : _("Your local changes to the following files would be overwritten by merge:\n%%s");
        else
                msg = advice_commit_before_merge
                      ? _("Your local changes to the following files would be overwritten by %s:\n%%s"
-                         "Please commit your changes or stash them before you can %s.")
+                         "Please commit your changes or stash them before you %s.")
                      : _("Your local changes to the following files would be overwritten by %s:\n%%s");
        msgs[ERROR_WOULD_OVERWRITE] = msgs[ERROR_NOT_UPTODATE_FILE] =
                xstrfmt(msg, cmd, cmd);
@@ -83,34 +83,34 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
        if (!strcmp(cmd, "checkout"))
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be removed by checkout:\n%%s"
-                         "Please move or remove them before you can switch branches.")
+                         "Please move or remove them before you switch branches.")
                      : _("The following untracked working tree files would be removed by checkout:\n%%s");
        else if (!strcmp(cmd, "merge"))
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be removed by merge:\n%%s"
-                         "Please move or remove them before you can merge.")
+                         "Please move or remove them before you merge.")
                      : _("The following untracked working tree files would be removed by merge:\n%%s");
        else
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be removed by %s:\n%%s"
-                         "Please move or remove them before you can %s.")
+                         "Please move or remove them before you %s.")
                      : _("The following untracked working tree files would be removed by %s:\n%%s");
        msgs[ERROR_WOULD_LOSE_UNTRACKED_REMOVED] = xstrfmt(msg, cmd, cmd);
 
        if (!strcmp(cmd, "checkout"))
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be overwritten by checkout:\n%%s"
-                         "Please move or remove them before you can switch branches.")
+                         "Please move or remove them before you switch branches.")
                      : _("The following untracked working tree files would be overwritten by checkout:\n%%s");
        else if (!strcmp(cmd, "merge"))
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be overwritten by merge:\n%%s"
-                         "Please move or remove them before you can merge.")
+                         "Please move or remove them before you merge.")
                      : _("The following untracked working tree files would be overwritten by merge:\n%%s");
        else
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be overwritten by %s:\n%%s"
-                         "Please move or remove them before you can %s.")
+                         "Please move or remove them before you %s.")
                      : _("The following untracked working tree files would be overwritten by %s:\n%%s");
        msgs[ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN] = xstrfmt(msg, cmd, cmd);
 
index f19444d..44d63fb 100644 (file)
@@ -58,20 +58,21 @@ static void reset_timeout(void)
        alarm(timeout);
 }
 
-static ssize_t send_client_data(int fd, const char *data, ssize_t sz)
+static void send_client_data(int fd, const char *data, ssize_t sz)
 {
-       if (use_sideband)
-               return send_sideband(1, fd, data, sz, use_sideband);
+       if (use_sideband) {
+               send_sideband(1, fd, data, sz, use_sideband);
+               return;
+       }
        if (fd == 3)
                /* emergency quit */
                fd = 2;
        if (fd == 2) {
                /* XXX: are we happy to lose stuff here? */
                xwrite(fd, data, sz);
-               return sz;
+               return;
        }
        write_or_die(fd, data, sz);
-       return sz;
 }
 
 static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
@@ -229,9 +230,7 @@ static void create_pack_file(void)
                        }
                        else
                                buffered = -1;
-                       sz = send_client_data(1, data, sz);
-                       if (sz < 0)
-                               goto fail;
+                       send_client_data(1, data, sz);
                }
 
                /*
@@ -258,9 +257,7 @@ static void create_pack_file(void)
        /* flush the data */
        if (0 <= buffered) {
                data[0] = buffered;
-               sz = send_client_data(1, data, 1);
-               if (sz < 0)
-                       goto fail;
+               send_client_data(1, data, 1);
                fprintf(stderr, "flushed.\n");
        }
        if (use_sideband)
index 199b1ef..6b4f5f3 100644 (file)
@@ -80,7 +80,7 @@ static struct worktree *get_main_worktree(void)
        int is_bare = 0;
        int is_detached = 0;
 
-       strbuf_addstr(&worktree_path, absolute_path(get_git_common_dir()));
+       strbuf_add_absolute_path(&worktree_path, get_git_common_dir());
        is_bare = !strbuf_strip_suffix(&worktree_path, "/.git");
        if (is_bare)
                strbuf_strip_suffix(&worktree_path, "/.");
@@ -125,7 +125,7 @@ static struct worktree *get_linked_worktree(const char *id)
        strbuf_rtrim(&worktree_path);
        if (!strbuf_strip_suffix(&worktree_path, "/.git")) {
                strbuf_reset(&worktree_path);
-               strbuf_addstr(&worktree_path, absolute_path("."));
+               strbuf_add_absolute_path(&worktree_path, ".");
                strbuf_strip_suffix(&worktree_path, "/.");
        }
 
index 5dc4e15..26db215 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
@@ -227,6 +227,24 @@ int xopen(const char *path, int oflag, ...)
        }
 }
 
+static int handle_nonblock(int fd, short poll_events, int err)
+{
+       struct pollfd pfd;
+
+       if (err != EAGAIN && err != EWOULDBLOCK)
+               return 0;
+
+       pfd.fd = fd;
+       pfd.events = poll_events;
+
+       /*
+        * no need to check for errors, here;
+        * a subsequent read/write will detect unrecoverable errors
+        */
+       poll(&pfd, 1, -1);
+       return 1;
+}
+
 /*
  * xread() is the same a read(), but it automatically restarts read()
  * operations with a recoverable error (EAGAIN and EINTR). xread()
@@ -242,20 +260,8 @@ ssize_t xread(int fd, void *buf, size_t len)
                if (nr < 0) {
                        if (errno == EINTR)
                                continue;
-                       if (errno == EAGAIN || errno == EWOULDBLOCK) {
-                               struct pollfd pfd;
-                               pfd.events = POLLIN;
-                               pfd.fd = fd;
-                               /*
-                                * it is OK if this poll() failed; we
-                                * want to leave this infinite loop
-                                * only when read() returns with
-                                * success, or an expected failure,
-                                * which would be checked by the next
-                                * call to read(2).
-                                */
-                               poll(&pfd, 1, -1);
-                       }
+                       if (handle_nonblock(fd, POLLIN, errno))
+                               continue;
                }
                return nr;
        }
@@ -273,8 +279,13 @@ ssize_t xwrite(int fd, const void *buf, size_t len)
            len = MAX_IO_SIZE;
        while (1) {
                nr = write(fd, buf, len);
-               if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
-                       continue;
+               if (nr < 0) {
+                       if (errno == EINTR)
+                               continue;
+                       if (handle_nonblock(fd, POLLOUT, errno))
+                               continue;
+               }
+
                return nr;
        }
 }
index 49e80aa..9816879 100644 (file)
@@ -94,14 +94,3 @@ int write_or_whine_pipe(int fd, const void *buf, size_t count, const char *msg)
 
        return 1;
 }
-
-int write_or_whine(int fd, const void *buf, size_t count, const char *msg)
-{
-       if (write_in_full(fd, buf, count) < 0) {
-               fprintf(stderr, "%s: write error (%s)\n",
-                       msg, strerror(errno));
-               return 0;
-       }
-
-       return 1;
-}
index 4ce4e35..b96be25 100644 (file)
@@ -947,9 +947,12 @@ static void show_merge_in_progress(struct wt_status *s,
 {
        if (has_unmerged(s)) {
                status_printf_ln(s, color, _("You have unmerged paths."));
-               if (s->hints)
+               if (s->hints) {
                        status_printf_ln(s, color,
-                               _("  (fix conflicts and run \"git commit\")"));
+                                        _("  (fix conflicts and run \"git commit\")"));
+                       status_printf_ln(s, color,
+                                        _("  (use \"git merge --abort\" to abort the merge)"));
+               }
        } else {
                s-> commitable = 1;
                status_printf_ln(s, color,
@@ -1062,7 +1065,7 @@ static void abbrev_sha1_in_line(struct strbuf *line)
                        strbuf_addf(split[1], "%s ", abbrev);
                        strbuf_reset(line);
                        for (i = 0; split[i]; i++)
-                               strbuf_addf(line, "%s", split[i]->buf);
+                               strbuf_addbuf(line, split[i]);
                }
        }
        strbuf_list_free(split);
index 04e1a1a..a613efc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  LibXDiff by Davide Libenzi ( File Differential Library )
- *  Copyright (C) 2003-2009 Davide Libenzi, Johannes E. Schindelin
+ *  Copyright (C) 2003-2016 Davide Libenzi, Johannes E. Schindelin
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
index 62cb23d..027192a 100644 (file)
@@ -200,8 +200,10 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
                                return 0;
                }
        } else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) {
-               while (i1 < s1 && i2 < s2 && l1[i1++] == l2[i2++])
-                       ; /* keep going */
+               while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
+                       i1++;
+                       i2++;
+               }
        }
 
        /*