1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-30 19:36:30 +02:00
Commit Graph

53892 Commits

Author SHA1 Message Date
Junio C Hamano 6d2035ee60 Merge branch 'jk/verify-sig-merge-into-void'
"git merge" and "git pull" that merges into an unborn branch used
to completely ignore "--verify-signatures", which has been
corrected.

* jk/verify-sig-merge-into-void:
  pull: handle --verify-signatures for unborn branch
  merge: handle --verify-signatures for unborn branch
  merge: extract verify_merge_signature() helper
2018-11-18 18:23:54 +09:00
Junio C Hamano 39847644ad Merge branch 'js/mingw-res-rebuild'
Windows build update.

* js/mingw-res-rebuild:
  Windows: force-recompile git.res for differing architectures
2018-11-18 18:23:53 +09:00
Junio C Hamano ab96f28ba4 Merge branch 'jk/unused-parameter-fixes'
Various functions have been audited for "-Wunused-parameter" warnings
and bugs in them got fixed.

* jk/unused-parameter-fixes:
  midx: double-check large object write loop
  assert NOARG/NONEG behavior of parse-options callbacks
  parse-options: drop OPT_DATE()
  apply: return -1 from option callback instead of calling exit(1)
  cat-file: report an error on multiple --batch options
  tag: mark "--message" option with NONEG
  show-branch: mark --reflog option as NONEG
  format-patch: mark "--no-numbered" option with NONEG
  status: mark --find-renames option with NONEG
  cat-file: mark batch options with NONEG
  pack-objects: mark index-version option as NONEG
  ls-files: mark exclude options as NONEG
  am: handle --no-patch-format option
  apply: mark include/exclude options as NONEG
2018-11-18 18:23:53 +09:00
Junio C Hamano fa2f2f085e Merge branch 'jk/curl-ldflags'
The way -lcurl library gets linked has been simplified by taking
advantage of the fact that we can just ask curl-config command how.

* jk/curl-ldflags:
  build: link with curl-defined linker flags
2018-11-18 18:23:53 +09:00
Junio C Hamano 95a3ef5e2e Merge branch 'mg/gpg-fingerprint-test'
Add a few tests for a topic already in 'master'.

* mg/gpg-fingerprint-test:
  t/t7510-signed-commit.sh: add signing subkey to Eris Discordia key
  t/t7510-signed-commit.sh: Add %GP to custom format checks
2018-11-18 18:23:53 +09:00
Junio C Hamano 26b80a841a Merge branch 'nd/pthreads'
The codebase has been cleaned up to reduce "#ifndef NO_PTHREADS".

* nd/pthreads:
  Clean up pthread_create() error handling
  read-cache.c: initialize copy_len to shut up gcc 8
  read-cache.c: reduce branching based on HAVE_THREADS
  read-cache.c: remove #ifdef NO_PTHREADS
  pack-objects: remove #ifdef NO_PTHREADS
  preload-index.c: remove #ifdef NO_PTHREADS
  grep: clean up num_threads handling
  grep: remove #ifdef NO_PTHREADS
  attr.c: remove #ifdef NO_PTHREADS
  name-hash.c: remove #ifdef NO_PTHREADS
  index-pack: remove #ifdef NO_PTHREADS
  send-pack.c: move async's #ifdef NO_PTHREADS back to run-command.c
  run-command.h: include thread-utils.h instead of pthread.h
  thread-utils: macros to unconditionally compile pthreads API
2018-11-18 18:23:52 +09:00
Junio C Hamano 62ca33e02a Merge branch 'ds/reachable-topo-order'
The revision walker machinery learned to take advantage of the
commit generation numbers stored in the commit-graph file.

* ds/reachable-topo-order:
  t6012: make rev-list tests more interesting
  revision.c: generation-based topo-order algorithm
  commit/revisions: bookkeeping before refactoring
  revision.c: begin refactoring --topo-order logic
  test-reach: add rev-list tests
  test-reach: add run_three_modes method
  prio-queue: add 'peek' operation
2018-11-18 18:23:52 +09:00
Junio C Hamano d166e6afe5 Tenth batch for 2.20
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-13 22:37:28 +09:00
Junio C Hamano 95182c65d8 Merge branch 'nd/complete-format-patch'
The support for format-patch (and send-email) by the command-line
completion script (in contrib/) has been simplified a bit.

* nd/complete-format-patch:
  completion: use __gitcomp_builtin for format-patch
2018-11-13 22:37:28 +09:00
Junio C Hamano 1e4a714e68 Merge branch 'nd/tree-walk-path-exclusion'
Pathspec matching against a tree object were buggy when negative
pathspec elements were involved, which has been fixed.

* nd/tree-walk-path-exclusion:
  tree-walk.c: fix overoptimistic inclusion in :(exclude) matching
2018-11-13 22:37:28 +09:00
Junio C Hamano 57f06d5ab5 Merge branch 'sg/travis-install-dependencies'
The procedure to install dependencies before testing at Travis CI
is getting revamped for both simplicity and flexibility, taking
advantage of the recent move to the vm-based environment.

* sg/travis-install-dependencies:
  travis-ci: install packages in 'ci/install-dependencies.sh'
2018-11-13 22:37:27 +09:00
Junio C Hamano 9235a6ce47 Merge branch 'bp/add-diff-files-optim'
"git add" needs to internally run "diff-files" equivalent, and the
codepath learned the same optimization as "diff-files" has to run
lstat(2) in parallel to find which paths have been updated in the
working tree.

* bp/add-diff-files-optim:
  add: speed up cmd_add() by utilizing read_cache_preload()
2018-11-13 22:37:27 +09:00
Junio C Hamano 39d23dfa40 Merge branch 'jk/xdiff-interface'
The interface into "xdiff" library used to discover the offset and
size of a generated patch hunk by first formatting it into the
textual hunk header "@@ -n,m +k,l @@" and then parsing the numbers
out.  A new interface has been introduced to allow callers a more
direct access to them.

* jk/xdiff-interface:
  xdiff-interface: drop parse_hunk_header()
  range-diff: use a hunk callback
  diff: convert --check to use a hunk callback
  combine-diff: use an xdiff hunk callback
  diff: use hunk callback for word-diff
  diff: discard hunk headers for patch-ids earlier
  diff: avoid generating unused hunk header lines
  xdiff-interface: provide a separate consume callback for hunks
  xdiff: provide a separate emit callback for hunks
2018-11-13 22:37:27 +09:00
Junio C Hamano f22838aa7a Merge branch 'jk/misc-unused-fixes'
Assorted fixes for bugs found while auditing -Wunused-parameter
warnings.

* jk/misc-unused-fixes:
  approxidate: fix NULL dereference in date_time()
  pathspec: handle non-terminated strings with :(attr)
  approxidate: handle pending number for "specials"
  rev-list: handle flags for --indexed-objects
2018-11-13 22:37:26 +09:00
Junio C Hamano e146cc97be Merge branch 'nd/per-worktree-ref-iteration'
The code to traverse objects for reachability, used to decide what
objects are unreferenced and expendable, have been taught to also
consider per-worktree refs of other worktrees as starting points to
prevent data loss.

* nd/per-worktree-ref-iteration:
  git-worktree.txt: correct linkgit command name
  reflog expire: cover reflog from all worktrees
  fsck: check HEAD and reflog from other worktrees
  fsck: move fsck_head_link() to get_default_heads() to avoid some globals
  revision.c: better error reporting on ref from different worktrees
  revision.c: correct a parameter name
  refs: new ref types to make per-worktree refs visible to all worktrees
  Add a place for (not) sharing stuff between worktrees
  refs.c: indent with tabs, not spaces
2018-11-13 22:37:26 +09:00
Junio C Hamano 11aa560de9 Merge branch 'bp/refresh-index-using-preload'
The helper function to refresh the cached stat information in the
in-core index has learned to perform the lstat() part of the
operation in parallel on multi-core platforms.

* bp/refresh-index-using-preload:
  refresh_index: remove unnecessary calls to preload_index()
  speed up refresh_index() by utilizing preload_index()
2018-11-13 22:37:26 +09:00
Junio C Hamano 409b3f287b Merge branch 'ag/rebase-i-in-c'
Code clean-up for a topic already in 'master'.

* ag/rebase-i-in-c:
  sequencer.c: remove a stray semicolon
2018-11-13 22:37:25 +09:00
Junio C Hamano 2281aa8721 Merge branch 'al/send-email-auto-cte-fixup'
"git send-email --transfer-encoding=..." in recent versions of Git
sometimes produced an empty "Content-Transfer-Encoding:" header,
which has been corrected.

* al/send-email-auto-cte-fixup:
  send-email: avoid empty transfer encoding header
2018-11-13 22:37:25 +09:00
Junio C Hamano 291123e69b Merge branch 'ds/add-missing-tags'
The history traversal used to implement the tag-following has been
optimized by introducing a new helper.

* ds/add-missing-tags:
  remote: make add_missing_tags() linear
  test-reach: test get_reachable_subset
  commit-reach: implement get_reachable_subset
2018-11-13 22:37:24 +09:00
Junio C Hamano 1961efecae Merge branch 'sh/mingw-safer-compat-poll'
Windows fix.

* sh/mingw-safer-compat-poll:
  poll: use GetTickCount64() to avoid wrap-around issues
2018-11-13 22:37:24 +09:00
Junio C Hamano 6e31fa9cc2 Merge branch 'js/rebase-p-tests'
In preparation to the day when we can deprecate and remove the
"rebase -p", make sure we can skip and later remove tests for
it.

* js/rebase-p-tests:
  tests: optionally skip `git rebase -p` tests
  t3418: decouple test cases from a previous `rebase -p` test case
  t3404: decouple some test cases from outcomes of previous test cases
2018-11-13 22:37:24 +09:00
Junio C Hamano 6b2a52431b Merge branch 'pw/am-rebase-read-author-script'
Unify code to read the author-script used in "git am" and the
commands that use the sequencer machinery, e.g. "git rebase -i".

* pw/am-rebase-read-author-script:
  sequencer: use read_author_script()
  add read_author_script() to libgit
  am: rename read_author_script()
  am: improve author-script error reporting
  am: don't die in read_author_script()
2018-11-13 22:37:23 +09:00
Junio C Hamano fd4bb3806b Merge branch 'jc/war-on-string-list'
Replace three string-list instances used as look-up tables in "git
fetch" with hashmaps.

* jc/war-on-string-list:
  fetch: replace string-list used as a look-up table with a hashmap
2018-11-13 22:37:23 +09:00
Junio C Hamano 20d04b4419 Merge branch 'ag/rev-parse-all-exclude-fix'
"git rev-parse --exclude=* --branches --branches"  (i.e. first
saying "add only things that do not match '*' out of all branches"
and then adding all branches, without any exclusion this time")
worked as expected, but "--exclude=* --all --all" did not work the
same way, which has been fixed.

* ag/rev-parse-all-exclude-fix:
  rev-parse: clear --exclude list after 'git rev-parse --all'
2018-11-13 22:37:23 +09:00
Junio C Hamano 67cf2fa3d5 Merge branch 'jt/tighten-fetch-proto-v2-response'
"git fetch" was a bit loose in parsing resposes from the other side
when talking over the protocol v2.

* jt/tighten-fetch-proto-v2-response:
  fetch-pack: be more precise in parsing v2 response
2018-11-13 22:37:22 +09:00
Junio C Hamano abb4824d13 Merge branch 'ao/submodule-wo-gitmodules-checked-out'
The submodule support has been updated to read from the blob at
HEAD:.gitmodules when the .gitmodules file is missing from the
working tree.

* ao/submodule-wo-gitmodules-checked-out:
  t/helper: add test-submodule-nested-repo-config
  submodule: support reading .gitmodules when it's not in the working tree
  submodule: add a helper to check if it is safe to write to .gitmodules
  t7506: clean up .gitmodules properly before setting up new scenario
  submodule: use the 'submodule--helper config' command
  submodule--helper: add a new 'config' subcommand
  t7411: be nicer to future tests and really clean things up
  t7411: merge tests 5 and 6
  submodule: factor out a config_set_in_gitmodules_file_gently function
  submodule: add a print_config_from_gitmodules() helper
2018-11-13 22:37:22 +09:00
Junio C Hamano 504bdc5994 Merge branch 'nb/worktree-api-doc'
Code readability fix.

* nb/worktree-api-doc:
  worktree: rename is_worktree_locked to worktree_lock_reason
  worktree: update documentation for lock_reason and lock_reason_valid
2018-11-13 22:37:21 +09:00
Junio C Hamano daa8282426 Merge branch 'ma/sequencer-do-reset-saner-loop-termination'
Code readability fix.

* ma/sequencer-do-reset-saner-loop-termination:
  sequencer: break out of loop explicitly
2018-11-13 22:37:21 +09:00
Junio C Hamano 0474cd19ef Merge branch 'js/mingw-utf8-env'
Windows fix.

* js/mingw-utf8-env:
  mingw: reencode environment variables on the fly (UTF-16 <-> UTF-8)
  t7800: fix quoting
2018-11-13 22:37:21 +09:00
Junio C Hamano 6c268fdda9 Merge branch 'js/mingw-perl5lib'
Windows fix.

* js/mingw-perl5lib:
  mingw: unset PERL5LIB by default
  config: move Windows-specific config settings into compat/mingw.c
  config: allow for platform-specific core.* config settings
  config: rename `dummy` parameter to `cb` in git_default_config()
2018-11-13 22:37:20 +09:00
Junio C Hamano fbfdc07511 Merge branch 'js/mingw-isatty-and-dup2'
Windows fix.

* js/mingw-isatty-and-dup2:
  mingw: fix isatty() after dup2()
2018-11-13 22:37:20 +09:00
Junio C Hamano bce4fc60ca Merge branch 'ab/pack-tests-cleanup'
A couple of tests used to leave the repository in a state that is
deliberately corrupt, which have been corrected.

* ab/pack-tests-cleanup:
  index-pack tests: don't leave test repo dirty at end
  pack-objects tests: don't leave test .git corrupt at end
  pack-objects test: modernize style
2018-11-13 22:37:20 +09:00
Junio C Hamano 5fb9263295 Merge branch 'ds/test-multi-pack-index'
Tests for the recently introduced multi-pack index machinery.

* ds/test-multi-pack-index:
  packfile: close multi-pack-index in close_all_packs
  multi-pack-index: define GIT_TEST_MULTI_PACK_INDEX
  midx: close multi-pack-index on repack
  midx: fix broken free() in close_midx()
2018-11-13 22:37:19 +09:00
Junio C Hamano 25e4da89ed Merge branch 'nd/wildmatch-double-asterisk'
A pattern with '**' that does not have a slash on either side used
to be an invalid one, but the code now treats such double-asterisks
the same way as two normal asterisks that happen to be adjacent to
each other.

* nd/wildmatch-double-asterisk:
  wildmatch: change behavior of "foo**bar" in WM_PATHNAME mode
2018-11-13 22:37:19 +09:00
Junio C Hamano 8c758f9a67 Merge branch 'nd/per-worktree-config'
A fourth class of configuration files (in addition to the
traditional "system wide", "per user in the $HOME directory" and
"per repository in the $GIT_DIR/config") has been introduced so
that different worktrees that share the same repository (hence the
same $GIT_DIR/config file) can use different customization.

* nd/per-worktree-config:
  worktree: add per-worktree config files
  t1300: extract and use test_cmp_config()
2018-11-13 22:37:18 +09:00
Junio C Hamano c657aa0525 Merge branch 'jk/stream-pack-non-delta-clarification'
Additional comment on a tricky piece of code to help developers.

* jk/stream-pack-non-delta-clarification:
  read_istream_pack_non_delta(): document input handling
2018-11-13 22:37:18 +09:00
Junio C Hamano 81c365bbd1 Merge branch 'jk/proto-v2-ref-prefix-fix'
"git ls-remote $there foo" was broken by recent update for the
protocol v2 and stopped showing refs that match 'foo' that are not
refs/{heads,tags}/foo, which has been fixed.

* jk/proto-v2-ref-prefix-fix:
  ls-remote: pass heads/tags prefixes to transport
  ls-remote: do not send ref prefixes for patterns
2018-11-13 22:37:17 +09:00
Junio C Hamano 879a8d4bf2 Merge branch 'jk/detect-truncated-zlib-input'
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
2018-11-13 22:37:17 +09:00
Junio C Hamano fd7761a1cd Merge branch 'nd/config-split'
Split the overly large Documentation/config.txt file into million
little pieces.  This potentially allows each individual piece
included into the manual page of the command it affects more easily.

* nd/config-split: (81 commits)
  config.txt: remove config/dummy.txt
  config.txt: move worktree.* to a separate file
  config.txt: move web.* to a separate file
  config.txt: move versionsort.* to a separate file
  config.txt: move user.* to a separate file
  config.txt: move url.* to a separate file
  config.txt: move uploadpack.* to a separate file
  config.txt: move uploadarchive.* to a separate file
  config.txt: move transfer.* to a separate file
  config.txt: move tag.* to a separate file
  config.txt: move submodule.* to a separate file
  config.txt: move stash.* to a separate file
  config.txt: move status.* to a separate file
  config.txt: move splitIndex.* to a separate file
  config.txt: move showBranch.* to a separate file
  config.txt: move sequencer.* to a separate file
  config.txt: move sendemail-config.txt to config/
  config.txt: move reset.* to a separate file
  config.txt: move rerere.* to a separate file
  config.txt: move repack.* to a separate file
  ...
2018-11-13 22:37:16 +09:00
Johannes Schindelin adb59def10 Windows: force-recompile git.res for differing architectures
When git.rc is compiled into git.res, the result is actually dependent
on the architecture. That is, you cannot simply link a 32-bit git.res
into a 64-bit git.exe.

Therefore, to allow 32-bit and 64-bit builds in the same directory, we
let git.res depend on GIT-PREFIX so that it gets recompiled when
compiling for a different architecture (this works because the exec path
changes based on the architecture: /mingw32/libexec/git-core for 32-bit
and /mingw64/libexec/git-core for 64-bit).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-07 11:58:24 +09:00
Jeff King aa097b88e9 approxidate: fix NULL dereference in date_time()
When we see a time like "noon", we pass "12" to our date_time() helper,
which sets the hour to 12pm. If the current time is before noon, then we
wrap around to yesterday using date_yesterday(). But unlike the normal
calls to date_yesterday() from approxidate_alpha(), we pass a NULL "num"
parameter. Since c27cc94fad (approxidate: handle pending number for
"specials", 2018-11-02), that causes a segfault.

One way to fix this is by checking for NULL. But arguably date_time() is
abusing our helper by passing NULL in the first place (and this is the
only case where one of these "special" parsers is used this way). So
instead, let's have it just do the 1-day subtraction itself. It's still
just a one-liner due to our update_tm() helper.

Note that the test added here is a little funny, as we say "10am noon",
which makes the "10am" seem pointless.  But this bug can only be
triggered when it the currently-parsed hour is before the special time.
The latest special time is "tea" at 1700, but t0006 uses a hard-coded
TEST_DATE_NOW of 1900. We could reset TEST_DATE_NOW, but that may lead
to confusion in other tests. Just saying "10am noon" makes this test
self-contained.

Reported-by: Carlo Arenas <carenas@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-07 11:04:06 +09:00
Jeff King 01a31f3bca pull: handle --verify-signatures for unborn branch
We usually just forward the --verify-signatures option along to
git-merge, and trust it to do the right thing. However, when we are on
an unborn branch (i.e., there is no HEAD yet), we handle this case
ourselves without even calling git-merge. And in this code path, we do
not respect the verification option at all.

It may be more maintainable in the long run to call git-merge for the
unborn case. That would fix this bug, as well as prevent similar ones in
the future. But unfortunately it's not easy to do. As t5520.3
demonstrates, there are some special cases that git-merge does not
handle, like "git pull .. master:master" (by the time git-merge is
invoked, we've overwritten the unborn HEAD).

So for now let's just teach git-pull to handle this feature.

Reported-by: Felix Eckhofer <felix@eckhofer.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-07 10:11:09 +09:00
Jeff King 7488ba3eea merge: handle --verify-signatures for unborn branch
When git-merge sees that we are on an unborn branch (i.e., there is no
HEAD), it follows a totally separate code path than the usual merge
logic. This code path does not know about verify_signatures, and so we
fail to notice bad or missing signatures.

This has been broken since --verify-signatures was added in efed002249
(merge/pull: verify GPG signatures of commits being merged, 2013-03-31).
In an ideal world, we'd unify the flow for this case with the regular
merge logic, which would fix this bug and avoid introducing similar
ones. But because the unborn case is so different, it would be a burden
on the rest of the function to continually handle the missing HEAD. So
let's just port the verification check to this special case.

Reported-by: Felix Eckhofer <felix@eckhofer.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-07 10:11:09 +09:00
Jeff King edc4d47d54 merge: extract verify_merge_signature() helper
The logic to implement "merge --verify-signatures" is inline in
cmd_merge(), but this site misses some cases. Let's extract the logic
into a function so we can call it from more places.

We'll move it to commit.[ch], since one of the callers (git-pull) is
outside our source file. This function isn't all that general (after
all, its main function is to exit the program) but it's not worth trying
to fix that. The heavy lifting is done by check_commit_signature(), and
our purpose here is just sharing the die() logic. We'll mark it with a
comment to make that clear.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-07 10:11:09 +09:00
Junio C Hamano 8858448bb4 Ninth batch for 2.20
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-06 15:51:23 +09:00
Junio C Hamano 67f673aa4a Merge branch 'sg/test-verbose-log'
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'
2018-11-06 15:50:23 +09:00
Junio C Hamano 6b37389f85 Merge branch 'rj/header-cleanup'
Code cleanup.

* rj/header-cleanup:
  commit-reach.h: add missing declarations (hdr-check)
  ewok_rlw.h: add missing 'inline' to function definition
  fetch-object.h: add missing declaration (hdr-check)
2018-11-06 15:50:23 +09:00
Junio C Hamano 6af9ca2436 Merge branch 'ss/travis-ci-force-vm-mode'
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
2018-11-06 15:50:23 +09:00
Junio C Hamano b3635c15b5 Merge branch 'sg/test-rebase-editor-fix'
* sg/test-rebase-editor-fix:
  t3404-rebase-interactive: test abbreviated commands
2018-11-06 15:50:22 +09:00
Junio C Hamano 1f8e7dc4da Merge branch 'tb/char-may-be-unsigned'
Build portability fix.

* tb/char-may-be-unsigned:
  path.c: char is not (always) signed
2018-11-06 15:50:22 +09:00