OSDN Git Service

git-core/git.git
6 years agoMerge branch 'sd/branch-copy'
Junio C Hamano [Tue, 3 Oct 2017 06:42:48 +0000 (15:42 +0900)]
Merge branch 'sd/branch-copy'

"git branch" learned "-c/-C" to create a new branch by copying an
existing one.

* sd/branch-copy:
  branch: fix "copy" to never touch HEAD
  branch: add a --copy (-c) option to go with --move (-m)
  branch: add test for -m renaming multiple config sections
  config: create a function to format section headers

6 years agoMerge branch 'bc/rev-parse-parseopt-fix'
Junio C Hamano [Tue, 3 Oct 2017 06:42:47 +0000 (15:42 +0900)]
Merge branch 'bc/rev-parse-parseopt-fix'

Recent versions of "git rev-parse --parseopt" did not parse the
option specification that does not have the optional flags (*=?!)
correctly, which has been corrected.

* bc/rev-parse-parseopt-fix:
  parse-options: only insert newline in help text if needed
  parse-options: write blank line to correct output stream
  t0040,t1502: Demonstrate parse_options bugs
  git-rebase: don't ignore unexpected command line arguments
  rev-parse parseopt: interpret any whitespace as start of help text
  rev-parse parseopt: do not search help text for flag chars
  t1502: demonstrate rev-parse --parseopt option mis-parsing

6 years agoMerge branch 'js/rebase-i-final'
Junio C Hamano [Tue, 3 Oct 2017 06:42:47 +0000 (15:42 +0900)]
Merge branch 'js/rebase-i-final'

The final batch to "git rebase -i" updates to move more code from
the shell script to C.

* js/rebase-i-final:
  rebase -i: rearrange fixup/squash lines using the rebase--helper
  t3415: test fixup with wrapped oneline
  rebase -i: skip unnecessary picks using the rebase--helper
  rebase -i: check for missing commits in the rebase--helper
  t3404: relax rebase.missingCommitsCheck tests
  rebase -i: also expand/collapse the SHA-1s via the rebase--helper
  rebase -i: do not invent onelines when expanding/collapsing SHA-1s
  rebase -i: remove useless indentation
  rebase -i: generate the script via rebase--helper
  t3415: verify that an empty instructionFormat is handled as before

6 years agoThe eleventh batch for 2.15
Junio C Hamano [Fri, 29 Sep 2017 02:25:46 +0000 (11:25 +0900)]
The eleventh batch for 2.15

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'sb/doc-config-submodule-update'
Junio C Hamano [Fri, 29 Sep 2017 02:23:44 +0000 (11:23 +0900)]
Merge branch 'sb/doc-config-submodule-update'

* sb/doc-config-submodule-update:
  Documentation/config: clarify the meaning of submodule.<name>.update

6 years agoMerge branch 'ma/leakplugs'
Junio C Hamano [Fri, 29 Sep 2017 02:23:43 +0000 (11:23 +0900)]
Merge branch 'ma/leakplugs'

Memory leaks in various codepaths have been plugged.

* ma/leakplugs:
  pack-bitmap[-write]: use `object_array_clear()`, don't leak
  object_array: add and use `object_array_pop()`
  object_array: use `object_array_clear()`, not `free()`
  leak_pending: use `object_array_clear()`, not `free()`
  commit: fix memory leak in `reduce_heads()`
  builtin/commit: fix memory leak in `prepare_index()`

6 years agoMerge branch 'rj/no-sign-compare'
Junio C Hamano [Fri, 29 Sep 2017 02:23:42 +0000 (11:23 +0900)]
Merge branch 'rj/no-sign-compare'

Many codepaths have been updated to squelch -Wsign-compare
warnings.

* rj/no-sign-compare:
  ALLOC_GROW: avoid -Wsign-compare warnings
  cache.h: hex2chr() - avoid -Wsign-compare warnings
  commit-slab.h: avoid -Wsign-compare warnings
  git-compat-util.h: xsize_t() - avoid -Wsign-compare warnings

6 years agoMerge branch 'sb/merge-commit-msg-hook'
Junio C Hamano [Fri, 29 Sep 2017 02:23:42 +0000 (11:23 +0900)]
Merge branch 'sb/merge-commit-msg-hook'

As "git commit" to conclude a conflicted "git merge" honors the
commit-msg hook, "git merge" that records a merge commit that
cleanly auto-merges should, but it didn't.
* sb/merge-commit-msg-hook (2017-09-22) 1 commit
(merged to 'next' on 2017-09-25 at 096e0502a8)
+ Documentation/githooks: mention merge in commit-msg hook

Add documentation for a topic that has recently graduated to the
'master' branch.

* sb/merge-commit-msg-hook:
  Documentation/githooks: mention merge in commit-msg hook

6 years agoMerge branch 'jt/fast-export-copy-modify-fix'
Junio C Hamano [Fri, 29 Sep 2017 02:23:42 +0000 (11:23 +0900)]
Merge branch 'jt/fast-export-copy-modify-fix'

"git fast-export" with -M/-C option issued "copy" instruction on a
path that is simultaneously modified, which was incorrect.

* jt/fast-export-copy-modify-fix:
  fast-export: do not copy from modified file

6 years agoMerge branch 'mk/describe-match-with-all'
Junio C Hamano [Fri, 29 Sep 2017 02:23:41 +0000 (11:23 +0900)]
Merge branch 'mk/describe-match-with-all'

"git describe --match <pattern>" has been taught to play well with
the "--all" option.

* mk/describe-match-with-all:
  describe: teach --match to handle branches and remotes

6 years agoMerge branch 'jm/status-ignored-directory-optim'
Junio C Hamano [Fri, 29 Sep 2017 02:23:40 +0000 (11:23 +0900)]
Merge branch 'jm/status-ignored-directory-optim'

"git status --ignored", when noticing that a directory without any
tracked path is ignored, still enumerated all the ignored paths in
the directory, which is unnecessary.  The codepath has been
optimized to avoid this overhead.

* jm/status-ignored-directory-optim:
  Improve performance of git status --ignored

