Граф коммитов

55729 Коммитов

Автор SHA1 Сообщение Дата
Junio C Hamano 90f2d88e61 Merge branch 'jh/trace2'
* jh/trace2:
  trace2: fix tracing when NO_PTHREADS is defined
2019-05-30 10:50:45 -07:00
Junio C Hamano 20aa7c594f Merge branch 'nd/diff-parseopt'
A brown-paper-bag bugfix to a change already in 'master'.

* nd/diff-parseopt:
  parse-options: check empty value in OPT_INTEGER and OPT_ABBREV
  diff-parseopt: restore -U (no argument) behavior
  diff-parseopt: correct variable types that are used by parseopt
2019-05-30 10:50:44 -07:00
Nguyễn Thái Ngọc Duy f7e68a0878 parse-options: check empty value in OPT_INTEGER and OPT_ABBREV
When parsing the argument for OPT_INTEGER and OPT_ABBREV, we check if we
can parse the entire argument to a number with "if (*s)". There is one
missing check: if "arg" is empty to begin with, we fail to notice.

This could happen with long option by writing like

  git diff --inter-hunk-context= blah blah

Before 16ed6c97cc (diff-parseopt: convert --inter-hunk-context,
2019-03-24), --inter-hunk-context is handled by a custom parser
opt_arg() and does detect this correctly.

This restores the bahvior for --inter-hunk-context and make sure all
other integer options are handled the same (sane) way. For OPT_ABBREV
this is new behavior. But it makes it consistent with the rest.

PS. OPT_MAGNITUDE has similar code but git_parse_ulong() does detect
empty "arg". So it's good to go.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-29 11:04:33 -07:00
Nguyễn Thái Ngọc Duy 8ef05193bc diff-parseopt: restore -U (no argument) behavior
Before d473e2e0e8 (diff.c: convert -U|--unified, 2019-01-27), -U and
--unified are implemented with a custom parser opt_arg() in diff.c. I
didn't check this code carefully and not realize that it's the
equivalent of PARSE_OPT_NONEG | PARSE_OPT_OPTARG.

In other words, if -U is specified without any argument, the option
should be accepted, and the default value should be used. Without
PARSE_OPT_OPTARG, parse_options() will reject this case and cause a
regression.

Reported-by: Bryan Turner <bturner@atlassian.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-29 11:04:32 -07:00
Nguyễn Thái Ngọc Duy 7f125ff909 diff-parseopt: correct variable types that are used by parseopt
Most number-related OPT_ macros store the value in an 'int'
variable. Many of the variables in 'struct diff_options' have a
different type, but during the conversion to using parse_options() I
failed to notice and correct.

The problem was reported on s360x which is a big-endian
architechture. The variable to store '-w' option in this case is
xdl_opts, 'long' type, 8 bytes. But since parse_options() assumes
'int' (4 bytes), it will store bits in the wrong part of xdl_opts. The
problem was found on little-endian platforms because parse_options()
will accidentally store at the right part of xdl_opts.

There aren't much to say about the type change (except that 'int' for
xdl_opts should still be big enough, since Windows' long is the same
size as 'int' and nobody has complained so far). Some safety checks may
be implemented in the future to prevent class of bugs.

Reported-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-29 11:04:30 -07:00
Jeff Hostetler 5fdae9d3be trace2: fix tracing when NO_PTHREADS is defined
Teach trace2 TLS code to not rely on pthread_getspecific() when NO_PTHREADS
is defined.  Instead, always assume the context data of the main thread.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-28 10:52:34 -07:00
Junio C Hamano aa25c82427 Git 2.22-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-19 16:46:42 +09:00
Junio C Hamano fab4a8a396 Merge branch 'js/difftool-no-index'
The "--dir-diff" mode of "git difftool" is not useful in "--no-index"
mode; they are now explicitly marked as mutually incompatible.

* js/difftool-no-index:
  difftool --no-index: error out on --dir-diff (and don't crash)
2019-05-19 16:45:35 +09:00
Junio C Hamano 8c59ba9a76 Merge branch 'jk/get-oid-indexed-object-name'
The codepath to parse :<path> that obtains the object name for an
indexed object has been made more robust.

* jk/get-oid-indexed-object-name:
  get_oid: handle NULL repo->index
2019-05-19 16:45:35 +09:00
Junio C Hamano bca6aba72e Merge branch 'jc/set-packet-header-signature-fix'
Code clean-up.

* jc/set-packet-header-signature-fix:
  pkt-line: drop 'const'-ness of a param to set_packet_header()
2019-05-19 16:45:35 +09:00
Junio C Hamano 8cbad4935e Merge branch 'cb/http-push-null-in-message-fix'
Code clean-up.

* cb/http-push-null-in-message-fix:
  http-push: prevent format overflow warning with gcc >= 9
2019-05-19 16:45:35 +09:00
Junio C Hamano 4ecaedec04 Merge branch 'js/stash-in-c-use-builtin-doc'
Doc update.

* js/stash-in-c-use-builtin-doc:
  stash: document stash.useBuiltin
2019-05-19 16:45:34 +09:00
Junio C Hamano dc58922cf0 Merge branch 'tz/test-lib-check-working-jgit'
A prerequiste check in the test suite to see if a working jgit is
available was made more robust.

* tz/test-lib-check-working-jgit:
  test-lib: try harder to ensure a working jgit
2019-05-19 16:45:34 +09:00
Junio C Hamano 7a09f5f1b6 Merge branch 'js/parseopt-unknown-cb-returns-an-enum'
Code clean-up.

* js/parseopt-unknown-cb-returns-an-enum:
  parse-options: adjust `parse_opt_unknown_cb()`s declared return type
2019-05-19 16:45:34 +09:00
Junio C Hamano ed8a451689 Merge branch 'ab/sha1dc'
Update collision-detecting SHA-1 code to build properly on HP-UX.

* ab/sha1dc:
  sha1dc: update from upstream
2019-05-19 16:45:34 +09:00
Junio C Hamano e0708c24d5 Merge branch 'js/rebase-i-label-shown-in-status-fix'
"git status" did not know that the "label" instruction in the
todo-list "rebase -i -r" uses should not be shown as a hex object
name.

* js/rebase-i-label-shown-in-status-fix:
  status: fix display of rebase -ir's `label` command
2019-05-19 16:45:33 +09:00
Junio C Hamano dd5b7dc8ed Merge branch 'es/check-non-portable-pre-5.10'
Developer support update.

* es/check-non-portable-pre-5.10:
  check-non-portable-shell: support Perl versions older than 5.10
2019-05-19 16:45:33 +09:00
Junio C Hamano bd96a7871a Merge branch 'ds/trace2-document-env-vars'
Doc update.

* ds/trace2-document-env-vars:
  trace2: add variable description to git.txt
2019-05-19 16:45:33 +09:00
Junio C Hamano cfd635c742 Merge branch 'js/fsmonitor-refresh-after-discarding-index'
The fsmonitor interface got out of sync after the in-core index
file gets discarded, which has been corrected.

* js/fsmonitor-refresh-after-discarding-index:
  fsmonitor: force a refresh after the index was discarded
  fsmonitor: demonstrate that it is not refreshed after discard_index()
2019-05-19 16:45:33 +09:00
Junio C Hamano 521d3ef38a Merge branch 'cm/notes-comment-fix'
A stale in-code comment has been updated.

* cm/notes-comment-fix:
  notes: correct documentation of format_display_notes()
2019-05-19 16:45:32 +09:00
Junio C Hamano b3e0981f28 Merge branch 'tt/no-ipv6-fallback-for-winxp'
Code cleanup.

* tt/no-ipv6-fallback-for-winxp:
  mingw: remove obsolete IPv6-related code
2019-05-19 16:45:32 +09:00
Junio C Hamano 0b076b4c0e Merge branch 'js/t5580-unc-alternate-test'
An additional test for MinGW

* js/t5580-unc-alternate-test:
  t5580: verify that alternates can be UNC paths
2019-05-19 16:45:32 +09:00
Junio C Hamano b5fb62bf49 Merge branch 'ds/cvsexportcommit-force-text'
"git cvsexportcommit" running on msys did not expect cvsnt showed
"cvs status" output with CRLF line endings.

* ds/cvsexportcommit-force-text:
  cvsexportcommit: force crlf translation
2019-05-19 16:45:31 +09:00
Junio C Hamano 6f3d93f7ac Merge branch 'sg/ci-libsvn-perl'
To run tests for Git SVN, our scripts for CI used to install the
git-svn package (in the hope that it would bring in the right
dependencies).  This has been updated to install the more direct
dependency, namely, libsvn-perl.

* sg/ci-libsvn-perl:
  ci: install 'libsvn-perl' instead of 'git-svn'
2019-05-19 16:45:31 +09:00
Junio C Hamano 717dad8ebc Merge branch 'bl/t4253-exit-code-from-format-patch'
Avoid patterns to pipe output from a git command to feed another
command in tests.

* bl/t4253-exit-code-from-format-patch:
  t4253-am-keep-cr-dos: avoid using pipes
2019-05-19 16:45:31 +09:00
Junio C Hamano 454b419729 Merge branch 'ds/midx-too-many-packs'
The code to generate the multi-pack idx file was not prepared to
see too many packfiles and ran out of open file descriptor, which
has been corrected.

* ds/midx-too-many-packs:
  midx: add packs to packed_git linked list
  midx: pass a repository pointer
2019-05-19 16:45:30 +09:00
Junio C Hamano 97616ca488 Merge branch 'en/unicode-in-refnames'
On a filesystem like HFS+, the names of the refs stored as filesystem
entities may become different from what the end-user expects, just
like files in the working tree get "renamed".  Work around the
mismatch by paying attention to the core.precomposeUnicode
configuration.

* en/unicode-in-refnames:
  Honor core.precomposeUnicode in more places
2019-05-19 16:45:30 +09:00
Junio C Hamano 85ac27e04f Merge branch 'dl/difftool-mergetool'
Update "git difftool" and "git mergetool" so that the combinations
of {diff,merge}.{tool,guitool} configuration variables serve as
fallback settings of each other in a sensible order.

* dl/difftool-mergetool:
  difftool: fallback on merge.guitool
  difftool: make --gui, --tool and --extcmd mutually exclusive
  mergetool: fallback to tool when guitool unavailable
  mergetool--lib: create gui_mode function
  mergetool: use get_merge_tool function
  t7610: add mergetool --gui tests
  t7610: unsuppress output
2019-05-19 16:45:30 +09:00
Junio C Hamano fed9391fba Merge branch 'mh/http-fread-api-fix'
A pair of private functions in http.c that had names similar to
fread/fwrite did not return the number of elements, which was found
to be confusing.

* mh/http-fread-api-fix:
  Make fread/fwrite-like functions in http.c more like fread/fwrite.
2019-05-19 16:45:29 +09:00
Junio C Hamano b20b8fecfb Merge branch 'js/t6500-use-windows-pid-on-mingw'
Future-proof a test against an update to MSYS2 runtime v3.x series.

* js/t6500-use-windows-pid-on-mingw:
  t6500(mingw): use the Windows PID of the shell
2019-05-19 16:45:29 +09:00
Junio C Hamano 7782066f67 Merge branch 'jk/apache-lsan'
Allow tests that involve httpd to be run under leak sanitizer, just
like we can already do so under address sanitizer.

* jk/apache-lsan:
  t/lib-httpd: pass LSAN_OPTIONS through apache
2019-05-19 16:45:29 +09:00
Junio C Hamano 2cfab60877 Merge branch 'nd/parse-options-aliases'
Attempt to use an abbreviated option in "git clone --recurs" is
responded by a request to disambiguate between --recursive and
--recurse-submodules, which is bad because these two are synonyms.
The parse-options API has been extended to define such synonyms
more easily and not produce an unnecessary failure.

* nd/parse-options-aliases:
  parse-options: don't emit "ambiguous option" for aliases
2019-05-19 16:45:28 +09:00
Junio C Hamano 4ac8371a1c Merge branch 'dl/branch-from-3dot-merge-base'
"git branch new A...B" and "git checkout -b new A...B" have been
taught that in their contexts, the notation A...B means "the merge
base between these two commits", just like "git checkout A...B"
detaches HEAD at that commit.

* dl/branch-from-3dot-merge-base:
  branch: make create_branch accept a merge base rev
  t2018: cleanup in current test
2019-05-19 16:45:28 +09:00
Junio C Hamano 3c9b393ca8 Merge branch 'js/commit-graph-parse-leakfix'
Leakfix.

* js/commit-graph-parse-leakfix:
  commit-graph: fix memory leak
2019-05-19 16:45:28 +09:00
Junio C Hamano 6795fc8afd Merge branch 'jk/cocci-batch'
Optionally "make coccicheck" can feed multiple source files to
spatch, gaining performance while spending more memory.

* jk/cocci-batch:
  coccicheck: make batch size of 0 mean "unlimited"
  coccicheck: optionally batch spatch invocations
2019-05-19 16:45:28 +09:00
Junio C Hamano 82dca958dd Merge branch 'ab/perf-installed-fix'
Performance test framework has been broken and measured the version
of Git that happens to be on $PATH, not the specified one to
measure, for a while, which has been corrected.

* ab/perf-installed-fix:
  perf-lib.sh: forbid the use of GIT_TEST_INSTALLED
  perf tests: add "bindir" prefix to git tree test results
  perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh
  perf-lib.sh: make "./run <revisions>" use the correct gits
  perf aggregate: remove GIT_TEST_INSTALLED from --codespeed
  perf README: correct docs for 3c8f12c96c regression
2019-05-19 16:45:28 +09:00
Junio C Hamano f42bee7d51 Merge branch 'id/windows-dep-aslr'
Allow DEP and ASLR for Windows build to for security hardening.

* id/windows-dep-aslr:
  mingw: enable DEP and ASLR
  mingw: do not let ld strip relocations
2019-05-19 16:45:27 +09:00
Junio C Hamano d66da839d8 Merge branch 'ab/trace2-typofix'
Typofix.

* ab/trace2-typofix:
  trace2: fix up a missing "leave" entry point
2019-05-19 16:45:27 +09:00
Junio C Hamano 195d799955 Merge branch 'nd/submodule-helper-incomplete-line-fix'
Typofix.

* nd/submodule-helper-incomplete-line-fix:
  submodule--helper: add a missing \n
2019-05-19 16:45:27 +09:00
Junio C Hamano 18cfb74f31 Merge branch 'cw/diff-highlight'
Portability fix for a diff-highlight tool (in contrib/).

* cw/diff-highlight:
  diff-highlight: use correct /dev/null for UNIX and Windows
2019-05-19 16:45:26 +09:00
Junio C Hamano 1294160b27 Merge branch 'dl/warn-tagging-a-tag'
Typofix.

* dl/warn-tagging-a-tag:
  tag: fix typo in nested tagging hint
2019-05-19 16:45:26 +09:00
Junio C Hamano 56bea28036 pkt-line: drop 'const'-ness of a param to set_packet_header()
The function's definition has a paramter of type "int" qualified as
"const".  The fact that the incoming parameter is used as read-only
in the fuction is an implementation detail that the callers should
not have to be told in the prototype declaring it (and "const" there
has no effect, as C passes parameters by value).

The prototype defined for the function in pkt-line.h lacked the
matching "const" for this reason, but apparently some compilers
(e.g. MS Visual C 2017) complain about the parameter type mismatch.

Let's squelch it by removing the "const" that is pointless in the
definition of a small and trivial function like this, which would
not help optimizing compilers nor reading humans that much.

Noticed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-16 13:29:06 +09:00
Todd Zullinger abd0f28983 test-lib: try harder to ensure a working jgit
The JGIT prereq uses `type jgit` to determine whether jgit is present.
While this is usually sufficient, it won't help if the jgit found is
badly broken.  This wastes time running tests which fail due to no fault
of our own.

Use `jgit --version` instead, to guard against cases where jgit is
present on the system, but will fail to run, e.g. because of some JRE
issue, or missing Java dependencies.  Checking that it gets far enough
to process the '--version' argument isn't perfect, but seems to be good
enough in practice.  It's also consistent with how we detect some other
dependencies, see e.g. the CURL and UNZIP prerequisites.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-15 14:20:01 +09:00
Jeff King 581d2fd9f2 get_oid: handle NULL repo->index
When get_oid() and its helpers see an index name like ":.gitmodules",
they try to load the index on demand, like:

  if (repo->index->cache)
	repo_read_index(repo);

However, that misses the case when "repo->index" itself is NULL; we'll
segfault in the conditional.

This never happens with the_repository; there we always point its index
field to &the_index. But a submodule repository may have a NULL index
field until somebody calls repo_read_index().

This bug is triggered by t7411, but it was hard to notice because it's
in an expect_failure block. That test was added by 2b1257e463 (t/helper:
add test-submodule-nested-repo-config, 2018-10-25). Back then we had no
easy way to access the .gitmodules blob of a submodule repo, so we
expected (and got) an error message to that effect. Later, d9b8b8f896
(submodule-config.c: use repo_get_oid for reading .gitmodules,
2019-04-16) started looking in the correct repo, which is when we
started triggering the segfault.

With this fix, the test starts passing (once we clean it up as its
comment instructs).

Note that as far as I know, this bug could not be triggered outside of
the test suite. It requires resolving an index name in a submodule, and
all of the code paths (aside from test-tool) which do that either load
the index themselves, or always pass the_repository.

Ultimately it comes from 3a7a698e93 (sha1-name.c: remove implicit
dependency on the_index, 2019-01-12), which replaced a check of
"the_index.cache" with "repo->index->cache". So even if there is another
way to trigger it, it wouldn't affect any versions before then.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-15 14:08:42 +09:00
Carlo Marcelo Arenas Belón 9dde06de13 http-push: prevent format overflow warning with gcc >= 9
In function 'finish_request',
    inlined from 'process_response' at http-push.c:248:2:
http-push.c:587:4: warning: '%s' directive argument is null [-Wformat-overflow=]
  587 |    fprintf(stderr, "Unable to get pack file %s\n%s",
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  588 |     request->url, curl_errorstr);
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

request->url is needed for the error message if there was a failure
during fetch but was being cleared unnecessarily earlier.

note that the leak is prevented by calling release_request unconditionally
at the end.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Suggested-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-15 11:03:08 +09:00
Johannes Schindelin 336ad8424c stash: document stash.useBuiltin
The stash.useBuiltin variable introduced in 90a462725e ("stash:
optionally use the scripted version again", 2019-02-25) was turned on by
default, but had no documentation.

Let's document it so that users who run into any stability issues with
the C rewrite know there's an escape hatch, and spell out that the
user should please report the bug when they have to turn off the
built-in stash.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-15 10:47:20 +09:00
Ævar Arnfjörð Bjarmason 4125f78222 sha1dc: update from upstream
Update sha1dc from the latest version by the upstream
maintainer[1]. See 07a20f569b ("Makefile: fix unaligned loads in
sha1dc with UBSan", 2019-03-12) for the last update.

This fixes an issue where HP-UX IA64 was wrongly detected as a
Little-endian instead of a Big-endian system, see [2] and [3].

1. 855827c583
2. https://public-inbox.org/git/603989bd-f86d-c61d-c6f5-fb6748a65ba9@siemens.com/
3. https://github.com/cr-marcstevens/sha1collisiondetection/pull/50

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-14 16:45:01 +09:00
Johannes Schindelin 567fce1e10 parse-options: adjust `parse_opt_unknown_cb()`s declared return type
In f41179f16b (parse-options: avoid magic return codes, 2019-01-27),
the signature of the low-level parse-opt callback function was changed
to return an `enum`.

And while the implementations were changed, one declaration was left
unchanged, still claiming to return `int`.

This can potentially lead to problems, as compilers are free to choose
any integral type for an `enum` as long as it can represent all declared
values.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-14 16:42:31 +09:00
Junio C Hamano ab15ad1a3b Git 2.22-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-13 23:50:35 +09:00
Junio C Hamano 49bc8ce539 Merge branch 'jh/trace2'
A few embarrassing bugfixes.

* jh/trace2:
  trace2: fix up a missing "leave" entry point
  trace2: fix incorrect function pointer check
2019-05-13 23:50:35 +09:00