Commit graph

44142 commits

Author SHA1 Message Date
Junio C Hamano 3a3338d373 Merge branch 'nd/log-decorate-color-head-arrow'
An entry "git log --decorate" for the tip of the current branch is
shown as "HEAD -> name" (where "name" is the name of the branch);
paint the arrow in the same color as "HEAD", not in the color for
commits.

* nd/log-decorate-color-head-arrow:
  log: decorate HEAD -> branch with the same color for arrow and HEAD
2016-08-08 14:48:42 -07:00
Junio C Hamano 940622bc8b Merge branch 'rs/use-strbuf-addstr'
* rs/use-strbuf-addstr:
  use strbuf_addstr() instead of strbuf_addf() with "%s"
  use strbuf_addstr() for adding constant strings to a strbuf
2016-08-08 14:48:41 -07:00
Junio C Hamano 68e80da479 Merge branch 'rs/st-mult'
Micro optimization of st_mult() facility used to check the integer
overflow coming from multiplication to compute size of memory
allocation.

* rs/st-mult:
  pass constants as first argument to st_mult()
2016-08-08 14:48:41 -07:00
Junio C Hamano 09ee6444f2 Merge branch 'ib/t3700-add-chmod-x-updates'
The t3700 test about "add --chmod=-x" have been made a bit more
robust and generally cleaned up.

* ib/t3700-add-chmod-x-updates:
  t3700: add a test_mode_in_index helper function
  t3700: merge two tests into one
  t3700: remove unwanted leftover files before running new tests
2016-08-08 14:48:40 -07:00
Junio C Hamano ae674b0130 Merge branch 'ab/gitweb-link-html-escape'
The characters in the label shown for tags/refs for commits in
"gitweb" output are now properly escaped for proper HTML output.

* ab/gitweb-link-html-escape:
  gitweb: escape link body in format_ref_marker
2016-08-08 14:48:40 -07:00
Junio C Hamano 78849622ec Merge branch 'jk/pack-objects-optim'
"git pack-objects" has a few options that tell it not to pack
objects found in certain packfiles, which require it to scan .idx
files of all available packs.  The codepaths involved in these
operations have been optimized for a common case of not having any
non-local pack and/or any .kept pack.

* jk/pack-objects-optim:
  pack-objects: compute local/ignore_pack_keep early
  pack-objects: break out of want_object loop early
  find_pack_entry: replace last_found_pack with MRU cache
  add generic most-recently-used list
  sha1_file: drop free_pack_by_name
  t/perf: add tests for many-pack scenarios
2016-08-08 14:48:39 -07:00
Junio C Hamano 7647537e3e Merge branch 'jk/difftool-in-subdir'
"git difftool <paths>..." started in a subdirectory failed to
interpret the paths relative to that directory, which has been
fixed.

* jk/difftool-in-subdir:
  difftool: use Git::* functions instead of passing around state
  difftool: avoid $GIT_DIR and $GIT_WORK_TREE
  difftool: fix argument handling in subdirs
2016-08-08 14:48:39 -07:00
Junio C Hamano 768ededa9c Merge branch 'va/i18n'
More i18n marking.

* va/i18n:
  i18n: config: unfold error messages marked for translation
  i18n: notes: mark comment for translation
2016-08-08 14:48:38 -07:00
Junio C Hamano 6b9114c649 Merge branch 'js/rebase-i-progress-tidy'
Regression fix for an i18n topic already in 'master'.

* js/rebase-i-progress-tidy:
  rebase-interactive: trim leading whitespace from progress count
2016-08-08 14:48:38 -07:00
Junio C Hamano 0d3279962a Merge branch 'jk/reflog-date'
The reflog output format is documented better, and a new format
--date=unix to report the seconds-since-epoch (without timezone)
has been added.

* jk/reflog-date:
  date: clarify --date=raw description
  date: add "unix" format
  date: document and test "raw-local" mode
  doc/pretty-formats: explain shortening of %gd
  doc/pretty-formats: describe index/time formats for %gd
  doc/rev-list-options: explain "-g" output formats
  doc/rev-list-options: clarify "commit@{Nth}" for "-g" option
