git
5 years agobuiltin_diff(): read $GIT_DIFF_OPTS closer to use
Jeff King [Fri, 11 Jan 2019 22:17:22 +0000 (17:17 -0500)] 
builtin_diff(): read $GIT_DIFF_OPTS closer to use

The value returned by getenv() is not guaranteed to remain valid across
other environment function calls. But in between our call and using the
value, we run fill_textconv(), which may do quite a bit of work,
including spawning sub-processes.

We can make this safer by calling getenv() right before we actually look
at its value.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agomerge-recursive: copy $GITHEAD strings
Jeff King [Fri, 11 Jan 2019 22:16:55 +0000 (17:16 -0500)] 
merge-recursive: copy $GITHEAD strings

If $GITHEAD_1234abcd is set in the environment, we use its value as a
"better branch name" in generating conflict markers. However, we pick
these better names early in the process, and the return value from
getenv() is not guaranteed to stay valid.

Let's make a copy of the returned string. And to make memory management
easier, let's just always return an allocated string from
better_branch_name(), so we know that it must always be freed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoinit: make a copy of $GIT_DIR string
Jeff King [Fri, 11 Jan 2019 22:16:31 +0000 (17:16 -0500)] 
init: make a copy of $GIT_DIR string

We pass the result of getenv("GIT_DIR") to init_db() and assume that the
string remains valid. But that's not guaranteed across calls to setenv()
or even getenv(), although it often works in practice. Let's make a copy
of the string so that we follow the rules.

Note that we need to mark it with UNLEAK(), since the value persists
until the end of program (but we have no opportunity to free it).

This patch also handles $GIT_WORK_TREE the same way. It actually doesn't
have as long a lifetime and is probably fine, but it's simpler to just
treat the two side-by-side variables the same.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoconfig: make a copy of $GIT_CONFIG string
Jeff King [Fri, 11 Jan 2019 22:15:54 +0000 (17:15 -0500)] 
config: make a copy of $GIT_CONFIG string

cmd_config() points our source filename pointer at the return value of
getenv(), but that value may be invalidated by further calls to
environment functions. Let's copy it to make sure it remains valid.

We don't need to bother freeing it, as it remains part of the
whole-process global state until we exit.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agocommit: copy saved getenv() result
Jeff King [Fri, 11 Jan 2019 22:15:40 +0000 (17:15 -0500)] 
commit: copy saved getenv() result

We save the result of $GIT_INDEX_FILE so that we can restore it after
setting it to a new value and running add--interactive. However, the
pointer returned by getenv() is not guaranteed to be valid after calling
setenv(). This _usually_ works fine, but can fail if libc needs to
reallocate the environment block during the setenv().

Let's just duplicate the string, so we know that it remains valid.

In the long run it may be more robust to teach interactive_add() to take
a set of environment variables to pass along to run-command when it
execs add--interactive. And then we would not have to do this
save/restore dance at all. But this is an easy fix in the meantime.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoget_super_prefix(): copy getenv() result
Jeff King [Fri, 11 Jan 2019 22:15:00 +0000 (17:15 -0500)] 
get_super_prefix(): copy getenv() result

The return value of getenv() is not guaranteed to remain valid across
multiple calls (nor across calls to setenv()). Since this function
caches the result for the length of the program, we must make a copy to
ensure that it is still valid when we need it.

Reported-by: Yngve N. Pettersen <yngve@vivaldi.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoGit 2.19.2 v2.19.2
Junio C Hamano [Wed, 21 Nov 2018 14:22:12 +0000 (23:22 +0900)] 
Git 2.19.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'sg/test-rebase-editor-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:10 +0000 (22:58 +0900)] 
Merge branch 'sg/test-rebase-editor-fix' into maint

* sg/test-rebase-editor-fix:
  t3404-rebase-interactive: test abbreviated commands

5 years agoMerge branch 'tb/char-may-be-unsigned' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:09 +0000 (22:58 +0900)] 
Merge branch 'tb/char-may-be-unsigned' into maint

Build portability fix.

* tb/char-may-be-unsigned:
  path.c: char is not (always) signed

5 years agoMerge branch 'jk/uploadpack-packobjectshook-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:08 +0000 (22:58 +0900)] 
Merge branch 'jk/uploadpack-packobjectshook-fix' into maint

Code clean-up that results in a small bugfix.

* jk/uploadpack-packobjectshook-fix:
  upload-pack: fix broken if/else chain in config callback

5 years agoMerge branch 'uk/merge-subtree-doc-update' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:08 +0000 (22:58 +0900)] 
Merge branch 'uk/merge-subtree-doc-update' into maint

Belated documentation update to adjust to a new world order that
happened a yew years ago.

* uk/merge-subtree-doc-update:
  howto/using-merge-subtree: mention --allow-unrelated-histories

5 years agoMerge branch 'jc/cocci-preincr' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:08 +0000 (22:58 +0900)] 
Merge branch 'jc/cocci-preincr' into maint

Code cleanup.

* jc/cocci-preincr:
  fsck: s/++i > 1/i++/
  cocci: simplify "if (++u > 1)" to "if (u++)"

5 years agoMerge branch 'ah/doc-updates' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:07 +0000 (22:58 +0900)] 
Merge branch 'ah/doc-updates' into maint

Doc updates.

* ah/doc-updates:
  doc: fix formatting in git-update-ref
  doc: fix indentation of listing blocks in gitweb.conf.txt
  doc: fix descripion for 'git tag --format'
  doc: fix inappropriate monospace formatting
  doc: fix ASCII art tab spacing
  doc: clarify boundaries of 'git worktree list --porcelain'

5 years agoMerge branch 'sg/doc-show-branch-typofix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:07 +0000 (22:58 +0900)] 
Merge branch 'sg/doc-show-branch-typofix' into maint

Docfix.

* sg/doc-show-branch-typofix:
  doc: fix small typo in git show-branch

5 years agoMerge branch 'tq/branch-style-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:06 +0000 (22:58 +0900)] 
Merge branch 'tq/branch-style-fix' into maint

Code clean-up.

* tq/branch-style-fix:
  branch: trivial style fix

