git/git.git
3 years agotrace: avoid unnecessary quoting
Jeff King [Mon, 15 Jan 2018 10:59:44 +0000 (17:59 +0700)]
trace: avoid unnecessary quoting

Trace output which contains arbitrary strings (e.g., the
arguments to commands which we are running) is always passed
through sq_quote_buf(). That function always adds
single-quotes, even if the output consists of vanilla
characters. This can make the output a bit hard to read.

Let's avoid the quoting if there are no characters which a
shell would interpret. Trace output doesn't necessarily need
to be shell-compatible, but:

  - the shell language is a good ballpark for what humans
    consider readable (well, humans versed in command line
    tools)

  - the run_command bits can be cut-and-pasted to a shell,
    and we'll keep that property

  - it covers any cases which would make the output
    visually ambiguous (e.g., embedded whitespace or quotes)

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosq_quote_argv: drop maxlen parameter
Jeff King [Mon, 15 Jan 2018 10:59:43 +0000 (17:59 +0700)]
sq_quote_argv: drop maxlen parameter

No caller passes anything but "0" for this parameter, which
requests that the function ignore it completely. In fact, in
all of history there was only one such caller, and it went
away in 7f51f8bc2b (alias: use run_command api to execute
aliases, 2011-01-07).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jk/doc-diff-options'
Junio C Hamano [Tue, 9 Jan 2018 22:32:57 +0000 (14:32 -0800)]
Merge branch 'jk/doc-diff-options'

Doc update.

* jk/doc-diff-options:
  docs/diff-options: clarify scope of diff-filter types

3 years agoMerge branch 'bw/protocol-v1'
Junio C Hamano [Tue, 9 Jan 2018 22:32:56 +0000 (14:32 -0800)]
Merge branch 'bw/protocol-v1'

Test fix for a topic already in 'master'.

* bw/protocol-v1:
  http: fix v1 protocol tests with apache httpd < 2.4

3 years agoMerge branch 'sg/travis-check-untracked'
Junio C Hamano [Tue, 9 Jan 2018 22:32:55 +0000 (14:32 -0800)]
Merge branch 'sg/travis-check-untracked'

* sg/travis-check-untracked:
  travis-ci: check that all build artifacts are .gitignore-d
  travis-ci: don't store P4 and Git LFS in the working tree

3 years agoMerge branch 'js/test-with-ws-in-path'
Junio C Hamano [Tue, 9 Jan 2018 22:32:55 +0000 (14:32 -0800)]
Merge branch 'js/test-with-ws-in-path'

Test fixes.

* js/test-with-ws-in-path:
  t0302 & t3900: add forgotten quotes
  Allow the test suite to pass in a directory whose name contains spaces

3 years agoMerge branch 'bc/submitting-patches-in-asciidoc'
Junio C Hamano [Tue, 9 Jan 2018 22:32:54 +0000 (14:32 -0800)]
Merge branch 'bc/submitting-patches-in-asciidoc'

Doc readability update.

* bc/submitting-patches-in-asciidoc:
  doc/SubmittingPatches: improve text formatting

3 years agoMerge branch 'sg/travis-skip-identical-test'
Junio C Hamano [Tue, 9 Jan 2018 22:32:54 +0000 (14:32 -0800)]
Merge branch 'sg/travis-skip-identical-test'

Avoid repeatedly testing the same tree in TravisCI that have been
tested successfully already.

* sg/travis-skip-identical-test:
  travis-ci: record and skip successfully built trees
  travis-ci: create the cache directory early in the build process
  travis-ci: print the "tip of branch is exactly at tag" message in color

3 years agoMerge branch 'ab/dc-sha1-loose-ends'
Junio C Hamano [Tue, 9 Jan 2018 22:32:53 +0000 (14:32 -0800)]
Merge branch 'ab/dc-sha1-loose-ends'

Tying loose ends for the recent integration work of
collision-detecting SHA-1 implementation.

* ab/dc-sha1-loose-ends:
  Makefile: NO_OPENSSL=1 should no longer imply BLK_SHA1=1

3 years agoMerge branch 'sg/travis-fixes'
Junio C Hamano [Tue, 9 Jan 2018 22:32:53 +0000 (14:32 -0800)]
Merge branch 'sg/travis-fixes'

Assorted updates for TravisCI integration.

* sg/travis-fixes:
  travis-ci: only print test failures if there are test results available
  travis-ci: save prove state for the 32 bit Linux build
  travis-ci: don't install default addon packages for the 32 bit Linux build
  travis-ci: fine tune the use of 'set -x' in 'ci/*' scripts

3 years agoMerge branch 'js/misc-git-gui-stuff' of ../git-gui
Junio C Hamano [Tue, 9 Jan 2018 19:07:03 +0000 (11:07 -0800)]
Merge branch 'js/misc-git-gui-stuff' of ../git-gui

* 'js/misc-git-gui-stuff' of ../git-gui:
  git-gui: allow Ctrl+T to toggle multiple paths
  git-gui: fix exception when trying to stage with empty file list
  git-gui: avoid exception upon Ctrl+T in an empty list
  git gui: fix staging a second line to a 1-line file

3 years agogit-gui: allow Ctrl+T to toggle multiple paths
Johannes Schindelin [Tue, 9 Jan 2018 14:33:04 +0000 (15:33 +0100)]
git-gui: allow Ctrl+T to toggle multiple paths

It is possible to select multiple files in the "Unstaged Changes" and
the "Staged Changes" lists. But when hitting Ctrl+T, surprisingly only
one entry is handled, not all selected ones.

Let's just use the same code path as for the "Stage To Commit" and the
"Unstage From Commit" menu items.

This fixes https://github.com/git-for-windows/git/issues/1012

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-gui: fix exception when trying to stage with empty file list
Johannes Schindelin [Tue, 9 Jan 2018 14:33:01 +0000 (15:33 +0100)]
git-gui: fix exception when trying to stage with empty file list

If there is nothing to stage, there is nothing to stage. Let's not try
to, even if the file list contains nothing at all.

This fixes https://github.com/git-for-windows/git/issues/1075

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-gui: avoid exception upon Ctrl+T in an empty list
Johannes Schindelin [Tue, 9 Jan 2018 14:32:58 +0000 (15:32 +0100)]
git-gui: avoid exception upon Ctrl+T in an empty list

Previously unstaged files can be staged by clicking on them and then
pressing Ctrl+T. Conveniently, the next unstaged file is selected
automatically so that the unstaged files can be staged by repeatedly
pressing Ctrl+T.

When a user hits Ctrl+T one time too many, though, Git GUI used to throw
this exception:

expected number but got ""
expected number but got ""
    while executing
"expr {int([lindex [$w tag ranges in_diff] 0])}"
    (procedure "toggle_or_diff" line 13)
    invoked from within
"toggle_or_diff toggle .vpane.files.workdir.list "
    (command bound to event)

Let's just avoid that by skipping the operation when there are no more
files to stage.

This fixes https://github.com/git-for-windows/git/issues/1060

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit gui: fix staging a second line to a 1-line file
Johannes Schindelin [Tue, 9 Jan 2018 14:32:54 +0000 (15:32 +0100)]
git gui: fix staging a second line to a 1-line file

When a 1-line file is augmented by a second line, and the user tries to
stage that single line via the "Stage Line" context menu item, we do not
want to see "apply: corrupt patch at line 5".

The reason for this error was that the hunk header looks like this:

@@ -1 +1,2 @@

but the existing code expects the original range always to contain a
comma. This problem is easily fixed by cutting the string "1 +1,2"
(that Git GUI formerly mistook for the starting line) at the space.

This fixes https://github.com/git-for-windows/git/issues/515

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.16-rc1 v2.16.0-rc1
Junio C Hamano [Fri, 5 Jan 2018 21:45:17 +0000 (13:45 -0800)]
Git 2.16-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'js/sequencer-cleanups'
Junio C Hamano [Fri, 5 Jan 2018 21:28:11 +0000 (13:28 -0800)]
Merge branch 'js/sequencer-cleanups'

Code cleanup.

* js/sequencer-cleanups:
  sequencer: do not invent whitespace when transforming OIDs
  sequencer: report when noop has an argument
  sequencer: remove superfluous conditional
  sequencer: strip bogus LF at end of error messages
  rebase: do not continue when the todo list generation failed

3 years agoMerge branch 'jh/memihash-opt'
Junio C Hamano [Fri, 5 Jan 2018 21:28:11 +0000 (13:28 -0800)]
Merge branch 'jh/memihash-opt'

Squelch compiler warning.

* jh/memihash-opt:
  t/helper/test-lazy-name-hash: fix compilation

3 years agoMerge branch 'tb/test-lint-wc-l'
Junio C Hamano [Fri, 5 Jan 2018 21:28:11 +0000 (13:28 -0800)]
Merge branch 'tb/test-lint-wc-l'

Test update.

* tb/test-lint-wc-l:
  check-non-portable-shell.pl: `wc -l` may have leading WS

3 years agoMerge branch 'rs/use-argv-array-in-child-process'
Junio C Hamano [Fri, 5 Jan 2018 21:28:10 +0000 (13:28 -0800)]
Merge branch 'rs/use-argv-array-in-child-process'

Code cleanup.

* rs/use-argv-array-in-child-process:
  send-pack: use internal argv_array of struct child_process
  http: use internal argv_array of struct child_process

3 years agoMerge branch 'ld/p4-multiple-shelves'
Junio C Hamano [Fri, 5 Jan 2018 21:28:10 +0000 (13:28 -0800)]
Merge branch 'ld/p4-multiple-shelves'

"git p4" update.

* ld/p4-multiple-shelves:
  git-p4: update multiple shelved change lists

3 years agoMerge branch 'jd/fix-strbuf-add-urlencode-bytes'
Junio C Hamano [Fri, 5 Jan 2018 21:28:10 +0000 (13:28 -0800)]
Merge branch 'jd/fix-strbuf-add-urlencode-bytes'

Bytes with high-bit set were encoded incorrectly and made
credential helper fail.

* jd/fix-strbuf-add-urlencode-bytes:
  strbuf: fix urlencode format string on signed char

3 years agoMerge branch 'ew/empty-merge-with-dirty-index'
Junio C Hamano [Fri, 5 Jan 2018 21:28:09 +0000 (13:28 -0800)]
Merge branch 'ew/empty-merge-with-dirty-index'

"git merge -s recursive" did not correctly abort when the index is
dirty, if the merged tree happened to be the same as the current
HEAD, which has been fixed.

* ew/empty-merge-with-dirty-index:
  merge-recursive: avoid incorporating uncommitted changes in a merge
  move index_has_changes() from builtin/am.c to merge.c for reuse
  t6044: recursive can silently incorporate dirty changes in a merge

3 years agoMerge branch 'db/doc-config-section-names-with-bs'
Junio C Hamano [Fri, 5 Jan 2018 21:28:09 +0000 (13:28 -0800)]
Merge branch 'db/doc-config-section-names-with-bs'

Doc update.

* db/doc-config-section-names-with-bs:
  config.txt: document behavior of backslashes in subsections

3 years agoMerge branch 'jk/test-suite-tracing'
Junio C Hamano [Fri, 5 Jan 2018 21:28:09 +0000 (13:28 -0800)]
Merge branch 'jk/test-suite-tracing'

Assorted fixes around running tests with "-x" tracing option.

* jk/test-suite-tracing:
  t/Makefile: introduce TEST_SHELL_PATH
  test-lib: make "-x" work with "--verbose-log"
  t5615: avoid re-using descriptor 4
  test-lib: silence "-x" cleanup under bash

3 years agodocs/diff-options: clarify scope of diff-filter types
Jeff King [Thu, 4 Jan 2018 16:49:42 +0000 (11:49 -0500)]
docs/diff-options: clarify scope of diff-filter types

The same document for "--diff-filter" is included by many
programs in the diff family. Because it mentions all
possible types (added, removed, etc), this may imply to the
reader that all types can be generated by a particular
command. But this isn't necessarily the case; "diff-files"
cannot generally produce an "Added" entry, since the diff is
limited to what is already in the index.

Let's make it clear that the list here is the full one, and
does not imply anything about what a particular invocation
may produce.

Note that conditionally including items (e.g., omitting
"Added" in the git-diff-files manpage) isn't the right
solution here for two reasons:

  - The problem isn't diff-files, but doing an index to
    working tree diff. "git diff" can do the same diff, but
    also has other modes where "Added" does show up.

  - The direction of the diff matters. Doing "diff-files -R"
    can get you Added entries (but not Deleted ones).

So it's best just to explain that the set of available types
depends on the specific diff invocation.

Reported-by: John Cheng <johnlicheng@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agohttp: fix v1 protocol tests with apache httpd < 2.4
Todd Zullinger [Sun, 31 Dec 2017 02:32:34 +0000 (21:32 -0500)]
http: fix v1 protocol tests with apache httpd < 2.4

