]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
5 years agoremote.c: make singular free_ref() public
Jeff King [Sat, 13 Apr 2019 05:54:31 +0000 (01:54 -0400)] 
remote.c: make singular free_ref() public

We provide a free_refs() function to free a list, but there's no easy
way for a caller to free a single ref. Let's make our singular
free_ref() function public. Since its name is so similar to the
list-freeing free_refs(), and because both of those functions have the
same signature, it might be easy to accidentally use the wrong one.
Let's call the singular version the more verbose "free_one_ref()" to
distinguish it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agofetch: use free_refs()
Jeff King [Sat, 13 Apr 2019 05:54:09 +0000 (01:54 -0400)] 
fetch: use free_refs()

There's no need for us to write this loop manually when a helper
function can already do it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agopkt-line: prepare buffer before handling ERR packets
Jeff King [Sat, 13 Apr 2019 05:54:02 +0000 (01:54 -0400)] 
pkt-line: prepare buffer before handling ERR packets

Since 2d103c31c2 (pack-protocol.txt: accept error packets in any
context, 2018-12-29), the pktline code will detect an ERR packet and die
automatically, saving the caller from dealing with it. But we do so too
early in the function, before we have terminated the buffer with a NUL.

As a result, passing the ERR message to die() may result in us printing
random cruft from a previous packet. This doesn't trigger memory tools
like ASan because we reuse the same buffer over and over (so the
contents are valid and initialized; they're just stale).

We can see demonstrate this by tightening the regex we use to match the
error message in t5516; without this patch, git-fetch will accidentally
print the capabilities from the (much longer) initial packet we
received.

By moving the ERR code later in the function we get a few other
benefits, too:

  - we'll now chomp any newline sent by the other side (which is what we
    want, since die() will add its own newline)

  - we'll now mention the ERR packet with GIT_TRACE_PACKET

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoupload-pack: send ERR packet for non-tip objects
Jeff King [Sat, 13 Apr 2019 05:53:34 +0000 (01:53 -0400)] 
upload-pack: send ERR packet for non-tip objects

Commit bdb31eada7 (upload-pack: report "not our ref" to client,
2017-02-23) catches the case where a client asks for an object we don't
have, and issues a message that the client can show to the user (in
addition to dying and writing to stderr).

There's a similar case (with the same message) when the client asks for
an object which we _do_ have, but which isn't a ref tip (or isn't
reachable, when uploadpack.allowReachableSHA1InWant is true). Let's give
that one the same treatment, for the same reason (namely that it's more
informative to the client than just hanging up, since they won't see our
stderr over some protocols).

There are two tests here. We cover it most directly in t5530 by invoking
upload-pack, which matches the existing "not our ref" test.

But a more end-to-end check is that "git fetch" actually shows the
message to the client. We're already checking in t5516 that this case
fails, so we can just check stderr there, too. Note that even after we
started ignoring SIGPIPE in 8bf4becf0c, this could in theory still be
racy as described in that commit (because we die() on write failures
before pumping the connection for any ERR packets).

In practice this should be OK for this case. The server will not
actually check reachability until it has received our whole group of
"want" lines. And since we have no objects in the repository, we won't
send any "have" lines, meaning we're always waiting to read the server
response.

Note also that this case cannot happen in the v2 protocol, since it
allows any available object to be requested. However, we don't have to
take any steps to protect against the upcoming GIT_TEST_PROTOCOL_VERSION
in our tests:

  - the tests in t5516 would already need to be skipped under v2, and
    that is covered by ab0c5f5096 (tests: always test fetch of
    unreachable with v0, 2019-02-25)

  - the tests in t5530 invoke upload-pack directly, which will continue
    to default to v0. Eventually we may have a test setting which uses
    v2 even for bare upload-pack calls, but we can't override it here
    until we know what the setting looks like.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot5530: check protocol response for "not our ref"
Jeff King [Sat, 13 Apr 2019 05:53:09 +0000 (01:53 -0400)] 
t5530: check protocol response for "not our ref"

Back in 9f9aa76130 (upload-pack: Improve error message when bad ref
requested, 2010-07-31), we added a test to make sure that we die with a
sensible message when the client asks for an object we don't have.

Much later, in bdb31eada7 (upload-pack: report "not our ref" to client,
2017-02-23), we started reporting that information via an "ERR" line in
the protocol. Let's check that part, as well.

While we're touching this test, let's drop the "-q" on the grep calls.
Our usual test style just relies on --verbose to control output.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot5516: drop ok=sigpipe from unreachable-want tests
Jeff King [Sat, 13 Apr 2019 05:52:18 +0000 (01:52 -0400)] 
t5516: drop ok=sigpipe from unreachable-want tests

We annotated our test_must_fail calls in 8bf4becf0c (add "ok=sigpipe" to
test_must_fail and use it to fix flaky tests, 2015-11-27) because the
abrupt hangup of the server meant that we'd sometimes fail on read() and
sometimes get SIGPIPE on write().

But since 143588949c (fetch: ignore SIGPIPE during network operation,
2019-03-03), we make sure that we end up with a real die(), and our
tests no longer need to work around the race.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoThe fourth batch
Junio C Hamano [Tue, 9 Apr 2019 17:19:09 +0000 (02:19 +0900)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'jt/submodule-fetch-errmsg'
Junio C Hamano [Tue, 9 Apr 2019 17:14:26 +0000 (02:14 +0900)] 
Merge branch 'jt/submodule-fetch-errmsg'

Error message update.

* jt/submodule-fetch-errmsg:
  submodule: explain first attempt failure clearly

5 years agoMerge branch 'jk/sha1dc'
Junio C Hamano [Tue, 9 Apr 2019 17:14:26 +0000 (02:14 +0900)] 
Merge branch 'jk/sha1dc'

Build update for SHA-1 with collision detection.

* jk/sha1dc:
  Makefile: fix unaligned loads in sha1dc with UBSan

5 years agoMerge branch 'jk/promote-ggg'
Junio C Hamano [Tue, 9 Apr 2019 17:14:25 +0000 (02:14 +0900)] 
Merge branch 'jk/promote-ggg'

Suggest GitGitGadget instead of submitGit as a way to submit
patches based on GitHub PR to us.

* jk/promote-ggg:
  point pull requesters to GitGitGadget

5 years agoMerge branch 'ar/t4150-remove-cruft'
Junio C Hamano [Tue, 9 Apr 2019 17:14:25 +0000 (02:14 +0900)] 
Merge branch 'ar/t4150-remove-cruft'

Test cleanup.

* ar/t4150-remove-cruft:
  t4150: remove unused variable

5 years agoMerge branch 'js/rebase-deprecate-preserve-merges'
Junio C Hamano [Tue, 9 Apr 2019 17:14:24 +0000 (02:14 +0900)] 
Merge branch 'js/rebase-deprecate-preserve-merges'

"git rebase --rebase-merges" replaces its old "--preserve-merges"
option; the latter is now marked as deprecated.

* js/rebase-deprecate-preserve-merges:
  rebase: deprecate --preserve-merges

5 years agoMerge branch 'ms/worktree-add-atomic-mkdir'
Junio C Hamano [Tue, 9 Apr 2019 17:14:24 +0000 (02:14 +0900)] 
Merge branch 'ms/worktree-add-atomic-mkdir'

"git worktree add" used to do a "find an available name with stat
and then mkdir", which is race-prone.  This has been fixed by using
mkdir and reacting to EEXIST in a loop.

* ms/worktree-add-atomic-mkdir:
  worktree: fix worktree add race

5 years agoMerge branch 'jk/line-log-with-patch'
Junio C Hamano [Tue, 9 Apr 2019 17:14:23 +0000 (02:14 +0900)] 
Merge branch 'jk/line-log-with-patch'

"git log -L<from>,<to>:<path>" with "-s" did not suppress the patch
output as it should.  This has been corrected.

* jk/line-log-with-patch:
  line-log: detect unsupported formats
  line-log: suppress diff output with "-s"

5 years agoMerge branch 'ra/t3600-test-path-funcs'
Junio C Hamano [Tue, 9 Apr 2019 17:14:23 +0000 (02:14 +0900)] 
Merge branch 'ra/t3600-test-path-funcs'

A GSoC micro.

* ra/t3600-test-path-funcs:
  t3600: use helpers to replace test -d/f/e/s <path>
  t3600: modernize style
  test functions: add function `test_file_not_empty`

5 years agoMerge branch 'nd/rewritten-ref-is-per-worktree'
Junio C Hamano [Tue, 9 Apr 2019 17:14:23 +0000 (02:14 +0900)] 
Merge branch 'nd/rewritten-ref-is-per-worktree'

"git rebase" uses the refs/rewritten/ hierarchy to store its
intermediate states, which inherently makes the hierarchy per
worktree, but it didn't quite work well.

* nd/rewritten-ref-is-per-worktree:
  Make sure refs/rewritten/ is per-worktree
  files-backend.c: reduce duplication in add_per_worktree_entries_to_dir()
  files-backend.c: factor out per-worktree code in loose_fill_ref_dir()

5 years agoMerge branch 'jh/resize-convert-scratch-buffer'
Junio C Hamano [Tue, 9 Apr 2019 17:14:22 +0000 (02:14 +0900)] 
Merge branch 'jh/resize-convert-scratch-buffer'

When the "clean" filter can reduce the size of a huge file in the
working tree down to a small "token" (a la Git LFS), there is no
point in allocating a huge scratch area upfront, but the buffer is
sized based on the original file size.  The convert mechanism now
allocates very minimum and reallocates as it receives the output
from the clean filter process.

* jh/resize-convert-scratch-buffer:
  convert: avoid malloc of original file size

5 years agoMerge branch 'dl/ignore-docs'
Junio C Hamano [Tue, 9 Apr 2019 17:14:22 +0000 (02:14 +0900)] 
Merge branch 'dl/ignore-docs'

Doc update.

* dl/ignore-docs:
  docs: move core.excludesFile from git-add to gitignore
  git-clean.txt: clarify ignore pattern files

5 years agoMerge branch 'ja/dir-rename-doc-markup-fix'
Junio C Hamano [Tue, 9 Apr 2019 17:14:21 +0000 (02:14 +0900)] 
Merge branch 'ja/dir-rename-doc-markup-fix'

Doc update.

* ja/dir-rename-doc-markup-fix:
  Doc: fix misleading asciidoc formating

5 years agoMerge branch 'dl/reset-doc-no-wrt-abbrev'
Junio C Hamano [Tue, 9 Apr 2019 17:14:20 +0000 (02:14 +0900)] 
Merge branch 'dl/reset-doc-no-wrt-abbrev'

Doc update.

* dl/reset-doc-no-wrt-abbrev:
  git-reset.txt: clarify documentation

5 years agoThe third batch
Junio C Hamano [Wed, 20 Mar 2019 06:19:48 +0000 (15:19 +0900)] 
The third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'br/commit-tree-parseopt'
Junio C Hamano [Wed, 20 Mar 2019 06:16:08 +0000 (15:16 +0900)] 
Merge branch 'br/commit-tree-parseopt'

The command line parser of "git commit-tree" has been rewritten to
use the parse-options API.

* br/commit-tree-parseopt:
  commit-tree: utilize parse-options api

5 years agoMerge branch 'jk/config-type-color-ends-with-lf'
Junio C Hamano [Wed, 20 Mar 2019 06:16:07 +0000 (15:16 +0900)] 
Merge branch 'jk/config-type-color-ends-with-lf'

"git config --type=color ..." is meant to replace "git config --get-color"
but there is a slight difference that wasn't documented, which is
now fixed.

* jk/config-type-color-ends-with-lf:
  config: document --type=color output is a complete line

5 years agoMerge branch 'ma/clear-repository-format'
Junio C Hamano [Wed, 20 Mar 2019 06:16:07 +0000 (15:16 +0900)] 
Merge branch 'ma/clear-repository-format'

The setup code has been cleaned up to avoid leaks around the
repository_format structure.

* ma/clear-repository-format:
  setup: fix memory leaks with `struct repository_format`
  setup: free old value before setting `work_tree`

5 years agoMerge branch 'jk/virtual-objects-do-exist'
Junio C Hamano [Wed, 20 Mar 2019 06:16:07 +0000 (15:16 +0900)] 
Merge branch 'jk/virtual-objects-do-exist'

A recent update broke "is this object available to us?" check for
well-known objects like an empty tree (which should yield "yes",
even when there is no on-disk object for an empty tree), which has
been corrected.

* jk/virtual-objects-do-exist:
  rev-list: allow cached objects in existence check

5 years agoMerge branch 'jk/no-sigpipe-during-network-transport'
Junio C Hamano [Wed, 20 Mar 2019 06:16:06 +0000 (15:16 +0900)] 
Merge branch 'jk/no-sigpipe-during-network-transport'

On platforms where "git fetch" is killed with SIGPIPE (e.g. OSX),
the upload-pack that runs on the other end that hangs up after
detecting an error could cause "git fetch" to die with a signal,
which led to a flakey test.  "git fetch" now ignores SIGPIPE during
the network portion of its operation (this is not a problem as we
check the return status from our write(2)s).

* jk/no-sigpipe-during-network-transport:
  fetch: ignore SIGPIPE during network operation
  fetch: avoid calling write_or_die()

5 years agoMerge branch 'jk/fsck-doc'
Junio C Hamano [Wed, 20 Mar 2019 06:16:05 +0000 (15:16 +0900)] 
Merge branch 'jk/fsck-doc'

"git fsck --connectivity-only" omits computation necessary to sift
the objects that are not reachable from any of the refs into
unreachable and dangling.  This is now enabled when dangling
objects are requested (which is done by default, but can be
overridden with the "--no-dangling" option).

* jk/fsck-doc:
  fsck: always compute USED flags for unreachable objects
  doc/fsck: clarify --connectivity-only behavior

5 years agoMerge branch 'js/stress-test-ui-tweak'
Junio C Hamano [Wed, 20 Mar 2019 06:16:05 +0000 (15:16 +0900)] 
Merge branch 'js/stress-test-ui-tweak'

Dev support.

* js/stress-test-ui-tweak:
  tests: introduce --stress-jobs=<N>
  tests: let --stress-limit=<N> imply --stress

5 years agoMerge branch 'js/rebase-orig-head-fix'
Junio C Hamano [Wed, 20 Mar 2019 06:16:05 +0000 (15:16 +0900)] 
Merge branch 'js/rebase-orig-head-fix'

"git rebase" that was reimplemented in C did not set ORIG_HEAD
correctly, which has been corrected.

* js/rebase-orig-head-fix:
  built-in rebase: set ORIG_HEAD just once, before the rebase
  built-in rebase: demonstrate that ORIG_HEAD is not set correctly
  built-in rebase: use the correct reflog when switching branches
  built-in rebase: no need to check out `onto` twice

5 years agoMerge branch 'jk/bisect-final-output'
Junio C Hamano [Wed, 20 Mar 2019 06:16:04 +0000 (15:16 +0900)] 
Merge branch 'jk/bisect-final-output'

The final report from "git bisect" used to show the suspected
culprit using a raw "diff-tree", with which there is no output for
a merge commit.  This has been updated to use a more modern and
human readable output that still is concise enough.

* jk/bisect-final-output:
  bisect: make diff-tree output prettier
  bisect: fix internal diff-tree config loading
  bisect: use string arguments to feed internal diff-tree

5 years agoMerge branch 'ab/makefile-help-devs-more'
Junio C Hamano [Wed, 20 Mar 2019 06:16:04 +0000 (15:16 +0900)] 
Merge branch 'ab/makefile-help-devs-more'

CFLAGS now can be tweaked when invoking Make while using
DEVELOPER=YesPlease; this did not work well before.

* ab/makefile-help-devs-more:
  Makefile: allow for combining DEVELOPER=1 and CFLAGS="..."
  Makefile: move the setting of *FLAGS closer to "include"
  Makefile: Move *_LIBS assignment into its own section
  Makefile: add/remove comments at top and tweak whitespace
  Makefile: move "strip" assignment down from flags
  Makefile: remove an out-of-date comment

5 years agoMerge git://ozlabs.org/~paulus/gitk
Junio C Hamano [Mon, 18 Mar 2019 02:18:49 +0000 (11:18 +0900)] 
Merge git://ozlabs.org/~paulus/gitk

* git://ozlabs.org/~paulus/gitk:
  gitk: Update Bulgarian translation (317t)

5 years agogitk: Update Bulgarian translation (317t)
Alexander Shopov [Wed, 13 Mar 2019 12:06:33 +0000 (13:06 +0100)] 
gitk: Update Bulgarian translation (317t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agosubmodule: explain first attempt failure clearly
Jonathan Tan [Wed, 13 Mar 2019 17:57:38 +0000 (10:57 -0700)] 
submodule: explain first attempt failure clearly

When cloning with --recurse-submodules a superproject with at least one
submodule with HEAD pointing to an unborn branch, the clone goes
something like this:

Cloning into 'test'...
<messages about cloning of superproject>
Submodule '<name>' (<uri>) registered for path '<submodule path>'
Cloning into '<submodule path>'...
fatal: Couldn't find remote ref HEAD
Unable to fetch in submodule path '<submodule path>'
<messages about fetching with SHA-1>
From <uri>
 * branch            <hash> -> FETCH_HEAD
Submodule path '<submodule path>': checked out '<hash>'

In other words, first, a fetch is done with no hash arguments (that is,
a fetch of HEAD) resulting in a "Couldn't find remote ref HEAD" error;
then, a fetch is done given a hash, which succeeds.

The fetch given a hash was added in fb43e31f2b ("submodule: try harder
to fetch needed sha1 by direct fetching sha1", 2016-02-24), and the
"Unable to fetch..." message was downgraded from a fatal error to a
notice in e30d833671 ("git-submodule.sh: try harder to fetch a
submodule", 2018-05-16).

This commit improves the notice to be clearer that we are retrying the
fetch, and that the previous messages (in particular, the fatal errors
from fetch) do not necessarily indicate that the whole command fails. In
other words:

 - If the HEAD-fetch succeeds and we then have the commit we want,
   git-submodule prints no explanation.
 - If the HEAD-fetch succeeds and we do not have the commit we want, but
   the hash-fetch succeeds, git-submodule prints no explanation.
 - If the HEAD-fetch succeeds and we do not have the commit we want, but
   the hash-fetch fails, git-submodule prints a fatal error.
 - If the HEAD-fetch fails, fetch prints a fatal error, and
   git-submodule informs the user that it will retry by fetching
   specific commits by hash.
   - If the hash-fetch then succeeds, git-submodule prints no
     explanation (besides the ones already printed).
   - If the HEAD-fetch then fails, git-submodule prints a fatal error.

It could be said that we should just eliminate the HEAD-fetch
altogether, but that changes some behavior (in particular, some refs
that were opportunistically updated would no longer be), so I have left
that alone for now.

There is an analogous situation with the fetching code in fetch_finish()
and surrounding functions. For now, I have added a NEEDSWORK.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMakefile: fix unaligned loads in sha1dc with UBSan
Jeff King [Tue, 12 Mar 2019 21:06:26 +0000 (17:06 -0400)] 
Makefile: fix unaligned loads in sha1dc with UBSan

The sha1dc library uses unaligned loads on platforms that support them.
This is normally what you'd want for performance, but it does cause
UBSan to complain when we compile with SANITIZE=undefined. Just like we
set -DNO_UNALIGNED_LOADS for our own code in that case, we should set
-DSHA1DC_FORCE_ALIGNED_ACCESS.

Of course that does nothing without pulling in the patches from sha1dc
to respect that define. So let's do that, too, updating both the
submodule link and our in-tree copy (from the same commit).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot4150: remove unused variable
Andrei Rybak [Tue, 12 Mar 2019 14:38:04 +0000 (15:38 +0100)] 
t4150: remove unused variable

In commit 735285b403 ("am: fix signoff when other trailers are present",
2017-08-08) tests using variable $signoff were rewritten and it is no
longer used, so just remove it from the test setup.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agopoint pull requesters to GitGitGadget
Jeff King [Tue, 12 Mar 2019 21:32:46 +0000 (17:32 -0400)] 
point pull requesters to GitGitGadget

In the contributing guide and PR template seen by people who open pull
requests on GitHub, we mention the submitGit tool, which gives an
alternative to figuring out the mailing list. These days we also have
the similar GitGitGadget tool, and we should make it clear that this
is also an option.

We could continue to mention _both_ tools, but it's probably better to
pick one in order to avoid overwhelming the user with choice. After all,
one of the purposes here is to reduce friction for first-time or
infrequent contributors. And there are a few reasons to prefer GGG:

  1. submitGit seems to still have a few rough edges. E.g., it doesn't
     munge timestamps to help threaded mail readers handled out-of-order
     delivery.

  2. Subjectively, GGG seems to be more commonly used on the list these
     days, especially by list regulars.

  3. GGG seems to be under more active development (likely related to
     point 2).

So let's actually swap out submitGit for GGG. While we're there, let's
put another link to the GGG page in the PR template, because that's
where users who are learning about it for the first time will want to go
to read more.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase: deprecate --preserve-merges
Johannes Schindelin [Mon, 11 Mar 2019 19:57:35 +0000 (12:57 -0700)] 
rebase: deprecate --preserve-merges

We have something much better now: --rebase-merges (which is a
complete re-design --preserve-merges, with a lot of issues fixed such as
the inability to reorder commits with --preserve-merges).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoworktree: fix worktree add race
Michal Suchanek [Wed, 20 Feb 2019 16:16:48 +0000 (17:16 +0100)] 
worktree: fix worktree add race

Git runs a stat loop to find a worktree name that's available and
then does mkdir on the found name. Turn it to mkdir loop to avoid
another invocation of worktree add finding the same free name and
creating the directory first.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Acked-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoline-log: detect unsupported formats
Jeff King [Mon, 11 Mar 2019 03:54:33 +0000 (23:54 -0400)] 
line-log: detect unsupported formats

If you use "log -L" with an output format like "--raw" or "--stat",
we'll silently ignore the format and just output the normal patch.
Let's detect and complain about this, which at least tells the user
what's going on.

The tests here aren't exhaustive over the set of all formats, but it
should at least let us know if somebody breaks the format-checking.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoThe second batch
Junio C Hamano [Mon, 11 Mar 2019 07:18:22 +0000 (16:18 +0900)] 
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoSync with maint
Junio C Hamano [Mon, 11 Mar 2019 07:16:34 +0000 (16:16 +0900)] 
Sync with maint

* maint:
  mingw: allow building with an MSYS2 runtime v3.x

5 years agoMerge branch 'js/rebase-recreate-merge'
Junio C Hamano [Mon, 11 Mar 2019 07:16:26 +0000 (16:16 +0900)] 
Merge branch 'js/rebase-recreate-merge'

Docfix.

* js/rebase-recreate-merge:
  rebase docs: fix "gitlink" typo

5 years agoMerge branch 'js/untravis-windows'
Junio C Hamano [Mon, 11 Mar 2019 07:16:26 +0000 (16:16 +0900)] 
Merge branch 'js/untravis-windows'

Dev support.

* js/untravis-windows:
  travis: remove the hack to build the Windows job on Azure Pipelines

5 years agoMerge branch 'rd/gc-prune-doc-fix'
Junio C Hamano [Mon, 11 Mar 2019 07:16:26 +0000 (16:16 +0900)] 
Merge branch 'rd/gc-prune-doc-fix'

Doxfix.

* rd/gc-prune-doc-fix:
  docs/git-gc: fix typo "--prune=all" to "--prune=now"

5 years agoMerge branch 'js/find-lib-h-with-ls-files-when-possible'
Junio C Hamano [Mon, 11 Mar 2019 07:16:25 +0000 (16:16 +0900)] 
Merge branch 'js/find-lib-h-with-ls-files-when-possible'

The Makefile uses 'find' utility to enumerate all the *.h header
files, which is expensive on platforms with slow filesystems; it
now optionally uses "ls-files" if working within a repository,
which is a trick similar to how all sources are enumerated to run
ETAGS on.

* js/find-lib-h-with-ls-files-when-possible:
  Makefile: use `git ls-files` to list header files, if possible

5 years agoMerge branch 'rj/hdr-check-gcrypt-fix'
Junio C Hamano [Mon, 11 Mar 2019 07:16:25 +0000 (16:16 +0900)] 
Merge branch 'rj/hdr-check-gcrypt-fix'

The set of header files used by "make hdr-check" unconditionally
included sha256/gcrypt.h, even when it is not used, causing the
make target to fail.  We now skip it when GCRYPT_SHA256 is not in
use.

* rj/hdr-check-gcrypt-fix:
  Makefile: fix 'hdr-check' when GCRYPT not installed

5 years agoMerge branch 'jk/guard-bswap-header'
Junio C Hamano [Mon, 11 Mar 2019 07:16:25 +0000 (16:16 +0900)] 
Merge branch 'jk/guard-bswap-header'

The include file compat/bswap.h has been updated so that it is safe
to (accidentally) include it more than once.

* jk/guard-bswap-header:
  compat/bswap: add include header guards

5 years agoMerge branch 'rd/attr.c-comment-typofix'
Junio C Hamano [Mon, 11 Mar 2019 07:16:24 +0000 (16:16 +0900)] 
Merge branch 'rd/attr.c-comment-typofix'

In-code comment typofix.

* rd/attr.c-comment-typofix:
  attr.c: ".gitattribute" -> ".gitattributes" (comments)

5 years agoMerge branch 'yb/utf-16le-bom-spellfix'
Junio C Hamano [Mon, 11 Mar 2019 07:16:24 +0000 (16:16 +0900)] 
Merge branch 'yb/utf-16le-bom-spellfix'

Doc update.

* yb/utf-16le-bom-spellfix:
  gitattributes.txt: fix typo

5 years agomingw: allow building with an MSYS2 runtime v3.x
Johannes Schindelin [Fri, 8 Mar 2019 15:51:19 +0000 (07:51 -0800)] 
mingw: allow building with an MSYS2 runtime v3.x

Recently the Git for Windows project started the upgrade process to
a MSYS2 runtime version based on Cygwin v3.x.

This has the very notable consequence that `$(uname -r)` no longer
reports a version starting with "2", but a version with "3".

That breaks our build, as df5218b4c30b (config.mak.uname: support MSys2,
2016-01-13) simply did not expect the version reported by `uname -r` to
depend on the underlying Cygwin version: it expected the reported
version to match the "2" in "MSYS2".

So let's invert that test case to test for *anything else* than a
version starting with "1" (for MSys). That should safeguard us for the
future, even if Cygwin ends up releasing versionsl like 314.272.65536.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot3600: use helpers to replace test -d/f/e/s <path>
Rohit Ashiwal [Mon, 4 Mar 2019 12:08:01 +0000 (17:38 +0530)] 
t3600: use helpers to replace test -d/f/e/s <path>

Take advantage of helper functions test_path_is_dir(),
test_path_is_missing(), etc. to replace `test -d|f|e|s` since the
functions make the code more readable and have better error
messages.

Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot3600: modernize style
Rohit Ashiwal [Mon, 4 Mar 2019 12:08:00 +0000 (17:38 +0530)] 
t3600: modernize style

The tests in `t3600-rm.sh` were written long time ago, and has a lot
of style violations, including the mixed use of tabs and spaces, not
having the title and the opening quote of the body on the first line
of the tests, and other shell script style violations. Update it to
match the CodingGuidelines.

Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotest functions: add function `test_file_not_empty`
Rohit Ashiwal [Mon, 4 Mar 2019 12:07:59 +0000 (17:37 +0530)] 
test functions: add function `test_file_not_empty`

Add a helper function to ensure that a given path is a non-empty file,
and give an error message when it is not.

Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMake sure refs/rewritten/ is per-worktree
Nguyễn Thái Ngọc Duy [Thu, 7 Mar 2019 12:29:17 +0000 (19:29 +0700)] 
Make sure refs/rewritten/ is per-worktree

a9be29c981 (sequencer: make refs generated by the `label` command
worktree-local, 2018-04-25) adds refs/rewritten/ as per-worktree
reference space. Unfortunately (my bad) there are a couple places that
need update to make sure it's really per-worktree.

 - add_per_worktree_entries_to_dir() is updated to make sure ref listing
   look at per-worktree refs/rewritten/ instead of per-repo one [1]

 - common_list[] is updated so that git_path() returns the correct
   location. This includes "rev-parse --git-path".

This mess is created by me. I started trying to fix it with the
introduction of refs/worktree, where all refs will be per-worktree
without special treatments. Unfortunate refs/rewritten came before
refs/worktree so this is all we can do.

This also fixes logs/refs/worktree not being per-worktree.

[1] note that ref listing still works sometimes. For example, if you
    have .git/worktrees/foo/refs/rewritten/bar AND the directory
    .git/worktrees/refs/rewritten, refs/rewritten/bar will show up.
    add_per_worktree_entries_to_dir() is only needed when the directory
    .git/worktrees/refs/rewritten is missing.

Reported-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agofiles-backend.c: reduce duplication in add_per_worktree_entries_to_dir()
Nguyễn Thái Ngọc Duy [Thu, 7 Mar 2019 12:29:16 +0000 (19:29 +0700)] 
files-backend.c: reduce duplication in add_per_worktree_entries_to_dir()

This function is duplicated to handle refs/bisect/ and refs/worktree/
and a third prefix is coming. Time to clean up.

This also fixes incorrect "refs/worktrees/" length in this code. The
correct length is 14 not 11. The test in the next patch will also cover
this.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agofiles-backend.c: factor out per-worktree code in loose_fill_ref_dir()
Nguyễn Thái Ngọc Duy [Thu, 7 Mar 2019 12:29:15 +0000 (19:29 +0700)] 
files-backend.c: factor out per-worktree code in loose_fill_ref_dir()

This is the first step for further cleaning up and extending this
function.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agomingw: drop MakeMaker reference
Johannes Schindelin [Mon, 25 Feb 2019 19:27:11 +0000 (11:27 -0800)] 
mingw: drop MakeMaker reference

In 20d2a30f8ffe (Makefile: replace perl/Makefile.PL with simple make
rules, 2017-12-10), Git stopped using MakeMaker. Therefore, that
definition in the MINGW-specific section became useless.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agocommit-tree: utilize parse-options api
Brandon Richardson [Thu, 7 Mar 2019 15:44:09 +0000 (11:44 -0400)] 
commit-tree: utilize parse-options api

Rather than parse options manually, which is both difficult to
read and error prone, parse options supplied to commit-tree
using the parse-options api.

It was discovered that the --no-gpg-sign option was documented
but not implemented in commit 70ddbd7767 (commit-tree: add missing
--gpg-sign flag, 2019-01-19), and the existing implementation
would attempt to translate the option as a tree oid. It was also
suggested earlier in commit 55ca3f99ae (commit-tree: add and document
--no-gpg-sign, 2013-12-13) that commit-tree should be migrated to
utilize the parse-options api, which could help prevent mistakes
like this in the future. Hence this change.

Also update the documentation to better describe that mixing
`-m` and `-F` options will correctly compose commit log messages in the
order in which the options are given.

In the process, mark various strings for translation.

Signed-off-by: Brandon Richardson <brandon1024.br@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoline-log: suppress diff output with "-s"
Jeff King [Thu, 7 Mar 2019 19:45:15 +0000 (14:45 -0500)] 
line-log: suppress diff output with "-s"

When "-L" is in use, we ignore any diff output format that the user
provides to us, and just always print a patch (with extra context lines
covering the whole area of interest). It's not entirely clear what we
should do with all formats (e.g., should "--stat" show just the diffstat
of the touched lines, or the stat for the whole file?).

But "-s" is pretty clear: the user probably wants to see just the
commits that touched those lines, without any diff at all. Let's at
least make that work.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoconvert: avoid malloc of original file size
Joey Hess [Thu, 7 Mar 2019 19:56:57 +0000 (14:56 -0500)] 
convert: avoid malloc of original file size

We write the output of a "clean" filter into a strbuf. Rather than
growing the strbuf dynamically as we read its output, we make the
initial allocation as large as the original input file. This is a good
guess when the filter is just tweaking a few bytes, but it's disastrous
when the point of the filter is to condense a very large file into a
short identifier (e.g., the way git-lfs and git-annex do). We may ask to
allocate many gigabytes, causing the allocation to fail and Git to
die().

Instead, let's just let strbuf do its usual growth.

When the clean filter does output something around the same size as the
worktree file, the buffer will need to be reallocated until it fits,
starting at 8192 and doubling in size. Benchmarking indicates that
reallocation is not a significant overhead for outputs up to a
few MB in size.

Signed-off-by: Joey Hess <id@joeyh.name>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodocs: move core.excludesFile from git-add to gitignore
Denton Liu [Thu, 7 Mar 2019 08:25:30 +0000 (00:25 -0800)] 
docs: move core.excludesFile from git-add to gitignore

A section in "git add" documentation mentions core.excludesFile and
explains how it works, but this is not specific to the command.

Move this description to gitignore.txt to be more generic.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogit-clean.txt: clarify ignore pattern files
Denton Liu [Thu, 7 Mar 2019 08:25:28 +0000 (00:25 -0800)] 
git-clean.txt: clarify ignore pattern files

In the git-clean documentation, -x and -e documented .gitignore,
$GIT_DIR/info/excludes but neglected to mention the file pointed to by
core.excludesFile.

Remove specific list of files and, instead, reference gitignore(5)
documentation so that information is consolidated and the git-clean
documentation is more precise.

Reported-by: Robert P. J. Day <rpjday@crashcourse.ca>
Helped-by: Martin Ågren <martin.agren@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoconfig: document --type=color output is a complete line
Jeff King [Tue, 5 Mar 2019 04:20:51 +0000 (23:20 -0500)] 
config: document --type=color output is a complete line

Even though the newer "--type=color" option to "git config" is meant
to be upward compatible with the traditional "--get-color" option,
unlike the latter, its output is not an incomplete line that lack
the LF at the end.  That makes it consistent with output of other
types like "git config --type=bool".

Document it, as it sometimes surprises unsuspecting users.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoStart 2.22 cycle
Junio C Hamano [Thu, 7 Mar 2019 02:59:54 +0000 (11:59 +0900)] 
Start 2.22 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'jt/http-auth-proto-v2-fix'
Junio C Hamano [Thu, 7 Mar 2019 00:59:59 +0000 (09:59 +0900)] 
Merge branch 'jt/http-auth-proto-v2-fix'

Unify RPC code for smart http in protocol v0/v1 and v2, which fixes
a bug in the latter (lack of authentication retry) and generally
improves the code base.

* jt/http-auth-proto-v2-fix:
  remote-curl: use post_rpc() for protocol v2 also
  remote-curl: refactor reading into rpc_state's buf
  remote-curl: reduce scope of rpc_state.result
  remote-curl: reduce scope of rpc_state.stdin_preamble
  remote-curl: reduce scope of rpc_state.argv

5 years agoMerge branch 'jk/diff-no-index-initialize'
Junio C Hamano [Thu, 7 Mar 2019 00:59:59 +0000 (09:59 +0900)] 
Merge branch 'jk/diff-no-index-initialize'

"git diff --no-index" may still want to access Git goodies like
--ext-diff and --textconv, but so far these have been ignored,
which has been corrected.

* jk/diff-no-index-initialize:
  diff: reuse diff setup for --no-index case

5 years agoMerge branch 'nd/no-more-check-racy'
Junio C Hamano [Thu, 7 Mar 2019 00:59:59 +0000 (09:59 +0900)] 
Merge branch 'nd/no-more-check-racy'

Unused code removal.

* nd/no-more-check-racy:
  Delete check-racy.c

5 years agoMerge branch 'rd/doc-hook-used-in-sample'
Junio C Hamano [Thu, 7 Mar 2019 00:59:59 +0000 (09:59 +0900)] 
Merge branch 'rd/doc-hook-used-in-sample'

Doc update.

* rd/doc-hook-used-in-sample:
  mention use of "hooks.allownonascii" in "man githooks"

5 years agoMerge branch 'nd/diff-parseopt-2'
Junio C Hamano [Thu, 7 Mar 2019 00:59:58 +0000 (09:59 +0900)] 
Merge branch 'nd/diff-parseopt-2'

Second batch to teach the diff machinery to use the parse-options
API.

* nd/diff-parseopt-2: (21 commits)
  diff-parseopt: convert --ignore-some-changes
  diff-parseopt: convert --[no-]minimal
  diff-parseopt: convert --relative
  diff-parseopt: convert --no-renames|--[no--rename-empty
  diff-parseopt: convert --find-copies-harder
  diff-parseopt: convert -C|--find-copies
  diff-parseopt: convert -D|--irreversible-delete
  diff-parseopt: convert -M|--find-renames
  diff-parseopt: convert -B|--break-rewrites
  diff-parseopt: convert --output-*
  diff-parseopt: convert --[no-]compact-summary
  diff-parseopt: convert --stat*
  diff-parseopt: convert -s|--no-patch
  diff-parseopt: convert --name-status
  diff-parseopt: convert --name-only
  diff-parseopt: convert --patch-with-stat
  diff-parseopt: convert --summary
  diff-parseopt: convert --check
  diff-parseopt: convert --dirstat and friends
  diff-parseopt: convert --numstat and --shortstat
  ...

5 years agoMerge branch 'en/merge-options-doc'
Junio C Hamano [Thu, 7 Mar 2019 00:59:58 +0000 (09:59 +0900)] 
Merge branch 'en/merge-options-doc'

Doc update.

* en/merge-options-doc:
  merge-options.txt: correct wording of --no-commit option

5 years agoMerge branch 'nd/completion-more-parameters'
Junio C Hamano [Thu, 7 Mar 2019 00:59:57 +0000 (09:59 +0900)] 
Merge branch 'nd/completion-more-parameters'

The command line completion (in contrib/) has been taught to
complete more subcommand parameters.

* nd/completion-more-parameters:
  completion: add more parameter value completion

5 years agoMerge branch 'ab/receive-pack-use-after-free-fix'
Junio C Hamano [Thu, 7 Mar 2019 00:59:57 +0000 (09:59 +0900)] 
Merge branch 'ab/receive-pack-use-after-free-fix'

Memfix.

* ab/receive-pack-use-after-free-fix:
  receive-pack: fix use-after-free bug

5 years agoMerge branch 'dl/doc-submodule-wo-subcommand'
Junio C Hamano [Thu, 7 Mar 2019 00:59:57 +0000 (09:59 +0900)] 
Merge branch 'dl/doc-submodule-wo-subcommand'

Doc update.

* dl/doc-submodule-wo-subcommand:
  submodule: document default behavior

5 years agoMerge branch 'jk/unused-params'
Junio C Hamano [Thu, 7 Mar 2019 00:59:56 +0000 (09:59 +0900)] 
Merge branch 'jk/unused-params'

Code clean-up.

* jk/unused-params:
  ref-filter: drop unused "sz" parameters
  ref-filter: drop unused "obj" parameters
  ref-filter: drop unused buf/sz pairs
  files-backend: drop refs parameter from split_symref_update()
  pack-objects: drop unused parameter from oe_map_new_pack()
  merge-recursive: drop several unused parameters
  diff: drop complete_rewrite parameter from run_external_diff()
  diff: drop unused emit data parameter from sane_truncate_line()
  diff: drop unused color reset parameters
  diff: drop options parameter from diffcore_fix_diff_index()

5 years agoMerge branch 'jk/prune-optim'
Junio C Hamano [Thu, 7 Mar 2019 00:59:56 +0000 (09:59 +0900)] 
Merge branch 'jk/prune-optim'

"git prune" has been taught to take advantage of reachability
bitmap when able.

* jk/prune-optim:
  t5304: rename "sha1" variables to "oid"
  prune: check SEEN flag for reachability
  prune: use bitmaps for reachability traversal
  prune: lazily perform reachability traversal

5 years agoMerge branch 'jh/trace2'
Junio C Hamano [Thu, 7 Mar 2019 00:59:56 +0000 (09:59 +0900)] 
Merge branch 'jh/trace2'

A more structured way to obtain execution trace has been added.

* jh/trace2:
  trace2: add for_each macros to clang-format
  trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.sh
  trace2:data: add subverb for rebase
  trace2:data: add subverb to reset command
  trace2:data: add subverb to checkout command
  trace2:data: pack-objects: add trace2 regions
  trace2:data: add trace2 instrumentation to index read/write
  trace2:data: add trace2 hook classification
  trace2:data: add trace2 transport child classification
  trace2:data: add trace2 sub-process classification
  trace2:data: add editor/pager child classification
  trace2:data: add trace2 regions to wt-status
  trace2: collect Windows-specific process information
  trace2: create new combined trace facility
  trace2: Documentation/technical/api-trace2.txt

5 years agoMerge branch 'js/doc-symref-in-proto-v1'
Junio C Hamano [Thu, 7 Mar 2019 00:59:56 +0000 (09:59 +0900)] 
Merge branch 'js/doc-symref-in-proto-v1'

Doc update.

* js/doc-symref-in-proto-v1:
  protocol-capabilities.txt: document symref

5 years agoMerge branch 'nd/split-index-null-base-fix'
Junio C Hamano [Thu, 7 Mar 2019 00:59:56 +0000 (09:59 +0900)] 
Merge branch 'nd/split-index-null-base-fix'

Split-index fix.

* nd/split-index-null-base-fix:
  read-cache.c: fix writing "link" index ext with null base oid

5 years agoMerge branch 'rj/prune-packed-excess-args'
Junio C Hamano [Thu, 7 Mar 2019 00:59:55 +0000 (09:59 +0900)] 
Merge branch 'rj/prune-packed-excess-args'

"git prune-packed" did not notice and complain against excess
arguments given from the command line, which now it does.

* rj/prune-packed-excess-args:
  prune-packed: check for too many arguments

5 years agoMerge branch 'jc/test-yes-doc'
Junio C Hamano [Thu, 7 Mar 2019 00:59:54 +0000 (09:59 +0900)] 
Merge branch 'jc/test-yes-doc'

Test doc update.

* jc/test-yes-doc:
  test: caution on our version of 'yes'

5 years agoMerge branch 'en/combined-all-paths'
Junio C Hamano [Thu, 7 Mar 2019 00:59:54 +0000 (09:59 +0900)] 
Merge branch 'en/combined-all-paths'

Output from "diff --cc" did not show the original paths when the
merge involved renames.  A new option adds the paths in the
original trees to the output.

* en/combined-all-paths:
  log,diff-tree: add --combined-all-paths option

5 years agoMerge branch 'sc/pack-redundant'
Junio C Hamano [Thu, 7 Mar 2019 00:59:54 +0000 (09:59 +0900)] 
Merge branch 'sc/pack-redundant'

Update the implementation of pack-redundant for performance in a
repository with many packfiles.

* sc/pack-redundant:
  pack-redundant: consistent sort method
  pack-redundant: rename pack_list.all_objects
  pack-redundant: new algorithm to find min packs
  pack-redundant: delete redundant code
  pack-redundant: delay creation of unique_objects
  t5323: test cases for git-pack-redundant

5 years agoMerge branch 'du/branch-show-current'
Junio C Hamano [Thu, 7 Mar 2019 00:59:53 +0000 (09:59 +0900)] 
Merge branch 'du/branch-show-current'

"git branch" learned a new subcommand "--show-current".

* du/branch-show-current:
  branch: introduce --show-current display option

5 years agoMerge branch 'dl/complete-submodule-absorbgitdirs'
Junio C Hamano [Thu, 7 Mar 2019 00:59:53 +0000 (09:59 +0900)] 
Merge branch 'dl/complete-submodule-absorbgitdirs'

Command-line completion (in contrib/) learned to tab-complete the
"git submodule absorbgitdirs" subcommand.

* dl/complete-submodule-absorbgitdirs:
  completion: complete git submodule absorbgitdirs

5 years agoMerge branch 'wh/author-committer-ident-config'
Junio C Hamano [Thu, 7 Mar 2019 00:59:53 +0000 (09:59 +0900)] 
Merge branch 'wh/author-committer-ident-config'

Four new configuration variables {author,committer}.{name,email}
have been introduced to override user.{name,email} in more specific
cases.

* wh/author-committer-ident-config:
  config: allow giving separate author and committer idents

5 years agoMerge branch 'aw/pretty-trailers'
Junio C Hamano [Thu, 7 Mar 2019 00:59:52 +0000 (09:59 +0900)] 
Merge branch 'aw/pretty-trailers'

The %(trailers) formatter in "git log --format=..."  now allows to
optionally pick trailers selectively by keyword, show only values,
etc.

* aw/pretty-trailers:
  pretty: add support for separator option in %(trailers)
  strbuf: separate callback for strbuf_expand:ing literals
  pretty: add support for "valueonly" option in %(trailers)
  pretty: allow showing specific trailers
  pretty: single return path in %(trailers) handling
  pretty: allow %(trailers) options with explicit value
  doc: group pretty-format.txt placeholders descriptions

5 years agoMerge branch 'nd/diff-parseopt'
Junio C Hamano [Thu, 7 Mar 2019 00:59:52 +0000 (09:59 +0900)] 
Merge branch 'nd/diff-parseopt'

The diff machinery, one of the oldest parts of the system, which
long predates the parse-options API, uses fairly long and complex
handcrafted option parser.  This is being rewritten to use the
parse-options API.

* nd/diff-parseopt:
  diff.c: convert --raw
  diff.c: convert -W|--[no-]function-context
  diff.c: convert -U|--unified
  diff.c: convert -u|-p|--patch
  diff.c: prepare to use parse_options() for parsing
  diff.h: avoid bit fields in struct diff_flags
  diff.h: keep forward struct declarations sorted
  parse-options: allow ll_callback with OPTION_CALLBACK
  parse-options: avoid magic return codes
  parse-options: stop abusing 'callback' for lowlevel callbacks
  parse-options: add OPT_BITOP()
  parse-options: disable option abbreviation with PARSE_OPT_KEEP_UNKNOWN
  parse-options: add one-shot mode
  parse-options.h: remove extern on function prototypes

5 years agoMerge branch 'tg/checkout-no-overlay'
Junio C Hamano [Thu, 7 Mar 2019 00:59:51 +0000 (09:59 +0900)] 
Merge branch 'tg/checkout-no-overlay'

"git checkout --no-overlay" can be used to trigger a new mode of
checking out paths out of the tree-ish, that allows paths that
match the pathspec that are in the current index and working tree
and are not in the tree-ish.

* tg/checkout-no-overlay:
  revert "checkout: introduce checkout.overlayMode config"
  checkout: introduce checkout.overlayMode config
  checkout: introduce --{,no-}overlay option
  checkout: factor out mark_cache_entry_for_checkout function
  checkout: clarify comment
  read-cache: add invalidate parameter to remove_marked_cache_entries
  entry: support CE_WT_REMOVE flag in checkout_entry
  entry: factor out unlink_entry function
  move worktree tests to t24*

5 years agoattr.c: ".gitattribute" -> ".gitattributes" (comments)
Robert P. J. Day [Wed, 6 Mar 2019 09:14:44 +0000 (04:14 -0500)] 
attr.c: ".gitattribute" -> ".gitattributes" (comments)

Correct misspelled ".gitattribute" in comments only, so no functional
change.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogitattributes.txt: fix typo
Yash Bhatambare [Wed, 6 Mar 2019 05:23:10 +0000 (05:23 +0000)] 
gitattributes.txt: fix typo

`UTF-16-LE-BOM` to `UTF-16LE-BOM`.

this closes https://github.com/git-for-windows/git/issues/2095

Signed-off-by: Yash Bhatambare <ybhatambare@gmail.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agocompat/bswap: add include header guards
Jeff King [Wed, 6 Mar 2019 19:05:10 +0000 (14:05 -0500)] 
compat/bswap: add include header guards

Our compat/bswap.h lacks the usual preprocessor guards against multiple
inclusion. This usually isn't an issue since it only gets included from
git-compat-util.h, which has its own guards. But it would produce
redeclaration errors if any file included it separately.

Our hdr-check target would complain about this, except that it currently
skips items in compat/ entirely.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMakefile: fix 'hdr-check' when GCRYPT not installed
Ramsay Jones [Wed, 6 Mar 2019 00:11:13 +0000 (00:11 +0000)] 
Makefile: fix 'hdr-check' when GCRYPT not installed

If the GCRYPT_SHA256 build variable is not set, then the 'hdr-check'
target complains about the missing <gcrypt.h> header file. Add the
'sha256/gcrypt.h' header file to the exception list, if the build
variable is not defined. While here, replace the 'xdiff%' filter
pattern with 'xdiff/%' (and similarly for the compat pattern) since
the original pattern inadvertently excluded the 'xdiff-interface.h'
header.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogit-reset.txt: clarify documentation
Denton Liu [Tue, 5 Mar 2019 23:34:26 +0000 (15:34 -0800)] 
git-reset.txt: clarify documentation

git-reset.txt contained a missing "a" and "wrt". Fix the missing "a" for
correctness and replace "wrt" with "with respect to" so that the
documentation is not so cryptic.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoDoc: fix misleading asciidoc formating
Jean-Noël Avila [Tue, 5 Mar 2019 21:44:23 +0000 (22:44 +0100)] 
Doc: fix misleading asciidoc formating

The end of sentence in "x." at the begining of a line misleads
ascidoctor into interpreting it as the start of numbered sub-list.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agofsck: always compute USED flags for unreachable objects
Jeff King [Tue, 5 Mar 2019 04:47:39 +0000 (23:47 -0500)] 
fsck: always compute USED flags for unreachable objects

The --connectivity-only option avoids opening every object, and instead
just marks reachable objects with a flag and compares this to the set
of all objects. This strategy is discussed in more detail in 3e3f8bd608
(fsck: prepare dummy objects for --connectivity-check, 2017-01-17).

This means that we report _every_ unreachable object as dangling.
Whereas in a full fsck, we'd have actually opened and parsed each of
those unreachable objects, marking their child objects with the USED
flag, to mean "this was mentioned by another object". And thus we can
report only the tip of an unreachable segment of the object graph as
dangling.

You can see this difference with a trivial example:

  tree=$(git hash-object -t tree -w /dev/null)
  one=$(echo one | git commit-tree $tree)
  two=$(echo two | git commit-tree -p $one $tree)

Running `git fsck` will report only $two as dangling, but with
--connectivity-only, both commits (and the tree) are reported. Likewise,
using --lost-found would write all three objects.

We can make --connectivity-only work like the normal case by taking a
separate pass over the unreachable objects, parsing them and marking
objects they refer to as USED. That still avoids parsing any blobs,
though we do pay the cost to access any unreachable commits and trees
(which may or may not be noticeable, depending on how many you have).

If neither --dangling nor --lost-found is in effect, then we can skip
this step entirely, just like we do now. That makes "--connectivity-only
--no-dangling" just as fast as the current "--connectivity-only". I.e.,
we do the correct thing always, but you can still tweak the options to
make it faster if you don't care about dangling objects.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodoc/fsck: clarify --connectivity-only behavior
Jeff King [Tue, 5 Mar 2019 04:46:38 +0000 (23:46 -0500)] 
doc/fsck: clarify --connectivity-only behavior

On reading this again, there are two things that were not immediately
clear to me:

  - we do still check links to blobs, even though we don't open the
    blobs themselves

  - we do not do the normal fsck checks, even for non-blob objects we do
    open

Let's reword it to make these points a little more clear.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorev-list: allow cached objects in existence check
Jeff King [Mon, 4 Mar 2019 17:40:54 +0000 (12:40 -0500)] 
rev-list: allow cached objects in existence check

This fixes a regression in 7c0fe330d5 (rev-list: handle missing tree
objects properly, 2018-10-05) where rev-list will now complain about the
empty tree when it doesn't physically exist on disk.

Before that commit, we relied on the traversal code in list-objects.c to
walk through the trees. Since it uses parse_tree(), we'd do a normal
object lookup that includes looking in the set of "cached" objects
(which is where our magic internal empty-tree kicks in).

After that commit, we instead tell list-objects.c not to die on any
missing trees, and we check them ourselves using has_object_file(). But
that function uses OBJECT_INFO_SKIP_CACHED, which means we won't use our
internal empty tree.

This normally wouldn't come up. For most operations, Git will try to
write out the empty tree object as it would any other object. And
pack-objects in a push or fetch will send the empty tree (even if it's
virtual on the sending side). However, there are cases where this can
matter. One I found in the wild:

  1. The root tree of a commit became empty by deleting all files,
     without using an index. In this case it was done using libgit2's
     tree builder API, but as the included test shows, it can easily be
     done with regular git using hash-object.

     The resulting repo works OK, as we'd avoid walking over our own
     reachable commits for a connectivity check.

  2. Cloning with --reference pointing to the repository from (1) can
     trigger the problem, because we tell the other side we already have
     that commit (and hence the empty tree), but then walk over it
     during the connectivity check (where we complain about it missing).

Arguably the workflow in step (1) should be more careful about writing
the empty tree object if we're referencing it. But this workflow did
work prior to 7c0fe330d5, so let's restore it.

This patch makes the minimal fix, which is to swap out a direct call to
oid_object_info_extended(), minus the SKIP_CACHED flag, instead of
calling has_object_file(). This is all that has_object_file() is doing
under the hood. And there's little danger of unrelated fallout from
other unexpected "cached" objects, since there's only one call site that
ends such a cached object, and it's in git-blame.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMakefile: use `git ls-files` to list header files, if possible
Johannes Schindelin [Mon, 4 Mar 2019 13:47:06 +0000 (05:47 -0800)] 
Makefile: use `git ls-files` to list header files, if possible

In d85b0dff72 (Makefile: use `find` to determine static header
dependencies, 2014-08-25), we switched from a static list of header
files to a dynamically-generated one, asking `find` to enumerate them.

Back in those days, we did not use `$(LIB_H)` by default, and many a
`make` implementation seems smart enough not to run that `find` command
in that case, so it was deemed okay to run `find` for special targets
requiring this macro.

However, as of ebb7baf02f (Makefile: add a hdr-check target,
2018-09-19), $(LIB_H) is part of a global rule and therefore must be
expanded. Meaning: this `find` command has to be run upon every
`make` invocation. In the presence of many a worktree, this can tax the
developers' patience quite a bit.

Even in the absence of worktrees or other untracked files and
directories, the cost of I/O to generate that list of header files is
simply a lot larger than a simple `git ls-files` call.

Therefore, just like in 335339758c (Makefile: ask "ls-files" to list
source files if available, 2011-10-18), we now prefer to use `git
ls-files` to enumerate the header files to enumerating them via `find`,
falling back to the latter if the former failed (which would be the case
e.g. in a worktree that was extracted from a source .tar file rather
than from a clone of Git's sources).

This has one notable consequence: we no longer include `command-list.h`
in `LIB_H`, as it is a generated file, not a tracked one, but that is
easily worked around. Of the three sites that use `LIB_H`, two
(`LOCALIZED_C` and `CHK_HDRS`) already handle generated headers
separately. In the third, the computed-dependency fallback, we can just
add in a reference to $(GENERATED_H).

Likewise, we no longer include not-yet-tracked header files in `LIB_H`.

Given the speed improvements, these consequences seem a comparably small
price to pay.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge tag 'l10n-2.21.0-rnd2.1' of git://github.com/git-l10n/git-po
Junio C Hamano [Tue, 5 Mar 2019 12:53:10 +0000 (21:53 +0900)] 
Merge tag 'l10n-2.21.0-rnd2.1' of git://github.com/git-l10n/git-po

L10n for Git 2.21.0 round 2.1

* tag 'l10n-2.21.0-rnd2.1' of git://github.com/git-l10n/git-po:
  l10n: Fixes to Catalan translation
  l10n: Updated Vietnamese translation for v2.21 rd2
  l10n: fr.po remove obsolete entries