5 years agoMerge branch 'tq/branch-create-wo-branch-get' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:06 +0000 (22:58 +0900)] 
Merge branch 'tq/branch-create-wo-branch-get' into maint

Code clean-up.

* tq/branch-create-wo-branch-get:
  builtin/branch.c: remove useless branch_get

5 years agoMerge branch 'sb/strbuf-h-update' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:06 +0000 (22:58 +0900)] 
Merge branch 'sb/strbuf-h-update' into maint

Code clean-up to serve as a BCP example.
Further clean-up patches may want to follow soon.

* sb/strbuf-h-update:
  strbuf.h: format according to coding guidelines

5 years agoMerge branch 'du/cherry-is-plumbing' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:05 +0000 (22:58 +0900)] 
Merge branch 'du/cherry-is-plumbing' into maint

Doc update to mark "git cherry" as a plumbing command.

* du/cherry-is-plumbing:
  doc: move git-cherry to plumbing

5 years agoMerge branch 'du/get-tar-commit-id-is-plumbing' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:05 +0000 (22:58 +0900)] 
Merge branch 'du/get-tar-commit-id-is-plumbing' into maint

Doc update to mark "git get-tar-commit-id" as a plumbing command.

* du/get-tar-commit-id-is-plumbing:
  doc: move git-get-tar-commit-id to plumbing

5 years agoMerge branch 'mm/doc-no-dashed-git' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:04 +0000 (22:58 +0900)] 
Merge branch 'mm/doc-no-dashed-git' into maint

Doc update.

* mm/doc-no-dashed-git:
  doc: fix a typo and clarify a sentence

5 years agoMerge branch 'du/rev-parse-is-plumbing' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:04 +0000 (22:58 +0900)] 
Merge branch 'du/rev-parse-is-plumbing' into maint

Doc update.

* du/rev-parse-is-plumbing:
  doc: move git-rev-parse from porcelain to plumbing

5 years agoMerge branch 'ma/t7005-bash-workaround' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:04 +0000 (22:58 +0900)] 
Merge branch 'ma/t7005-bash-workaround' into maint

Test fix.

* ma/t7005-bash-workaround:
  t7005-editor: quote filename to fix whitespace-issue

5 years agoMerge branch 'jc/how-to-document-api' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:03 +0000 (22:58 +0900)] 
Merge branch 'jc/how-to-document-api' into maint

Doc update.

* jc/how-to-document-api:
  CodingGuidelines: document the API in *.h files

5 years agoMerge branch 'mw/doc-typofixes' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:03 +0000 (22:58 +0900)] 
Merge branch 'mw/doc-typofixes' into maint

Typofixes.