The apache config used by tests was updated to use the SetEnvIf
directive to set the Git-Protocol header in 19113a26b6 ("http: tell
server that the client understands v1", 2017-10-16).

Setting the Git-Protocol header is restricted to httpd >= 2.4, but
mod_setenvif and the SetEnvIf directive work with lower versions, at
least as far back as 2.0, according to the httpd documentation:

    https://httpd.apache.org/docs/2.0/mod/mod_setenvif.html

Drop the restriction.  Tested with httpd 2.2 and 2.4.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot0302 & t3900: add forgotten quotes
Johannes Schindelin [Wed, 3 Jan 2018 16:54:54 +0000 (17:54 +0100)]
t0302 & t3900: add forgotten quotes

When cleaning up files in the $HOME directory, it really makes sense to
quote the path, especially in Git's test suite, where the HOME directory
is *guaranteed* to contain spaces in its name.

It would appear that those two tests pass even without cleaning up the
files, but really more by pure chance than by design (the cleanup seems
not actually to be necessary).

However, if anybody would have a left-over `trash/` directory in Git's
`t/` directory, these tests would fail, because they would all of a
sudden try to delete that directory, but without the `-r` (recursive)
flag. That is how this issue was found.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoAllow the test suite to pass in a directory whose name contains spaces
Johannes Schindelin [Wed, 3 Jan 2018 16:54:50 +0000 (17:54 +0100)]
Allow the test suite to pass in a directory whose name contains spaces

It is totally legitimate to clone Git's source code anywhere, including
into, say, directories whose name (or the name of its absolute path)
contains spaces.

However, a couple of tests failed to anticipate this, for lack of
quoting (or in one instance, for failure to expect more than one space
in the absolute path of the TEST_DIRECTORY). This can be easily verified
by calling these commands in your current clone:

git clone . with\ spaces
cd with\ spaces
make -j15 test

Let's fix this.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc/SubmittingPatches: improve text formatting
Todd Zullinger [Tue, 2 Jan 2018 15:33:50 +0000 (10:33 -0500)]
doc/SubmittingPatches: improve text formatting

049e64aa50 ("Documentation: convert SubmittingPatches to AsciiDoc",
2017-11-12) changed the `git blame` and `git shortlog` examples given in
the section on sending your patches.

In order to italicize the `$path` argument the commands are enclosed in
plus characters as opposed to backticks.  The difference between the
quoting methods is that backtick enclosed text is not subject to further
expansion.  This formatting makes reading SubmittingPatches in a git
clone a little more difficult.  In addition to the underscores around
`$path` the `--` chars in `git shortlog --no-merges` must be replaced
with `{litdd}`.

Use backticks to quote these commands.  The italicized `$path` is lost
from the html version but the commands can be read (and copied) more
easily by users reading the text version.  These readers are more likely
to use the commands while submitting patches.  Make it easier for them.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotravis-ci: check that all build artifacts are .gitignore-d
SZEDER Gábor [Sun, 31 Dec 2017 16:02:06 +0000 (17:02 +0100)]
travis-ci: check that all build artifacts are .gitignore-d

Every once in a while our explicit .gitignore files get out of sync
when our build process learns to create new artifacts, like test
helper executables, but the .gitignore files are not updated
accordingly.

Use Travis CI to help catch such issues earlier: check that there are
no untracked files at the end of any build jobs building Git (i.e. the
64 bit Clang and GCC Linux and OSX build jobs, plus the GETTEXT_POISON
and 32 bit Linux build jobs) or its documentation, and fail the build
job if there are any present.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotravis-ci: don't store P4 and Git LFS in the working tree
SZEDER Gábor [Sun, 31 Dec 2017 16:02:05 +0000 (17:02 +0100)]
travis-ci: don't store P4 and Git LFS in the working tree

The Clang and GCC 64 bit Linux build jobs download and store the P4
and Git LFS executables under the current directory, which is the
working tree that we are about to build and test.  This means that Git
commands like 'status' or 'ls-files' would list these files as
untracked.  The next commit is about to make sure that there are no
untracked files present after the build, and the downloaded
executables in the working tree are interfering with those upcoming
checks.

Therefore, let's download P4 and Git LFS in the home directory,
outside of the working tree.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotravis-ci: record and skip successfully built trees
SZEDER Gábor [Sun, 31 Dec 2017 10:12:05 +0000 (11:12 +0100)]
travis-ci: record and skip successfully built trees

Travis CI dutifully builds and tests each new branch tip, even if its
tree has previously been successfully built and tested.  This happens
often enough in contributors' workflows, when a work-in-progress
branch is rebased changing e.g. only commit messages or the order or
number of commits while leaving the resulting code intact, and is then
pushed to a Travis CI-enabled GitHub fork.

This is wasting Travis CI's resources and is sometimes scary-annoying
when the new tip commit with a tree identical to the previous,
successfully tested one is suddenly reported in red, because one of
the OSX build jobs happened to exceed the time limit yet again.

So extend our Travis CI build scripts to skip building commits whose
trees have previously been successfully built and tested.  Use the
Travis CI cache feature to keep a record of the object names of trees
that tested successfully, in a plain and simple flat text file, one
line per tree object name.  Append the current tree's object name at
the end of every successful build job to this file, along with a bit
of additional info about the build job (commit object name, Travis CI
job number and id).  Limit the size of this file to 1000 records, to
prevent it from growing too large for git/git's forever living
integration branches.  Check, using a simple grep invocation, in each
build job whether the current commit's tree is already in there, and
skip the build if it is.  Include a message in the skipped build job's
trace log, containing the URL to the build job successfully testing
that tree for the first time and instructions on how to force a
re-build.  Catch the case when a build job, which successfully built
and tested a particular tree for the first time, is restarted and omit
the URL of the previous build job's trace log, as in this case it's
the same build job and the trace log has just been overwritten.

Note: this won't kick in if two identical trees are on two different
branches, because Travis CI caches are not shared between build jobs
of different branches.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotravis-ci: create the cache directory early in the build process
SZEDER Gábor [Sun, 31 Dec 2017 10:12:04 +0000 (11:12 +0100)]
travis-ci: create the cache directory early in the build process

It seems that Travis CI creates the cache directory for us anyway,
even when a previous cache doesn't exist for the current build job.
Alas, this behavior is not explicitly documented, therefore we don't
rely on it and create the cache directory ourselves in those build
jobs that read/write cached data (currently only the prove state).

In the following commit we'll start to cache additional data in every
build job, and will access the cache much earlier in the build
process.

Therefore move creating the cache directory to 'ci/lib-travisci.sh' to
make sure that it exists at the very beginning of every build job.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotravis-ci: print the "tip of branch is exactly at tag" message in color
SZEDER Gábor [Sun, 31 Dec 2017 10:12:03 +0000 (11:12 +0100)]
travis-ci: print the "tip of branch is exactly at tag" message in color

To make this info message stand out from the regular build job trace
output.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.16-rc0 v2.16.0-rc0
Junio C Hamano [Thu, 28 Dec 2017 22:12:06 +0000 (14:12 -0800)]
Git 2.16-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'sb/describe-blob'
Junio C Hamano [Thu, 28 Dec 2017 22:08:50 +0000 (14:08 -0800)]
Merge branch 'sb/describe-blob'

"git describe" was taught to dig trees deeper to find a
<commit-ish>:<path> that refers to a given blob object.

* sb/describe-blob:
  builtin/describe.c: describe a blob
  builtin/describe.c: factor out describe_commit
  builtin/describe.c: print debug statements earlier
  builtin/describe.c: rename `oid` to avoid variable shadowing
  revision.h: introduce blob/tree walking in order of the commits
  list-objects.c: factor out traverse_trees_and_blobs
  t6120: fix typo in test name

3 years agoMerge branch 'hi/merge-verify-sig-config'
Junio C Hamano [Thu, 28 Dec 2017 22:08:50 +0000 (14:08 -0800)]
Merge branch 'hi/merge-verify-sig-config'

"git merge" learned to pay attention to merge.verifySignatures
configuration variable and pretend as if '--verify-signatures'
option was given from the command line.

* hi/merge-verify-sig-config:
  t5573, t7612: clean up after unexpected success of 'pull' and 'merge'
  t: add tests for pull --verify-signatures
  merge: add config option for verifySignatures

3 years agoMerge branch 'ws/curl-http-proxy-over-https'
Junio C Hamano [Thu, 28 Dec 2017 22:08:50 +0000 (14:08 -0800)]
Merge branch 'ws/curl-http-proxy-over-https'

Git has been taught to support an https:// URL used for http.proxy
when using recent versions of libcurl.

* ws/curl-http-proxy-over-https:
  http: support CURLPROXY_HTTPS

3 years agoMerge branch 'ks/doc-previous-checkout'
Junio C Hamano [Thu, 28 Dec 2017 22:08:49 +0000 (14:08 -0800)]
Merge branch 'ks/doc-previous-checkout'

Doc update.

* ks/doc-previous-checkout:
  Doc/check-ref-format: clarify information about @{-N} syntax

3 years agoMerge branch 'ks/rebase-error-messages'
Junio C Hamano [Thu, 28 Dec 2017 22:08:49 +0000 (14:08 -0800)]
Merge branch 'ks/rebase-error-messages'

Error messages from "git rebase" have been somewhat cleaned up.

* ks/rebase-error-messages:
  rebase: rebasing can also be done when HEAD is detached
  rebase: distinguish user input by quoting it
  rebase: consistently use branch_name variable

3 years agoMerge branch 'sr/http-sslverify-config-doc'
Junio C Hamano [Thu, 28 Dec 2017 22:08:49 +0000 (14:08 -0800)]
Merge branch 'sr/http-sslverify-config-doc'

Docfix.

* sr/http-sslverify-config-doc:
  config: document default value of http.sslVerify

3 years agoMerge branch 'nm/imap-send-quote-server-folder-name'
Junio C Hamano [Thu, 28 Dec 2017 22:08:48 +0000 (14:08 -0800)]
Merge branch 'nm/imap-send-quote-server-folder-name'

"git imap-send" did not correctly quote the folder name when
making a request to the server, which has been corrected.

* nm/imap-send-quote-server-folder-name:
  imap-send: URI encode server folder

3 years agoMerge branch 'bp/fsmonitor'
Junio C Hamano [Thu, 28 Dec 2017 22:08:48 +0000 (14:08 -0800)]
Merge branch 'bp/fsmonitor'

Test fix.

* bp/fsmonitor:
  p7519: improve check for prerequisite WATCHMAN

3 years agoMerge branch 'jh/partial-clone-doc'
Junio C Hamano [Thu, 28 Dec 2017 22:08:47 +0000 (14:08 -0800)]
Merge branch 'jh/partial-clone-doc'

* jh/partial-clone-doc:
  partial-clone: design doc

3 years agoMerge branch 'jt/transport-hide-vtable'
Junio C Hamano [Thu, 28 Dec 2017 22:08:47 +0000 (14:08 -0800)]
Merge branch 'jt/transport-hide-vtable'

Code clean-up.

* jt/transport-hide-vtable:
  transport: make transport vtable more private
  clone, fetch: remove redundant transport check

3 years agoMerge branch 'js/enhanced-version-info'
Junio C Hamano [Thu, 28 Dec 2017 22:08:47 +0000 (14:08 -0800)]
Merge branch 'js/enhanced-version-info'

"git version --build-options" learned to report the host CPU and
the exact commit object name the binary was built from.

* js/enhanced-version-info:
  version --build-options: report commit, too, if possible
  version --build-options: also report host CPU

3 years agoMerge branch 'tz/lib-git-svn-svnserve-tests'
Junio C Hamano [Thu, 28 Dec 2017 22:08:46 +0000 (14:08 -0800)]
Merge branch 'tz/lib-git-svn-svnserve-tests'

* tz/lib-git-svn-svnserve-tests:
  t/lib-git-svn.sh: improve svnserve tests with parallel make test
  t/lib-git-svn: cleanup inconsistent tab/space usage

3 years agoMerge branch 'ew/svn-crlf'
Junio C Hamano [Thu, 28 Dec 2017 22:08:46 +0000 (14:08 -0800)]
Merge branch 'ew/svn-crlf'

"git svn" has been updated to strip CRs in the commit messages, as
recent versions of Subversion rejects them.

* ew/svn-crlf:
  git-svn: convert CRLF to LF in commit message to SVN

3 years agoMerge branch 'cc/skip-to-optional-val'
Junio C Hamano [Thu, 28 Dec 2017 22:08:46 +0000 (14:08 -0800)]
Merge branch 'cc/skip-to-optional-val'

Introduce a helper to simplify code to parse a common pattern that
expects either "--key" or "--key=<something>".

* cc/skip-to-optional-val:
  t4045: reindent to make helpers readable
  diff: add tests for --relative without optional prefix value
  diff: use skip_to_optional_arg_default() in parsing --relative
  diff: use skip_to_optional_arg_default()
  diff: use skip_to_optional_arg()
  index-pack: use skip_to_optional_arg()
  git-compat-util: introduce skip_to_optional_arg()

3 years agoMerge branch 'ra/prompt-eread-fix'
Junio C Hamano [Thu, 28 Dec 2017 22:08:45 +0000 (14:08 -0800)]
Merge branch 'ra/prompt-eread-fix'

Update the shell prompt script (in contrib/) to strip trailing CR
from strings read from various "state" files.

* ra/prompt-eread-fix:
  git-prompt: fix reading files with windows line endings
  git-prompt: make __git_eread intended use explicit

3 years agoMerge branch 'bw/path-doc'
Junio C Hamano [Thu, 28 Dec 2017 22:08:45 +0000 (14:08 -0800)]
Merge branch 'bw/path-doc'

Doc updates.

* bw/path-doc:
  path: document path functions

3 years agoMakefile: NO_OPENSSL=1 should no longer imply BLK_SHA1=1
Ævar Arnfjörð Bjarmason [Thu, 28 Dec 2017 14:07:41 +0000 (14:07 +0000)]
Makefile: NO_OPENSSL=1 should no longer imply BLK_SHA1=1

Use the collision detecting SHA-1 implementation by default even when
NO_OPENSSL is set.

Setting NO_OPENSSL=UnfortunatelyYes has implied BLK_SHA1=1 ever since
the former was introduced in dd53c7ab29 (Support for NO_OPENSSL,
2005-07-29).  That implication should have been removed when the
default SHA-1 implementation changed from OpenSSL to DC_SHA1 in
e6b07da278 (Makefile: make DC_SHA1 the default, 2017-03-17).  Finish
what that commit started by removing the BLK_SHA1 fallback setting so
the default DC_SHA1 implementation will be used.

Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosequencer: do not invent whitespace when transforming OIDs
Johannes Schindelin [Fri, 22 Dec 2017 23:56:00 +0000 (00:56 +0100)]
sequencer: do not invent whitespace when transforming OIDs

For commands that do not have an argument, there is no need to append a
trailing space at the end of the line.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosequencer: report when noop has an argument
Johannes Schindelin [Fri, 22 Dec 2017 23:55:57 +0000 (00:55 +0100)]
sequencer: report when noop has an argument

The noop command cannot accept any argument, but we never told the user
about any bogus argument. Fix that.

while at it, mention clearly when an argument is required but missing
(for commands *other* than noop).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosequencer: remove superfluous conditional
Johannes Schindelin [Fri, 22 Dec 2017 23:55:53 +0000 (00:55 +0100)]
sequencer: remove superfluous conditional

In a conditional block that is only reached when handling a TODO_REWORD
(as seen even from a 3-line context), there is absolutely no need to
nest another block under the identical condition.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosequencer: strip bogus LF at end of error messages
Johannes Schindelin [Fri, 22 Dec 2017 23:55:43 +0000 (00:55 +0100)]
sequencer: strip bogus LF at end of error messages

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorebase: do not continue when the todo list generation failed
Johannes Schindelin [Fri, 22 Dec 2017 23:55:38 +0000 (00:55 +0100)]
rebase: do not continue when the todo list generation failed

This is a *really* long-standing bug. As a matter of fact, this bug has
been with us from the very beginning of `rebase -i`: 1b1dce4bae7 (Teach
rebase an interactive mode, 2007-06-25), where the output of `rev-list`
was piped to `sed` (and any failure of the `rev-list` process would go
completely undetected).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotravis-ci: only print test failures if there are test results available
SZEDER Gábor [Wed, 27 Dec 2017 16:36:03 +0000 (17:36 +0100)]
travis-ci: only print test failures if there are test results available

When a build job running the test suite fails, our
'ci/print-test-failures.sh' script scans all 't/test-results/*.exit'
files to find failed tests and prints their verbose output.  However,
if a build job were to fail before it ever gets to run the test suite,
then there will be no files to match the above pattern and the shell
will take the pattern literally, resulting in errors like this in the
trace log:

  cat: t/test-results/*.exit: No such file or directory
  ------------------------------------------------------------------------
  t/test-results/*.out...
  ------------------------------------------------------------------------
  cat: t/test-results/*.out: No such file or directory

Check upfront and proceed only if there are any such files present.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotravis-ci: save prove state for the 32 bit Linux build
SZEDER Gábor [Wed, 27 Dec 2017 16:36:02 +0000 (17:36 +0100)]
travis-ci: save prove state for the 32 bit Linux build

This change follows suit of 6272ed319 (travis-ci: run previously
failed tests first, then slowest to fastest, 2016-01-26), which did
this for the Linux and OSX build jobs.  Travis CI build jobs run the
tests parallel, which is sligtly faster when tests are run in slowest
to fastest order, shortening the overall runtime of this build job by
about a minute / 10%.

Note, that the 32 bit Linux build job runs the tests suite in a Docker
container and we have to share the Travis CI cache directory with the
container as a second volume.  Otherwise we couldn't use a symlink
pointing to the prove state file in the cache directory, because
that's outside of the directory hierarchy accessible from within the
container.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotravis-ci: don't install default addon packages for the 32 bit Linux build
SZEDER Gábor [Wed, 27 Dec 2017 16:36:01 +0000 (17:36 +0100)]
travis-ci: don't install default addon packages for the 32 bit Linux build

The 32 bit Linux build job compiles Git and runs the test suite in a
Docker container, while the additional packages (apache2, git-svn,
language-pack-is) are installed on the host, therefore don't have
any effect and are unnecessary.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Acked-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotravis-ci: fine tune the use of 'set -x' in 'ci/*' scripts
SZEDER Gábor [Wed, 27 Dec 2017 16:36:00 +0000 (17:36 +0100)]
travis-ci: fine tune the use of 'set -x' in 'ci/*' scripts

The change in commit 4f2636667 (travis-ci: use 'set -x' in 'ci/*'
scripts for extra tracing output, 2017-12-12) left a couple of rough
edges:

  - 'ci/run-linux32-build.sh' is executed in a Docker container and
    therefore doesn't source 'ci/lib-travisci.sh', which would enable
    tracing executed commands.  Enable 'set -x' in this script, too.

  - 'ci/print-test-failures.sh' iterates over all the files containing
    the exit codes of all the executed test scripts.  Since there are
    over 800 such files, the loop produces way too much noise with
    tracing executed commands enabled, so disable 'set -x' for this
    script.

  - 'ci/run-windows-build.sh' busily waits in a loop for the result of
    the Windows build, producing too much noise with tracing executed
    commands enabled as well.  Disable 'set -x' for the duration of
    that loop.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoRelNotes: the eleventh batch
Junio C Hamano [Wed, 27 Dec 2017 19:20:27 +0000 (11:20 -0800)]
RelNotes: the eleventh batch

Hopefully the last one before -rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'rb/quick-install-doc'
Junio C Hamano [Wed, 27 Dec 2017 19:16:30 +0000 (11:16 -0800)]
Merge branch 'rb/quick-install-doc'

The build procedure now allows not just the repositories but also
the refs to be used to take pre-formatted manpages and html
documents to install.

* rb/quick-install-doc:
  install-doc-quick: allow specifying what ref to install

3 years agoMerge branch 'jt/transport-no-more-rsync'
Junio C Hamano [Wed, 27 Dec 2017 19:16:30 +0000 (11:16 -0800)]
Merge branch 'jt/transport-no-more-rsync'

Code clean-up.

* jt/transport-no-more-rsync:
  transport: remove unused "push" in vtable

3 years agoMerge branch 'sg/travis-fixes'
Junio C Hamano [Wed, 27 Dec 2017 19:16:30 +0000 (11:16 -0800)]
Merge branch 'sg/travis-fixes'

Assorted updates for TravisCI integration.

* sg/travis-fixes:
  travis-ci: use 'set -x' in 'ci/*' scripts for extra tracing output
  travis-ci: set GIT_TEST_HTTPD in 'ci/lib-travisci.sh'
  travis-ci: move setting environment variables to 'ci/lib-travisci.sh'
  travis-ci: introduce a $jobname variable for 'ci/*' scripts

3 years agoMerge branch 'sb/test-helper-excludes'
Junio C Hamano [Wed, 27 Dec 2017 19:16:29 +0000 (11:16 -0800)]
Merge branch 'sb/test-helper-excludes'

Simplify the ignore rules for t/helper directory.

* sb/test-helper-excludes:
  t/helper: ignore everything but sources

3 years agoMerge branch 'ot/pretty'
Junio C Hamano [Wed, 27 Dec 2017 19:16:29 +0000 (11:16 -0800)]
Merge branch 'ot/pretty'

Code clean-up.

* ot/pretty:
  format: create docs for pretty.h
  format: create pretty.h file

3 years agoMerge branch 'bw/submodule-sans-cache-compat'
Junio C Hamano [Wed, 27 Dec 2017 19:16:28 +0000 (11:16 -0800)]
Merge branch 'bw/submodule-sans-cache-compat'

Code clean-up.

* bw/submodule-sans-cache-compat:
  submodule: convert get_next_submodule to not rely on the_index
  submodule: used correct index in is_staging_gitmodules_ok
  submodule: convert stage_updated_gitmodules to take a struct index_state

3 years agoMerge branch 'es/clone-shared-worktree'
Junio C Hamano [Wed, 27 Dec 2017 19:16:28 +0000 (11:16 -0800)]
Merge branch 'es/clone-shared-worktree'

"git clone --shared" to borrow from a (secondary) worktree did not
work, even though "git clone --local" did.  Both are now accepted.

* es/clone-shared-worktree:
  clone: support 'clone --shared' from a worktree

3 years agoMerge branch 'tb/delimit-pretty-trailers-args-with-comma'
Junio C Hamano [Wed, 27 Dec 2017 19:16:27 +0000 (11:16 -0800)]
Merge branch 'tb/delimit-pretty-trailers-args-with-comma'

Doc updates.

* tb/delimit-pretty-trailers-args-with-comma:
  docs/pretty-formats: mention commas in %(trailers) syntax

3 years agoMerge branch 'rs/fmt-merge-msg-leakfix'
Junio C Hamano [Wed, 27 Dec 2017 19:16:26 +0000 (11:16 -0800)]
Merge branch 'rs/fmt-merge-msg-leakfix'

Leakfix.

* rs/fmt-merge-msg-leakfix:
  transport-helper: plug strbuf and string_list leaks

3 years agoMerge branch 'jt/decorate-api'
Junio C Hamano [Wed, 27 Dec 2017 19:16:26 +0000 (11:16 -0800)]
Merge branch 'jt/decorate-api'

A few structures and variables that are implementation details of
the decorate API have been renamed and then the API got documented
better.

* jt/decorate-api:
  decorate: clean up and document API

3 years agoMerge branch 'jk/cvsimport-quoting'
Junio C Hamano [Wed, 27 Dec 2017 19:16:26 +0000 (11:16 -0800)]
Merge branch 'jk/cvsimport-quoting'

Typo/Logico fix.

* jk/cvsimport-quoting:
  cvsimport: apply shell-quoting regex globally

3 years agoMerge branch 'db/doc-workflows-neuter-the-maintainer'
Junio C Hamano [Wed, 27 Dec 2017 19:16:25 +0000 (11:16 -0800)]
Merge branch 'db/doc-workflows-neuter-the-maintainer'

Docfix.

* db/doc-workflows-neuter-the-maintainer:
  doc: reword gitworkflows.txt for neutrality

3 years agoMerge branch 'ks/branch-cleanup'
Junio C Hamano [Wed, 27 Dec 2017 19:16:25 +0000 (11:16 -0800)]
Merge branch 'ks/branch-cleanup'

Code clean-up.

* ks/branch-cleanup:
  builtin/branch: strip refs/heads/ using skip_prefix
  branch: update warning message shown when copying a misnamed branch
  branch: group related arguments of create_branch()
  branch: improve documentation and naming of create_branch() parameters

3 years agoMerge branch 'rs/strbuf-read-once-reset-length'
Junio C Hamano [Wed, 27 Dec 2017 19:16:24 +0000 (11:16 -0800)]
Merge branch 'rs/strbuf-read-once-reset-length'

Leakfix.

* rs/strbuf-read-once-reset-length:
  strbuf: release memory on read error in strbuf_read_once()

3 years agoMerge branch 'rs/fmt-merge-msg-string-leak-fix'
Junio C Hamano [Wed, 27 Dec 2017 19:16:23 +0000 (11:16 -0800)]
Merge branch 'rs/fmt-merge-msg-string-leak-fix'

Leakfix.

* rs/fmt-merge-msg-string-leak-fix:
  fmt-merge-msg: avoid leaking strbuf in shortlog()

3 years agoMerge branch 'rs/am-builtin-leakfix'
Junio C Hamano [Wed, 27 Dec 2017 19:16:22 +0000 (11:16 -0800)]
Merge branch 'rs/am-builtin-leakfix'

Leakfix.

* rs/am-builtin-leakfix:
  am: release strbuf after use in split_mail_mbox()

3 years agoMerge branch 'es/worktree-checkout-hook'
Junio C Hamano [Wed, 27 Dec 2017 19:16:21 +0000 (11:16 -0800)]
Merge branch 'es/worktree-checkout-hook'

"git worktree add" learned to run the post-checkout hook, just like
"git checkout" does, after the initial checkout.

* es/worktree-checkout-hook:
  worktree: invoke post-checkout hook (unless --no-checkout)

3 years agoMerge branch 'lb/rebase-i-short-command-names'
Junio C Hamano [Wed, 27 Dec 2017 19:16:21 +0000 (11:16 -0800)]
Merge branch 'lb/rebase-i-short-command-names'

With a configuration variable rebase.abbreviateCommands set,
"git rebase -i" produces the todo list with a single-letter
command names.

* lb/rebase-i-short-command-names:
  sequencer.c: drop 'const' from function return type
  t3404: add test case for abbreviated commands
  rebase -i: learn to abbreviate command names
  rebase -i -x: add exec commands via the rebase--helper
  rebase -i: update functions to use a flags parameter
  rebase -i: replace reference to sha1 with oid
  rebase -i: refactor transform_todo_ids
  rebase -i: set commit to null in exec commands
  Documentation: use preferred name for the 'todo list' script
  Documentation: move rebase.* configs to new file

3 years agoMerge branch 'tb/check-crlf-for-safe-crlf'
Junio C Hamano [Wed, 27 Dec 2017 19:16:21 +0000 (11:16 -0800)]
Merge branch 'tb/check-crlf-for-safe-crlf'

The "safe crlf" check incorrectly triggered for contents that does
not use CRLF as line endings, which has been corrected.

* tb/check-crlf-for-safe-crlf:
  t0027: Adapt the new MIX tests to Windows
  convert: tighten the safe autocrlf handling

3 years agoMerge branch 'jh/object-filtering'
Junio C Hamano [Wed, 27 Dec 2017 19:16:20 +0000 (11:16 -0800)]
Merge branch 'jh/object-filtering'

In preparation for implementing narrow/partial clone, the object
walking machinery has been taught a way to tell it to "filter" some
objects from enumeration.

* jh/object-filtering:
  rev-list: support --no-filter argument
  list-objects-filter-options: support --no-filter
  list-objects-filter-options: fix 'keword' typo in comment
  pack-objects: add list-objects filtering
  rev-list: add list-objects filtering support
  list-objects: filter objects in traverse_commit_list
  oidset: add iterator methods to oidset
  oidmap: add oidmap iterator methods
  dir: allow exclusions from blob in addition to file

3 years agosequencer.c: drop 'const' from function return type
Junio C Hamano [Wed, 27 Dec 2017 19:12:45 +0000 (11:12 -0800)]
sequencer.c: drop 'const' from function return type

With -Werror=ignored-qualifiers, a function that claims to return
"const char" gets this error:

    CC sequencer.o
sequencer.c:798:19: error: type qualifiers ignored on function return
type [-Werror=ignored-qualifiers]
 static const char command_to_char(const enum todo_command command)
                   ^

Reported-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostrbuf: fix urlencode format string on signed char
Julien Dusser [Fri, 22 Dec 2017 17:24:37 +0000 (18:24 +0100)]
strbuf: fix urlencode format string on signed char

Git credential fails with special char in password with

    remote: Invalid username or password.
    fatal: Authentication failed for

    File ~/.git-credential contains badly urlencoded characters
    %ffffffXX%ffffffYY instead of %XX%YY.

Add a cast to an unsigned char to fix urlencode use of %02x on a
char.

Signed-off-by: Julien Dusser <julien.dusser@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosend-pack: use internal argv_array of struct child_process
René Scharfe [Fri, 22 Dec 2017 08:14:10 +0000 (09:14 +0100)]
send-pack: use internal argv_array of struct child_process

Avoid a magic number of NULL placeholder values and a magic index by
constructing the command line for pack-objects using the embedded
argv_array of the child_process.  The resulting code is shorter and
easier to extend.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agohttp: use internal argv_array of struct child_process
René Scharfe [Fri, 22 Dec 2017 11:56:59 +0000 (12:56 +0100)]
http: use internal argv_array of struct child_process

Avoid a strangely magic array size (it's slightly too big) and explicit
index numbers by building the command line for index-pack using the
embedded argv_array of the child_process.  Add the flag -o and its
argument with argv_array_pushl() to make it obvious that they belong
together.  The resulting code is shorter and easier to extend.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-p4: update multiple shelved change lists
Luke Diamand [Thu, 21 Dec 2017 11:06:14 +0000 (11:06 +0000)]
git-p4: update multiple shelved change lists

--update-shelve can now be specified multiple times on the
command-line, to update multiple shelved changelists in a single
submit.

This then means that a git patch series can be mirrored to a
sequence of shelved changelists, and (relatively easily) kept in
sync as changes are made in git.

Note that Perforce does not really support overlapping shelved
changelists where one change touches the files modified by
another. Trying to do this will result in merge conflicts.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocheck-non-portable-shell.pl: `wc -l` may have leading WS
Torsten Bögershausen [Thu, 21 Dec 2017 21:26:46 +0000 (22:26 +0100)]
check-non-portable-shell.pl: `wc -l` may have leading WS

Test scripts count number of lines in an output and check it againt
its expectation.  fb3340a6 ("test-lib: introduce test_line_count to
measure files", 2010-10-31) introduced a helper to show a failure in
such a test in a more readable way than comparing `wc -l` output with
a number.

Besides, on some platforms, "$(wc -l <file)" is padded with leading
whitespace on the left, so

test "$(wc -l <file)" = 4

would not work (most notably on macosX); the users of test_line_count
helper would not suffer from such a portability glitch.

Add a check in check-non-portable-shell.pl to find '"' between
`wc -l` and '=' and hint the user about test_line_count().

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoconfig.txt: document behavior of backslashes in subsections
Dave Borowitz [Thu, 21 Dec 2017 13:10:42 +0000 (08:10 -0500)]
config.txt: document behavior of backslashes in subsections

Unrecognized escape sequences are invalid in values:

  $ git config -f - --list <<EOF
  [foo]
    bar = "\t\\\y\"\u"
  EOF
  fatal: bad config line 2 in standard input

But in subsection names, the backslash is simply dropped if the
following character does not produce a recognized escape sequence:

  $ git config -f - --list <<EOF
  [foo "\t\\\y\"\u"]
    bar = baz
  EOF
  foo.t\y"u.bar=baz

Although it would be nice for subsection names and values to have
consistent behavior, changing the behavior for subsection names is a
nonstarter since it would cause existing, valid config files to
suddenly be interpreted differently.

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ew/empty-merge-with-dirty-index-maint' into ew/empty-merge-with-dirty...
Junio C Hamano [Fri, 22 Dec 2017 20:48:38 +0000 (12:48 -0800)]
Merge branch 'ew/empty-merge-with-dirty-index-maint' into ew/empty-merge-with-dirty-index

* ew/empty-merge-with-dirty-index-maint:
  merge-recursive: avoid incorporating uncommitted changes in a merge
  move index_has_changes() from builtin/am.c to merge.c for reuse
  t6044: recursive can silently incorporate dirty changes in a merge

3 years agomerge-recursive: avoid incorporating uncommitted changes in a merge
Elijah Newren [Thu, 21 Dec 2017 19:19:07 +0000 (11:19 -0800)]
merge-recursive: avoid incorporating uncommitted changes in a merge

builtin/merge.c contains this important requirement for merge strategies:
/*
 * At this point, we need a real merge.  No matter what strategy
 * we use, it would operate on the index, possibly affecting the
 * working tree, and when resolved cleanly, have the desired
 * tree in the index -- this means that the index must be in
 * sync with the head commit.  The strategies are responsible
 * to ensure this.
 */

merge-recursive does not do this check directly, instead it relies on
unpack_trees() to do it.  However, merge_trees() has a special check for
the merge branch exactly matching the merge base; when it detects that
situation, it returns early without calling unpack_trees(), because it
knows that the HEAD commit already has the correct result.  Unfortunately,
it didn't check that the index matched HEAD, so after it returned, the
outer logic ended up creating a merge commit that included something
other than HEAD.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomove index_has_changes() from builtin/am.c to merge.c for reuse
Elijah Newren [Thu, 21 Dec 2017 19:19:06 +0000 (11:19 -0800)]
move index_has_changes() from builtin/am.c to merge.c for reuse

index_has_changes() is a function we want to reuse outside of just am,
making it also available for merge-recursive and merge-ort.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6044: recursive can silently incorporate dirty changes in a merge
Elijah Newren [Thu, 21 Dec 2017 19:19:05 +0000 (11:19 -0800)]
t6044: recursive can silently incorporate dirty changes in a merge

The recursive merge strategy has some special handling when the tree for
the merge branch exactly matches the merge base, but that code path is
missing checks for the index having changes relative to HEAD.  Add a
testcase covering this scenario.

Reported-by: Andreas Krey <a.krey@gmx.de>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot/helper/test-lazy-name-hash: fix compilation
Stefan Beller [Mon, 18 Dec 2017 21:49:47 +0000 (13:49 -0800)]
t/helper/test-lazy-name-hash: fix compilation

I was compiling origin/master today with DEVELOPER compiler flags
and was greeted by:

t/helper/test-lazy-init-name-hash.c: In function ‘cmd_main’:
t/helper/test-lazy-init-name-hash.c:172:5: error: ‘nr_threads_used’ may be used uninitilized in this function [-Werror=maybe-uninitialized]
     printf("avg [size %8d] [single %f] %c [multi %f %d]\n",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         nr,
         ~~~
         (double)avg_single/1000000000,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         (avg_single < avg_multi ? '<' : '>'),
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         (double)avg_multi/1000000000,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         nr_threads_used);
         ~~~~~~~~~~~~~~~~
t/helper/test-lazy-init-name-hash.c:115:6: note: ‘nr_threads_used’ was declared here
  int nr_threads_used;
      ^~~~~~~~~~~~~~~

I do not see how we can arrive at that line without having `nr_threads_used`
initialized, as we'd have `count > 1`  (which asserts that we ran the
loop above at least once, such that it *should* be initialized).

