Commit graph

47896 commits

Author SHA1 Message Date
Junio C Hamano 53ee6b8f1a Merge branch 'rs/apply-validate-input'
Tighten error checks for invalid "git apply" input.

* rs/apply-validate-input:
  apply: check git diffs for mutually exclusive header lines
  apply: check git diffs for invalid file modes
  apply: check git diffs for missing old filenames
2017-06-30 13:45:24 -07:00
Junio C Hamano ca069a3c5c Merge branch 'jc/pack-bitmap-unaligned'
An unaligned 32-bit access in pack-bitmap code ahs been corrected.

* jc/pack-bitmap-unaligned:
  pack-bitmap: don't perform unaligned memory access
2017-06-30 13:45:24 -07:00
Junio C Hamano 9bab852f65 Merge branch 'ah/doc-pretty-color-auto-prefix'
Doc update.

* ah/doc-pretty-color-auto-prefix:
  doc: clarify syntax for %C(auto,...) in pretty formats
2017-06-30 13:45:23 -07:00
Junio C Hamano d5d6a44099 Merge branch 'ks/submodule-add-doc'
Doc update.

* ks/submodule-add-doc:
  Documentation/git-submodule: cleanup "add" section
2017-06-30 13:45:22 -07:00
Junio C Hamano 7e46f19a10 Merge branch 'ks/status-initial-commit'
"git status" has long shown essentially the same message as "git
commit"; the message it gives while preparing for the root commit,
i.e. "Initial commit", was hard to understand for some new users.
Now it says "No commits yet" to stress more on the current status
(rather than the commit the user is preparing for, which is more in
line with the focus of "git commit").

* ks/status-initial-commit:
  status: contextually notify user about an initial commit
2017-06-30 13:45:22 -07:00
Junio C Hamano c7ee0baae7 Merge branch 'ab/die-errors-in-threaded'
Traditionally, the default die() routine had a code to prevent it
from getting called multiple times, which interacted badly when a
threaded program used it (one downside is that the real error may
be hidden and instead the only error message given to the user may
end up being "die recursion detected", which is not very useful).

* ab/die-errors-in-threaded:
  die(): stop hiding errors due to overzealous recursion guard
2017-06-30 13:45:21 -07:00
Junio C Hamano 5452224710 Merge branch 'pw/rebase-i-regression-fix-tests'
Fix a recent regression to "git rebase -i" and add tests that would
have caught it and others.

* pw/rebase-i-regression-fix-tests:
  t3420: fix under GETTEXT_POISON build
  rebase: add more regression tests for console output
  rebase: add regression tests for console output
  rebase -i: add test for reflog message
  sequencer: print autostash messages to stderr
2017-06-30 13:45:21 -07:00
Stefan Beller c2d4b4cd06 merge-recursive: use DIFF_XDL_SET macro
Instead of implementing this on our own, just use a convenience macro.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-30 10:56:37 -07:00
Phillip Wood 3f9c637ec7 t9700: add tests for Git::unquote_path()
Check that unquote_path() handles spaces and escape sequences
properly.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-30 08:05:15 -07:00
Phillip Wood d5f28b7241 Git::unquote_path(): throw an exception on bad path
This is what the other routines in Git.pm do if there's an error.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-30 08:04:59 -07:00
Phillip Wood 4cebfac944 Git::unquote_path(): handle '\a'
unquote_path() does not handle quoted paths containing '\a',
even though quote.c::unquote_c_style() does, and quote.c:sq_lookup[]
tells quote.c::sq_must_quote() that '\007' must be quoted as '\a'.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-30 08:02:43 -07:00
Phillip Wood 1d542a5487 add -i: move unquote_path() to Git.pm
Move unquote_path() from git-add--interactive to Git.pm so it can be
used by other scripts. Note this is a straight copy, it does not
handle '\a'. That will be fixed in the next commit.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-30 08:02:20 -07:00
Kaartic Sivaraam b3cf1b7789 commit-template: distinguish status information unconditionally
The commit template adds the status information without
adding a new line to distinguish them in the absence
of optional parts. This results in difficulty in interpreting
it's content, specifically for inexperienced users.

Unconditionally, add new lines to separate the status message
from the other parts of the commit-template to make it more
readable.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-30 07:50:21 -07:00
Kaartic Sivaraam b884244c84 commit-template: remove outdated notice about explicit paths
The notice that "git commit <paths>" default to "git commit
--only <paths>" was there since 756e3ee0 ("Merge branch
'jc/commit'", 2006-02-14).  Back then, existing users of Git
expected the command doing "git commit --include <paths>", and
after the behaviour of the command was changed to align with
other people's "$scm commit <paths>", the text was added to help
them transition their expectations.

Remove the message that now has outlived its usefulness.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-30 07:50:19 -07:00
René Scharfe 76d8d45ffb coccinelle: polish FREE_AND_NULL rules
There are two rules for using FREE_AND_NULL in free.cocci, one for
pointer types and one for expressions.  Both cause coccinelle to remove
empty lines and even newline characters between replacements for some
reason; consecutive "free(x);/x=NULL;" sequences end up as multiple
FREE_AND_NULL calls on the same time.

Remove the type rule, as the expression rule already covers it, and
rearrange the lines of the latter to place the addition of FREE_AND_NULL
between the removals, which causes coccinelle to leave surrounding
whitespace untouched.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-29 10:46:16 -07:00
Junio C Hamano dc4b4a61ba submodule--helper: do not call utf8_fprintf() unnecessarily
The helper function utf8_fprintf(fp, ...) has exactly the same
effect to the output stream fp as fprintf(fp, ...) does, and the
only difference is that its return value counts in display columns
consumed (assuming that the payload is encoded in UTF-8), as opposed
to number of bytes.

There is no reason to call it unless the caller cares about its
return value.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-28 14:27:10 -07:00
Junio C Hamano 73fc2aadc7 t1450: use egrep for regexp "alternation"
GNU grep allows "\(A\|B\)" as alternation in BRE, but this is an
extension not understood by some other implementations of grep
(Michael Kebe reported an breakage on Solaris).

Rewrite the offending test to ERE and use egrep instead.

Noticed-by: Michael Kebe <michael.kebe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-28 10:17:50 -07:00
A. Wilcox fdc1ad97c1 subtree: honour USE_ASCIIDOCTOR when set
Defining USE_ASCIIDOCTOR=1 when building Git uses asciidoctor over
asciidoc when generating DocBook and man page documentation.  However,
the contrib/subtree module does not presently honour that flag.

This causes a build failure when asciidoc is not present on the build
system.  Instead, adapt the main Documentation/Makefile logic to use
asciidoctor when requested.

Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-27 21:01:27 -07:00
René Scharfe d70e9c5c8c apply: check git diffs for mutually exclusive header lines
A file can either be added, removed, copied, or renamed, but no two of
these actions can be done by the same patch.  Some of these combinations
provoke error messages due to missing file names, and some are only
caught by an assertion.  Check git patches already as they are parsed
and report conflicting lines on sight.

Found by Vegard Nossum using AFL.

Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-27 14:41:10 -07:00
René Scharfe 44e5471a8d apply: check git diffs for invalid file modes
An empty string as mode specification is accepted silently by git apply,
as Vegard Nossum found out using AFL.  It's interpreted as zero.  Reject
such bogus file modes, and only accept ones consisting exclusively of
octal digits.

Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-27 10:59:38 -07:00
René Scharfe 4269974179 apply: check git diffs for missing old filenames
2c93286a (fix "git apply --index ..." not to deref NULL) added a check
for git patches missing a +++ line, preventing a segfault.  Check for
missing --- lines as well, and add a test for each case.

Found by Vegard Nossum using AFL.

Original-patch-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-27 10:58:30 -07:00
Ville Skyttä 6412757514 Spelling fixes
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-27 10:35:49 -07:00
Junio C Hamano e0aaa1b653 Twelfth batch for 2.14
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-26 14:12:46 -07:00
Junio C Hamano aca226e6e9 Merge branch 'mb/reword-autocomplete-message'
Message update.

* mb/reword-autocomplete-message:
  auto-correct: tweak phrasing
2017-06-26 14:09:33 -07:00
Junio C Hamano 6968ca9b25 Merge branch 'ks/t7508-indent-fix'
Cosmetic update to a test.

* ks/t7508-indent-fix:
  t7508: fix a broken indentation
2017-06-26 14:09:32 -07:00
Junio C Hamano 54e6ce5960 Merge branch 'jk/add-p-commentchar-fix'
"git add -p" were updated in 2.12 timeframe to cope with custom
core.commentchar but the implementation was buggy and a
metacharacter like $ and * did not work.

* jk/add-p-commentchar-fix:
  add--interactive: quote commentChar regex
  add--interactive: handle EOF in prompt_yesno
2017-06-26 14:09:31 -07:00
Junio C Hamano e25a76721c Merge branch 'dt/raise-core-packed-git-limit'
Doc update for a topic already in 'master'.

* dt/raise-core-packed-git-limit:
  docs: update 64-bit core.packedGitLimit default
2017-06-26 14:09:30 -07:00
Junio C Hamano 5c83d850d0 Merge branch 'mh/packed-ref-store-prep'
Bugfix for a topic that is (only) in 'master'.

* mh/packed-ref-store-prep:
  for_each_bisect_ref(): don't trim refnames
  lock_packed_refs(): fix cache validity check
2017-06-26 14:09:29 -07:00
Junio C Hamano 849b44cdf1 Merge branch 'lb/status-stash-count'
"git status" learned to optionally give how many stash entries the
user has in its output.

* lb/status-stash-count:
  glossary: define 'stash entry'
  status: add optional stash count information
  stash: update documentation to use 'stash entry'
2017-06-26 14:09:29 -07:00
James Clarke da41c942b3 pack-bitmap: don't perform unaligned memory access
The preceding bitmap entries have a 1-byte XOR-offset and 1-byte flags,
so their size is not a multiple of 4. Thus the name-hash cache is only
guaranteed to be 2-byte aligned and so we must use get_be32 rather than
indexing the array directly.

Signed-off-by: James Clarke <jrtc27@jrtc27.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-26 12:32:31 -07:00
Jonathan Tan e83e71c5e1 sha1_file: refactor has_sha1_file_with_flags
has_sha1_file_with_flags() implements many mechanisms in common with
sha1_object_info_extended(). Make has_sha1_file_with_flags() a
convenience function for sha1_object_info_extended() instead.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-26 10:28:58 -07:00
Jonathan Tan cd585e2a33 sha1_file: do not access pack if unneeded
Currently, regardless of the contents of the "struct object_info" passed
to sha1_object_info_extended(), that function always accesses the
packfile whenever it returns information about a packed object, since it
needs to populate "u.packed".

Add the ability to pass NULL, and use NULL-ness of the argument to
activate an optimization in which sha1_object_info_extended() does not
needlessly access the packfile. A subsequent patch will make use of this
optimization.

A similar optimization is not made for the cached and loose cases as it
would not cause a significant performance improvement.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-26 10:28:58 -07:00
Jonathan Tan dfdd4afcf9 sha1_file: teach sha1_object_info_extended more flags
Improve sha1_object_info_extended() by supporting additional
flags. This allows has_sha1_file_with_flags() to be modified to use
sha1_object_info_extended() in a subsequent patch.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-26 10:28:42 -07:00
Christian Couder 3ee83f48e5 t1700: make sure split-index respects core.sharedrepository
Add a few tests to check that both the split-index file and the
shared-index file are created using the right permissions when
core.sharedrepository is set.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-25 10:42:52 -07:00
Christian Couder 73de1c93ad t1301: move modebits() to test-lib-functions.sh
As the modebits() function can be useful outside t1301,
let's move it into test-lib-functions.sh, and while at
it let's rename it test_modebits().

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-25 10:42:52 -07:00
Christian Couder df801f3f9f read-cache: use shared perms when writing shared index
Since f6ecc62dbf (write_shared_index(): use tempfile module, 2015-08-10)
write_shared_index() has been using mks_tempfile() to create the
temporary file that will become the shared index.

But even before that, it looks like the functions used to create this
file didn't call adjust_shared_perm(), which means that the shared
index file has always been created with 600 permissions regardless
of the shared permission settings.

Because of that, on repositories created with `git init --shared=all`
and using the split index feature, one gets an error like:

fatal: .git/sharedindex.a52f910b489bc462f187ab572ba0086f7b5157de: index file open failed: Permission denied

when another user performs any operation that reads the shared index.

Call adjust_shared_perm() on the temporary file created by
mks_tempfile() ourselves to adjust the permission bits.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-25 10:42:52 -07:00
Junio C Hamano e629a7d28a Sync with 2.13.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-24 15:34:14 -07:00
Junio C Hamano 8c8e978f57 Git 2.13.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-24 15:31:36 -07:00
Junio C Hamano 8992def6b3 Merge branch 'sn/reset-doc-typofix' into maint
Doc update.

* sn/reset-doc-typofix:
  doc: git-reset: fix a trivial typo
2017-06-24 15:29:35 -07:00
Junio C Hamano 74567ac001 Merge branch 'sg/doc-pretty-formats' into maint
Doc update.

* sg/doc-pretty-formats:
  docs/pretty-formats: stress that %- removes all preceding line-feeds
2017-06-24 15:29:35 -07:00
Junio C Hamano 77bcac3e72 Merge branch 'sd/t3200-branch-m-test' into maint
New test.

* sd/t3200-branch-m-test:
  t3200: add test for single parameter passed to -m option
2017-06-24 15:29:34 -07:00
Junio C Hamano 8d7a6b6c85 Merge branch 'sg/revision-parser-skip-prefix' into maint
Code clean-up.

* sg/revision-parser-skip-prefix:
  revision.c: use skip_prefix() in handle_revision_pseudo_opt()
  revision.c: use skip_prefix() in handle_revision_opt()
  revision.c: stricter parsing of '--early-output'
  revision.c: stricter parsing of '--no-{min,max}-parents'
  revision.h: turn rev_info.early_output back into an unsigned int
2017-06-24 15:29:34 -07:00
Junio C Hamano 6f0c89d08c Merge branch 'km/test-mailinfo-b-failure' into maint
New tests.

* km/test-mailinfo-b-failure:
  t5100: add some more mailinfo tests
2017-06-24 15:29:33 -07:00
Junio C Hamano 4f7132a9be Merge branch 'sb/submodule-rm-absorb' into maint
Doc update to a recently graduated topic.

* sb/submodule-rm-absorb:
  Documentation/git-rm: correct submodule description
2017-06-24 15:29:32 -07:00
Junio C Hamano b960cd37c6 Merge branch 'jc/diff-tree-stale-comment' into maint
Comment fix.

* jc/diff-tree-stale-comment:
  diff-tree: update stale in-code comments
2017-06-24 15:29:31 -07:00
Junio C Hamano c4db75f275 Merge branch 'ps/stash-push-pathspec-fix' into maint
"git stash push <pathspec>" did not work from a subdirectory at all.
Bugfix for a topic in v2.13

* ps/stash-push-pathspec-fix:
  git-stash: fix pushing stash with pathspec from subdir
2017-06-24 15:29:30 -07:00
Junio C Hamano 0378c85644 Merge branch 'ls/github' into maint
Help contributors that visit us at GitHub.

* ls/github:
  Configure Git contribution guidelines for github.com
2017-06-24 15:29:29 -07:00
Junio C Hamano 7deb48af0f Merge branch 'jk/pack-idx-corruption-safety' into maint
A flaky test has been corrected.

* jk/pack-idx-corruption-safety:
  t5313: make extended-table test more deterministic
2017-06-24 15:29:29 -07:00
Junio C Hamano 7809876866 Merge branch 'jk/diff-blob' into maint
The result from "git diff" that compares two blobs, e.g. "git diff
$commit1:$path $commit2:$path", used to be shown with the full
object name as given on the command line, but it is more natural to
use the $path in the output and use it to look up .gitattributes.

* jk/diff-blob:
  diff: use blob path for blob/file diffs
  diff: use pending "path" if it is available
  diff: use the word "path" instead of "name" for blobs
  diff: pass whole pending entry in blobinfo
  handle_revision_arg: record paths for pending objects
  handle_revision_arg: record modes for "a..b" endpoints
  t4063: add tests of direct blob diffs
  get_sha1_with_context: dynamically allocate oc->path
  get_sha1_with_context: always initialize oc->symlink_path
  sha1_name: consistently refer to object_context as "oc"
  handle_revision_arg: add handle_dotdot() helper
  handle_revision_arg: hoist ".." check out of range parsing
  handle_revision_arg: stop using "dotdot" as a generic pointer
  handle_revision_arg: simplify commit reference lookups
  handle_revision_arg: reset "dotdot" consistently
2017-06-24 15:29:28 -07:00
Junio C Hamano e8d9d8b0bd Merge branch 'jc/name-rev-lw-tag' into maint
"git describe --contains" penalized light-weight tags so much that
they were almost never considered.  Instead, give them about the
same chance to be considered as an annotated tag that is the same
age as the underlying commit would.

* jc/name-rev-lw-tag:
  name-rev: favor describing with tags and use committer date to tiebreak
  name-rev: refactor logic to see if a new candidate is a better name
2017-06-24 15:29:28 -07:00