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

2017-07-16 Thread René Scharfe
Am 16.07.2017 um 13:15 schrieb René Scharfe: Am 16.07.2017 um 13:08 schrieb Jeff King: On Sun, Jul 16, 2017 at 01:06:45PM +0200, René Scharfe wrote: diff --git a/builtin/ls-files.c b/builtin/ls-files.c index b8514a0029..adf572da68 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -36

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

2017-07-16 Thread René Scharfe
Am 16.07.2017 um 13:08 schrieb Jeff King: On Sun, Jul 16, 2017 at 01:06:45PM +0200, René Scharfe wrote: diff --git a/builtin/ls-files.c b/builtin/ls-files.c index b8514a0029..adf572da68 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -362,7 +362,7 @@ static void prune_index(struct i

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

2017-07-16 Thread Jeff King
On Sun, Jul 16, 2017 at 01:06:45PM +0200, René Scharfe wrote: > > > diff --git a/builtin/ls-files.c b/builtin/ls-files.c > > > index b8514a0029..adf572da68 100644 > > > --- a/builtin/ls-files.c > > > +++ b/builtin/ls-files.c > > > @@ -362,7 +362,7 @@ static void prune_index(struct index_state *ist

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

2017-07-16 Thread René Scharfe
Am 16.07.2017 um 12:41 schrieb Jeff King: On Sat, Jul 15, 2017 at 10:11:20PM +0200, 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 UBSa

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

2017-07-16 Thread Jeff King
On Sat, Jul 15, 2017 at 10:11:20PM +0200, 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. Makes sense. We could use MOVE_

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:

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 > --- > builtin/ls-

[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 insertion(+), 1 deletion