Just clear the variable at the beginning of the function to squelch
the warning.

Signed-off-by: Stefan Beller <sbeller@google.com>
Acked-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5573, t7612: clean up after unexpected success of 'pull' and 'merge'
Junio C Hamano [Fri, 15 Dec 2017 19:42:36 +0000 (11:42 -0800)]
t5573, t7612: clean up after unexpected success of 'pull' and 'merge'

The previous steps added test_when_finished to tests that run 'git
pull' or 'git merge' with expectation of success, so that the test
after them can start from a known state even when their 'git pull'
invocation unexpectedly fails.  However, tests that run 'git pull'
or 'git merge' expecting it not to succeed forgot to protect later
tests the same way---if they unexpectedly succeed, the test after
them would start from an unexpected state.

Reset and checkout the initial commit after all these tests, whether
they expect their invocations to succeed or fail.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoRelNotes: the tenth batch
Junio C Hamano [Tue, 19 Dec 2017 19:34:35 +0000 (11:34 -0800)]
RelNotes: the tenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ls/editor-waiting-message'
Junio C Hamano [Tue, 19 Dec 2017 19:33:59 +0000 (11:33 -0800)]
Merge branch 'ls/editor-waiting-message'

Git shows a message to tell the user that it is waiting for the
user to finish editing when spawning an editor, in case the editor
opens to a hidden window or somewhere obscure and the user gets
lost.