6 years agoThe tenth batch for 2.15
Junio C Hamano [Thu, 28 Sep 2017 05:51:45 +0000 (14:51 +0900)]
The tenth batch for 2.15

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'js/win32-lazyload-dll'
Junio C Hamano [Thu, 28 Sep 2017 05:47:57 +0000 (14:47 +0900)]
Merge branch 'js/win32-lazyload-dll'

Add a helper in anticipation for its need in a future topic RSN.

* js/win32-lazyload-dll:
  Win32: simplify loading of DLL functions

6 years agoMerge branch 'jc/merge-x-theirs-docfix'
Junio C Hamano [Thu, 28 Sep 2017 05:47:57 +0000 (14:47 +0900)]
Merge branch 'jc/merge-x-theirs-docfix'

The documentation for '-X<option>' for merges was misleadingly
written to suggest that "-s theirs" exists, which is not the case.

* jc/merge-x-theirs-docfix:
  merge-strategies: avoid implying that "-s theirs" exists

6 years agoMerge branch 'ks/doc-use-camelcase-for-config-name'
Junio C Hamano [Thu, 28 Sep 2017 05:47:56 +0000 (14:47 +0900)]
Merge branch 'ks/doc-use-camelcase-for-config-name'

Doc update.

* ks/doc-use-camelcase-for-config-name:
  doc: camelCase the config variables to improve readability

6 years agoMerge branch 'mk/diff-delta-avoid-large-offset'
Junio C Hamano [Thu, 28 Sep 2017 05:47:56 +0000 (14:47 +0900)]
Merge branch 'mk/diff-delta-avoid-large-offset'

The delta format used in the packfile cannot reference data at
offset larger than what can be expressed in 4-byte, but the
generator for the data failed to make sure the offset does not
overflow.  This has been corrected.

* mk/diff-delta-avoid-large-offset:
  diff-delta: do not allow delta offset truncation

6 years agoMerge branch 'mk/diff-delta-uint-may-be-shorter-than-ulong'
Junio C Hamano [Thu, 28 Sep 2017 05:47:56 +0000 (14:47 +0900)]
Merge branch 'mk/diff-delta-uint-may-be-shorter-than-ulong'

The machinery to create xdelta used in pack files received the
sizes of the data in size_t, but lost the higher bits of them by
storing them in "unsigned int" during the computation, which is
fixed.

* mk/diff-delta-uint-may-be-shorter-than-ulong:
  diff-delta: fix encoding size that would not fit in "unsigned int"

6 years agoMerge branch 'rs/resolve-ref-optional-result'
Junio C Hamano [Thu, 28 Sep 2017 05:47:56 +0000 (14:47 +0900)]
Merge branch 'rs/resolve-ref-optional-result'

Code clean-up.

* rs/resolve-ref-optional-result:
  refs: pass NULL to resolve_ref_unsafe() if hash is not needed
  refs: pass NULL to refs_resolve_ref_unsafe() if hash is not needed
  refs: make sha1 output parameter of refs_resolve_ref_unsafe() optional

6 years agoMerge branch 'rs/mailinfo-qp-decode-fix'
Junio C Hamano [Thu, 28 Sep 2017 05:47:55 +0000 (14:47 +0900)]
Merge branch 'rs/mailinfo-qp-decode-fix'

"git mailinfo" was loose in decoding quoted printable and produced
garbage when the two letters after the equal sign are not
hexadecimal.  This has been fixed.

* rs/mailinfo-qp-decode-fix:
  mailinfo: don't decode invalid =XY quoted-printable sequences

6 years agoMerge branch 'jk/doc-read-tree-table-asciidoctor-fix'
Junio C Hamano [Thu, 28 Sep 2017 05:47:55 +0000 (14:47 +0900)]
Merge branch 'jk/doc-read-tree-table-asciidoctor-fix'

A docfix.

* jk/doc-read-tree-table-asciidoctor-fix:
  doc: put literal block delimiter around table

6 years agoMerge branch 'ik/userdiff-html-h-element-fix'
Junio C Hamano [Thu, 28 Sep 2017 05:47:54 +0000 (14:47 +0900)]
Merge branch 'ik/userdiff-html-h-element-fix'

The built-in pattern to detect the "function header" for HTML did
not match <H1>..<H6> elements without any attributes, which has
been fixed.

* ik/userdiff-html-h-element-fix:
  userdiff: fix HTML hunk header regexp

6 years agoMerge branch 'jk/fallthrough'
Junio C Hamano [Thu, 28 Sep 2017 05:47:53 +0000 (14:47 +0900)]
Merge branch 'jk/fallthrough'

Many codepaths have been updated to squelch -Wimplicit-fallthrough
warnings from Gcc 7 (which is a good code hygiene).

* jk/fallthrough:
  consistently use "fallthrough" comments in switches
  curl_trace(): eliminate switch fallthrough
  test-line-buffer: simplify command parsing

6 years agoMerge branch 'jk/diff-blob'
Junio C Hamano [Thu, 28 Sep 2017 05:47:53 +0000 (14:47 +0900)]
Merge branch 'jk/diff-blob'

"git cat-file --textconv" started segfaulting recently, which
has been corrected.

* jk/diff-blob:
  cat-file: handle NULL object_context.path

6 years agoMerge branch 'hn/typofix'
Junio C Hamano [Thu, 28 Sep 2017 05:47:52 +0000 (14:47 +0900)]
Merge branch 'hn/typofix'

* hn/typofix:
  submodule.h: typofix

6 years agoMerge branch 'ic/fix-filter-branch-to-handle-tag-without-tagger'
Junio C Hamano [Thu, 28 Sep 2017 05:47:52 +0000 (14:47 +0900)]
Merge branch 'ic/fix-filter-branch-to-handle-tag-without-tagger'

"git filter-branch" cannot reproduce a history with a tag without
the tagger field, which only ancient versions of Git allowed to be
created.  This has been corrected.

* ic/fix-filter-branch-to-handle-tag-without-tagger:
  filter-branch: use hash-object instead of mktag
  filter-branch: stash away ref map in a branch
  filter-branch: preserve and restore $GIT_AUTHOR_* and $GIT_COMMITTER_*
  filter-branch: reset $GIT_* before cleaning up

6 years agoMerge branch 'jk/describe-omit-some-refs'
Junio C Hamano [Thu, 28 Sep 2017 05:47:52 +0000 (14:47 +0900)]
Merge branch 'jk/describe-omit-some-refs'

"git describe --match" learned to take multiple patterns in v2.13
series, but the feature ignored the patterns after the first one
and did not work at all.  This has been fixed.

* jk/describe-omit-some-refs:
  describe: fix matching to actually match all patterns

6 years agoSync with 2.14.2
Junio C Hamano [Tue, 26 Sep 2017 05:15:55 +0000 (14:15 +0900)]
Sync with 2.14.2

* maint:
  Git 2.14.2
  Git 2.13.6
  Git 2.12.5
  Git 2.11.4
  Git 2.10.5
  cvsimport: shell-quote variable used in backticks
  archimport: use safe_pipe_capture for user input
  shell: drop git-cvsserver support by default
  cvsserver: use safe_pipe_capture for `constant commands` as well
  cvsserver: use safe_pipe_capture instead of backticks
  cvsserver: move safe_pipe_capture() to the main package

6 years agoWin32: simplify loading of DLL functions
Johannes Schindelin [Mon, 25 Sep 2017 16:06:24 +0000 (18:06 +0200)]
Win32: simplify loading of DLL functions

Dynamic loading of DLL functions is duplicated in several places in Git
for Windows' source code.

This patch adds a pair of macros to simplify the process: the
DECLARE_PROC_ADDR(<dll>, <return-type>, <function-name>,
...<function-parameter-types>...) macro to be used at the beginning of a
code block, and the INIT_PROC_ADDR(<function-name>) macro to call before
using the declared function. The return value of the INIT_PROC_ADDR()
call has to be checked; If it is NULL, the function was not found in the
specified DLL.

