gitweb.git
Merge branch 'tb/push-to-cygwin-unc-path'Junio C Hamano Tue, 18 Jul 2017 19:48:09 +0000 (12:48 -0700)

Merge branch 'tb/push-to-cygwin-unc-path'

On Cygwin, similar to Windows, "git push //server/share/repository"
ought to mean a repository on a network share that can be accessed
locally, but this did not work correctly due to stripping the double
slashes at the beginning.

This may need to be heavily tested before it gets unleashed to the
wild, as the change is at a fairly low-level code and would affect
not just the code to decide if the push destination is local. There
may be unexpected fallouts in the path normalization.

* tb/push-to-cygwin-unc-path:
cygwin: allow pushing to UNC paths

clean.c: use designated initializerJunio C Hamano Fri, 14 Jul 2017 15:38:09 +0000 (08:38 -0700)

clean.c: use designated initializer

This is another test balloon to see if we get complaints from people
whose compilers do not support designated initializer for arrays.

The use of the feature is not all that interesting for cases like
the one this patch touches, where the initialized elements of the
array is dense, but it would be nice if we can use the feature to
initialize an array that has elements initialized to interesting
values only sparsely.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: skip unreadable subdirectoriesHielke Christian Braun Tue, 18 Jul 2017 08:41:54 +0000 (10:41 +0200)

gitweb: skip unreadable subdirectories

gitweb terminates and shows no project list, if it can not access a
sub-directory in the project root directory while looking for projects
to show.

Work it around by skipping unreadable directories.

Signed-off-by: Hielke Christian Braun <hcb@unco.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: Update Catalan translationJordi Mas Tue, 18 Jul 2017 19:06:06 +0000 (21:06 +0200)

l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>

doc: camelCase the i18n config variables to improve... Kaartic Sivaraam Mon, 17 Jul 2017 15:39:00 +0000 (21:09 +0530)

doc: camelCase the i18n config variables to improve readability

The i18n config variable used weren't readable as they were in
the crude form of how git stores/uses it's config variables.

Improve it's readability by replacing them with camelCased versions
of config variables as it doesn't have any impact on it's usage.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: check for empty message before the check for... Kaartic Sivaraam Mon, 17 Jul 2017 15:36:15 +0000 (21:06 +0530)

commit: check for empty message before the check for untouched template

The check for whether the template given to 'git commit' is untouched
is done before the empty message check. This results in a wrong error
message being displayed in the following case. When the user removes
everything in template completely to abort the commit he is shown the
"template untouched" error which is wrong. He should be shown the
"empty message" error.

Do the empty message check before checking for an untouched template
thus fixing this issue.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: make resolve message clearer for inexperienced... William Duclot Sun, 16 Jul 2017 19:42:20 +0000 (21:42 +0200)

rebase: make resolve message clearer for inexperienced users

The git UI can be improved by addressing the error messages to those
they help: inexperienced and casual git users. To this intent, it is
helpful to make sure the terms used in those messages can be understood
by this segment of users, and that they guide them to resolve the
problem.

In particular, failure to apply a patch during a git rebase is a common
problem that can be very destabilizing for the inexperienced user. It is
important to lead them toward the resolution of the conflict (which is a
3-steps process, thus complex) and reassure them that they can escape a
situation they can't handle with "--abort". This commit answer those two
points by detailling the resolution process and by avoiding cryptic git
linguo.

Signed-off-by: William Duclot <william.duclot@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

dir: support platforms that require aligned readsRené Scharfe Sun, 16 Jul 2017 12:17:37 +0000 (14:17 +0200)

dir: support platforms that require aligned reads

The untracked cache is stored on disk by concatenating its memory
structures without any padding. Consequently some of the structs are
not aligned at a particular boundary when the whole extension is read
back in one go. That's only OK on platforms without strict alignment
requirements, or for byte-aligned data like strings or hash values.

Decode struct ondisk_untracked_cache carefully from the extension
blob by using explicit pointer arithmetic with offsets, avoiding
alignment issues. Use char pointers for passing stat_data objects to
stat_data_from_disk(), and use memcpy(3) in that function to get the
contents into a properly aligned struct, then perform the byte-order
adjustment in place there.

Found with Clang's UBSan.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: handle EOF in test_copy_bytes()Jeff King Sun, 16 Jul 2017 10:45:32 +0000 (06:45 -0400)

t: handle EOF in test_copy_bytes()

The test_copy_bytes() function claims to read up to N bytes,
or until it gets EOF. But we never handle EOF in our loop,
and a short input will cause perl to go into an infinite
loop of read() getting zero bytes.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ls-files: don't try to prune an empty indexRené Scharfe Sun, 16 Jul 2017 11:16:01 +0000 (13:16 +0200)

ls-files: don't try to prune an empty index

Exit early when asked to prune an index that contains no entries to
begin with. This avoids pointer arithmetic on istate->cache, which is
possibly NULL in that case.

Found with Clang's UBSan.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

apply: use COPY_ARRAY and MOVE_ARRAY in update_image()René Scharfe Sat, 15 Jul 2017 20:20:54 +0000 (22:20 +0200)

apply: use COPY_ARRAY and MOVE_ARRAY in update_image()

Simplify the code by using the helper macros COPY_ARRAY and MOVE_ARRAY,
which also makes them more robust in the case we copy or move no lines,
as they allow using NULL points in that case, while memcpy(3) and
memmove(3) don't.

Found with Clang's UBSan.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use MOVE_ARRAYRené Scharfe Sat, 15 Jul 2017 20:00:45 +0000 (22:00 +0200)

use MOVE_ARRAY

Simplify the code for moving members inside of an array and make it more
robust by using the helper macro MOVE_ARRAY. It calculates the size
based on the specified number of elements for us and supports NULL
pointers when that number is zero. Raw memmove(3) calls with NULL can
cause the compiler to (over-eagerly) optimize out later NULL checks.

