Re: [PATCH 3/2] apply: use COPY_ARRAY and MOVE_ARRAY in update_image()

2017-07-15 Thread René Scharfe
Am 16.07.2017 um 02:31 schrieb Ramsay Jones: On 15/07/17 21:20, René Scharfe wrote: 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

Re: [PATCH] ls-files: don't try to prune an empty index

2017-07-15 Thread René Scharfe
Am 16.07.2017 um 02:28 schrieb Ramsay Jones: On 15/07/17 21:11, René Scharfe wrote: 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:

Keeping a non-1:1 mirror in sync and keeping private branches

2017-07-15 Thread Jan Danielsson
Hello, Let's say there'a s hosting service hosting a repository which I want to self-host. I don't just want to do a mirror, but I want to keep it in sync (using a cronjob). In addition, I want to have private branches on the self-hosted repository. (In this particular case, the "hosting

Re: [PATCH 3/2] apply: use COPY_ARRAY and MOVE_ARRAY in update_image()

2017-07-15 Thread Ramsay Jones
On 15/07/17 21:20, René Scharfe wrote: > 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

Re: [PATCH] ls-files: don't try to prune an empty index

2017-07-15 Thread Ramsay Jones
On 15/07/17 21:11, René Scharfe wrote: > 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 > ---

Re: [PATCH] bswap: convert to unsigned before shifting in get_be32

2017-07-15 Thread Ramsay Jones
On 15/07/17 20:11, René Scharfe wrote: > 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

[PATCH 3/2] apply: use COPY_ARRAY and MOVE_ARRAY in update_image()

2017-07-15 Thread René Scharfe
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

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

2017-07-15 Thread René Scharfe
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 --- builtin/ls-files.c | 2 +- 1 file changed, 1

[PATCH 2/2] use MOVE_ARRAY

2017-07-15 Thread René Scharfe
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

[PATCH 1/2] add MOVE_ARRAY

2017-07-15 Thread René Scharfe
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

Re: [L10N] Kickoff of translation for Git 2.14.0 round 1

2017-07-15 Thread Jean-Noël Avila
Le 15/07/2017 à 07:06, Jiang Xin a écrit : > Hi, > > Git v2.14.0-rc0 has been released, and it's time to start new round of git > l10n. > This time there are 30+ updated messages need to be translated since last > update: > > l10n: git.pot: v2.14.0 round 1 (34 new, 23 removed) > >

[PATCH 2/1] bswap: convert get_be16, get_be32 and put_be32 to inline functions

2017-07-15 Thread René Scharfe
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 --- All these redundant casts started to bother me, so I tried to come up with nice and clean

[PATCH] bswap: convert to unsigned before shifting in get_be32

2017-07-15 Thread René Scharfe
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.

[PATCH] set FD_CLOEXEC properly when O_CLOEXEC is not supported

2017-07-15 Thread Eric Wong
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 --- sha1_file.c | 6 +++--- 1 file changed, 3

Re: [PATCH v3 06/20] builtin/receive-pack: convert portions to struct object_id

2017-07-15 Thread René Scharfe
Am 31.03.2017 um 03:39 schrieb brian m. carlson: > @@ -1081,10 +1081,10 @@ static const char *update(struct command *cmd, struct > shallow_info *si) > return "hook declined"; > } > > - if (is_null_sha1(new_sha1)) { > + if (is_null_oid(new_oid)) { >

Re: [PATCH 04/33] notes: make get_note return pointer to struct object_id

2017-07-15 Thread René Scharfe
Am 30.05.2017 um 19:30 schrieb Brandon Williams: > @@ -392,7 +392,7 @@ static int add(int argc, const char **argv, const char > *prefix) > const char *object_ref; > struct notes_tree *t; > unsigned char object[20], new_note[20]; > - const unsigned char *note; > + const

Re: [PATCH 30/33] tree-diff: convert diff_tree_paths to struct object_id

2017-07-15 Thread brian m. carlson
On Sat, Jul 15, 2017 at 07:18:51PM +0200, René Scharfe wrote: > -- >8 -- > Subject: [PATCH] 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, >

Re: [PATCH 30/33] tree-diff: convert diff_tree_paths to struct object_id

2017-07-15 Thread René Scharfe
Am 30.05.2017 um 19:31 schrieb Brandon Williams: > @@ -273,21 +274,20 @@ static struct combine_diff_path *emit_path(struct > combine_diff_path *p, > } > > if (recurse) { > - const unsigned char **parents_sha1; > + const struct object_id **parents_oid; > >

Re: [PATCH 5/5] Makefile: disable unaligned loads with UBSan

2017-07-15 Thread René Scharfe
Am 10.07.2017 um 15:24 schrieb Jeff King: > The undefined behavior sanitizer complains about unaligned > loads, even if they're OK for a particular platform in > practice. It's possible that they _are_ a problem, of > course, but since it's a known tradeoff the UBSan errors are > just noise. > >

Re: [FEATURE] git-commit option to prepend filename to commit message

2017-07-15 Thread John J Foerch
-Original Message- >From: Jeff King >Sent: Jul 15, 2017 12:05 PM >To: John J Foerch >Cc: git@vger.kernel.org >Subject: Re: [FEATURE] git-commit option to prepend filename to commit message > >On Sat, Jul 15, 2017 at 10:19:34AM -0400, John J

Re: [FEATURE] git-commit option to prepend filename to commit message

2017-07-15 Thread John J Foerch
Perfect, thank you Hannes! -Original Message- >From: Johannes Sixt >Sent: Jul 15, 2017 12:01 PM >To: John J Foerch >Cc: git@vger.kernel.org >Subject: Re: [FEATURE] git-commit option to prepend filename to commit message > >Am 15.07.2017 um 16:19

Re: [FEATURE] git-commit option to prepend filename to commit message

2017-07-15 Thread Jeff King
On Sat, Jul 15, 2017 at 10:19:34AM -0400, John J Foerch wrote: > The feature would be a command line option for git commit that would > automatically prepend the ": " to the commit message. The > different cases of its behavior could be: > > - commit affecting a single file, with commit

Re: [FEATURE] git-commit option to prepend filename to commit message

2017-07-15 Thread Johannes Sixt
Am 15.07.2017 um 16:19 schrieb John J Foerch: The feature would be a command line option for git commit that would automatically prepend the ": " to the commit message. Write a prepare-commit-msg hook: https://www.kernel.org/pub/software/scm/git/docs/githooks.html#_prepare_commit_msg --

[FEATURE] git-commit option to prepend filename to commit message

2017-07-15 Thread John J Foerch
Hello, I had an idea for a feature for git commit that I wanted to pass along and see if maybe others would also think this would be useful. Very often, I make commits that affect a single file, and have simple commit messages of this form: : The feature would be a command line option

Re: [PATCH v6 02/10] rebase -i: generate the script via rebase--helper

2017-07-15 Thread Johannes Schindelin
Hi Stefan, On Fri, 14 Jul 2017, Stefan Beller wrote: > There are two conflicting messages I get: > * only a few fields seem to be polluted (verbose_header, > max_parents), much fewer than I thought > * we do use these undocumented ways already, > but not at the scale that DScho is trying to

Re: What's cooking in git.git (Jul 2017, #04; Thu, 13)

2017-07-15 Thread Ævar Arnfjörð Bjarmason
On Thu, Jul 13 2017, Junio C. Hamano jotted: > Here are the topics that have been cooking. Commits prefixed with > [...] > > * jc/allow-lazy-cas (2017-07-06) 1 commit > - push: disable lazy --force-with-lease by default > > Because "git push --force-with-lease[=]" that relies on the >

Re: [PATCH] strbuf: use designated initializers in STRBUF_INIT

2017-07-15 Thread Jeff King
On Sat, Jul 15, 2017 at 07:43:09AM +0900, Mike Hommey wrote: > > - There were occasional cases where we wished if variable-length > >arrays, flexible array members and variadic macros were available > >in our codebase during the course of this project. We would > >probably want to

Re: [PATCH] push: disable lazy --force-with-lease by default

2017-07-15 Thread Ævar Arnfjörð Bjarmason
On Fri, Jul 07 2017, Junio C. Hamano jotted: [Re-flowing & re-quoting some of this for clarity] > Ævar Arnfjörð Bjarmason writes: > >> Which is why I think we should take Francesco's patch (with fixes from >> feedback), instead of Junio's. > > The patch in this discussion is

Re: [ANNOUNCE] Git v2.14.0-rc0

2017-07-15 Thread Ævar Arnfjörð Bjarmason
On Sat, Jul 15 2017, Christian Couder jotted: > On Sat, Jul 15, 2017 at 1:17 AM, Ævar Arnfjörð Bjarmason > wrote: >> >> On Thu, Jul 13 2017, Junio C. Hamano jotted: > >>> * "git send-email" learned to overcome some SMTP server limitation >>>that does not allow many pieces

Re: [PATCH] commit & merge: modularize the empty message validator

2017-07-15 Thread Kaartic Sivaraam
On Fri, 2017-07-14 at 23:19 +0530, Kaartic Sivaraam wrote: > * Imagine a hypothetical version of git that aborts when the > is empty though a  is present. This would > quite possibly instigate controversies as the "hypothetical git" > reduces the "valid commit