Example:

        DECLARE_PROC_ADDR(kernel32.dll, BOOL, CreateHardLinkW,
                          LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES);

        if (!INIT_PROC_ADDR(CreateHardLinkW))
                return error("Could not find CreateHardLinkW() function";

if (!CreateHardLinkW(source, target, NULL))
return error("could not create hardlink from %S to %S",
     source, target);
return 0;

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: camelCase the config variables to improve readability
Kaartic Sivaraam [Sat, 23 Sep 2017 04:56:17 +0000 (10:26 +0530)]
doc: camelCase the config variables to improve readability

References to multi-word configuration variable names in our
documentation must consistently use camelCase to highlight where
the word boundaries are, even though these are treated case
insensitively.

Fix a few places that spell them in all lowercase, which makes
them harder to read.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoThe ninth batch for 2.15
Junio C Hamano [Mon, 25 Sep 2017 06:28:27 +0000 (15:28 +0900)]
The ninth batch for 2.15

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ks/test-readme-phrasofix'
Junio C Hamano [Mon, 25 Sep 2017 06:24:10 +0000 (15:24 +0900)]
Merge branch 'ks/test-readme-phrasofix'

Doc updates.

* ks/test-readme-phrasofix:
  t/README: fix typo and grammatically improve a sentence

6 years agoMerge branch 'ow/rev-parse-is-shallow-repo'
Junio C Hamano [Mon, 25 Sep 2017 06:24:10 +0000 (15:24 +0900)]
Merge branch 'ow/rev-parse-is-shallow-repo'

"git rev-parse" learned "--is-shallow-repository", that is to be
used in a way similar to existing "--is-bare-repository" and
friends.

* ow/rev-parse-is-shallow-repo:
  rev-parse: rev-parse: add --is-shallow-repository

6 years agoMerge branch 'rj/test-ulimit-on-windows'
Junio C Hamano [Mon, 25 Sep 2017 06:24:09 +0000 (15:24 +0900)]
Merge branch 'rj/test-ulimit-on-windows'

On Cygwin, "ulimit -s" does not report failure but it does not work
at all, which causes an unexpected success of some tests that
expect failures under a limited stack situation.  This has been
fixed.

* rj/test-ulimit-on-windows:
  t9010-*.sh: skip all tests if the PIPE prereq is missing
  test-lib: use more compact expression in PIPE prerequisite
  test-lib: don't use ulimit in test prerequisites on cygwin

6 years agoMerge branch 'jk/info-alternates-fix'
Junio C Hamano [Mon, 25 Sep 2017 06:24:09 +0000 (15:24 +0900)]
Merge branch 'jk/info-alternates-fix'

A regression fix for 2.11 that made the code to read the list of
alternate object stores overrun the end of the string.

* jk/info-alternates-fix:
  read_info_alternates: warn on non-trivial errors
  read_info_alternates: read contents into strbuf

6 years agoMerge branch 'mh/for-each-string-list-item-empty-fix'
Junio C Hamano [Mon, 25 Sep 2017 06:24:09 +0000 (15:24 +0900)]
Merge branch 'mh/for-each-string-list-item-empty-fix'

Code cmp.std.c nitpick.

* mh/for-each-string-list-item-empty-fix:
  for_each_string_list_item: avoid undefined behavior for empty list

6 years agoMerge branch 'tb/test-lint-echo-e'
Junio C Hamano [Mon, 25 Sep 2017 06:24:09 +0000 (15:24 +0900)]
Merge branch 'tb/test-lint-echo-e'

The test linter has been taught that we do not like "echo -e".

* tb/test-lint-echo-e:
  test-lint: echo -e (or -E) is not portable

6 years agoMerge branch 'jk/revision-remove-cmdline-pathspec'
Junio C Hamano [Mon, 25 Sep 2017 06:24:09 +0000 (15:24 +0900)]
Merge branch 'jk/revision-remove-cmdline-pathspec'

Code clean-up that also plugs memory leaks.

* jk/revision-remove-cmdline-pathspec:
  pathspec doc: parse_pathspec does not maintain references to args
  revision: replace "struct cmdline_pathspec" with argv_array

6 years agoMerge branch 'ls/travis-scriptify'
Junio C Hamano [Mon, 25 Sep 2017 06:24:09 +0000 (15:24 +0900)]
Merge branch 'ls/travis-scriptify'

The scripts to drive TravisCI has been reorganized and then an
optimization to avoid spending cycles on a branch whose tip is
tagged has been implemented.

* ls/travis-scriptify:
  travis-ci: fix "skip_branch_tip_with_tag()" string comparison
  travis: dedent a few scripts that are indented overly deeply
  travis-ci: skip a branch build if equal tag is present
  travis-ci: move Travis CI code into dedicated scripts

6 years agoMerge branch 'aw/gc-lockfile-fscanf-fix'
Junio C Hamano [Mon, 25 Sep 2017 06:24:08 +0000 (15:24 +0900)]
Merge branch 'aw/gc-lockfile-fscanf-fix'

"git gc" tries to avoid running two instances at the same time by
reading and writing pid/host from and to a lock file; it used to
use an incorrect fscanf() format when reading, which has been
corrected.

* aw/gc-lockfile-fscanf-fix:
  gc: call fscanf() with %<len>s, not %<len>c, when reading hostname

6 years agoMerge branch 'hv/mv-nested-submodules-test'
Junio C Hamano [Mon, 25 Sep 2017 06:24:08 +0000 (15:24 +0900)]
Merge branch 'hv/mv-nested-submodules-test'

A test to demonstrate "git mv" failing to adjust nested submodules
has been added.

* hv/mv-nested-submodules-test:
  add test for bug in git-mv for recursive submodules

6 years agoMerge branch 'bw/git-clang-format'
Junio C Hamano [Mon, 25 Sep 2017 06:24:07 +0000 (15:24 +0900)]
Merge branch 'bw/git-clang-format'

"make style" runs git-clang-format to help developers by pointing
out coding style issues.

* bw/git-clang-format:
  Makefile: add style build rule
  clang-format: outline the git project's coding style

6 years agoMerge branch 'nm/imap-send-with-curl'
Junio C Hamano [Mon, 25 Sep 2017 06:24:07 +0000 (15:24 +0900)]
Merge branch 'nm/imap-send-with-curl'

"git imap-send" has our own implementation of the protocol and also
can use more recent libCurl with the imap protocol support.  Update
the latter so that it can use the credential subsystem, and then
make it the default option to use, so that we can eventually
deprecate and remove the former.

* nm/imap-send-with-curl:
  imap-send: use curl by default when possible
  imap_send: setup_curl: retreive credentials if not set in config file
  imap-send: add wrapper to get server credentials if needed
  imap-send: return with error if curl failed

6 years agoMerge branch 'ks/commit-do-not-touch-cut-line'
Junio C Hamano [Mon, 25 Sep 2017 06:24:07 +0000 (15:24 +0900)]
Merge branch 'ks/commit-do-not-touch-cut-line'

The explanation of the cut-line in the commit log editor has been
slightly tweaked.

* ks/commit-do-not-touch-cut-line:
  commit-template: change a message to be more intuitive

6 years agoMerge branch 'tg/refs-allowed-flags'
Junio C Hamano [Mon, 25 Sep 2017 06:24:07 +0000 (15:24 +0900)]
Merge branch 'tg/refs-allowed-flags'

API error-proofing which happens to also squelch warnings from GCC.

* tg/refs-allowed-flags:
  refs: strip out not allowed flags from ref_transaction_update

6 years agoMerge branch 'rs/archive-excluded-directory'
Junio C Hamano [Mon, 25 Sep 2017 06:24:07 +0000 (15:24 +0900)]
Merge branch 'rs/archive-excluded-directory'

"git archive", especially when used with pathspec, stored an empty
directory in its output, even though Git itself never does so.
This has been fixed.

* rs/archive-excluded-directory:
  archive: don't add empty directories to archives

6 years agoMerge branch 'ks/help-alias-label'
Junio C Hamano [Mon, 25 Sep 2017 06:24:07 +0000 (15:24 +0900)]
Merge branch 'ks/help-alias-label'

"git help co" now says "co is aliased to ...", not "git co is".

* ks/help-alias-label:
  help: change a message to be more precise

6 years agoMerge branch 'jn/per-repo-object-store-fixes'
Junio C Hamano [Mon, 25 Sep 2017 06:24:06 +0000 (15:24 +0900)]
Merge branch 'jn/per-repo-object-store-fixes'

Step #0 of a planned & larger series to make the in-core object
store per in-core repository object.

* jn/per-repo-object-store-fixes:
  replace-objects: evaluate replacement refs without using the object store
  push, fetch: error out for submodule entries not pointing to commits
  pack: make packed_git_mru global a value instead of a pointer

6 years agoMerge branch 'jk/write-in-full-fix'
Junio C Hamano [Mon, 25 Sep 2017 06:24:06 +0000 (15:24 +0900)]
Merge branch 'jk/write-in-full-fix'

Many codepaths did not diagnose write failures correctly when disks
go full, due to their misuse of write_in_full() helper function,
which have been corrected.

* jk/write-in-full-fix:
  read_pack_header: handle signed/unsigned comparison in read result
  config: flip return value of store_write_*()
  notes-merge: use ssize_t for write_in_full() return value
  pkt-line: check write_in_full() errors against "< 0"
  convert less-trivial versions of "write_in_full() != len"
  avoid "write_in_full(fd, buf, len) != len" pattern
  get-tar-commit-id: check write_in_full() return against 0
  config: avoid "write_in_full(fd, buf, len) < len" pattern

6 years agoMerge branch 'ez/doc-duplicated-words-fix'
Junio C Hamano [Mon, 25 Sep 2017 06:24:06 +0000 (15:24 +0900)]
Merge branch 'ez/doc-duplicated-words-fix'

Typofix.

* ez/doc-duplicated-words-fix:
  doc: fix minor typos (extra/duplicated words)

6 years agoMerge branch 'kd/doc-for-each-ref'
Junio C Hamano [Mon, 25 Sep 2017 06:24:06 +0000 (15:24 +0900)]
Merge branch 'kd/doc-for-each-ref'

Doc update.

* kd/doc-for-each-ref:
  doc/for-each-ref: explicitly specify option names
  doc/for-each-ref: consistently use '=' to between argument names and values

6 years agoMerge branch 'cc/subprocess-handshake-missing-capabilities'
Junio C Hamano [Mon, 25 Sep 2017 06:24:06 +0000 (15:24 +0900)]
Merge branch 'cc/subprocess-handshake-missing-capabilities'

Finishing touches to a topic already in 'master'.

* cc/subprocess-handshake-missing-capabilities:
  subprocess: loudly die when subprocess asks for an unsupported capability

6 years agoMerge branch 'kw/write-index-reduce-alloc'
Junio C Hamano [Mon, 25 Sep 2017 06:24:05 +0000 (15:24 +0900)]
Merge branch 'kw/write-index-reduce-alloc'

A hotfix to a topic already in 'master'.

* kw/write-index-reduce-alloc:
  read-cache: fix index corruption with index v4
  Add t/helper/test-write-cache to .gitignore

6 years agoMerge branch 'mg/name-rev-tests-with-short-stack'
Junio C Hamano [Mon, 25 Sep 2017 06:24:05 +0000 (15:24 +0900)]
Merge branch 'mg/name-rev-tests-with-short-stack'

A handful of tests to demonstrates a recursive implementation of
"name-rev" hurts.

* mg/name-rev-tests-with-short-stack:
  t6120: test describe and name-rev with deep repos
  t6120: clean up state after breaking repo
  t6120: test name-rev --all and --stdin
  t7004: move limited stack prereq to test-lib

6 years agoparse-options: only insert newline in help text if needed
Brandon Casey [Mon, 25 Sep 2017 04:08:05 +0000 (21:08 -0700)]
parse-options: only insert newline in help text if needed

Currently, when parse_options() produces a help message it always emits
a blank line after the usage text to separate it from the options text.
If the option spec does not define any switches, or only defines hidden
switches that will not be displayed, then the help text will end up with
two trailing blank lines instead of one.  Let's defer emitting the blank
line between the usage text and the options text until it is clear that
the options section will not be empty.

Fixes t1502.5, t1502.6.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoparse-options: write blank line to correct output stream
Brandon Casey [Mon, 25 Sep 2017 04:08:04 +0000 (21:08 -0700)]
parse-options: write blank line to correct output stream

When commit 54e6dc7 added translation support to parse-options, an
fprintf was mistakenly replaced by a call to putchar().  Let's use fputc
instead.

Fixes t0040.11, t0040.12, t0040.33, and t1502.8.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot0040,t1502: Demonstrate parse_options bugs
Brandon Casey [Mon, 25 Sep 2017 04:08:03 +0000 (21:08 -0700)]
t0040,t1502: Demonstrate parse_options bugs

When the option spec contains no switches or only hidden switches,
parse_options will emit an extra blank line at the end of help output so
that the help text will end in two blank lines instead of one.

When parse_options produces internal help output after an error has
occurred it will emit blank lines within the usage string to stdout
instead of stderr.

Update t/helper/test-parse-options.c to have a description body in the
usage string to exercise this second bug and mark tests as failing in
t0040.

Add tests to t1502 to demonstrate both of these problems.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-strategies: avoid implying that "-s theirs" exists
Junio C Hamano [Mon, 25 Sep 2017 05:34:23 +0000 (14:34 +0900)]
merge-strategies: avoid implying that "-s theirs" exists

The description of `-Xours` merge option has a parenthetical note
that tells the readers that it is very different from `-s ours`,
which is correct, but the description of `-Xtheirs` that follows it
carelessly says "this is the opposite of `ours`", giving a false
impression that the readers also need to be warned that it is very
different from `-s theirs`, which in reality does not even exist.

Clarify it a bit to avoid misleading readers.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoDocumentation/config: clarify the meaning of submodule.<name>.update
Stefan Beller [Fri, 22 Sep 2017 22:52:50 +0000 (15:52 -0700)]
Documentation/config: clarify the meaning of submodule.<name>.update

With more commands (that potentially change a submodule) paying attention
to submodules as well as the recent discussion[1] on
submodule.<name>.update, let's spell out that submodule.<name>.update
is strictly to be used for configuring the "submodule update" command
and not to be obeyed by other commands.

These other commands usually have a strict meaning of what they should
do (i.e. checkout, reset, rebase, merge) as well as have their name
overlapping with the modes possible for submodule.<name>.update.

[1] https://public-inbox.org/git/4283F0B0-BC1C-4ED1-8126-7E512D84484B@gmail.com/
    submodule.<name>.update was set to "none", triggering unexpected
    behavior as the submodule was thought to never be touched.
    However a newer version of Git taught 'git pull --rebase' to also
    populate and rebase submodules if they were active.
    The newer options such as submodule.active and command specific
    flags would not have triggered unexpected behavior.

Reported-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomailinfo: don't decode invalid =XY quoted-printable sequences
René Scharfe [Sat, 23 Sep 2017 18:04:40 +0000 (20:04 +0200)]
mailinfo: don't decode invalid =XY quoted-printable sequences

Decode =XY in quoted-printable segments only if X and Y are hexadecimal
digits, otherwise just copy them.  That's at least better than
interpreting negative results from hexval() as a character.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefs: pass NULL to resolve_ref_unsafe() if hash is not needed
René Scharfe [Sat, 23 Sep 2017 09:45:04 +0000 (11:45 +0200)]
refs: pass NULL to resolve_ref_unsafe() if hash is not needed

This allows us to get rid of some write-only variables, among them seven
SHA1 buffers.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefs: pass NULL to refs_resolve_ref_unsafe() if hash is not needed
René Scharfe [Sat, 23 Sep 2017 09:44:57 +0000 (11:44 +0200)]
refs: pass NULL to refs_resolve_ref_unsafe() if hash is not needed

This allows us to get rid of two write-only variables, one of them
being a SHA1 buffer.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefs: make sha1 output parameter of refs_resolve_ref_unsafe() optional
René Scharfe [Sat, 23 Sep 2017 09:41:45 +0000 (11:41 +0200)]
refs: make sha1 output parameter of refs_resolve_ref_unsafe() optional

Allow callers of refs_resolve_ref_unsafe() to pass NULL if they don't
need the resolved hash value.  We already allow the same for the flags
parameter.  This new leniency is inherited by the various wrappers like
resolve_ref_unsafe().

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agouserdiff: fix HTML hunk header regexp
Ilya Kantor [Sat, 23 Sep 2017 07:53:47 +0000 (10:53 +0300)]
userdiff: fix HTML hunk header regexp

Current HTML header regexp doesn't match headers without attributes.

So it fails to match <h1>...</h1>, while <h1 class="smth">...</h1> matches.

Make attributes optional to fix this.  The regexp is still far from
perfect, but now it at least handles the common case.

Signed-off-by: Ilya Kantor <iliakan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: put literal block delimiter around table
Jeff King [Sat, 23 Sep 2017 05:55:26 +0000 (01:55 -0400)]
doc: put literal block delimiter around table

The git-read-tree manpage has a table that is meant to
be shown with its spacing exactly as it is in the source. We
mark it as a "literal paragraph" by indenting each line by
at least one space. This renders OK with asciidoc for both
the HTML and manpage versions.

But there are two problems when we render it with
asciidoctor.

The first is that some lines mix tabs and spaces.  Even if
asciidoctor is correctly configured for 8-space tabs, it
seems to handle this case differently, soaking up some of
the initial literal-paragraph spaces and mis-aligning the
table text.

The second problem is that the table uses blank lines to
group rows. But as blank lines separate paragraphs in
asciidoc, this actually means that each chunk of the table
is rendered in its own pre-formatted <div> block. This
happens even with vanilla asciidoc, but there's no visible
result because the literal paragraphs aren't styled in any
special way. But with asciidoctor (or at least the styles
used on git-scm.com), literal paragraphs are styled with a
different background.  This breaks the table into a visually
distracting sequence of chunks.

We can fix both by adding a literal-paragraph block
delimiter. That turns the whole table into a single block
(for both implementations) and causes asciidoctor to render
the indentation as it is in the source.

Reported-at: https://github.com/git/git-scm.com/issues/1023
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopack-bitmap[-write]: use `object_array_clear()`, don't leak
Martin Ågren [Fri, 22 Sep 2017 23:34:54 +0000 (01:34 +0200)]
pack-bitmap[-write]: use `object_array_clear()`, don't leak

Instead of setting the fields of rev->pending to 0/NULL, thereby leaking
memory, call `object_array_clear(&rev->pending)`.

In pack-bitmap.c, we make copies of those fields as `pending_nr` and
`pending_e`. We never update the aliases and the original fields never
change, so the aliases are not really needed and just make it harder
than necessary to understand the code. While we're here, remove the
aliases to make the code easier to follow.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoobject_array: add and use `object_array_pop()`
Martin Ågren [Fri, 22 Sep 2017 23:34:53 +0000 (01:34 +0200)]
object_array: add and use `object_array_pop()`

In a couple of places, we pop objects off an object array `foo` by
decreasing `foo.nr`. We access `foo.nr` in many places, but most if not
all other times we do so read-only, e.g., as we iterate over the array.
But when we change `foo.nr` behind the array's back, it feels a bit
nasty and looks like it might leak memory.

Leaks happen if the popped element has an allocated `name` or `path`.
At the moment, that is not the case. Still, 1) the object array might
gain more fields that want to be freed, 2) a code path where we pop
might start using names or paths, 3) one of these code paths might be
copied to somewhere where we do, and 4) using a dedicated function for
popping is conceptually cleaner.