* mw/doc-typofixes:
  docs: typo: s/isimilar/similar/
  docs: graph: remove unnecessary `graph_update()' call
  docs: typo: s/go/to/

5 years agoMerge branch 'rs/sequencer-oidset-insert-avoids-dups' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:02 +0000 (22:58 +0900)] 
Merge branch 'rs/sequencer-oidset-insert-avoids-dups' into maint

Code clean-up.

* rs/sequencer-oidset-insert-avoids-dups:
  sequencer: use return value of oidset_insert()

5 years agoMerge branch 'ma/mailing-list-address-in-git-help' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:02 +0000 (22:58 +0900)] 
Merge branch 'ma/mailing-list-address-in-git-help' into maint

Doc update.

* ma/mailing-list-address-in-git-help:
  git doc: direct bug reporters to mailing list archive

5 years agoMerge branch 'nd/packobjectshook-doc-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:01 +0000 (22:58 +0900)] 
Merge branch 'nd/packobjectshook-doc-fix' into maint

Doc update.

* nd/packobjectshook-doc-fix:
  config.txt: correct the note about uploadpack.packObjectsHook

5 years agoMerge branch 'ma/t1400-undebug-test' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:01 +0000 (22:58 +0900)] 
Merge branch 'ma/t1400-undebug-test' into maint

Test fix.

* ma/t1400-undebug-test:
  t1400: drop debug `echo` to actually execute `test`

5 years agoMerge branch 'ma/commit-graph-docs' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:00 +0000 (22:58 +0900)] 
Merge branch 'ma/commit-graph-docs' into maint

Doc update.

* ma/commit-graph-docs:
  Doc: refer to the "commit-graph file" with dash
  git-commit-graph.txt: refer to "*commit*-graph file"
  git-commit-graph.txt: typeset more in monospace
  git-commit-graph.txt: fix bullet lists

5 years agoMerge branch 'dz/credential-doc-url-matching-rules' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:58:00 +0000 (22:58 +0900)] 
Merge branch 'dz/credential-doc-url-matching-rules' into maint

Doc update.

* dz/credential-doc-url-matching-rules:
  doc: clarify gitcredentials path component matching

5 years agoMerge branch 'jk/check-everything-connected-is-long-gone' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:59 +0000 (22:57 +0900)] 
Merge branch 'jk/check-everything-connected-is-long-gone' into maint

Comment fix.

* jk/check-everything-connected-is-long-gone:
  receive-pack: update comment with check_everything_connected

5 years agoMerge branch 'fe/doc-updates' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:58 +0000 (22:57 +0900)] 
Merge branch 'fe/doc-updates' into maint

Doc updates.

* fe/doc-updates:
  git-describe.1: clarify that "human readable" is also git-readable
  git-column.1: clarify initial description, provide examples
  git-archimport.1: specify what kind of Arch we're talking about

5 years agoMerge branch 'tg/t5551-with-curl-7.61.1' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:58 +0000 (22:57 +0900)] 
Merge branch 'tg/t5551-with-curl-7.61.1' into maint

Test update.
Supersedes tz/t5551-with-curl-7.61.1 topic

* tg/t5551-with-curl-7.61.1:
  t5551: compare sorted cookies files
  t5551: move setup code inside test_expect blocks

5 years agoMerge branch 'tq/refs-internal-comment-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:58 +0000 (22:57 +0900)] 
Merge branch 'tq/refs-internal-comment-fix' into maint

Fix for typo in a sample code in comment.

* tq/refs-internal-comment-fix:
  refs: docstring typo

5 years agoMerge branch 'sg/split-index-test' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:57 +0000 (22:57 +0900)] 
Merge branch 'sg/split-index-test' into maint

Test updates.

* sg/split-index-test:
  t0090: disable GIT_TEST_SPLIT_INDEX for the test checking split index
  t1700-split-index: drop unnecessary 'grep'

5 years agoMerge branch 'bw/protocol-v2' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:57 +0000 (22:57 +0900)] 
Merge branch 'bw/protocol-v2' into maint

Doc fix.

* bw/protocol-v2:
  config: document value 2 for protocol.version

5 years agoMerge branch 'sb/string-list-remove-unused' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:56 +0000 (22:57 +0900)] 
Merge branch 'sb/string-list-remove-unused' into maint

Code clean-up.

* sb/string-list-remove-unused:
  string-list: remove unused function print_string_list

5 years agoMerge branch 'jk/dev-build-format-security' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:56 +0000 (22:57 +0900)] 
Merge branch 'jk/dev-build-format-security' into maint

Build tweak to help developers.

* jk/dev-build-format-security:
  config.mak.dev: add -Wformat-security

5 years agoMerge branch 'sg/t3701-tighten-trace' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:55 +0000 (22:57 +0900)] 
Merge branch 'sg/t3701-tighten-trace' into maint

Test update.

* sg/t3701-tighten-trace:
  t3701-add-interactive: tighten the check of trace output

5 years agoMerge branch 'en/double-semicolon-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:54 +0000 (22:57 +0900)] 
Merge branch 'en/double-semicolon-fix' into maint

Code clean-up.

* en/double-semicolon-fix:
  Remove superfluous trailing semicolons

5 years agoMerge branch 'tb/void-check-attr' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:54 +0000 (22:57 +0900)] 
Merge branch 'tb/void-check-attr' into maint

Code clean-up.

* tb/void-check-attr:
  Make git_check_attr() a void function

5 years agoMerge branch 'sg/doc-trace-appends' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:54 +0000 (22:57 +0900)] 
Merge branch 'sg/doc-trace-appends' into maint

Docfix.

* sg/doc-trace-appends:
  Documentation/git.txt: clarify that GIT_TRACE=/path appends

5 years agoMerge branch 'tg/conflict-marker-size' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:53 +0000 (22:57 +0900)] 
Merge branch 'tg/conflict-marker-size' into maint

Developer aid.

* tg/conflict-marker-size:
  .gitattributes: add conflict-marker-size for relevant files

5 years agoMerge branch 'ts/doc-build-manpage-xsl-quietly' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:53 +0000 (22:57 +0900)] 
Merge branch 'ts/doc-build-manpage-xsl-quietly' into maint

Build tweak.

* ts/doc-build-manpage-xsl-quietly:
  Documentation/Makefile: make manpage-base-url.xsl generation quieter

5 years agoMerge branch 'jk/detect-truncated-zlib-input' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:52 +0000 (22:57 +0900)] 
Merge branch 'jk/detect-truncated-zlib-input' into maint

A regression in Git 2.12 era made "git fsck" fall into an infinite
loop while processing truncated loose objects.

* jk/detect-truncated-zlib-input:
  cat-file: handle streaming failures consistently
  check_stream_sha1(): handle input underflow
  t1450: check large blob in trailing-garbage test

5 years agoMerge branch 'sg/test-verbose-log' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:52 +0000 (22:57 +0900)] 
Merge branch 'sg/test-verbose-log' into maint

Our test scripts can now take the '-V' option as a synonym for the
'--verbose-log' option.

* sg/test-verbose-log:
  test-lib: introduce the '-V' short option for '--verbose-log'

5 years agoMerge branch 'ss/travis-ci-force-vm-mode' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:52 +0000 (22:57 +0900)] 
Merge branch 'ss/travis-ci-force-vm-mode' into maint

The "container" mode of TravisCI is going away.  Our .travis.yml
file is getting prepared for the transition.

* ss/travis-ci-force-vm-mode:
  travis-ci: no longer use containers

5 years agoMerge branch 'md/exclude-promisor-objects-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:52 +0000 (22:57 +0900)] 
Merge branch 'md/exclude-promisor-objects-fix' into maint

Operations on promisor objects make sense in the context of only a
small subset of the commands that internally use the revisions
machinery, but the "--exclude-promisor-objects" option were taken
and led to nonsense results by commands like "log", to which it
didn't make much sense.  This has been corrected.

* md/exclude-promisor-objects-fix:
  exclude-promisor-objects: declare when option is allowed
  Documentation/git-log.txt: do not show --exclude-promisor-objects

5 years agoMerge branch 'js/shallow-and-fetch-prune' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:51 +0000 (22:57 +0900)] 
Merge branch 'js/shallow-and-fetch-prune' into maint

"git repack" in a shallow clone did not correctly update the
shallow points in the repository, leading to a repository that
does not pass fsck.

* js/shallow-and-fetch-prune:
  repack -ad: prune the list of shallow commits
  shallow: offer to prune only non-existing entries
  repack: point out a bug handling stale shallow info

5 years agoMerge branch 'jc/receive-deny-current-branch-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:51 +0000 (22:57 +0900)] 
Merge branch 'jc/receive-deny-current-branch-fix' into maint

The receive.denyCurrentBranch=updateInstead codepath kicked in even
when the push should have been rejected due to other reasons, such
as it does not fast-forward or the update-hook rejects it, which
has been corrected.

* jc/receive-deny-current-branch-fix:
  receive: denyCurrentBranch=updateinstead should not blindly update

5 years agoMerge branch 'js/diff-notice-has-drive-prefix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:50 +0000 (22:57 +0900)] 
Merge branch 'js/diff-notice-has-drive-prefix' into maint

Under certain circumstances, "git diff D:/a/b/c D:/a/b/d" on
Windows would strip initial parts from the paths because they
were not recognized as absolute, which has been corrected.

* js/diff-notice-has-drive-prefix:
  diff: don't attempt to strip prefix from absolute Windows paths

5 years agoMerge branch 'js/pack-objects-mutex-init-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:50 +0000 (22:57 +0900)] 
Merge branch 'js/pack-objects-mutex-init-fix' into maint

A mutex used in "git pack-objects" were not correctly initialized
and this caused "git repack" to dump core on Windows.

* js/pack-objects-mutex-init-fix:
  pack-objects (mingw): initialize `packing_data` mutex in the correct spot
  pack-objects (mingw): demonstrate a segmentation fault with large deltas
  pack-objects: fix typo 'detla' -> 'delta'

5 years agoMerge branch 'jk/run-command-notdot' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:50 +0000 (22:57 +0900)] 
Merge branch 'jk/run-command-notdot' into maint

The implementation of run_command() API on the UNIX platforms had a
bug that caused a command not on $PATH to be found in the current
directory.

* jk/run-command-notdot:
  run-command: mark path lookup errors with ENOENT

5 years agoMerge branch 'np/log-graph-octopus-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:49 +0000 (22:57 +0900)] 
Merge branch 'np/log-graph-octopus-fix' into maint

"git log --graph" showing an octopus merge sometimes miscounted the
number of display columns it is consuming to show the merge and its
parent commits, which has been corrected.

* np/log-graph-octopus-fix:
  log: fix coloring of certain octopus merge shapes

5 years agoMerge branch 'sg/split-index-racefix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:48 +0000 (22:57 +0900)] 
Merge branch 'sg/split-index-racefix' into maint

The codepath to support the experimental split-index mode had
remaining "racily clean" issues fixed.

* sg/split-index-racefix:
  split-index: BUG() when cache entry refers to non-existing shared entry
  split-index: smudge and add racily clean cache entries to split index
  split-index: don't compare cached data of entries already marked for split index
  split-index: count the number of deleted entries
  t1700-split-index: date back files to avoid racy situations
  split-index: add tests to demonstrate the racy split index problem
  t1700-split-index: document why FSMONITOR is disabled in this test script

5 years agoMerge branch 'jt/non-blob-lazy-fetch' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:48 +0000 (22:57 +0900)] 
Merge branch 'jt/non-blob-lazy-fetch' into maint

A partial clone that is configured to lazily fetch missing objects
will on-demand issue a "git fetch" request to the originating
repository to fill not-yet-obtained objects.  The request has been
optimized for requesting a tree object (and not the leaf blob
objects contained in it) by telling the originating repository that
no blobs are needed.

* jt/non-blob-lazy-fetch:
  fetch-pack: exclude blobs when lazy-fetching trees
  fetch-pack: avoid object flags if no_dependents

5 years agoMerge branch 'sm/show-superproject-while-conflicted' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:48 +0000 (22:57 +0900)] 
Merge branch 'sm/show-superproject-while-conflicted' into maint

A corner-case bugfix.

* sm/show-superproject-while-conflicted:
  rev-parse: --show-superproject-working-tree should work during a merge

5 years agoMerge branch 'en/status-multiple-renames-to-the-same-target-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:48 +0000 (22:57 +0900)] 
Merge branch 'en/status-multiple-renames-to-the-same-target-fix' into maint

The code in "git status" sometimes hit an assertion failure.  This
was caused by a structure that was reused without cleaning the data
used for the first run, which has been corrected.

* en/status-multiple-renames-to-the-same-target-fix:
  commit: fix erroneous BUG, 'multiple renames on the same target? how?'

5 years agoMerge branch 'jn/mailmap-update' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:47 +0000 (22:57 +0900)] 
Merge branch 'jn/mailmap-update' into maint

The mailmap file update.

* jn/mailmap-update:
  mailmap: consistently normalize brian m. carlson's name

5 years agoMerge branch 'ds/commit-graph-with-grafts' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:47 +0000 (22:57 +0900)] 
Merge branch 'ds/commit-graph-with-grafts' into maint

The recently introduced commit-graph auxiliary data is incompatible
with mechanisms such as replace & grafts that "breaks" immutable
nature of the object reference relationship.  Disable optimizations
based on its use (and updating existing commit-graph) when these
incompatible features are in use in the repository.

* ds/commit-graph-with-grafts:
  commit-graph: close_commit_graph before shallow walk
  commit-graph: not compatible with uninitialized repo
  commit-graph: not compatible with grafts
  commit-graph: not compatible with replace objects
  test-repository: properly init repo
  commit-graph: update design document
  refs.c: upgrade for_each_replace_ref to be a each_repo_ref_fn callback
  refs.c: migrate internal ref iteration to pass thru repository argument

5 years agoMerge branch 'tg/range-diff-corner-case-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:46 +0000 (22:57 +0900)] 
Merge branch 'tg/range-diff-corner-case-fix' into maint

Recently added "range-diff" had a corner-case bug to cause it
segfault, which has been corrected.

* tg/range-diff-corner-case-fix:
  linear-assignment: fix potential out of bounds memory access

5 years agoMerge branch 'en/update-ref-no-deref-stdin' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:46 +0000 (22:57 +0900)] 
Merge branch 'en/update-ref-no-deref-stdin' into maint

"git update-ref" learned to make both "--no-deref" and "--stdin"
work at the same time.

* en/update-ref-no-deref-stdin:
  update-ref: allow --no-deref with --stdin
  update-ref: fix type of update_flags variable to match its usage

5 years agoMerge branch 'ms/remote-error-message-update' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:46 +0000 (22:57 +0900)] 
Merge branch 'ms/remote-error-message-update' into maint

Update error messages given by "git remote" and make them consistent.

* ms/remote-error-message-update:
  builtin/remote: quote remote name on error to display empty name

5 years agoMerge branch 'jt/lazy-object-fetch-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:45 +0000 (22:57 +0900)] 
Merge branch 'jt/lazy-object-fetch-fix' into maint

The code to backfill objects in lazily cloned repository did not
work correctly, which has been corrected.

* jt/lazy-object-fetch-fix:
  fetch-object: set exact_oid when fetching
  fetch-object: unify fetch_object[s] functions

5 years agoMerge branch 'en/sequencer-empty-edit-result-aborts' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:45 +0000 (22:57 +0900)] 
Merge branch 'en/sequencer-empty-edit-result-aborts' into maint

"git rebase" etc. in Git 2.19 fails to abort when given an empty
commit log message as result of editing, which has been corrected.

* en/sequencer-empty-edit-result-aborts:
  sequencer: fix --allow-empty-message behavior, make it smarter

5 years agoMerge branch 'nd/attr-pathspec-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:45 +0000 (22:57 +0900)] 
Merge branch 'nd/attr-pathspec-fix' into maint

"git add ':(attr:foo)'" is not supported and is supposed to be
rejected while the command line arguments are parsed, but we fail
to reject such a command line upfront.

* nd/attr-pathspec-fix:
  add: do not accept pathspec magic 'attr'

5 years agoMerge branch 'en/rerere-multi-stage-1-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:44 +0000 (22:57 +0900)] 
Merge branch 'en/rerere-multi-stage-1-fix' into maint

A corner case bugfix in "git rerere" code.

* en/rerere-multi-stage-1-fix:
  rerere: avoid buffer overrun
  t4200: demonstrate rerere segfault on specially crafted merge

5 years agoMerge branch 'js/mingw-o-append' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:44 +0000 (22:57 +0900)] 
Merge branch 'js/mingw-o-append' into maint

Further fix for O_APPEND emulation on Windows

* js/mingw-o-append:
  mingw: fix mingw_open_append to work with named pipes
  t0051: test GIT_TRACE to a windows named pipe

5 years agoMerge branch 'jk/reopen-tempfile-truncate' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:43 +0000 (22:57 +0900)] 
Merge branch 'jk/reopen-tempfile-truncate' into maint

Fix for a long-standing bug that leaves the index file corrupt when
it shrinks during a partial commit.

* jk/reopen-tempfile-truncate:
  reopen_tempfile(): truncate opened file

5 years agoMerge branch 'bp/mv-submodules-with-fsmonitor' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:43 +0000 (22:57 +0900)] 
Merge branch 'bp/mv-submodules-with-fsmonitor' into maint

When fsmonitor is in use, after operation on submodules updates
.gitmodules, we lost track of the fact that we did so and relied on
stale fsmonitor data.

* bp/mv-submodules-with-fsmonitor:
  git-mv: allow submodules and fsmonitor to work together

5 years agoMerge branch 'js/rebase-i-autosquash-fix' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:42 +0000 (22:57 +0900)] 
Merge branch 'js/rebase-i-autosquash-fix' into maint

"git rebase -i" did not clear the state files correctly when a run
of "squash/fixup" is aborted and then the user manually amended the
commit instead, which has been corrected.

* js/rebase-i-autosquash-fix:
  rebase -i: be careful to wrap up fixup/squash chains
  rebase -i --autosquash: demonstrate a problem skipping the last squash

5 years agoMerge branch 'jk/trailer-fixes' into maint
Junio C Hamano [Wed, 21 Nov 2018 13:57:41 +0000 (22:57 +0900)] 
Merge branch 'jk/trailer-fixes' into maint

"git interpret-trailers" and its underlying machinery had a buggy
code that attempted to ignore patch text after commit log message,
which triggered in various codepaths that will always get the log
message alone and never get such an input.

* jk/trailer-fixes:
  append_signoff: use size_t for string offsets
  sequencer: ignore "---" divider when parsing trailers
  pretty, ref-filter: format %(trailers) with no_divider option
  interpret-trailers: allow suppressing "---" divider
  interpret-trailers: tighten check for "---" patch boundary
  trailer: pass process_trailer_opts to trailer_info_get()
  trailer: use size_t for iterating trailer list
  trailer: use size_t for string offsets

6 years agoAdjust for 2.19.x series
Junio C Hamano [Wed, 31 Oct 2018 04:12:12 +0000 (13:12 +0900)] 
Adjust for 2.19.x series

* jk/detect-truncated-zlib-input
  cat-file: handle streaming failures consistently
  check_stream_sha1(): handle input underflow
  t1450: check large blob in trailing-garbage test

6 years agocat-file: handle streaming failures consistently
Jeff King [Tue, 30 Oct 2018 23:23:38 +0000 (19:23 -0400)] 
cat-file: handle streaming failures consistently

There are three ways to convince cat-file to stream a blob:

  - cat-file -p $blob

  - cat-file blob $blob

  - echo $batch | cat-file --batch

In the first two, we simply exit with the error code of
streaw_blob_to_fd(). That means that an error will cause us
to exit with "-1" (which we try to avoid) without printing
any kind of error message (which is confusing to the user).

Instead, let's match the third case, which calls die() on an
error. Unfortunately we cannot be more specific, as
stream_blob_to_fd() does not tell us whether the problem was
on reading (e.g., a corrupt object) or on writing (e.g.,
ENOSPC). That might be an opportunity for future work, but
for now we will at least exit with a sane message and exit
code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocheck_stream_sha1(): handle input underflow
Jeff King [Tue, 30 Oct 2018 23:23:12 +0000 (19:23 -0400)] 
check_stream_sha1(): handle input underflow

This commit fixes an infinite loop when fscking large
truncated loose objects.

The check_stream_sha1() function takes an mmap'd loose
object buffer and streams 4k of output at a time, checking
its sha1. The loop quits when we've output enough bytes (we
know the size from the object header), or when zlib tells us
anything except Z_OK or Z_BUF_ERROR.

The latter is expected because zlib may run out of room in
our 4k buffer, and that is how it tells us to process the
output and loop again.

But Z_BUF_ERROR also covers another case: one in which zlib
cannot make forward progress because it needs more _input_.
This should never happen in this loop, because though we're
streaming the output, we have the entire deflated input
available in the mmap'd buffer. But since we don't check
this case, we'll just loop infinitely if we do see a
truncated object, thinking that zlib is asking for more
output space.

It's tempting to fix this by checking stream->avail_in as
part of the loop condition (and quitting if all of our bytes
have been consumed). But that assumes that once zlib has
consumed the input, there is nothing left to do.  That's not
necessarily the case: it may have read our input into its
internal state, but still have bytes to output.

Instead, let's continue on Z_BUF_ERROR only when we see the
case we're expecting: the previous round filled our output
buffer completely. If it didn't (and we still saw
Z_BUF_ERROR), we know something is wrong and should break
out of the loop.

The bug comes from commit f6371f9210 (sha1_file: add
read_loose_object() function, 2017-01-13), which
reimplemented some of the existing loose object functions.
So it's worth checking if this bug was inherited from any of
those. The answers seems to be no. The two obvious
candidates are both OK:

  1. unpack_sha1_rest(); this doesn't need to loop on
     Z_BUF_ERROR at all, since it allocates the expected
     output buffer in advance (which we can't do since we're
     explicitly streaming here)

  2. check_object_signature(); the streaming path relies on
     the istream interface, which uses read_istream_loose()
     for this case. That function uses a similar "is our
     output buffer full" check with Z_BUF_ERROR (which is
     where I stole it from for this patch!)

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1450: check large blob in trailing-garbage test
Jeff King [Tue, 30 Oct 2018 23:18:51 +0000 (19:18 -0400)] 
t1450: check large blob in trailing-garbage test

Commit cce044df7f (fsck: detect trailing garbage in all
object types, 2017-01-13) added two tests of trailing
garbage in a loose object file: one with a commit and one
with a blob. The point of having two is that blobs would
follow a different code path that streamed the contents,
instead of loading it into a buffer as usual.

At the time, merely being a blob was enough to trigger the
streaming code path. But since 7ac4f3a007 (fsck: actually
fsck blob data, 2018-05-02), we now only stream blobs that
are actually large. So since then, the streaming code path
is not tested at all for this case.

We can restore the original intent of the test by tweaking
core.bigFileThreshold to make our small blob seem large.
There's no easy way to externally verify that we followed
the streaming code path, but I did check before/after using
a temporary debug statement.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agotest-lib: introduce the '-V' short option for '--verbose-log'
SZEDER Gábor [Mon, 29 Oct 2018 12:13:59 +0000 (13:13 +0100)] 
test-lib: introduce the '-V' short option for '--verbose-log'

'--verbose-log' is one of the most useful and thus most frequently
used test options, but due to its length it's a pain to type on the
command line.

Let's introduce the corresponding short option '-V' to save some
keystrokes.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot3404-rebase-interactive: test abbreviated commands
Johannes Sixt [Sat, 27 Oct 2018 08:08:01 +0000 (10:08 +0200)] 
t3404-rebase-interactive: test abbreviated commands

Make sure that each short command is tested at least once. To
not exacerbate the runtime of the test script, do not add new
tests, but modify existing ones according to these criteria:

- The test does not have a prerequisite.
- The 'git rebase' command is not guarded by test_must_fail.

The pick commands are optional in the FAKE_LINES variable, but
when used, they do end up in the insn sheet. Test them, too.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agotravis-ci: no longer use containers
Sebastian Staudt [Thu, 25 Oct 2018 17:41:45 +0000 (19:41 +0200)] 
travis-ci: no longer use containers

Travis CI will soon deprecate the container-based infrastructure
enabled by `sudo: false` in ce59dffb34190e780be2fa9f449f842cadee9753.

More info:
https://blog.travis-ci.com/2018-10-04-combining-linux-infrastructures

Signed-off-by: Sebastian Staudt <koraktor@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopath.c: char is not (always) signed
Torsten Bögershausen [Thu, 25 Oct 2018 16:13:08 +0000 (18:13 +0200)] 
path.c: char is not (always) signed

If a "char" in C is signed or unsigned is not specified, because it is
out of tradition "implementation dependent".
Therefore constructs like "if (name[i] < 0)" are not portable,
use "if (name[i] & 0x80)" instead.

Detected by "gcc (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516" when
setting
DEVELOPER = 1
DEVOPTS = extra-all

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoupload-pack: fix broken if/else chain in config callback
Jeff King [Wed, 24 Oct 2018 07:27:52 +0000 (03:27 -0400)] 
upload-pack: fix broken if/else chain in config callback

The upload_pack_config() callback uses an if/else chain
like:

  if (!strcmp(var, "a"))
     ...
  else if (!strcmp(var, "b"))
     ...
  etc

This works as long as the conditions are mutually exclusive,
but one of them is not. 20b20a22f8 (upload-pack: provide a
hook for running pack-objects, 2016-05-18) added:

  else if (current_config_scope() != CONFIG_SCOPE_REPO) {
     ... check some more options ...
  }

That was fine in that commit, because it came at the end of
the chain.  But later, 10ac85c785 (upload-pack: add object
filtering for partial clone, 2017-12-08) did this:

  else if (current_config_scope() != CONFIG_SCOPE_REPO) {
     ... check some more options ...
  } else if (!strcmp("uploadpack.allowfilter", var))
     ...

We'd always check the scope condition first, meaning we'd
_only_ respect allowfilter when it's in the repo config. You
can see this with:

  git -c uploadpack.allowfilter=true upload-pack . | head -1

which will not advertise the filter capability (but will
after this patch). We never noticed because:

  - our tests always set it in the repo config

  - in protocol v2, we use a different code path that
    actually calls repo_config_get_bool() separately, so
    that _does_ work. Real-world people experimenting with
    this may be using v2.

The more recent uploadpack.allowrefinwant option is in the
same boat.

There are a few possible fixes:

  1. Bump the scope conditional back to the bottom of the
     chain. But that just means somebody else is likely to
     make the same mistake later.

  2. Make the conditional more like the others. I.e.:

       else if (!current_config_scope() != CONFIG_SCOPE_REPO &&
                !strcmp(var, "uploadpack.notallowedinrepo"))

     This works, but the idea of the original structure was
     that we may grow multiple sensitive options like this.

  3. Pull it out of the chain entirely. The chain mostly
     serves to avoid extra strcmp() calls after we've found
     a match. But it's not worth caring about those. In the
     worst case, when there isn't a match, we're already
     hitting every strcmp (and this happens regularly for
     stuff like "core.bare", etc).

This patch does (3).

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agohowto/using-merge-subtree: mention --allow-unrelated-histories
Uwe Kleine-König [Wed, 24 Oct 2018 08:04:52 +0000 (10:04 +0200)] 
howto/using-merge-subtree: mention --allow-unrelated-histories

Without passing --allow-unrelated-histories the command sequence
fails as intended since commit e379fdf34fee ("merge: refuse to create
too cool a merge by default"). To setup a subtree merging unrelated
histories is normal, so add the option to the howto document.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorepack -ad: prune the list of shallow commits
Johannes Schindelin [Wed, 24 Oct 2018 15:56:13 +0000 (08:56 -0700)] 
repack -ad: prune the list of shallow commits

`git repack` can drop unreachable commits without further warning,
making the corresponding entries in `.git/shallow` invalid, which causes
serious problems when deepening the branches.

One scenario where unreachable commits are dropped by `git repack` is
when a `git fetch --prune` (or even a `git fetch` when a ref was
force-pushed in the meantime) can make a commit unreachable that was
reachable before.

Therefore it is not safe to assume that a `git repack -adlf` will keep
unreachable commits alone (under the assumption that they had not been
packed in the first place, which is an assumption at least some of Git's
code seems to make).

This is particularly important to keep in mind when looking at the
`.git/shallow` file: if any commits listed in that file become
unreachable, it is not a problem, but if they go missing, it *is* a
problem. One symptom of this problem is that a deepening fetch may now
fail with

fatal: error in object: unshallow <commit-hash>

To avoid this problem, let's prune the shallow list in `git repack` when
the `-d` option is passed, unless `-A` is passed, too (which would force
the now-unreachable objects to be turned into loose objects instead of
being deleted). Additionally, we also need to take `--keep-reachable`
and `--unpack-unreachable=<date>` into account.

Note: an alternative solution discussed during the review of this patch
was to teach `git fetch` to simply ignore entries in .git/shallow if the
corresponding commits do not exist locally. A quick test, however,
revealed that the .git/shallow file is written during a shallow *clone*,
in which case the commits do not exist, either, but the "shallow" line
*does* need to be sent. Therefore, this approach would be a lot more
finicky than the approach presented by the this patch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoshallow: offer to prune only non-existing entries
Johannes Schindelin [Wed, 24 Oct 2018 15:56:12 +0000 (08:56 -0700)] 
shallow: offer to prune only non-existing entries

The `prune_shallow()` function wants a full reachability check to be
completed before it goes to work, to ensure that all unreachable entries
are removed from the shallow file.

However, in the upcoming patch we do not even want to go that far. We
really only need to remove entries corresponding to pruned commits, i.e.
to commits that no longer exist.

Let's support that use case.

Rather than extending the signature of `prune_shallow()` to accept
another Boolean, let's turn it into a bit field and declare constants,
for readability.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorepack: point out a bug handling stale shallow info
Johannes Schindelin [Wed, 24 Oct 2018 15:56:10 +0000 (08:56 -0700)] 
repack: point out a bug handling stale shallow info

A `git fetch --prune` can turn previously-reachable objects unreachable,
even commits that are in the `shallow` list. A subsequent `git repack
-ad` will then unceremoniously drop those unreachable commits, and the
`shallow` list will become stale. This means that when we try to fetch
with a larger `--depth` the next time, we may end up with:

fatal: error in object: unshallow <commit-hash>

Reported by Alejandro Pauly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot0061: adjust to test-tool transition
Junio C Hamano [Thu, 25 Oct 2018 02:41:09 +0000 (11:41 +0900)] 
t0061: adjust to test-tool transition

6 years agorun-command: mark path lookup errors with ENOENT
Jeff King [Wed, 24 Oct 2018 07:38:00 +0000 (03:38 -0400)] 
run-command: mark path lookup errors with ENOENT

Since commit e3a434468f (run-command: use the
async-signal-safe execv instead of execvp, 2017-04-19),
prepare_cmd() does its own PATH lookup for any commands we
run (on non-Windows platforms).

However, its logic does not match the old execvp call when
we fail to find a matching entry in the PATH. Instead of
feeding the name directly to execv, execvp would consider
that an ENOENT error. By continuing and passing the name
directly to execv, we effectively behave as if "." was
included at the end of the PATH. This can have confusing and
even dangerous results.

The fix itself is pretty straight-forward. There's a new
test in t0061 to cover this explicitly, and I've also added
a duplicate of the ENOENT test to ensure that we return the
correct errno for this case.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofsck: s/++i > 1/i++/
Junio C Hamano [Wed, 24 Oct 2018 01:25:12 +0000 (10:25 +0900)] 
fsck: s/++i > 1/i++/

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agococci: simplify "if (++u > 1)" to "if (u++)"
Junio C Hamano [Wed, 24 Oct 2018 01:10:10 +0000 (10:10 +0900)] 
cocci: simplify "if (++u > 1)" to "if (u++)"

It is more common to use post-increment than pre-increment when the
side effect is the primary thing we want in our code and in C in
general (unlike C++).

Initializing a variable to 0, incrementing it every time we do
something, and checking if we have already done that thing to guard
the code to do that thing, is easier to understand when written

if (u++)
; /* we've done that! */
else
do_it(); /* just once. */

but if you try to use pre-increment, you end up with a less natural
looking

if (++u > 1)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoexclude-promisor-objects: declare when option is allowed
Matthew DeVore [Tue, 23 Oct 2018 01:13:42 +0000 (18:13 -0700)] 
exclude-promisor-objects: declare when option is allowed

The --exclude-promisor-objects option causes some funny behavior in at
least two commands: log and blame. It causes a BUG crash:

$ git log --exclude-promisor-objects
BUG: revision.c:2143: exclude_promisor_objects can only be used
when fetch_if_missing is 0
Aborted
[134]

Fix this such that the option is treated like any other unknown option.
The commands that must support it are limited, so declare in those
commands that the flag is supported. In particular:

pack-objects
prune
rev-list

The commands were found by searching for logic which parses
--exclude-promisor-objects outside of revision.c. Extra logic outside of
revision.c is needed because fetch_if_missing must be turned on before
revision.c sees the option or it will BUG-crash. The above list is
supported by the fact that no other command is introspectively invoked
by another command passing --exclude-promisor-object.

Signed-off-by: Matthew DeVore <matvore@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoDocumentation/git-log.txt: do not show --exclude-promisor-objects
Matthew DeVore [Tue, 23 Oct 2018 01:13:41 +0000 (18:13 -0700)] 
Documentation/git-log.txt: do not show --exclude-promisor-objects

Do not suggest that --exclude-promisor-objects is supported by git-log,
since it currently BUG-crashes and it's not necessary to support it.
Options that control behavior for promisor objects should be limited to
a small number of commands.

Signed-off-by: Matthew DeVore <matvore@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: fix formatting in git-update-ref
Andreas Heiduk [Mon, 22 Oct 2018 20:45:46 +0000 (22:45 +0200)] 
doc: fix formatting in git-update-ref

Remove the parapgraph numbers from lines explaining the reflog format
and typeset these lines in monospace.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: fix indentation of listing blocks in gitweb.conf.txt
Andreas Heiduk [Mon, 22 Oct 2018 20:45:45 +0000 (22:45 +0200)] 
doc: fix indentation of listing blocks in gitweb.conf.txt

'gitweb.conf.txt' uses inconsistent indentation in listing blocks and a mix
of listing blocks and literal paragraphs. Both didn't look pretty in the
rendered HTML page.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: fix descripion for 'git tag --format'
Andreas Heiduk [Mon, 22 Oct 2018 20:45:44 +0000 (22:45 +0200)] 
doc: fix descripion for 'git tag --format'

The '--format=<format>' is now listed in the 'OPTIONS' section, not only
the '<format>' string itself. The description moved up a few paragraphs
because '<format>' is not a standalone paramater but a parameter for the
option '--format'.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: fix inappropriate monospace formatting
Andreas Heiduk [Mon, 22 Oct 2018 20:45:43 +0000 (22:45 +0200)] 
doc: fix inappropriate monospace formatting

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: fix ASCII art tab spacing
Andreas Heiduk [Mon, 22 Oct 2018 20:45:42 +0000 (22:45 +0200)] 
doc: fix ASCII art tab spacing

Followup to 5dd05ebf ("doc: fix merge-base ASCII art tab spacing", 2016-10-21)

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: clarify boundaries of 'git worktree list --porcelain'
Andreas Heiduk [Mon, 22 Oct 2018 20:45:41 +0000 (22:45 +0200)] 
doc: clarify boundaries of 'git worktree list --porcelain'

Defined delimiters for 'git worktree list --porcelain' make the format
easier to parse in scripts. For example

sed -n '/^worktree ID$/,/^$/p'

extracts only the information for the worktree 'ID'.

The format did not changed since [1], only the guaranty is added.

[1] bb9c03b82a (worktree: add 'list' command, 2015-10-08)

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodiff: don't attempt to strip prefix from absolute Windows paths
Johannes Sixt [Fri, 19 Oct 2018 16:58:07 +0000 (18:58 +0200)] 
diff: don't attempt to strip prefix from absolute Windows paths

git diff can be invoked with absolute paths. Typically, this triggers
the --no-index case. Then the absolute paths remain in the file names
that are printed in the output.

There is one peculiarity, though: When the command is invoked from a
a sub-directory in a repository, then it is attempted to strip the
sub-directory from the beginning of relative paths. Yet, to detect a
relative path the code just checks for an initial forward slash.
This mistakes a Windows style path like "D:/base" as a relative path
and the output looks like this, for example:

  D:\dir\test\one>git -P diff --numstat D:\dir\base D:\dir\diff
  1       1       ir/{base => diff}/1.txt

where the correct output should be

  D:\dir\test\one>git -P diff --numstat D:\dir\base D:\dir\diff
  1       1       D:/dir/{base => diff}/1.txt

If the sub-directory where 'git diff' is invoked is sufficiently deep
that the prefix becomes longer than the path to be printed, then the
subsequent code accesses the path out of bounds.

Use is_absolute_path() to detect Windows style absolute paths.

One might wonder whether the check for a directory separator that
is visible in the patch context should be changed from == '/' to
is_dir_sep() or not. It turns out not to be necessary. That code
only ever investigates paths that have undergone pathspec
normalization, after which there are only forward slashes even on
Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreceive: denyCurrentBranch=updateinstead should not blindly update
Junio C Hamano [Fri, 19 Oct 2018 04:57:35 +0000 (13:57 +0900)] 
receive: denyCurrentBranch=updateinstead should not blindly update

The handling of receive.denyCurrentBranch=updateInstead was added to
a switch statement that handles other values of the variable, but
all the other case arms only checked a condition to reject the
attempted push, or let later logic in the same function to still
intervene, so that a push that does not fast-forward (which is
checked after the switch statement in question) is still rejected.

But the handling of updateInstead incorrectly took immediate effect,
without giving other checks a chance to intervene.

Instead of calling update_worktree() that causes the side effect
immediately, just note the fact that we will need to call the
function later, and first give other checks a chance to reject the
request.  After the update-hook gets a chance to reject the push
(which happens as the last step in a series of checks), call
update_worktree() when we earlier detected the need to.

Reported-by: Rajesh Madamanchi
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopack-objects (mingw): initialize `packing_data` mutex in the correct spot
Johannes Schindelin [Tue, 16 Oct 2018 21:02:52 +0000 (14:02 -0700)] 
pack-objects (mingw): initialize `packing_data` mutex in the correct spot

In 9ac3f0e5b3e4 (pack-objects: fix performance issues on packing large
deltas, 2018-07-22), a mutex was introduced that is used to guard the
call to set the delta size. This commit even added code to initialize
it, but at an incorrect spot: in `init_threaded_search()`, while the
call to `oe_set_delta_size()` (and hence to `packing_data_lock()`) can
happen in the call chain `check_object()` <- `get_object_details()` <-
`prepare_pack()` <- `cmd_pack_objects()`, which is long before the
`prepare_pack()` function calls `ll_find_deltas()` (which initializes
the threaded search).

Another tell-tale that the mutex was initialized in an incorrect spot is
that the function to initialize it lives in builtin/, while the code
that uses the mutex is defined in a libgit.a header file.

Let's use a more appropriate function: `prepare_packing_data()`, which
not only lives in libgit.a, but *has* to be called before the
`packing_data` struct is used that contains that mutex.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>