2016-08-08 14:48:37 -07:00
Junio C Hamano 4c30ad8cc6 Merge branch 'cp/completion-clone-recurse-submodules'
* cp/completion-clone-recurse-submodules:
  completion: add option '--recurse-submodules' to 'git clone'
2016-08-08 14:48:37 -07:00
Junio C Hamano 4d7f59aece Merge branch 'jk/t4205-cleanup'
Test modernization.

* jk/t4205-cleanup:
  t4205: indent here documents
  t4205: drop top-level &&-chaining
2016-08-08 14:48:36 -07:00
Junio C Hamano f2be3b73e0 Merge branch 'da/subtree-modernize'
Style fixes for "git subtree" (in contrib/).

* da/subtree-modernize:
  subtree: adjust function definitions to match CodingGuidelines
  subtree: adjust style to match CodingGuidelines
2016-08-08 14:48:35 -07:00
Junio C Hamano abbf7bd495 Merge branch 'nd/fetch-ref-summary'
Hotfix of a test in a topic that has already been merged to 'master'.

* nd/fetch-ref-summary:
  t5510: skip tests under GETTEXT_POISON build
2016-08-08 14:48:35 -07:00
Junio C Hamano 612c3dfb06 Merge branch 'ew/git-svn-http-tests'
Tests for "git svn" have been taught to reuse the lib-httpd test
infrastructure when testing the subversion integration that
interacts with subversion repositories served over the http://
protocol.

* ew/git-svn-http-tests:
  git svn: migrate tests to use lib-httpd
  t/t91*: do not say how to avoid the tests
2016-08-08 14:48:34 -07:00
Junio C Hamano 3819fb9ab4 Merge branch 'js/t4130-rename-without-ino'
Windows port was failing some tests in t4130, due to the lack of
inum in the returned values by its lstat(2) emulation.

* js/t4130-rename-without-ino:
  t4130: work around Windows limitation
2016-08-08 14:48:33 -07:00
Junio C Hamano 00f27feb6a Hopefully final batch for 2.9.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-08 14:22:36 -07:00
Junio C Hamano 593be730f2 Merge branch 'sb/pack-protocol-doc-nak' into maint
A doc update.

* sb/pack-protocol-doc-nak:
  Documentation: pack-protocol correct NAK response
2016-08-08 14:21:47 -07:00
Junio C Hamano f7b01d3eb7 Merge branch 'rs/submodule-config-code-cleanup' into maint
Code cleanup.

* rs/submodule-config-code-cleanup:
  submodule-config: fix test binary crashing when no arguments given
  submodule-config: combine early return code into one goto
  submodule-config: passing name reference for .gitmodule blobs
  submodule-config: use explicit empty string instead of strbuf in config_from()
2016-08-08 14:21:46 -07:00
Junio C Hamano 6a024a249f Merge branch 'sb/submodule-deinit-all' into maint
A comment update for a topic that was merged to Git v2.8.

* sb/submodule-deinit-all:
  submodule deinit: remove outdated comment
2016-08-08 14:21:46 -07:00
Junio C Hamano 5131967e4a Merge branch 'rs/worktree-use-strbuf-absolute-path' into maint
Code simplification.

* rs/worktree-use-strbuf-absolute-path:
  worktree: use strbuf_add_absolute_path() directly
2016-08-08 14:21:45 -07:00
Junio C Hamano 2f8c654edb Merge branch 'jc/doc-diff-filter-exclude' into maint
Belated doc update for a feature added in v1.8.5.

* jc/doc-diff-filter-exclude:
  diff: document diff-filter exclusion
2016-08-08 14:21:44 -07:00
Junio C Hamano 970994deb1 Merge branch 'nd/test-helpers' into maint
Build clean-up.

* nd/test-helpers:
  t/test-lib.sh: fix running tests with --valgrind
  Makefile: use VCSSVN_LIB to refer to svn library
  Makefile: drop extra dependencies for test helpers
2016-08-08 14:21:43 -07:00
Junio C Hamano 48aa37ed42 Merge branch 'rs/use-strbuf-addbuf' into maint
Code cleanup.

