Re: [PATCH v6 08/10] submodule: add a helper to check if it is safe to write to .gitmodules

2018-10-08 Thread Antonio Ospite
On Sun, 07 Oct 2018 08:44:20 +0900 Junio C Hamano wrote: > Stefan Beller writes: > > >> static int module_config(int argc, const char **argv, const char *prefix) > >> { > >> + enum { > >> + CHECK_WRITEABLE = 1 > >> + } command = 0; > > > > Can we have the default

Re: [PATCH v6 08/10] submodule: add a helper to check if it is safe to write to .gitmodules

2018-10-06 Thread Junio C Hamano
Stefan Beller writes: >> static int module_config(int argc, const char **argv, const char *prefix) >> { >> + enum { >> + CHECK_WRITEABLE = 1 >> + } command = 0; > > Can we have the default named? Then we would only use states > from within the enum? Why? Do we use a

Re: [PATCH v6 08/10] submodule: add a helper to check if it is safe to write to .gitmodules

2018-10-06 Thread Antonio Ospite
On Fri, 5 Oct 2018 16:50:10 -0700 Stefan Beller wrote: > > static int module_config(int argc, const char **argv, const char *prefix) > > { > > + enum { > > + CHECK_WRITEABLE = 1 > > + } command = 0; > > Can we have the default named? Then we would only use states >

Re: [PATCH v6 08/10] submodule: add a helper to check if it is safe to write to .gitmodules

2018-10-05 Thread Stefan Beller
> static int module_config(int argc, const char **argv, const char *prefix) > { > + enum { > + CHECK_WRITEABLE = 1 > + } command = 0; Can we have the default named? Then we would only use states from within the enum?

[PATCH v6 08/10] submodule: add a helper to check if it is safe to write to .gitmodules

2018-10-05 Thread Antonio Ospite
Introduce a helper function named is_writing_gitmodules_ok() to verify that the .gitmodules file is safe to write. The function name follows the scheme of is_staging_gitmodules_ok(). The two symbolic constants GITMODULES_INDEX and GITMODULES_HEAD are used to get help from the C preprocessor in