* ls/editor-waiting-message:
  launch_editor(): indicate that Git waits for user input
  refactor "dumb" terminal determination

3 years agoMerge branch 'sg/setup-doc-update'
Junio C Hamano [Tue, 19 Dec 2017 19:33:58 +0000 (11:33 -0800)]
Merge branch 'sg/setup-doc-update'

Comment update.

* sg/setup-doc-update:
  setup.c: fix comment about order of .git directory discovery

3 years agoMerge branch 'ar/unconfuse-three-dots'
Junio C Hamano [Tue, 19 Dec 2017 19:33:58 +0000 (11:33 -0800)]
Merge branch 'ar/unconfuse-three-dots'

Ancient part of codebase still shows dots after an abbreviated
object name just to show that it is not a full object name, but
these ellipses are confusing to people who newly discovered Git
who are used to seeing abbreviated object names and find them
confusing with the range syntax.

* ar/unconfuse-three-dots:
  t2020: test variations that matter
  t4013: test new output from diff --abbrev --raw
  diff: diff_aligned_abbrev: remove ellipsis after abbreviated SHA-1 value
  t4013: prepare for upcoming "diff --raw --abbrev" output format change
  checkout: describe_detached_head: remove ellipsis after committish
  print_sha1_ellipsis: introduce helper
  Documentation: user-manual: limit usage of ellipsis
  Documentation: revisions: fix typo: "three dot" ---> "three-dot" (in line with "two-dot").