* rs/use-strbuf-addbuf:
  strbuf: avoid calling strbuf_grow() twice in strbuf_addbuf()
  use strbuf_addbuf() for appending a strbuf to another
2016-08-08 14:21:42 -07:00
Junio C Hamano ee7fd70edf Merge branch 'lf/recv-sideband-cleanup' into maint
Code simplification.

* lf/recv-sideband-cleanup:
  sideband.c: small optimization of strbuf usage
  sideband.c: refactor recv_sideband()
2016-08-08 14:21:41 -07:00
Junio C Hamano e69771c3af Merge branch 'ah/unpack-trees-advice-messages' into maint
Grammofix.

* ah/unpack-trees-advice-messages:
  unpack-trees: fix English grammar in do-this-before-that messages
2016-08-08 14:21:40 -07:00
Junio C Hamano 26256c017f Merge branch 'lf/sideband-returns-void' into maint
A small internal API cleanup.

* lf/sideband-returns-void:
  upload-pack.c: make send_client_data() return void
  sideband.c: make send_sideband() return void
2016-08-08 14:21:40 -07:00
Junio C Hamano 1e274ef2ba Merge branch 'jk/send-pack-stdio' into maint
Code clean-up.

* jk/send-pack-stdio:
  write_or_die: remove the unused write_or_whine() function
  send-pack: use buffered I/O to talk to pack-objects
2016-08-08 14:21:39 -07:00
Junio C Hamano a220e2bbbf Merge branch 'pb/commit-editmsg-path' into maint
Code clean-up.

* pb/commit-editmsg-path:
  builtin/commit.c: memoize git-path for COMMIT_EDITMSG
2016-08-08 14:21:38 -07:00
Junio C Hamano 8d64216807 Merge branch 'ew/find-perl-on-freebsd-in-local' into maint
Recent FreeBSD stopped making perl available at /usr/bin/perl;
switch the default the built-in path to /usr/local/bin/perl on not
too ancient FreeBSD releases.

* ew/find-perl-on-freebsd-in-local:
  config.mak.uname: correct perl path on FreeBSD
2016-08-08 14:21:38 -07:00
Junio C Hamano 172b811322 Merge branch 'ew/daemon-socket-keepalive' into maint
Recent update to "git daemon" tries to enable the socket-level
KEEPALIVE, but when it is spawned via inetd, the standard input
file descriptor may not necessarily be connected to a socket.
Suppress an ENOTSOCK error from setsockopt().

* ew/daemon-socket-keepalive:
  Windows: add missing definition of ENOTSOCK
  daemon: ignore ENOTSOCK from setsockopt
2016-08-08 14:21:37 -07:00
Junio C Hamano aa9136a87e Merge branch 'nd/pack-ofs-4gb-limit' into maint
"git pack-objects" and "git index-pack" mostly operate with off_t
when talking about the offset of objects in a packfile, but there
were a handful of places that used "unsigned long" to hold that
value, leading to an unintended truncation.

* nd/pack-ofs-4gb-limit:
  fsck: use streaming interface for large blobs in pack
  pack-objects: do not truncate result in-pack object size on 32-bit systems
  index-pack: correct "offset" type in unpack_entry_data()
  index-pack: report correct bad object offsets even if they are large
  index-pack: correct "len" type in unpack_data()
  sha1_file.c: use type off_t* for object_info->disk_sizep
  pack-objects: pass length to check_pack_crc() without truncation