This patch was generated with contrib/coccinelle/array.cocci and spatch
(Coccinelle).

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add MOVE_ARRAYRené Scharfe Sat, 15 Jul 2017 19:36:20 +0000 (21:36 +0200)

add MOVE_ARRAY

Similar to COPY_ARRAY (introduced in 60566cbb58), add a safe and
convenient helper for moving potentially overlapping ranges of array
entries. It infers the element size, multiplies automatically and
safely to get the size in bytes, does a basic type safety check by
comparing element sizes and unlike memmove(3) it supports NULL
pointers iff 0 elements are to be moved.

Also add a semantic patch to demonstrate the helper's intended usage.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bswap: convert get_be16, get_be32 and put_be32 to inlin... René Scharfe Sat, 15 Jul 2017 19:22:50 +0000 (21:22 +0200)

bswap: convert get_be16, get_be32 and put_be32 to inline functions

Simplify the implementation and allow callers to use expressions with
side-effects by turning the macros get_be16, get_be32 and put_be32 into
inline functions.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bswap: convert to unsigned before shifting in get_be32René Scharfe Sat, 15 Jul 2017 19:11:14 +0000 (21:11 +0200)

bswap: convert to unsigned before shifting in get_be32

The pointer p is dereferenced and we get an unsigned char. Before
shifting it's automatically promoted to int. Left-shifting a signed
32-bit value bigger than 127 by 24 places is undefined. Explicitly
convert to a 32-bit unsigned type to avoid undefined behaviour if
the highest bit is set.

Found with Clang's UBSan.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

set FD_CLOEXEC properly when O_CLOEXEC is not supportedEric Wong Sat, 15 Jul 2017 18:55:40 +0000 (18:55 +0000)

set FD_CLOEXEC properly when O_CLOEXEC is not supported

FD_CLOEXEC only applies to the file descriptor, so it needs to be
manipuluated via F_GETFD/F_SETFD. F_GETFL/F_SETFL are for file
description flags.

Verified via strace with o_cloexec set to zero.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

receive-pack: don't access hash of NULL object_id pointerRené Scharfe Sat, 15 Jul 2017 18:33:54 +0000 (20:33 +0200)

receive-pack: don't access hash of NULL object_id pointer

We set old_oid to NULL if we found out that it's a corrupt reference.
In that case don't try to access the hash member and pass NULL to
ref_transaction_delete() instead.

Found with Clang's UBSan.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes: don't access hash of NULL object_id pointerRené Scharfe Sat, 15 Jul 2017 18:15:26 +0000 (20:15 +0200)

notes: don't access hash of NULL object_id pointer

Check if note is NULL, as we already do for different purposes a few
lines above, and pass a NULL pointer to prepare_note_data() in that
case instead of trying to access the hash member.

Found with Clang's UBSan.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: allow combining UBSan with other sanitizersRené Scharfe Sat, 15 Jul 2017 17:18:56 +0000 (19:18 +0200)

Makefile: allow combining UBSan with other sanitizers

Multiple sanitizers can be specified as a comma-separated list. Set
the flag NO_UNALIGNED_LOADS even if UndefinedBehaviorSanitizer is not
the only sanitizer to build with.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tree-diff: don't access hash of NULL object_id pointerRené Scharfe Sat, 15 Jul 2017 17:18:51 +0000 (19:18 +0200)

tree-diff: don't access hash of NULL object_id pointer

The object_id pointers can be NULL for invalid entries. Don't try to
dereference them and pass NULL along to fill_tree_descriptor() instead,
which handles them just fine.

Found with Clang's UBSan.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

alias: compare alias name *case-insensitively*Johannes Schindelin Fri, 14 Jul 2017 08:39:38 +0000 (10:39 +0200)

alias: compare alias name *case-insensitively*

It is totally legitimate to add CamelCased aliases, but due to the way
config keys are compared, the case does not matter.

Therefore, we must compare the alias name insensitively to the config
keys.

This fixes a regression introduced by a9bcf6586d1 (alias: use
the early config machinery to expand aliases, 2017-06-14).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t1300: demonstrate that CamelCased aliases regressedJohannes Schindelin Fri, 14 Jul 2017 08:39:29 +0000 (10:39 +0200)

t1300: demonstrate that CamelCased aliases regressed

It is totally legitimate to add CamelCased aliases, but due to the way
config keys are compared, the case does not matter.

Except that now it does: the alias name is expected to be all
lower-case. This is a regression introduced by a9bcf6586d1 (alias: use
the early config machinery to expand aliases, 2017-06-14).

Noticed by Alejandro Pauly, diagnosed by Kevin Willford.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_name: convert uses of 40 to GIT_SHA1_HEXSZbrian m. carlson Thu, 13 Jul 2017 23:49:30 +0000 (23:49 +0000)

sha1_name: convert uses of 40 to GIT_SHA1_HEXSZ

There are several uses of the constant 40 in find_unique_abbrev_r.
Convert them to GIT_SHA1_HEXSZ.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_name: convert GET_SHA1* flags to GET_OID*brian m. carlson Thu, 13 Jul 2017 23:49:29 +0000 (23:49 +0000)

sha1_name: convert GET_SHA1* flags to GET_OID*

Convert the flags for get_oid_with_context and friends to use "OID"
instead of "SHA1" in their names.

This transform was made by running the following one-liner on the
affected files:

perl -pi -e 's/GET_SHA1/GET_OID/g'

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_name: convert get_sha1* to get_oid*brian m. carlson Thu, 13 Jul 2017 23:49:28 +0000 (23:49 +0000)

sha1_name: convert get_sha1* to get_oid*

Now that all the callers of get_sha1 directly or indirectly use struct
object_id, rename the functions starting with get_sha1 to start with
get_oid. Convert the internals in sha1_name.c to use struct object_id
as well, and eliminate explicit length checks where possible. Convert a
use of 40 in get_oid_basic to GIT_SHA1_HEXSZ.

Outside of sha1_name.c and cache.h, this transition was made with the
following semantic patch:

@@
expression E1, E2;
@@
- get_sha1(E1, E2.hash)
+ get_oid(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1(E1, E2->hash)
+ get_oid(E1, E2)

@@
expression E1, E2;
@@
- get_sha1_committish(E1, E2.hash)
+ get_oid_committish(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1_committish(E1, E2->hash)
+ get_oid_committish(E1, E2)

@@
expression E1, E2;
@@
- get_sha1_treeish(E1, E2.hash)
+ get_oid_treeish(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1_treeish(E1, E2->hash)
+ get_oid_treeish(E1, E2)

@@
expression E1, E2;
@@
- get_sha1_commit(E1, E2.hash)
+ get_oid_commit(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1_commit(E1, E2->hash)
+ get_oid_commit(E1, E2)

@@
expression E1, E2;
@@
- get_sha1_tree(E1, E2.hash)
+ get_oid_tree(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1_tree(E1, E2->hash)
+ get_oid_tree(E1, E2)

@@
expression E1, E2;
@@
- get_sha1_blob(E1, E2.hash)
+ get_oid_blob(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1_blob(E1, E2->hash)
+ get_oid_blob(E1, E2)

@@
expression E1, E2, E3, E4;
@@
- get_sha1_with_context(E1, E2, E3.hash, E4)
+ get_oid_with_context(E1, E2, &E3, E4)

@@
expression E1, E2, E3, E4;
@@
- get_sha1_with_context(E1, E2, E3->hash, E4)
+ get_oid_with_context(E1, E2, E3, E4)

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Convert remaining callers of get_sha1 to get_oid.brian m. carlson Thu, 13 Jul 2017 23:49:27 +0000 (23:49 +0000)

Convert remaining callers of get_sha1 to get_oid.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/unpack-file: convert to struct object_idbrian m. carlson Thu, 13 Jul 2017 23:49:25 +0000 (23:49 +0000)

builtin/unpack-file: convert to struct object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: convert bisect_checkout to struct object_idbrian m. carlson Thu, 13 Jul 2017 23:49:24 +0000 (23:49 +0000)

bisect: convert bisect_checkout to struct object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/update_ref: convert to struct object_idbrian m. carlson Thu, 13 Jul 2017 23:49:23 +0000 (23:49 +0000)

builtin/update_ref: convert to struct object_id

Convert the uses of unsigned char * to struct object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: convert to struct object_idbrian m. carlson Thu, 13 Jul 2017 23:49:22 +0000 (23:49 +0000)

sequencer: convert to struct object_id

Convert the remaining instances of unsigned char * to struct object_id.
This removes several calls to get_sha1.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote: convert struct push_cas to struct object_idbrian m. carlson Thu, 13 Jul 2017 23:49:21 +0000 (23:49 +0000)

remote: convert struct push_cas to struct object_id

This gets rid of one use of get_sha1.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: convert submodule config lookup to use object_idbrian m. carlson Thu, 13 Jul 2017 23:49:20 +0000 (23:49 +0000)

submodule: convert submodule config lookup to use object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/merge-tree: convert remaining caller of get_sha... brian m. carlson Thu, 13 Jul 2017 23:49:19 +0000 (23:49 +0000)

builtin/merge-tree: convert remaining caller of get_sha1 to object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/fsck: convert remaining caller of get_sha1... brian m. carlson Thu, 13 Jul 2017 23:49:18 +0000 (23:49 +0000)

builtin/fsck: convert remaining caller of get_sha1 to object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: bg.po: Updated Bulgarian translation (3206t)Alexander Shopov Wed, 5 Jul 2017 08:17:59 +0000 (11:17 +0300)

l10n: bg.po: Updated Bulgarian translation (3206t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>

l10n: vi.po(3206t): Update Vietnamese translationTran Ngoc Quan Sat, 15 Jul 2017 06:53:33 +0000 (13:53 +0700)

l10n: vi.po(3206t): Update Vietnamese translation

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>

l10n: git.pot: v2.14.0 round 1 (34 new, 23 removed)Jiang Xin Sat, 15 Jul 2017 03:58:14 +0000 (11:58 +0800)

l10n: git.pot: v2.14.0 round 1 (34 new, 23 removed)

Generate po/git.pot from v2.14.0-rc0 for git v2.14.0 l10n round 1.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>

Merge branch 'maint' of git://github.com/git-l10n/git-poJiang Xin Sat, 15 Jul 2017 01:26:40 +0000 (09:26 +0800)

Merge branch 'maint' of git://github.com/git-l10n/git-po

* 'maint' of git://github.com/git-l10n/git-po:
l10n: ru.po: update Russian translation
l10n: Fixes to Catalan translation

strbuf: use designated initializers in STRBUF_INITJeff King Mon, 10 Jul 2017 07:03:42 +0000 (03:03 -0400)

strbuf: use designated initializers in STRBUF_INIT

There are certain C99 features that might be nice to use in
our code base, but we've hesitated to do so in order to
avoid breaking compatibility with older compilers. But we
don't actually know if people are even using pre-C99
compilers these days.

One way to figure that out is to introduce a very small use
of a feature, and see if anybody complains. The strbuf code
is a good place to do this for a few reasons:

- it always gets compiled, no matter which Makefile knobs
have been tweaked.

- it's very stable; this definition hasn't changed in a
long time and is not likely to (so if we have to revert,
it's unlikely to cause headaches)

If this patch can survive a few releases without complaint,
then we can feel more confident that designated initializers
are widely supported by our user base. It also is an
indication that other C99 features may be supported, but not
a guarantee (e.g., gcc had designated initializers before
C99 existed).

And if we do get complaints, then we'll have gained some
data and we can easily revert this patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.14-rc0 v2.14.0-rc0Junio C Hamano Thu, 13 Jul 2017 23:22:29 +0000 (16:22 -0700)

Git 2.14-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jk/build-with-asan'Junio C Hamano Thu, 13 Jul 2017 23:14:54 +0000 (16:14 -0700)

Merge branch 'jk/build-with-asan'

The build procedure has been improved to allow building and testing
Git with address sanitizer more easily.

* jk/build-with-asan:
Makefile: disable unaligned loads with UBSan
Makefile: turn off -fomit-frame-pointer with sanitizers
Makefile: add helper for compiling with -fsanitize
test-lib: turn on ASan abort_on_error by default
test-lib: set ASAN_OPTIONS variable before we run git

Merge branch 'sb/pull-rebase-submodule'Junio C Hamano Thu, 13 Jul 2017 23:14:54 +0000 (16:14 -0700)

Merge branch 'sb/pull-rebase-submodule'

"git pull --rebase --recurse-submodules" learns to rebase the
branch in the submodules to an updated base.

* sb/pull-rebase-submodule:
builtin/fetch cleanup: always set default value for submodule recursing
pull: optionally rebase submodules (remote submodule changes only)
builtin/fetch: parse recurse-submodules-default at default options parsing
builtin/fetch: factor submodule recurse parsing out to submodule config

Merge branch 'sb/hashmap-customize-comparison'Junio C Hamano Thu, 13 Jul 2017 23:14:54 +0000 (16:14 -0700)

Merge branch 'sb/hashmap-customize-comparison'

Update the hashmap API so that data to customize the behaviour of
the comparison function can be specified at the time a hashmap is
initialized.

* sb/hashmap-customize-comparison:
hashmap: migrate documentation from Documentation/technical into header
patch-ids.c: use hashmap correctly
hashmap.h: compare function has access to a data field

Merge branch 'ab/grep-lose-opt-regflags'Junio C Hamano Thu, 13 Jul 2017 23:14:54 +0000 (16:14 -0700)

Merge branch 'ab/grep-lose-opt-regflags'

Code cleanup.

* ab/grep-lose-opt-regflags:
grep: remove redundant REG_NEWLINE when compiling fixed regex
grep: remove regflags from the public grep_opt API
grep: remove redundant and verbose re-assignments to 0
grep: remove redundant "fixed" field re-assignment to 0
grep: adjust a redundant grep pattern type assignment
grep: remove redundant double assignment to 0

ref-filter: consult want_color() before emitting colorsJeff King Thu, 13 Jul 2017 15:09:32 +0000 (11:09 -0400)

ref-filter: consult want_color() before emitting colors

When color placeholders like %(color:red) are used in a
ref-filter format, we unconditionally output the colors,
even if the user has asked us for no colors. This usually
isn't a problem when the user is constructing a --format on
the command line, but it means we may do the wrong thing
when the format is fed from a script or alias. For example:

$ git config alias.b 'branch --format=%(color:green)%(refname)'
$ git b --no-color

should probably omit the green color. Likewise, running:

$ git b >branches

should probably also omit the color, just as we would for
all baked-in coloring (and as we recently started to do for
user-specified colors in --pretty formats).

This commit makes both of those cases work by teaching
the ref-filter code to consult want_color() before
outputting any color. The color flag in ref_format defaults
to "-1", which means we'll consult color.ui, which in turn
defaults to the usual isatty() check on stdout. However,
callers like git-branch which support their own color config
(and command-line options) can override that.

The new tests independently cover all three of the callers
of ref-filter (for-each-ref, tag, and branch). Even though
these seem redundant, it confirms that we've correctly
plumbed through all of the necessary config to make colors
work by default.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pretty: respect color settings for %C placeholdersJeff King Thu, 13 Jul 2017 15:08:46 +0000 (11:08 -0400)

pretty: respect color settings for %C placeholders

The color placeholders have traditionally been
unconditional, showing colors even when git is not otherwise
configured to do so. This was not so bad for their original
use, which was on the command-line (and the user could
decide at that moment whether to add colors or not). But
these days we have configured formats via pretty.*, and
those should operate correctly in multiple contexts.

In 3082517 (log --format: teach %C(auto,black) to respect
color config, 2012-12-17), we gave an extended placeholder
that could be used to accomplish this. But it's rather
clunky to use, because you have to specify it individually
for each color (and their matching resets) in the format.
We shied away from just switching the default to auto,
because it is technically breaking backwards compatibility.

However, there's not really a use case for unconditional
colors. The most plausible reason you would want them is to
redirect "git log" output to a file. But there, the right
answer is --color=always, as it does the right thing both
with custom user-format colors and git-generated colors.

So let's switch to the more useful default. In the
off-chance that somebody really does find a use for
unconditional colors without wanting to enable the rest of
git's colors, we provide a new %C(always,...) to enable the
old behavior. And we can remind them of --color=always in
the documentation.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-list: pass diffopt->use_colors through to pretty... Jeff King Thu, 13 Jul 2017 15:07:30 +0000 (11:07 -0400)

rev-list: pass diffopt->use_colors through to pretty-print

When rev-list pretty-prints a commit, it creates a new
pretty_print_context and copies items from the rev_info
struct. We don't currently copy the "use_color" field,
though. Nobody seems to have noticed because the only part
of pretty.c that cares is the %C(auto,...) placeholder, and
presumably not many people use that with the rev-list
plumbing (as opposed to with git-log).

It will become more noticeable in a future patch, though,
when we start treating all user-format colors as auto-colors
(in which case it would become impossible to format colors
with rev-list, even with --color=always).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

for-each-ref: load config earlierJeff King Thu, 13 Jul 2017 15:07:14 +0000 (11:07 -0400)

for-each-ref: load config earlier

In most commands we load config before parsing command line
options, since it lets the latter override the former with a
simple variable assignment. In the case of for-each-ref,
though, we do it in the reverse order. This is OK with
the current code, since there's no interaction between the
config and command-line options.

However, as the ref-filter code starts to care about config
during verify_ref_format(), we'll want to make sure the
config is loaded. Let's bump the config to the usual spot
near the top of the function.

We can drop the comment there; it's impossible to keep a
"why we load the config" comment like this up to date with
every config option we might be interested in. And indeed,
it's already stale; we'd care about core.abbrev, for
instance, when %(objectname:short) is used.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

color: check color.ui in git_default_config()Jeff King Thu, 13 Jul 2017 15:07:03 +0000 (11:07 -0400)

color: check color.ui in git_default_config()

Back in prehistoric times, our decision on whether or not to
show color by default relied on using a config callback that
either did or didn't load color config like color.diff.
When we introduced color.ui, we put it in the same boat:
commands had to manually respect it by using git_color_config()
or its git_color_default_config() convenience wrapper.

But in 4c7f1819b (make color.ui default to 'auto',
2013-06-10), that changed. Since then, we default color.ui
to auto in all programs, meaning that even plumbing commands
like "git diff-tree --pretty" might colorize the output.
Nobody seems to have complained in the intervening years,
presumably because the "is stdout a tty" check does a good
job of catching the right cases.

But that leaves an interesting curiosity: color.ui defaults
to auto even in plumbing, but you can't actually _disable_
the color via config. So if you really hate color and set
"color.ui" to false, diff-tree will still show color (but
porcelain like git-diff won't). Nobody noticed that either,
probably because very few people disable color.

One could argue that the plumbing should _always_ disable
color unless an explicit --color option is given on the
command line. But in practice, this creates a lot of
complications for scripts which do want plumbing to show
user-visible output. They can't just pass "--color" blindly;
they need to check the user's config and decide what to
send.

Given that nobody has complained about the current behavior,
let's assume it's a good path, and follow it to its
conclusion: supporting color.ui everywhere.

Note that you can create havoc by setting color.ui=always in
your config, but that's more or less already the case. We
could disallow it entirely, but it is handy for one-offs
like:

git -c color.ui=always foo >not-a-tty

when "foo" does not take a --color option itself.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: pass ref_format struct to atom parsersJeff King Thu, 13 Jul 2017 15:06:40 +0000 (11:06 -0400)

ref-filter: pass ref_format struct to atom parsers

The callback for parsing each formatting atom gets to see
only the atom struct (which it's filling in) and the text to
be parsed. This doesn't leave any room for it to behave
differently based on context known only to the ref_format.

We can solve this by passing in the surrounding ref_format
to each parser. Note that this makes things slightly awkward
for sort strings, which parse atoms without having a
ref_format. We'll solve that by using a dummy ref_format
with default parameters.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: factor out the parsing of sorting atomsJeff King Thu, 13 Jul 2017 15:02:58 +0000 (11:02 -0400)

ref-filter: factor out the parsing of sorting atoms

We parse sort strings as single formatting atoms, and just
build on parse_ref_filter_atom(). Let's pull this idea into
its own function, since it's about to get a little more
complex. As a bonus, we can give the function a slightly
more natural interface, since our single atoms are in their
own strings.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: make parse_ref_filter_atom a private functionJeff King Thu, 13 Jul 2017 15:02:52 +0000 (11:02 -0400)

ref-filter: make parse_ref_filter_atom a private function

The parse_ref_filter_atom() function really shouldn't be
exposed outside of ref-filter.c; its return value is an
integer index into an array that is private in that file.

Since the previous commit removed the sole external caller
(and replaced it with a public function at a more
appropriately level), we can just make this static.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: provide a function for parsing sort optionsJeff King Thu, 13 Jul 2017 15:02:44 +0000 (11:02 -0400)

ref-filter: provide a function for parsing sort options

The ref-filter module currently provides a callback suitable
for parsing command-line --sort options. But since git-tag
also supports the tag.sort config option, it needs a
function whose implementation is quite similar, but with a
slightly different interface. The end result is that
builtin/tag.c has a copy-paste of parse_opt_ref_sorting().

Instead, let's provide a function to parse an arbitrary
sort string, which we can then trivially wrap to make the
parse_opt variant.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: move need_color_reset_at_eol into ref_formatJeff King Thu, 13 Jul 2017 15:02:30 +0000 (11:02 -0400)

ref-filter: move need_color_reset_at_eol into ref_format

Calling verify_ref_format() doesn't just confirm that the
format is sane; it actually sets some global variables that
will be used later when formatting the refs. These logically
should belong to the ref_format, which would make it
possible to use multiple formats within a single program
invocation.

Let's move one such flag into the ref_format struct. There
are still others that would need to be moved before it would
be safe to use multiple formats, but this commit gives a
blueprint for how that should look.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: abstract ref format into its own structJeff King Thu, 13 Jul 2017 15:01:18 +0000 (11:01 -0400)

ref-filter: abstract ref format into its own struct

The ref-filter module provides routines for formatting a ref
for output. The fundamental interface for the format is a
"const char *" containing the format, and any additional
options need to be passed to each invocation of
show_ref_array_item.

Instead, let's make a ref_format struct that holds the
format, along with any associated format options. That will
make some enhancements easier in the future:

1. new formatting options can be added without disrupting
existing callers

2. some state can be carried in the struct rather than as
global variables

For now this just has the text format itself along with the
quote_style option, but we'll add more fields in future patches.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: simplify automatic color resetJeff King Thu, 13 Jul 2017 14:58:56 +0000 (10:58 -0400)

ref-filter: simplify automatic color reset

When the user-format doesn't add the closing color reset, we
add one automatically. But we do so by parsing the "reset"
string. We can just use the baked-in string literal, which
is simpler.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: use test_decode_color rather than literal ANSI codesJeff King Thu, 13 Jul 2017 14:58:41 +0000 (10:58 -0400)

t: use test_decode_color rather than literal ANSI codes

When we put literal ANSI terminal codes into our test
scripts, it makes diffs on those scripts hard to read (the
colors may be indistinguishable from diff coloring, or in
the case of a reset, may not be visible at all).

Some scripts get around this by including human-readable
names and converting to literal codes with a git-config
hack. This makes the actual code diffs look OK, but test_cmp
output suffers from the same problem.

Let's use test_decode_color instead, which turns the codes
into obvious text tags.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs/for-each-ref: update pointer to color syntaxJeff King Thu, 13 Jul 2017 14:56:21 +0000 (10:56 -0400)

docs/for-each-ref: update pointer to color syntax

The documentation for the %(color) placeholder refers to the
color.branch.* config for more details. But those details
moved to their own section in b92c1a28f
(Documentation/config.txt: describe 'color' value type in
the "Values" section, 2015-03-03). Let's update our
pointer. We can steal the text from 30cfe72d3 (pretty: fix
document link for color specification, 2016-10-11), which
fixed the same problem in a different place.

While we're at it, let's give an example, which makes the
syntax much more clear than just the text.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

check return value of verify_ref_format()Jeff King Thu, 13 Jul 2017 14:56:10 +0000 (10:56 -0400)

check return value of verify_ref_format()

Users of the ref-filter code must call verify_ref_format()
before formatting any refs, but most ignore its return
value. This means we may print an error on a syntactically
bogus pattern, but keep going anyway.

In most cases this results in a fatal error when we actually
try to format a ref. But if you have no refs to show at all,
then the behavior is confusing: git prints the error from
verify_ref_format(), then exits with code 0 without showing
any output. Let's instead abort immediately if we know we
have a bogus format.

We'll output the usage information if we have it handy (just
like the existing call in cmd_for_each_ref() does), and
otherwise just die().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag: convert gpg_verify_tag to use struct object_idStefan Beller Thu, 13 Jul 2017 00:44:15 +0000 (17:44 -0700)

tag: convert gpg_verify_tag to use struct object_id

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: convert lookup_commit_graft to struct object_idStefan Beller Thu, 13 Jul 2017 00:44:14 +0000 (17:44 -0700)

commit: convert lookup_commit_graft to struct object_id

With this patch, commit.h doesn't contain the string 'sha1' any more.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: filter for {'code':'info'} in p4CmdListMiguel Torroja Thu, 13 Jul 2017 07:00:35 +0000 (09:00 +0200)

git-p4: filter for {'code':'info'} in p4CmdList

The function p4CmdList accepts a new argument: skip_info. When set to
True it ignores any 'code':'info' entry (skip_info=False by default).

That allows us to fix some of the tests in t9831-git-p4-triggers.sh
known to be broken with verobse p4 triggers

Signed-off-by: Miguel Torroja <miguel.torroja@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: parse marshal output "p4 -G" in p4 changesMiguel Torroja Thu, 13 Jul 2017 07:00:34 +0000 (09:00 +0200)

git-p4: parse marshal output "p4 -G" in p4 changes

The option -G of p4 (python marshal output) gives more context about the
data being output. That's useful when using the command "change -o" as
we can distinguish between warning/error line and real change description.

This fixes the case where a p4 trigger for "p4 change" is set and the command git-p4 submit is run.

Signed-off-by: Miguel Torroja <miguel.torroja@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: git-p4 tests with p4 triggersMiguel Torroja Thu, 13 Jul 2017 07:00:33 +0000 (09:00 +0200)

git-p4: git-p4 tests with p4 triggers

Some p4 triggers in the server side generate some warnings when
executed. Unfortunately those messages are mixed with the output of
p4 commands. A few git-p4 commands don't expect extra messages or output
lines and may fail with verbose triggers.
New tests added are known to be broken.

Signed-off-by: Miguel Torroja <miguel.torroja@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with v2.13.3Junio C Hamano Wed, 12 Jul 2017 22:25:14 +0000 (15:25 -0700)

Sync with v2.13.3

Git 2.13.3 v2.13.3Junio C Hamano Wed, 12 Jul 2017 22:24:15 +0000 (15:24 -0700)

Git 2.13.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'kn/ref-filter-branch-list' into maintJunio C Hamano Wed, 12 Jul 2017 22:23:09 +0000 (15:23 -0700)

Merge branch 'kn/ref-filter-branch-list' into maint

The rewrite of "git branch --list" using for-each-ref's internals
that happened in v2.13 regressed its handling of color.branch.local;
this has been fixed.

* kn/ref-filter-branch-list:
ref-filter.c: drop return from void function
branch: set remote color in ref-filter branch immediately
branch: use BRANCH_COLOR_LOCAL in ref-filter format
branch: only perform HEAD check for local branches

Merge branch 'ks/typofix-commit-c-comment' into maintJunio C Hamano Wed, 12 Jul 2017 22:20:48 +0000 (15:20 -0700)

Merge branch 'ks/typofix-commit-c-comment' into maint

Typofix.

* ks/typofix-commit-c-comment:
builtin/commit.c: fix a typo in the comment

Merge branch 'jk/reflog-walk-maint' into maintJunio C Hamano Wed, 12 Jul 2017 22:20:35 +0000 (15:20 -0700)

Merge branch 'jk/reflog-walk-maint' into maint

After "git branch --move" of the currently checked out branch, the
code to walk the reflog of HEAD via "log -g" and friends
incorrectly stopped at the reflog entry that records the renaming
of the branch.

* jk/reflog-walk-maint:
reflog-walk: include all fields when freeing complete_reflogs
reflog-walk: don't free reflogs added to cache
reflog-walk: duplicate strings in complete_reflogs list
reflog-walk: skip over double-null oid due to HEAD rename

Hopefully the last batch before -rc0Junio C Hamano Wed, 12 Jul 2017 22:19:27 +0000 (15:19 -0700)

Hopefully the last batch before -rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ks/fix-rebase-doc-picture'Junio C Hamano Wed, 12 Jul 2017 22:18:24 +0000 (15:18 -0700)

Merge branch 'ks/fix-rebase-doc-picture'

Doc update.

* ks/fix-rebase-doc-picture:
doc: correct a mistake in an illustration

Merge branch 'rs/wt-status-cleanup'Junio C Hamano Wed, 12 Jul 2017 22:18:23 +0000 (15:18 -0700)

Merge branch 'rs/wt-status-cleanup'

Code cleanup.

* rs/wt-status-cleanup:
wt-status: use separate variable for result of shorten_unambiguous_ref

Merge branch 'rs/use-div-round-up'Junio C Hamano Wed, 12 Jul 2017 22:18:23 +0000 (15:18 -0700)

Merge branch 'rs/use-div-round-up'

Code cleanup.

* rs/use-div-round-up:
use DIV_ROUND_UP

Merge branch 'kn/ref-filter-branch-list'Junio C Hamano Wed, 12 Jul 2017 22:18:23 +0000 (15:18 -0700)

Merge branch 'kn/ref-filter-branch-list'

The rewrite of "git branch --list" using for-each-ref's internals
that happened in v2.13 regressed its handling of color.branch.local;
this has been fixed.

* kn/ref-filter-branch-list:
ref-filter.c: drop return from void function
branch: set remote color in ref-filter branch immediately
branch: use BRANCH_COLOR_LOCAL in ref-filter format
branch: only perform HEAD check for local branches

Merge branch 'rs/urlmatch-cleanup'Junio C Hamano Wed, 12 Jul 2017 22:18:22 +0000 (15:18 -0700)

Merge branch 'rs/urlmatch-cleanup'

Code cleanup.

* rs/urlmatch-cleanup:
urlmatch: use hex2chr() in append_normalized_escapes()

Merge branch 'rs/apply-avoid-over-reading'Junio C Hamano Wed, 12 Jul 2017 22:18:22 +0000 (15:18 -0700)

Merge branch 'rs/apply-avoid-over-reading'

Code cleanup.

* rs/apply-avoid-over-reading:
apply: use strcmp(3) for comparing strings in gitdiff_verify_name()

Merge branch 'sb/submodule-doc'Junio C Hamano Wed, 12 Jul 2017 22:18:21 +0000 (15:18 -0700)

Merge branch 'sb/submodule-doc'

Doc update.

* sb/submodule-doc:
submodules: overhaul documentation

hook: add a simple first exampleKaartic Sivaraam Tue, 11 Jul 2017 14:30:54 +0000 (20:00 +0530)

hook: add a simple first example

Add a simple example that replaces an outdated example
that was removed. This ensures that there's at the least
a simple example that illustrates what could be done
using the hook just by enabling it.

Also, update the documentation.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

hook: add sign-off using "interpret-trailers"Kaartic Sivaraam Tue, 11 Jul 2017 14:11:10 +0000 (19:41 +0530)

hook: add sign-off using "interpret-trailers"

The sample hook to prepare the commit message before
a commit allows users to opt-in to add the sign-off
to the commit message. The sign-off is added at a place
that isn't consistent with the "-s" option of "git commit".
Further, it could go out of view in certain cases.

Add the sign-off in a way similar to "-s" option of
"git commit" using git's interpret-trailers command.

It works well in all cases except when the user invokes
"git commit" without any arguments. In that case manually
add a new line after the first line to ensure it's consistent
with the output of "-s" option.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

hook: name the positional variablesKaartic Sivaraam Tue, 11 Jul 2017 14:11:09 +0000 (19:41 +0530)

hook: name the positional variables

It's always nice to have named variables instead of
positional variables as they communicate their purpose
well.

Appropriately name the positional variables of the hook
to make it easier to see what's going on.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

hook: cleanup scriptKaartic Sivaraam Tue, 11 Jul 2017 14:11:08 +0000 (19:41 +0530)

hook: cleanup script

Prepare the 'preare-commit-msg' sample script for
upcoming changes. Preparation includes removal of
an example that has outlived it's purpose. The example
is the one that comments the "Conflicts:" part of a
merge commit message. It isn't relevant anymore as
it's done by default since 261f315b ("merge & sequencer:
turn "Conflicts:" hint into a comment", 2014-08-28).

Further update the relevant comments from the sample script
and update the documentation.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gc: run pre-detach operations under lockJeff King Tue, 11 Jul 2017 09:06:35 +0000 (05:06 -0400)

gc: run pre-detach operations under lock

We normally try to avoid having two auto-gc operations run
at the same time, because it wastes resources. This was done
long ago in 64a99eb47 (gc: reject if another gc is running,
unless --force is given, 2013-08-08).

When we do a detached auto-gc, we run the ref-related
commands _before_ detaching, to avoid confusing lock
contention. This was done by 62aad1849 (gc --auto: do not
lock refs in the background, 2014-05-25).

These two features do not interact well. The pre-detach
operations are run before we check the gc.pid lock, meaning
that on a busy repository we may run many of them
concurrently. Ideally we'd take the lock before spawning any
operations, and hold it for the duration of the program.

This is tricky, though, with the way the pid-file interacts
with the daemonize() process. Other processes will check
that the pid recorded in the pid-file still exists. But
detaching causes us to fork and continue running under a
new pid. So if we take the lock before detaching, the
pid-file will have a bogus pid in it. We'd have to go back
and update it with the new pid after detaching. We'd also
have to play some tricks with the tempfile subsystem to
tweak the "owner" field, so that the parent process does not
clean it up on exit, but the child process does.

Instead, we can do something a bit simpler: take the lock
only for the duration of the pre-detach work, then detach,
then take it again for the post-detach work. Technically,
this means that the post-detach lock could lose to another
process doing pre-detach work. But in the long run this
works out.

That second process would then follow-up by doing
post-detach work. Unless it was in turn blocked by a third
process doing pre-detach work, and so on. This could in
theory go on indefinitely, as the pre-detach work does not
repack, and so need_to_gc() will continue to trigger. But
in each round we are racing between the pre- and post-detach
locks. Eventually, one of the post-detach locks will win the
race and complete the full gc. So in the worst case, we may
racily repeat the pre-detach work, but we would never do so
simultaneously (it would happen via a sequence of serialized
race-wins).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pre-rebase hook: capture documentation in a <<here... Jonathan Nieder Mon, 10 Jul 2017 23:35:25 +0000 (16:35 -0700)

pre-rebase hook: capture documentation in a <<here document

Without this change, the sample hook does not pass a syntax check
(sh -n):

$ sh -n hooks--pre-rebase.sample
hooks--pre-rebase.sample: line 101: syntax error near unexpected token `('
hooks--pre-rebase.sample: line 101: ` merged into it again (either directly or indirectly).'

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use DIV_ROUND_UPRené Scharfe Sat, 8 Jul 2017 10:35:35 +0000 (12:35 +0200)

use DIV_ROUND_UP

Convert code that divides and rounds up to use DIV_ROUND_UP to make the
intent clearer and reduce the number of magic constants.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Mon, 10 Jul 2017 21:02:45 +0000 (14:02 -0700)

Sync with maint

Prepare for 2.13.3Junio C Hamano Mon, 10 Jul 2017 21:02:07 +0000 (14:02 -0700)

Prepare for 2.13.3

Merge branch 'sb/merge-recursive-code-cleanup' into... Junio C Hamano Mon, 10 Jul 2017 20:59:09 +0000 (13:59 -0700)

Merge branch 'sb/merge-recursive-code-cleanup' into maint

Code clean-up.

* sb/merge-recursive-code-cleanup:
merge-recursive: use DIFF_XDL_SET macro

Merge branch 'jc/utf8-fprintf' into maintJunio C Hamano Mon, 10 Jul 2017 20:59:08 +0000 (13:59 -0700)

Merge branch 'jc/utf8-fprintf' into maint

Code cleanup.

* jc/utf8-fprintf:
submodule--helper: do not call utf8_fprintf() unnecessarily

Merge branch 'js/fsck-name-object' into maintJunio C Hamano Mon, 10 Jul 2017 20:59:08 +0000 (13:59 -0700)

Merge branch 'js/fsck-name-object' into maint

Test fix.

* js/fsck-name-object:
t1450: use egrep for regexp "alternation"

Merge branch 'js/t5534-rev-parse-gives-multi-line-outpu... Junio C Hamano Mon, 10 Jul 2017 20:59:07 +0000 (13:59 -0700)

Merge branch 'js/t5534-rev-parse-gives-multi-line-output-fix' into maint

A few tests that tried to verify the contents of push certificates
did not use 'git rev-parse' to formulate the line to look for in
the certificate correctly.

* js/t5534-rev-parse-gives-multi-line-output-fix:
t5534: fix misleading grep invocation

Merge branch 'ab/sha1dc-maint' into maintJunio C Hamano Mon, 10 Jul 2017 20:59:06 +0000 (13:59 -0700)

Merge branch 'ab/sha1dc-maint' into maint

Update the sha1dc again to fix portability glitches.

* ab/sha1dc-maint:
sha1dc: update from upstream

Merge branch 'aw/contrib-subtree-doc-asciidoctor' into... Junio C Hamano Mon, 10 Jul 2017 20:59:06 +0000 (13:59 -0700)

Merge branch 'aw/contrib-subtree-doc-asciidoctor' into maint

The Makefile rule in contrib/subtree for building documentation
learned to honour USE_ASCIIDOCTOR just like the main documentation
set does.

* aw/contrib-subtree-doc-asciidoctor:
subtree: honour USE_ASCIIDOCTOR when set

Merge branch 'cc/shared-index-permfix' into maintJunio C Hamano Mon, 10 Jul 2017 20:59:05 +0000 (13:59 -0700)

Merge branch 'cc/shared-index-permfix' into maint

The split index code did not honor core.sharedrepository setting
correctly.

* cc/shared-index-permfix:
t1700: make sure split-index respects core.sharedrepository
t1301: move modebits() to test-lib-functions.sh
read-cache: use shared perms when writing shared index

Merge branch 'ah/doc-pretty-color-auto-prefix' into... Junio C Hamano Mon, 10 Jul 2017 20:59:05 +0000 (13:59 -0700)

Merge branch 'ah/doc-pretty-color-auto-prefix' into maint

Doc update.

* ah/doc-pretty-color-auto-prefix:
doc: clarify syntax for %C(auto,...) in pretty formats

Merge branch 'mb/reword-autocomplete-message' into... Junio C Hamano Mon, 10 Jul 2017 20:59:04 +0000 (13:59 -0700)

Merge branch 'mb/reword-autocomplete-message' into maint

Message update.

* mb/reword-autocomplete-message:
auto-correct: tweak phrasing

Merge branch 'ks/t7508-indent-fix' into maintJunio C Hamano Mon, 10 Jul 2017 20:59:03 +0000 (13:59 -0700)

Merge branch 'ks/t7508-indent-fix' into maint

Cosmetic update to a test.

* ks/t7508-indent-fix:
t7508: fix a broken indentation

Merge branch 'sb/t4005-modernize' into maintJunio C Hamano Mon, 10 Jul 2017 20:59:02 +0000 (13:59 -0700)

Merge branch 'sb/t4005-modernize' into maint

Test clean-up.

* sb/t4005-modernize:
t4005: modernize style and drop hard coded sha1

Merge branch 'rs/apply-validate-input' into maintJunio C Hamano Mon, 10 Jul 2017 20:59:01 +0000 (13:59 -0700)

Merge branch 'rs/apply-validate-input' into maint

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

Merge branch 'jc/pack-bitmap-unaligned' into maintJunio C Hamano Mon, 10 Jul 2017 20:59:00 +0000 (13:59 -0700)

Merge branch 'jc/pack-bitmap-unaligned' into maint

An unaligned 32-bit access in pack-bitmap code ahs been corrected.

* jc/pack-bitmap-unaligned:
pack-bitmap: don't perform unaligned memory access

Merge branch 'pw/rebase-i-regression-fix-tests' into... Junio C Hamano Mon, 10 Jul 2017 20:58:59 +0000 (13:58 -0700)

Merge branch 'pw/rebase-i-regression-fix-tests' into maint

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