[PATCH] name-rev: avoid cutoff timestamp underflow

2019-09-24 Thread SZEDER Gábor
When 'git name-rev' is invoked with commit-ish parameters, it tries to save some work, and doesn't visit commits older than the committer date of the oldest given commit minus a one day worth of slop. Since our 'timestamp_t' is an unsigned type, this leads to a timestamp underflow when the committ

Re: [PATCH] name-rev: avoid cutoff timestamp underflow

2019-09-24 Thread SZEDER Gábor
On Mon, Sep 23, 2019 at 09:16:26PM +0200, Johannes Sixt wrote: > Am 23.09.19 um 10:37 schrieb SZEDER Gábor: > > On Sun, Sep 22, 2019 at 11:01:26PM +0200, Johannes Sixt wrote: > >> Huh? For signed cutoff and positive CUTOFF_DATE_SLOP, > >> cutoff - CUTOFF_DATE_SLOP < cutoff is ALWAYS true. Signed in

Re: [PATCH] name-rev: avoid cutoff timestamp underflow

2019-09-23 Thread Johannes Sixt
Am 23.09.19 um 10:37 schrieb SZEDER Gábor: > On Sun, Sep 22, 2019 at 11:01:26PM +0200, Johannes Sixt wrote: >> Huh? For signed cutoff and positive CUTOFF_DATE_SLOP, >> cutoff - CUTOFF_DATE_SLOP < cutoff is ALWAYS true. Signed interger >> underflow is undefined behavior and signed integer arithmetic

Re: [PATCH] name-rev: avoid cutoff timestamp underflow

2019-09-23 Thread Phillip Wood
On 23/09/2019 09:37, SZEDER Gábor wrote: On Sun, Sep 22, 2019 at 11:01:26PM +0200, Johannes Sixt wrote: Am 22.09.19 um 21:53 schrieb SZEDER Gábor: On Sun, Sep 22, 2019 at 07:57:36PM +0100, Phillip Wood wrote: On 22/09/2019 19:01, SZEDER Gábor wrote: +/* + * One day. See the 'name a rev close

Re: [PATCH] name-rev: avoid cutoff timestamp underflow

2019-09-23 Thread SZEDER Gábor
On Mon, Sep 23, 2019 at 01:42:30AM +, brian m. carlson wrote: > On 2019-09-22 at 18:01:43, SZEDER Gábor wrote: > > diff --git a/builtin/name-rev.c b/builtin/name-rev.c > > index c785fe16ba..a4d8d312ab 100644 > > --- a/builtin/name-rev.c > > +++ b/builtin/name-rev.c > > @@ -9,7 +9,11 @@ > > #in

Re: [PATCH] name-rev: avoid cutoff timestamp underflow

2019-09-23 Thread SZEDER Gábor
On Sun, Sep 22, 2019 at 11:01:26PM +0200, Johannes Sixt wrote: > Am 22.09.19 um 21:53 schrieb SZEDER Gábor: > > On Sun, Sep 22, 2019 at 07:57:36PM +0100, Phillip Wood wrote: > >> On 22/09/2019 19:01, SZEDER Gábor wrote: > >>> +/* > >>> + * One day. See the 'name a rev close to epoch' test in t6120

Re: [PATCH] name-rev: avoid cutoff timestamp underflow

2019-09-22 Thread brian m. carlson
On 2019-09-22 at 18:01:43, SZEDER Gábor wrote: > diff --git a/builtin/name-rev.c b/builtin/name-rev.c > index c785fe16ba..a4d8d312ab 100644 > --- a/builtin/name-rev.c > +++ b/builtin/name-rev.c > @@ -9,7 +9,11 @@ > #include "sha1-lookup.h" > #include "commit-slab.h" > > -#define CUTOFF_DATE_SLO

Re: [PATCH] name-rev: avoid cutoff timestamp underflow

2019-09-22 Thread Johannes Sixt
Am 22.09.19 um 21:53 schrieb SZEDER Gábor: > On Sun, Sep 22, 2019 at 07:57:36PM +0100, Phillip Wood wrote: >> On 22/09/2019 19:01, SZEDER Gábor wrote: >>> +/* >>> + * One day. See the 'name a rev close to epoch' test in t6120 when >>> + * changing this value >>> + */ >>> +#define CUTOFF_DATE_SLOP

Re: [PATCH] name-rev: avoid cutoff timestamp underflow

2019-09-22 Thread SZEDER Gábor
On Sun, Sep 22, 2019 at 07:57:36PM +0100, Phillip Wood wrote: > On 22/09/2019 19:01, SZEDER Gábor wrote: > >When 'git name-rev' is invoked with commit-ish parameters, it tries to > >save some work, and doesn't visit commits older than the committer > >date of the oldest given commit minus a one day

Re: [PATCH] name-rev: avoid cutoff timestamp underflow

2019-09-22 Thread Phillip Wood
Hi Gábor On 22/09/2019 19:01, SZEDER Gábor wrote: When 'git name-rev' is invoked with commit-ish parameters, it tries to save some work, and doesn't visit commits older than the committer date of the oldest given commit minus a one day worth of slop. Since our 'timestamp_t' is an unsigned type,

[PATCH] name-rev: avoid cutoff timestamp underflow

2019-09-22 Thread SZEDER Gábor
When 'git name-rev' is invoked with commit-ish parameters, it tries to save some work, and doesn't visit commits older than the committer date of the oldest given commit minus a one day worth of slop. Since our 'timestamp_t' is an unsigned type, this leads to a timestamp underflow when the committ