2016-08-08 14:21:36 -07:00
Junio C Hamano 743fba85f7 Merge branch 'rs/notes-merge-no-toctou' into maint
"git notes merge" had a code to see if a path exists (and fails if
it does) and then open the path for writing (when it doesn't).
Replace it with open with O_EXCL.

* rs/notes-merge-no-toctou:
  notes-merge: use O_EXCL to avoid overwriting existing files
2016-08-08 14:21:35 -07:00
Junio C Hamano a52fb9b8f3 Merge branch 'js/ignore-space-at-eol' into maint
An age old bug that caused "git diff --ignore-space-at-eol"
misbehave has been fixed.

* js/ignore-space-at-eol:
  diff: fix a double off-by-one with --ignore-space-at-eol
  diff: demonstrate a bug with --patience and --ignore-space-at-eol
2016-08-08 14:21:35 -07:00
Junio C Hamano 71076e11cd Merge branch 'jk/push-scrub-url' into maint
"git fetch http://user:pass@host/repo..." scrubbed the userinfo
part, but "git push" didn't.

* jk/push-scrub-url:
  t5541: fix url scrubbing test when GPG is not set
  push: anonymize URL in status output
2016-08-08 14:21:34 -07:00
Junio C Hamano 880b3fee51 Merge branch 'nd/cache-tree-ita' into maint
"git add -N dir/file && git write-tree" produced an incorrect tree
when there are other paths in the same directory that sorts after
"file".

* nd/cache-tree-ita:
  cache-tree: do not generate empty trees as a result of all i-t-a subentries
  cache-tree.c: fix i-t-a entry skipping directory updates sometimes
  test-lib.sh: introduce and use $EMPTY_BLOB
  test-lib.sh: introduce and use $EMPTY_TREE
2016-08-08 14:21:33 -07:00
Junio C Hamano 327b3f8459 Merge branch 'mh/blame-worktree' into maint
"git blame file" allowed the lineage of lines in the uncommitted,
unadded contents of "file" to be inspected, but it refused when
"file" did not appear in the current commit.  When "file" was
created by renaming an existing file (but the change has not been
committed), this restriction was unnecessarily tight.

* mh/blame-worktree:
  t/t8003-blame-corner-cases.sh: Use here documents
  blame: allow to blame paths freshly added to the index
2016-08-08 14:21:32 -07:00
Johannes Schindelin 189d035e67 git mv: do not keep slash in git mv dir non-existing-dir/
When calling `rename("dir", "non-existing-dir/")` on Linux, it silently
succeeds, stripping the trailing slash of the second argument.

This is all good and dandy but this behavior disagrees with the specs at

http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html

that state clearly regarding the 2nd parameter (called `new`):

	If the `new` argument does not resolve to an existing directory
	entry for a file of type directory and the `new` argument
	contains at least one non- <slash> character and ends with one
	or more trailing <slash> characters after all symbolic links
	have been processed, `rename()` shall fail.

Of course, we would like `git mv dir non-existing-dir/` to succeed (and
rename the directory "dir" to "non-existing-dir"). Let's be extra
careful to remove the trailing slash in that case.

This lets t7001-mv.sh pass in Bash on Windows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-08 10:43:20 -07:00
René Scharfe 1eb47f167d use strbuf_add_unique_abbrev() for adding short hashes
Call strbuf_add_unique_abbrev() to add abbreviated hashes to strbufs
instead of taking detours through find_unique_abbrev() and its static
buffer.  This is shorter and a bit more efficient.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-06 10:33:57 -07:00
René Scharfe 560b0e8f52 archive-tar: make write_extended_header() void
The function write_extended_header() only ever returns 0.  Simplify
it and its caller by dropping its return value, like we did with
write_global_extended_header() earlier.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-06 10:31:51 -07:00
René Scharfe c6c9e1885c nedmalloc: work around overzealous GCC 6 warning
With GCC 6, the strdup() function is declared with the "nonnull"
attribute, stating that it is not allowed to pass a NULL value as
parameter.

In nedmalloc()'s reimplementation of strdup(), Postel's Law is heeded
and NULL parameters are handled gracefully. GCC 6 complains about that
now because it thinks that NULL cannot be passed to strdup() anyway.

Because the callers in this project of strdup() must be prepared to
call any implementation of strdup() supplied by the platform, so it
is pointless to pretend that it is OK to call it with NULL.

Remove the conditional based on NULL-ness of the input; this
squelches the warning.  Check the return value of malloc() instead
to make sure we actually got the memory to write to.

See https://gcc.gnu.org/gcc-6/porting_to.html for details.

Diagnosed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-05 15:37:47 -07:00
René Scharfe 02a8cfa478 merge: use string_list_split() in add_strategies()
Call string_list_split() for cutting a space separated list into pieces
instead of reimplementing it based on struct strategy.  The attr member
of struct strategy was not used split_merge_strategies(); it was a pure
string operation.  Also be nice and clean up once we're done splitting;
the old code didn't bother freeing any of the allocated memory.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-05 15:11:06 -07:00
René Scharfe af4941d444 merge-recursive: use STRING_LIST_INIT_NODUP
Initialize a string_list right when it's defined.  That's shorter, saves
a function call and makes it more obvious that we're using the NODUP
variant here.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-05 15:10:35 -07:00
René Scharfe 542aa25d97 use CHILD_PROCESS_INIT to initialize automatic variables
Initialize struct child_process variables already when they're defined.
That's shorter and saves a function call.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-05 15:10:05 -07:00
René Scharfe bc57b9c0cc use strbuf_addstr() instead of strbuf_addf() with "%s"
Call strbuf_addstr() for adding a simple string to a strbuf instead of
using the heavier strbuf_addf().  This is shorter and documents the
intent more clearly.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-05 15:09:25 -07:00
Jeff King 6f25305799 trace: do not fall back to stderr
If the trace code cannot open a specified file, or does not
understand the contents of the GIT_TRACE variable, it falls
back to printing trace output to stderr.

This is an attempt to be helpful, but in practice it just
ends up annoying. The user was trying to get the output to
go somewhere else, so spewing it to stderr does not really
accomplish that. And as it's intended for debugging, they
can presumably re-run the command with their error
corrected.

So instead of falling back, this patch disables bogus trace
keys for the rest of the program, just as we do for write
errors. We can drop the "Defaulting to..." part of the error
message entirely; after seeing "cannot open '/foo'", the
user can assume that tracing is skipped.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-05 09:28:17 -07:00
Jeff King ca5c701ca5 write_or_die: drop write_or_whine_pipe()
This function has no callers, and is not likely to gain any
because it's confusing to use.

It unconditionally complains to stderr, but _doesn't_ die.
Yet any caller which wants a "gentle" write would generally
want to suppress the error message, because presumably
they're going to write a better one, and/or try the
operation again.

And the check_pipe() call leads to confusing behaviors. It
means we die for EPIPE, but not for other errors, which is
confusing and pointless.

On top of all that, it has unusual error return semantics,
which makes it easy for callers to get it wrong.

Let's drop the function, and if somebody ever needs to
resurrect something like it, they can fix these warts.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-05 09:28:17 -07:00
Jeff King 46ac74b716 trace: disable key after write error
If we get a write error writing to a trace descriptor, the
error isn't likely to go away if we keep writing. Instead,
you'll just get the same error over and over. E.g., try:

  GIT_TRACE_PACKET=42 git ls-remote >/dev/null

You don't really need to see:

  warning: unable to write trace for GIT_TRACE_PACKET: Bad file descriptor

hundreds of times. We could fallback to tracing to stderr,
as we do in the error code-path for open(), but there's not
much point. If the user fed us a bogus descriptor, they're
probably better off fixing their invocation. And if they
didn't, and we saw a transient error (e.g., ENOSPC writing
to a file), it probably doesn't help anybody to have half of
the trace in a file, and half on stderr.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-05 09:28:16 -07:00
Jeff King 3b0c3ab777 trace: correct variable name in write() error message
Our error message for write() always mentions GIT_TRACE,
even though we may be writing for a different variable
entirely. It's also not quite accurate to say "fd given by
GIT_TRACE environment variable", as we may hit this error
based on a filename the user put in the variable (we do
complain and switch to stderr if the file cannot be opened,
but it's still possible to hit a write() error on the
descriptor later).

So let's fix those things, and switch to our more usual
"unable to do X: Y" format for the error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-05 09:28:16 -07:00
Jeff King b3a1c5da02 trace: cosmetic fixes for error messages
The error messages for the trace code are often multi-line;
the first line gets a nice "warning:", but the rest are
left-aligned. Let's give them an indentation to make sure
they stand out as a unit.

While we're here, let's also downcase the first letter of
each error (our usual style), and break up a long line of
advice (since we're already using multiple lines, one more
doesn't hurt).

We also replace "What does 'foo' for GIT_TRACE mean?". While
cute, it's probably a good idea to give more context, and
follow our usual styles. So it's now "unknown trace value
for 'GIT_TRACE': foo".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-05 09:28:16 -07:00