Introduce and use `object_array_pop()` instead. Release memory in the
new function. Document that popping an object leaves the associated
elements in limbo.

The converted places were identified by grepping for "\.nr\>" and
looking for "--".

Make the new function return NULL on an empty array. This is consistent
with `pop_commit()` and allows the following:

while ((o = object_array_pop(&foo)) != NULL) {
// do something
}

But as noted above, we don't need to go out of our way to avoid reading
`foo.nr`. This is probably more readable:

while (foo.nr) {
... o = object_array_pop(&foo);
// do something
}

The name of `object_array_pop()` does not quite align with
`add_object_array()`. That is unfortunate. On the other hand, it matches
`object_array_clear()`. Arguably it's `add_...` that is the odd one out,
since it reads like it's used to "add" an "object array". For that
reason, side with `object_array_clear()`.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoobject_array: use `object_array_clear()`, not `free()`
Martin Ågren [Fri, 22 Sep 2017 23:34:52 +0000 (01:34 +0200)]
object_array: use `object_array_clear()`, not `free()`

Instead of freeing `foo.objects` for an object array `foo` (sometimes
conditionally), call `object_array_clear(&foo)`. This means we don't
poke as much into the implementation, which is already a good thing, but
also that we release the individual entries as well, thereby fixing at
least one memory-leak (in diff-lib.c).

