Re: [PATCH 11/11] refs: split and make get_*_ref_store() public API
- From
Stefan Beller <sbeller@google.com>
- Date
- Feb 13, 2017, 23:55 UTC
- Message-ID
- <CAGZ79kZC6TntQrW7MF6-h5z5En-u6rwNX=zuaHRNDpbO80ALHA@mail.gmail.com>
- In-Reply-To
- <20170213152011.12050-12-pclouds@gmail.com>
> > +/* > + * Return the ref_store instance for the specified submodule. For the > + * main repository, use submodule==NULL; such a call cannot fail.
So now we have both a get_main as well as a get_submodule function, but the submodule function can return the main as well?
I'd rather see this as a BUG; or asking another way: What is the difference between get_submodule_ref_store(NULL) and get_main_ref_store() ?
As you went through all call sites (by renaming the function), we'd be able to tell that there is no caller with NULL, or is it?
Stefan
Show 10 quoted lines
> For > + * a submodule, the submodule must exist and be a nonbare repository, > + * otherwise return NULL. If the requested reference store has not yet > + * been initialized, initialize it first. > + * > + * For backwards compatibility, submodule=="" is treated the same as > + * submodule==NULL. > + */ > +struct ref_store *get_submodule_ref_store(const char *submodule); > +struct ref_store *get_main_ref_store(void);