Re: [PATCH v3 32/39] setup: add support for reading extensions.objectformat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-07-23 at 02:04:52, Junio C Hamano wrote:
> "brian m. carlson" <sandals@xxxxxxxxxxxxxxxxxxxx> writes:
> 
> > @@ -613,6 +622,11 @@ int verify_repository_format(const struct repository_format *format,
> >  		return -1;
> >  	}
> >  
> > +	if (format->version <= 0 && format->hash_algo != GIT_HASH_SHA1) {
> > +		strbuf_addstr(err, _("extensions.objectFormat is not valid in repo v0"));
> > +		return -1;
> > +	}
> > +
> >  	return 0;
> >  }
> >  
> 
> By declaring that the repository is invalid if its version is less
> than 1 and objectFormat extension defined, we prevent unwanted
> upgrading from happening by mistake.

Yes, and more specifically:

* If the repository is v0 and has an objectFormat set, we fail in newer
  versions of Git (i.e., after this series).  Older versions which do
  not support the extension will see breakage (because unknown
  extensions are not fatal in v0), but we hope by adding this check that
  nobody will ever configure a repo this way, since it will be totally
  nonfunctional in this state, regardless of version.
* If the repository is v1 and has an objectFormat set, we work with
  newer Git and everything is great.  Older Git versions fail hard here,
  and the user gets a moderately helpful error message.

v2 of the series just ignored the setting in v0, which would make it
equally broken in older and newer versions, but would provide a less
useful error message (probably about a corrupt index).
-- 
brian m. carlson: Houston, Texas, US



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux