1
0
mirror of https://github.com/git/git.git synced 2024-10-01 15:21:24 +02:00
Commit Graph

49298 Commits

Author SHA1 Message Date
Thomas Gummerer
4bddd98311 split-index: don't write cache tree with null oid entries
In a96d3cc3f6 ("cache-tree: reject entries with null sha1", 2017-04-21)
we made sure that broken cache entries do not get propagated to new
trees.  Part of that was making sure not to re-use an existing cache
tree that includes a null oid.

It did so by dropping the cache tree in 'do_write_index()' if one of
the entries contains a null oid.  In split index mode however, there
are two invocations to 'do_write_index()', one for the shared index
and one for the split index.  The cache tree is only written once, to
the split index.

As we only loop through the elements that are effectively being
written by the current invocation, that may not include the entry with
a null oid in the split index (when it is already written to the
shared index), where we write the cache tree.  Therefore in split
index mode we may still end up writing the cache tree, even though
there is an entry with a null oid in the index.

Fix this by checking for null oids in prepare_to_write_split_index,
where we loop the entries of the shared index as well as the entries for
the split index.

This fixes t7009 with GIT_TEST_SPLIT_INDEX.  Also add a new test that's
more specifically showing the problem.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-19 10:36:39 -08:00
Thomas Gummerer
a125a22334 read-cache: fix reading the shared index for other repos
read_index_from() takes a path argument for the location of the index
file.  For reading the shared index in split index mode however it just
ignores that path argument, and reads it from the gitdir of the current
repository.

This works as long as an index in the_repository is read.  Once that
changes, such as when we read the index of a submodule, or of a
different working tree than the current one, the gitdir of
the_repository will no longer contain the appropriate shared index,
and git will fail to read it.

For example t3007-ls-files-recurse-submodules.sh was broken with
GIT_TEST_SPLIT_INDEX set in 188dce131f ("ls-files: use repository
object", 2017-06-22), and t7814-grep-recurse-submodules.sh was also
broken in a similar manner, probably by introducing struct repository
there, although I didn't track down the exact commit for that.

be489d02d2 ("revision.c: --indexed-objects add objects from all
worktrees", 2017-08-23) breaks with split index mode in a similar
manner, not erroring out when it can't read the index, but instead
carrying on with pruning, without taking the index of the worktree into
account.

Fix this by passing an additional gitdir parameter to read_index_from,
to indicate where it should look for and read the shared index from.

read_cache_from() defaults to using the gitdir of the_repository.  As it
is mostly a convenience macro, having to pass get_git_dir() for every
call seems overkill, and if necessary users can have more control by
using read_index_from().

Helped-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-19 10:36:34 -08:00
Junio C Hamano
3013dff866 Prepare for 2.15.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-06 09:10:35 -08:00
Junio C Hamano
03d4bc1edf Merge branch 'jc/merge-base-fork-point-doc' into maint
Clarify and enhance documentation for "merge-base --fork-point", as
it was clear what it computed but not why/what for.

* jc/merge-base-fork-point-doc:
  merge-base --fork-point doc: clarify the example and failure modes
2017-12-06 09:09:05 -08:00
Junio C Hamano
ce7320901f Merge branch 'tz/redirect-fix' into maint
A few scripts (both in production and tests) incorrectly redirected
their error output.  These have been corrected.

* tz/redirect-fix:
  rebase: fix stderr redirect in apply_autostash()
  t/lib-gpg: fix gpgconf stderr redirect to /dev/null
2017-12-06 09:09:04 -08:00
Junio C Hamano
0cfcb1695f Merge branch 'tz/notes-error-to-stderr' into maint
"git notes" sent its error message to its standard output stream,
which was corrected.

* tz/notes-error-to-stderr:
  notes: send "Automatic notes merge failed" messages to stderr
2017-12-06 09:09:04 -08:00
Junio C Hamano
2ace172f95 Merge branch 'sb/test-cherry-pick-submodule-getting-in-a-way' into maint
The three-way merge performed by "git cherry-pick" was confused
when a new submodule was added in the meantime, which has been
fixed (or "papered over").

* sb/test-cherry-pick-submodule-getting-in-a-way:
  merge-recursive: handle addition of submodule on our side of history
  t/3512: demonstrate unrelated submodule/file conflict as cherry-pick failure
2017-12-06 09:09:03 -08:00
Junio C Hamano
0175b6e2b9 Merge branch 'pw/sequencer-recover-from-unlockable-index' into maint
The sequencer machinery (used by "git cherry-pick A..B", and "git
rebase -i", among other things) would have lost a commit if stopped
due to an unlockable index file, which has been fixed.

* pw/sequencer-recover-from-unlockable-index:
  sequencer: reschedule pick if index can't be locked
2017-12-06 09:09:03 -08:00
Junio C Hamano
43240cb731 Merge branch 'rs/apply-inaccurate-eof-with-incomplete-line' into maint
"git apply --inaccurate-eof" when used with "--ignore-space-change"
triggered an internal sanity check, which has been fixed.

* rs/apply-inaccurate-eof-with-incomplete-line:
  apply: update line lengths for --inaccurate-eof
2017-12-06 09:09:03 -08:00
Junio C Hamano
2db93a80d3 Merge branch 'tz/complete-branch-copy' into maint
Command line completion (in contrib/) has been taught about the
"--copy" option of "git branch".

* tz/complete-branch-copy:
  completion: add '--copy' option to 'git branch'
2017-12-06 09:09:02 -08:00
Junio C Hamano
3cc60ecdda Merge branch 'ew/rebase-mboxrd' into maint
When "git rebase" prepared an mailbox of changes and fed it to "git
am" to replay them, it was confused when a stray "From " happened
to be in the log message of one of the replayed changes.  This has
been corrected.

* ew/rebase-mboxrd:
  rebase: use mboxrd format to avoid split errors
2017-12-06 09:09:01 -08:00
Junio C Hamano
74d6c9de9b Merge branch 'sd/branch-copy' into maint
Code clean-up.

* sd/branch-copy:
  config: avoid "write_in_full(fd, buf, len) != len" pattern
2017-12-06 09:09:01 -08:00
Junio C Hamano
0114a7ad06 Merge branch 'sw/pull-ipv46-passthru' into maint
Contrary to the documentation, "git pull -4/-6 other-args" did not
ask the underlying "git fetch" to go over IPv4/IPv6, which has been
corrected.

* sw/pull-ipv46-passthru:
  pull: pass -4/-6 option to 'git fetch'
2017-12-06 09:09:00 -08:00
Junio C Hamano
3cdea38707 Merge branch 'bc/submitting-patches-in-asciidoc' into maint
The SubmittingPatches document has been converted to produce an
HTML version via AsciiDoc/Asciidoctor.

* bc/submitting-patches-in-asciidoc:
  Documentation: convert SubmittingPatches to AsciiDoc
  Documentation: enable compat-mode for Asciidoctor
2017-12-06 09:08:59 -08:00
Junio C Hamano
02abc6be8e Merge branch 'mh/avoid-rewriting-packed-refs' into maint
Recent update to the refs infrastructure implementation started
rewriting packed-refs file more often than before; this has been
optimized again for most trivial cases.

* mh/avoid-rewriting-packed-refs:
  files-backend: don't rewrite the `packed-refs` file unnecessarily
  t1409: check that `packed-refs` is not rewritten unnecessarily
2017-12-06 09:08:50 -08:00
Junio C Hamano
9b185bef0c Git 2.15.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.15.1
2017-11-28 13:39:14 +09:00
Junio C Hamano
b201e96f94 Merge branch 'rs/config-write-section-fix' into maint
There was a recent semantic mismerge in the codepath to write out a
section of a configuration section, which has been corrected.

* rs/config-write-section-fix:
  config: flip return value of write_section()
2017-11-28 13:38:33 +09:00
Junio C Hamano
7bc77766e1 A bit more fixes for 2.15.1
We've been waiting long enough, a few more would not hurt ;-)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 10:58:31 +09:00
Junio C Hamano
80a0e0fdd6 Merge branch 'ma/reduce-heads-leakfix' into maint
Leak fixes.

* ma/reduce-heads-leakfix:
  reduce_heads: fix memory leaks
  builtin/merge-base: free commit lists
2017-11-27 10:57:02 +09:00
Junio C Hamano
03e8004f06 Merge branch 'ma/bisect-leakfix' into maint
Leak fixes.

* ma/bisect-leakfix:
  bisect: fix memory leak when returning best element
  bisect: fix off-by-one error in `best_bisection_sorted()`
  bisect: fix memory leak in `find_bisection()`
  bisect: change calling-convention of `find_bisection()`
2017-11-27 10:57:02 +09:00
Junio C Hamano
df481b99ef Merge branch 'rs/apply-fuzzy-match-fix' into maint
A fix for an ancient bug in "git apply --ignore-space-change" codepath.

* rs/apply-fuzzy-match-fix:
  apply: avoid out-of-bounds access in fuzzy_matchlines()
2017-11-27 10:57:02 +09:00
Junio C Hamano
b51df7d306 Merge branch 'ad/submitting-patches-title-decoration' into maint
Doc update around use of "format-patch --subject-prefix" etc.

* ad/submitting-patches-title-decoration:
  doc/SubmittingPatches: correct subject guidance
2017-11-27 10:57:01 +09:00
Junio C Hamano
95bf6151dc Merge branch 'rs/imap-send-next-arg-fix' into maint
Error checking in "git imap-send" for empty response has been
improved.

* rs/imap-send-next-arg-fix:
  imap-send: handle missing response codes gracefully
  imap-send: handle NULL return of next_arg()
2017-11-27 10:57:00 +09:00
Todd Zullinger
7d22aec681 RelNotes: minor typo fixes in 2.15.1 draft
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-26 12:49:23 +09:00
Junio C Hamano
95a731ce92 Almost ready for 2.15.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-21 14:07:08 +09:00
Junio C Hamano
1c89be1db2 Merge branch 'rs/sequencer-rewrite-file-cleanup' into maint
Code cleanup.

* rs/sequencer-rewrite-file-cleanup:
  sequencer.c: check return value of close() in rewrite_file()
  sequencer: use O_TRUNC to truncate files
  sequencer: factor out rewrite_file()
2017-11-21 14:05:33 +09:00
Junio C Hamano
01e0c53c73 Merge branch 'cb/t4201-robustify' into maint
A test update.

* cb/t4201-robustify:
  t4201: make use of abbreviation in the test more robust
2017-11-21 14:05:33 +09:00
Junio C Hamano
b2a276830f Merge branch 'tz/fsf-address-update' into maint
Replace the mailing address of FSF to a URL, as FSF prefers.

* tz/fsf-address-update:
  Replace Free Software Foundation address in license notices
  Replace Free Software Foundation address in license notices
2017-11-21 14:05:32 +09:00
Junio C Hamano
8ff22f5a88 Merge branch 'ad/rebase-i-serie-typofix' into maint
Typofix.

* ad/rebase-i-serie-typofix:
  rebase -i: fix comment typo
2017-11-21 14:05:32 +09:00
Junio C Hamano
5a80d1dd9c Merge branch 'jk/info-alternates-fix' into maint
We used to add an empty alternate object database to the system
that does not help anything; it has been corrected.

* jk/info-alternates-fix:
  link_alt_odb_entries: make empty input a noop
2017-11-21 14:05:31 +09:00
Junio C Hamano
8e3e51a3a7 Merge branch 'ab/pcre-v2' into maint
Building with NO_LIBPCRE1_JIT did not disable it, which has been fixed.

* ab/pcre-v2:
  grep: fix NO_LIBPCRE1_JIT to fully disable JIT
2017-11-21 14:05:30 +09:00
Junio C Hamano
b77b96e29b Merge branch 'sr/wrapper-quote-filenames' into maint
Some error messages did not quote filenames shown in it, which have
been fixed.

* sr/wrapper-quote-filenames:
  wrapper.c: consistently quote filenames in error messages
2017-11-21 14:05:29 +09:00
Junio C Hamano
6baa11dc2a Merge branch 'bw/rebase-i-ignored-submodule-fix' into maint
"git rebase -i" recently started misbehaving when a submodule that
is configured with 'submodule.<name>.ignore' is dirty; this has
been corrected.

* bw/rebase-i-ignored-submodule-fix:
  wt-status: actually ignore submodules when requested
2017-11-21 14:05:29 +09:00
Shuyu Wei
ffb4568afe pull: pass -4/-6 option to 'git fetch'
The -4/-6 option should be passed through to 'git fetch' to be
consistent with the man page.

Signed-off-by: Wei Shuyu <wsy@dogben.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-21 09:53:48 +09:00
René Scharfe
782c030ea2 config: flip return value of write_section()
d9bd4cbb9cc (config: flip return value of store_write_*()) made
write_section() follow the convention of write(2) to return -1 on error
and the number of written bytes on success.  3b48045c6c7 (Merge branch
'sd/branch-copy') changed it back to returning 0 on error and 1 on
success, but left its callers still checking for negative values.

Let write_section() follow the convention of write(2) again to meet the
expectations of its callers.

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>
2017-11-18 20:38:40 +09:00
Eric Wong
ae3b2b04bb rebase: use mboxrd format to avoid split errors
The mboxrd format allows the use of embedded "From " lines in
commit messages without being misinterpreted by mailsplit

Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-18 12:30:16 +09:00
René Scharfe
4855de1233 apply: update line lengths for --inaccurate-eof
Some diff implementations don't report missing newlines at the end of
files.  Applying such a patch can cause a newline character to be
added inadvertently.  The option --inaccurate-eof of git apply can be
used to remove trailing newlines if needed.

apply_one_fragment() cuts it off from the buffers for preimage and
postimage.  Before it does, it builds an array with the lengths of each
line for both.  Make sure to update the length of the last line in
these line info structures as well to keep them consistent with their
respective buffer.

Without this fix the added test fails; git apply dies and reports:

   fatal: BUG: caller miscounted postlen: asked 1, orig = 1, used = 2

That sanity check is only called if whitespace changes are ignored.

Reported-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-17 10:42:08 +09:00
Todd Zullinger
41ca0f773e completion: add '--copy' option to 'git branch'
In 52d59cc645 (branch: add a --copy (-c) option to go with --move (-m),
2017-06-18), `git branch` learned a `--copy` option.  Include it when
providing command completions.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-17 10:32:19 +09:00
Phillip Wood
bd58886775 sequencer: reschedule pick if index can't be locked
If the index cannot be locked in do_recursive_merge(), issue an
error message and go on to the error recovery codepath, instead of
dying.  When the commit cannot be picked, it needs to be rescheduled
when performing an interactive rebase, but just dying there won't
allow that to happen, and when the user runs 'git rebase --continue'
rather than 'git rebase --abort', the commit gets silently dropped.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
2017-11-16 14:19:12 +09:00
Phillip Wood
c5e3bc6ec4 config: avoid "write_in_full(fd, buf, len) != len" pattern
As explained in commit 06f46f237 (avoid "write_in_full(fd, buf, len)
!= len" pattern, 2017–09–13) the return value of write_in_full() is
either -1 or the requested number of bytes. As such comparing the
return value to an unsigned value such as strbuf.len will fail to
catch errors. Change the code to use the preferred '< 0' check.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-16 10:36:16 +09:00
Elijah Newren
c641ca6707 merge-recursive: handle addition of submodule on our side of history
The code for a newly added path assumed that the path was a normal file,
and thus checked for there being a directory still being in the way of
the file.  Note that since unpack_trees() does path-in-the-way checks
already, the only way for there to be a directory in the way at this
point in the code, is if there is some kind of D/F conflict in the merge.

For a submodule addition on HEAD's side of history, the submodule would
have already been present.  This means that we do expect there to be a
directory present but should not consider it to be "in the way"; instead,
it's the expected submodule.  So, when there's a submodule addition from
HEAD's side, don't bother checking the working copy for a directory in
the way.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-15 12:42:34 +09:00
Junio C Hamano
5a1f5c3060 Start preparation for 2.15.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-15 12:05:22 +09:00
Junio C Hamano
266b87b90b Merge branch 'ks/mailmap' into maint
* ks/mailmap:
  mailmap: use Kaartic Sivaraam's new address
2017-11-15 12:05:04 +09:00
Junio C Hamano
2d35c507d2 Merge branch 'jm/relnotes-2.15-typofix' into maint
Typofix.

* jm/relnotes-2.15-typofix:
  fix typos in 2.15.0 release notes
2017-11-15 12:05:04 +09:00
Junio C Hamano
da2b4ee388 Merge branch 'cn/diff-indent-no-longer-is-experimental' into maint
Doc update.

* cn/diff-indent-no-longer-is-experimental:
  diff: --indent-heuristic is no longer experimental
2017-11-15 12:05:04 +09:00
Junio C Hamano
74ef46558e Merge branch 'js/mingw-redirect-std-handles' into maint
MinGW updates.

* js/mingw-redirect-std-handles:
  mingw: document the standard handle redirection
  mingw: optionally redirect stderr/stdout via the same handle
  mingw: add experimental feature to redirect standard handles
2017-11-15 12:05:03 +09:00
Junio C Hamano
558d8568df Merge branch 'js/wincred-empty-cred' into maint
MinGW updates.

* js/wincred-empty-cred:
  wincred: handle empty username/password correctly
  t0302: check helper can handle empty credentials
2017-11-15 12:05:03 +09:00
Junio C Hamano
40bc898103 Merge branch 'js/mingw-full-version-in-resources' into maint
MinGW updates.

* js/mingw-full-version-in-resources:
  mingw: include the full version information in the resources
2017-11-15 12:05:03 +09:00
Junio C Hamano
30322f1727 Merge branch 'dk/libsecret-unlock-to-load-fix' into maint
The credential helper for libsecret (in contrib/) has been improved
to allow possibly prompting the end user to unlock secrets that are
currently locked (otherwise the secrets may not be loaded).

* dk/libsecret-unlock-to-load-fix:
  credential-libsecret: unlock locked secrets
2017-11-15 12:05:02 +09:00
Junio C Hamano
16f8cd1fba Merge branch 'js/early-config' into maint
Correct start-up sequence so that a repository could be placed
immediately under the root directory again (which was broken at
around Git 2.13).

* js/early-config:
  setup: avoid double slashes when looking for HEAD
2017-11-15 12:05:01 +09:00