Re: [PATCH v2 2/3] setup: do not use invalid `repository_format`

2019-01-22 Thread Martin Ågren
On Tue, 22 Jan 2019 at 08:07, Jeff King wrote: > > On Thu, Jan 17, 2019 at 07:31:14AM +0100, Martin Ågren wrote: > > > Something like the below on top of this series (then rebased). (The last > > hunk below is a revert of this patch.) > > Yes, that's exactly what I had in mind. Usually our clear()

Re: [PATCH v2 2/3] setup: do not use invalid `repository_format`

2019-01-21 Thread Jeff King
On Thu, Jan 17, 2019 at 07:31:14AM +0100, Martin Ågren wrote: > > I also get why read_repository_format() doing this in patch 3 would be a > > problem: > > > > + if (format->version == -1) { > > + clear_repository_format(format); > > + format->version = -1;

Re: [PATCH v2 2/3] setup: do not use invalid `repository_format`

2019-01-16 Thread Martin Ågren
On Tue, 15 Jan 2019 at 20:31, Jeff King wrote: > > On Mon, Jan 14, 2019 at 07:34:56PM +0100, Martin Ågren wrote: > > > This can be observed by adding this to the end of > > `read_repository_format()`: > > > > if (format->version == -1) > > format->hash_algo = 0; /* no-one shoul

Re: [PATCH v2 2/3] setup: do not use invalid `repository_format`

2019-01-15 Thread Jeff King
On Mon, Jan 14, 2019 at 07:34:56PM +0100, Martin Ågren wrote: > If `read_repository_format()` encounters an error, `format->version` > will be -1 and all other fields of `format` will be undefined. However, > in `setup_git_directory_gently()`, we use `repo_fmt.hash_algo` > regardless of the value