If someone is holding on to a pointer to an element's `name` or `path`,
that is now a dangling pointer, i.e., we'd be turning an unpleasant
situation into an outright bug. To the best of my understanding no such
long-term pointers are being taken.

The way we handle `study` in builting/reflog.c still looks like it might
leak. That will be addressed in the next commit.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoleak_pending: use `object_array_clear()`, not `free()`
Martin Ågren [Fri, 22 Sep 2017 23:34:51 +0000 (01:34 +0200)]
leak_pending: use `object_array_clear()`, not `free()`

Setting `leak_pending = 1` tells `prepare_revision_walk()` not to
release the `pending` array, and makes that the caller's responsibility.
See 4a43d374f (revision: add leak_pending flag, 2011-10-01) and
353f5657a (bisect: use leak_pending flag, 2011-10-01).

Commit 1da1e07c8 (clean up name allocation in prepare_revision_walk,
2014-10-15) fixed a memory leak in `prepare_revision_walk()` by
switching from `free()` to `object_array_clear()`. However, where we use
the `leak_pending`-mechanism, we're still only calling `free()`.

Use `object_array_clear()` instead. Copy some helpful comments from
353f5657a to the other callers that we update to clarify the memory
responsibilities, and to highlight that the commits are not affected
when we clear the array -- it is indeed correct to both tidy up the
commit flags and clear the object array.

Document `leak_pending` in revision.h to help future users get this
right.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocommit: fix memory leak in `reduce_heads()`
Martin Ågren [Fri, 22 Sep 2017 23:34:50 +0000 (01:34 +0200)]
commit: fix memory leak in `reduce_heads()`

We don't free the temporary scratch space we use with
`remove_redundant()`. Free it similar to how we do it in
`get_merge_bases_many_0()`.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobuiltin/commit: fix memory leak in `prepare_index()`
Martin Ågren [Fri, 22 Sep 2017 23:34:49 +0000 (01:34 +0200)]
builtin/commit: fix memory leak in `prepare_index()`

Release `pathspec` and the string list `partial`.

When we clear the string list, make sure we do not free the `util`
pointers. That would result in double-freeing, since we set them up as
`item->util = item` in `list_paths()`.

Initialize the string list early, so that we can always release it. That
introduces some unnecessary overhead in various code paths, but means
there is one and only one way out of the function. If we ever accumulate
more things we need to free, it should be straightforward to do so.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobranch: fix "copy" to never touch HEAD
Junio C Hamano [Fri, 22 Sep 2017 03:24:50 +0000 (12:24 +0900)]
branch: fix "copy" to never touch HEAD

When creating a new branch B by copying the branch A that happens to
be the current branch, it also updates HEAD to point at the new
branch.  It probably was made this way because "git branch -c A B"
piggybacked its implementation on "git branch -m A B",

This does not match the usual expectation.  If I were sitting on a
blue chair, and somebody comes and repaints it to red, I would
accept ending up sitting on a chair that is now red (I am also OK to
stand, instead, as there no longer is my favourite blue chair).  But
if somebody creates a new red chair, modelling it after the blue
chair I am sitting on, I do not expect to be booted off of the blue
chair and ending up on sitting on the new red one.

Let's fix this before it hits 'next'.  Those who want to create a
new branch and switch to it can do "git checkout B" after doing a
"git branch -c B", and if that operation is so useful and deserves a
short-hand way to do so, perhaps extend "git checkout -b B" to copy
configurations while creating the new branch B.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoGit 2.14.2 v2.14.2
Junio C Hamano [Fri, 22 Sep 2017 05:51:37 +0000 (14:51 +0900)]
Git 2.14.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSync with 2.13.6
Junio C Hamano [Fri, 22 Sep 2017 05:50:02 +0000 (14:50 +0900)]
Sync with 2.13.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoGit 2.13.6 v2.13.6
Junio C Hamano [Fri, 22 Sep 2017 05:49:24 +0000 (14:49 +0900)]
Git 2.13.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSync with 2.12.5
Junio C Hamano [Fri, 22 Sep 2017 05:48:08 +0000 (14:48 +0900)]
Sync with 2.12.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoGit 2.12.5 v2.12.5
Junio C Hamano [Fri, 22 Sep 2017 05:47:41 +0000 (14:47 +0900)]
Git 2.12.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSync with 2.11.4
Junio C Hamano [Fri, 22 Sep 2017 05:45:30 +0000 (14:45 +0900)]
Sync with 2.11.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoGit 2.11.4 v2.11.4
Junio C Hamano [Fri, 22 Sep 2017 05:44:45 +0000 (14:44 +0900)]
Git 2.11.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSync with 2.10.5
Junio C Hamano [Fri, 22 Sep 2017 05:43:13 +0000 (14:43 +0900)]
Sync with 2.10.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoGit 2.10.5 v2.10.5
Junio C Hamano [Fri, 22 Sep 2017 05:42:22 +0000 (14:42 +0900)]
Git 2.10.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'jk/safe-pipe-capture' into maint-2.10
Junio C Hamano [Fri, 22 Sep 2017 05:34:34 +0000 (14:34 +0900)]
Merge branch 'jk/safe-pipe-capture' into maint-2.10

6 years agoMerge branch 'jk/cvsimport-quoting' into maint-2.10
Junio C Hamano [Fri, 22 Sep 2017 05:34:34 +0000 (14:34 +0900)]
Merge branch 'jk/cvsimport-quoting' into maint-2.10

6 years agoMerge branch 'jc/cvsserver' into maint-2.10
Junio C Hamano [Fri, 22 Sep 2017 05:34:34 +0000 (14:34 +0900)]
Merge branch 'jc/cvsserver' into maint-2.10

6 years agoMerge branch 'jk/git-shell-drop-cvsserver' into maint-2.10
Junio C Hamano [Fri, 22 Sep 2017 05:34:34 +0000 (14:34 +0900)]
Merge branch 'jk/git-shell-drop-cvsserver' into maint-2.10

6 years agoALLOC_GROW: avoid -Wsign-compare warnings
Ramsay Jones [Thu, 21 Sep 2017 16:49:38 +0000 (17:49 +0100)]
ALLOC_GROW: avoid -Wsign-compare warnings

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocache.h: hex2chr() - avoid -Wsign-compare warnings
Ramsay Jones [Thu, 21 Sep 2017 16:48:38 +0000 (17:48 +0100)]
cache.h: hex2chr() - avoid -Wsign-compare warnings

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocommit-slab.h: avoid -Wsign-compare warnings
Ramsay Jones [Thu, 21 Sep 2017 16:47:36 +0000 (17:47 +0100)]
commit-slab.h: avoid -Wsign-compare warnings

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-compat-util.h: xsize_t() - avoid -Wsign-compare warnings
Ramsay Jones [Thu, 21 Sep 2017 16:46:24 +0000 (17:46 +0100)]
git-compat-util.h: xsize_t() - avoid -Wsign-compare warnings

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofilter-branch: use hash-object instead of mktag
Ian Campbell [Thu, 21 Sep 2017 07:49:32 +0000 (08:49 +0100)]
filter-branch: use hash-object instead of mktag

This allows us to recreate even historical tags which would now be consider
invalid, such as v2.6.12-rc2..v2.6.13-rc3 in the Linux kernel source tree which
lack the `tagger` header.

    $ git rev-parse v2.6.12-rc2
    9e734775f7c22d2f89943ad6c745571f1930105f
    $ git cat-file tag v2.6.12-rc2 | git mktag
    error: char76: could not find "tagger "
    fatal: invalid tag signature file
    $ git cat-file tag v2.6.12-rc2 | git hash-object -t tag -w --stdin
    9e734775f7c22d2f89943ad6c745571f1930105f

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofilter-branch: stash away ref map in a branch
Ian Campbell [Thu, 21 Sep 2017 07:49:31 +0000 (08:49 +0100)]
filter-branch: stash away ref map in a branch

With "--state-branch=<branchname>" option, the mapping from old object names
and filtered ones in ./map/ directory is stashed away in the object database,
and the one from the previous run is read to populate the ./map/ directory,
allowing for incremental updates of large trees.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofilter-branch: preserve and restore $GIT_AUTHOR_* and $GIT_COMMITTER_*
Ian Campbell [Thu, 21 Sep 2017 07:49:30 +0000 (08:49 +0100)]
filter-branch: preserve and restore $GIT_AUTHOR_* and $GIT_COMMITTER_*

These are modified by set_ident() but a subsequent patch would like to operate
on their original values.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofilter-branch: reset $GIT_* before cleaning up
Ian Campbell [Thu, 21 Sep 2017 07:49:29 +0000 (08:49 +0100)]
filter-branch: reset $GIT_* before cleaning up

This is pure code motion to enable a subsequent patch to add code which needs
to happen with the reset $GIT_* but before the temporary directory has been
cleaned up.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoconsistently use "fallthrough" comments in switches
Jeff King [Thu, 21 Sep 2017 06:25:41 +0000 (02:25 -0400)]
consistently use "fallthrough" comments in switches

Gcc 7 adds -Wimplicit-fallthrough, which can warn when a
switch case falls through to the next case. The general idea
is that the compiler can't tell if this was intentional or
not, so you should annotate any intentional fall-throughs as
such, leaving it to complain about any unannotated ones.

There's a GNU __attribute__ which can be used for
annotation, but of course we'd have to #ifdef it away on
non-gcc compilers. Gcc will also recognize
specially-formatted comments, which matches our current
practice. Let's extend that practice to all of the
unannotated sites (which I did look over and verify that
they were behaving as intended).

Ideally in each case we'd actually give some reasons in the
comment about why we're falling through, or what we're
falling through to. And gcc does support that with
-Wimplicit-fallthrough=2, which relaxes the comment pattern
matching to anything that contains "fallthrough" (or a
variety of spelling variants). However, this isn't the
default for -Wimplicit-fallthrough, nor for -Wextra. In the
name of simplicity, it's probably better for us to support
the default level, which requires "fallthrough" to be the
only thing in the comment (modulo some window dressing like
"else" and some punctuation; see the gcc manual for the
complete set of patterns).

This patch suppresses all warnings due to
-Wimplicit-fallthrough. We might eventually want to add that
to the DEVELOPER Makefile knob, but we should probably wait
until gcc 7 is more widely adopted (since earlier versions
will complain about the unknown warning type).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocurl_trace(): eliminate switch fallthrough
Jeff King [Thu, 21 Sep 2017 06:23:24 +0000 (02:23 -0400)]
curl_trace(): eliminate switch fallthrough

Our trace handler is called by curl with a curl_infotype
variable to interpret its data field. For most types we
print the data and then break out of the switch. But for
CURLINFO_TEXT, we print data and then fall through to the
"default" case, which does the exact same thing (nothing!)
that breaking out of the switch would.

This is probably a leftover from an early iteration of the
patch where the code after the switch _did_ do something
interesting that was unique to the non-text case arms.
But in its current form, this fallthrough is merely
confusing (and causes gcc's -Wimplicit-fallthrough to
complain).

Let's make CURLINFO_TEXT like the other case arms, and push
the default arm to the end where it's more obviously a
catch-all.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agotest-line-buffer: simplify command parsing
Jeff King [Thu, 21 Sep 2017 06:22:43 +0000 (02:22 -0400)]
test-line-buffer: simplify command parsing

The handle_command() function matches an incoming command
string with a sequence of starts_with() checks. But it also
surrounds these with a switch on the first character of the
command, which lets us jump to the right block of
starts_with() without going linearly through the list.

However, each case arm of the switch falls through to the
one below it. This is pointless (we know that a command
starting with 'b' does not need to check any of the commands
in the 'c' block), and it makes gcc's -Wimplicit-fallthrough
complain.

We could solve this by adding a break at the end of each
block. However, this optimization isn't helping anything.
Even if it does make matching faster (which is debatable),
this is code that is run only in the test suite, and each
run receives at most two of these "commands". We should
favor simplicity and readability over micro-optimizing.

Instead, let's drop the switch statement completely and
replace it with an if/else cascade.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocat-file: handle NULL object_context.path
Jeff King [Thu, 21 Sep 2017 06:21:40 +0000 (02:21 -0400)]
cat-file: handle NULL object_context.path

Commit dc944b65f1 (get_sha1_with_context: dynamically
allocate oc->path, 2017-05-19) changed the rules that
callers must follow for seeing if we parsed a path in the
object name. The rules switched from "check if the oc.path
buffer is empty" to "check if the oc.path pointer is NULL".
But that commit forgot to update some sites in
cat_one_file(), meaning we might dereference a NULL pointer.

You can see this by making a path-aware request like
--textconv without specifying --path, and giving an object
name that doesn't have a path in it. Like:

  git cat-file --textconv HEAD

which will reliably segfault.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule.h: typofix
Han-Wen Nienhuys [Thu, 21 Sep 2017 12:43:37 +0000 (14:43 +0200)]
submodule.h: typofix

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoDocumentation/githooks: mention merge in commit-msg hook
Stefan Beller [Thu, 21 Sep 2017 20:29:54 +0000 (13:29 -0700)]
Documentation/githooks: mention merge in commit-msg hook

The commit-msg hook is invoked by both commit and merge now.

Reported-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agotravis-ci: fix "skip_branch_tip_with_tag()" string comparison
Lars Schneider [Thu, 21 Sep 2017 20:48:30 +0000 (22:48 +0200)]
travis-ci: fix "skip_branch_tip_with_tag()" string comparison

09f5e97 ("travis-ci: skip a branch build if equal tag is present",
2017-09-17) introduced the "skip_branch_tip_with_tag" function with
a broken string comparison. Fix it!

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopathspec doc: parse_pathspec does not maintain references to args
Jonathan Nieder [Thu, 21 Sep 2017 04:41:12 +0000 (21:41 -0700)]
pathspec doc: parse_pathspec does not maintain references to args

The command line arguments passed to main() are valid for the life of
a program, but the same is not true for all other argv-style arrays
(e.g.  when a caller creates an argv_array).  Clarify that
parse_pathspec does not rely on the argv passed to it to remain valid.

This makes it easier to tell that callers like "git rev-list --stdin"
are safe and ensures that that is more likely to remain true as the
implementation of parse_pathspec evolves.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>