Re: [PATCH v7 09/10] submodule: support reading .gitmodules when it's not in the working tree

2018-10-30 Thread Antonio Ospite
On Tue, 30 Oct 2018 10:57:09 +0100 (STD) Johannes Schindelin wrote: > Hi Antonio, > Hi Johannes, > On Thu, 25 Oct 2018, Antonio Ospite wrote: > > > diff --git a/t/t7418-submodule-sparse-gitmodules.sh > > b/t/t7418-submodule-sparse-gitmodules.sh > > new file

[PATCH v7 03/10] t7411: merge tests 5 and 6

2018-10-25 Thread Antonio Ospite
Tests 5 and 6 check for the effects of the same commit, merge the two tests to make it more straightforward to clean things up after the test has finished. The cleanup will be added in a future commit. Signed-off-by: Antonio Ospite --- t/t7411-submodule-config.sh | 18 +- 1

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

2018-10-25 Thread Antonio Ospite
eable" command, as git scripts may want to perform the check before modifying submodules configuration. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c | 24 +++- cache.h | 2 ++ submodule.c | 18 ++ s

[PATCH v7 10/10] t/helper: add test-submodule-nested-repo-config

2018-10-25 Thread Antonio Ospite
. This is because the git API does not always make it possible access the object store of an arbitrary repository (see get_oid() usage in config_from_gitmodules()). When this git limitation gets fixed the aforementioned use case will be supported too. Signed-off-by: Antonio Ospite --- Makefile

[PATCH v7 02/10] submodule: factor out a config_set_in_gitmodules_file_gently function

2018-10-25 Thread Antonio Ospite
dules". The purpose of the change is mainly to centralize the code that writes to the .gitmodules file to avoid some duplication. The naming follows git_config_set_in_file_gently() but the git_ prefix is removed to communicate that this is not a generic git-config API. Signed-off-by: Antonio Ospite ---

[PATCH v7 06/10] submodule: use the 'submodule--helper config' command

2018-10-25 Thread Antonio Ospite
Use the 'submodule--helper config' command in git-submodules.sh to avoid referring explicitly to .gitmodules by the hardcoded file path. This makes it possible to access the submodules configuration in a more controlled way. Signed-off-by: Antonio Ospite --- git-submodule.sh | 8 1

[PATCH v7 01/10] submodule: add a print_config_from_gitmodules() helper

2018-10-25 Thread Antonio Ospite
Add a new print_config_from_gitmodules() helper function to print values from .gitmodules just like "git config -f .gitmodules" would. This will be used by a new submodule--helper subcommand to be able to access the .gitmodules file in a more controlled way. Signed-off-by: Anto

[PATCH v7 07/10] t7506: clean up .gitmodules properly before setting up new scenario

2018-10-25 Thread Antonio Ospite
ctually start afresh in the new scenario. This is more future-proof and does not break current tests. Signed-off-by: Antonio Ospite --- t/t7506-status-submodule.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh index 94

[PATCH v7 04/10] t7411: be nicer to future tests and really clean things up

2018-10-25 Thread Antonio Ospite
anymore. Signed-off-by: Antonio Ospite --- t/t7411-submodule-config.sh | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh index f2cd1f4a2c..b1f3c6489b 100755 --- a/t/t7411-submodule-config.sh +++ b/t/t7411-submodule

[PATCH v7 00/10] Make submodules work if .gitmodules is not checked out

2018-10-25 Thread Antonio Ospite
now, instead of just testing the return value of "git submodule ..." commands when .gitmodules is not in the working tree, the actual use case is checked in each test, with pre- and post-conditions. Thank you, Antonio Antonio Ospite (10): submodule: add a print_c

[PATCH v7 09/10] submodule: support reading .gitmodules when it's not in the working tree

2018-10-25 Thread Antonio Ospite
case where this new feature does not work properly yet: nested submodules without .gitmodules in their working tree. This has been documented with a warning and a test_expect_failure item in t7814, and in this case the current behavior is not altered: no config is read. Signed-off-by: Anto

[PATCH v7 05/10] submodule--helper: add a new 'config' subcommand

2018-10-25 Thread Antonio Ospite
Add a new 'config' subcommand to 'submodule--helper', this extra level of indirection makes it possible to add some flexibility to how the submodules configuration is handled. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c | 14 ++ t/t7411-submodule-config.sh | 27

Re: [PATCH v6 00/10] Make submodules work if .gitmodules is not checked out

2018-10-25 Thread Antonio Ospite
On Thu, 25 Oct 2018 17:40:47 +0900 Junio C Hamano wrote: > Antonio Ospite writes: > > > this series teaches git to try and read the .gitmodules file from the > > index (:.gitmodules) or from the current branch (HEAD:.gitmodules) when > > the file is not readily avail

Re: [PATCH v6 09/10] submodule: support reading .gitmodules when it's not in the working tree

2018-10-10 Thread Antonio Ospite
ty output ' Maybe a little overkill? The "upstream" repo will be added in test 1 to better clarify the roles of the involved repositories. The commit ids should be stable because of test_tick, shouldn't they? Thanks for the comments, they helped improving the quality of the t

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
" or "--list-all" as possible additions), and does not affect the generated code, so I though it was worth it. Anyways, these are really details, let's concentrate on patches 9 and 10 which deserve much more attention. :) Thanks you, Antonio -- Antonio Ospite https://ao2.it h

Re: [PATCH v6 00/10] Make submodules work if .gitmodules is not checked out

2018-10-06 Thread Antonio Ospite
On Fri, 5 Oct 2018 15:05:51 +0200 Antonio Ospite wrote: [...] > t/t7416-submodule-sparse-gitmodules.sh | 78 ++ > 16 files changed, 410 insertions(+), 32 deletions(-) > create mode 100755 t/t7416-submodule-sparse-gitmodules.sh I just saw that t7416 and t7417 have b

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
fault enum value but I am not sure what it should be: NO_COMMAND_OPTION, COMMAND_DEFAULT, MODE_DEFAULT? Ciao, Antonio -- Antonio Ospite https://ao2.it https://twitter.com/ao2it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing?

Re: [PATCH] builtin/grep.c: remote superflous submodule code

2018-10-06 Thread Antonio Ospite
> submodule.c > > Signed-off-by: Stefan Beller Not sure if I am entitled to formally ack it, but: Acked-by: Antonio Ospite > --- > > Antonio Ospite writes: > > BTW, with Stefan Beller we also identified some unneeded code which > > could have been remove

[PATCH v6 09/10] submodule: support reading .gitmodules when it's not in the working tree

2018-10-05 Thread Antonio Ospite
case where this new feature does not work properly yet: nested submodules without .gitmodules in their working tree. This has been documented with a warning and a test_expect_failure item in t7814, and in this case the current behavior is not altered: no config is read. Signed-off-by: Anto

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

2018-10-05 Thread Antonio Ospite
eable" command, as git scripts may want to perform the check before modifying submodules configuration. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c | 24 +++- cache.h | 2 ++ submodule.c | 18 ++ s

[PATCH v6 05/10] submodule--helper: add a new 'config' subcommand

2018-10-05 Thread Antonio Ospite
Add a new 'config' subcommand to 'submodule--helper', this extra level of indirection makes it possible to add some flexibility to how the submodules configuration is handled. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c | 14 ++ t/t7411-submodule-config.sh | 27

[PATCH v6 10/10] t/helper: add test-submodule-nested-repo-config

2018-10-05 Thread Antonio Ospite
. This is because the git API does not always make it possible access the object store of an arbitrary repository (see get_oid() usage in config_from_gitmodules()). When this git limitation gets fixed the aforementioned use case will be supported too. Signed-off-by: Antonio Ospite --- Makefile

[PATCH v6 02/10] submodule: factor out a config_set_in_gitmodules_file_gently function

2018-10-05 Thread Antonio Ospite
dules". The purpose of the change is mainly to centralize the code that writes to the .gitmodules file to avoid some duplication. The naming follows git_config_set_in_file_gently() but the git_ prefix is removed to communicate that this is not a generic git-config API. Signed-off-by: Antonio Ospite ---

[PATCH v6 04/10] t7411: be nicer to future tests and really clean things up

2018-10-05 Thread Antonio Ospite
anymore. Signed-off-by: Antonio Ospite --- t/t7411-submodule-config.sh | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh index f2cd1f4a2c..b1f3c6489b 100755 --- a/t/t7411-submodule-config.sh +++ b/t/t7411-submodule

[PATCH v6 01/10] submodule: add a print_config_from_gitmodules() helper

2018-10-05 Thread Antonio Ospite
Add a new print_config_from_gitmodules() helper function to print values from .gitmodules just like "git config -f .gitmodules" would. This will be used by a new submodule--helper subcommand to be able to access the .gitmodules file in a more controlled way. Signed-off-by: Anto

[PATCH v6 07/10] t7506: clean up .gitmodules properly before setting up new scenario

2018-10-05 Thread Antonio Ospite
ctually start afresh in the new scenario. This is more future-proof and does not break current tests. Signed-off-by: Antonio Ospite --- t/t7506-status-submodule.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh index 94

[PATCH v6 06/10] submodule: use the 'submodule--helper config' command

2018-10-05 Thread Antonio Ospite
Use the 'submodule--helper config' command in git-submodules.sh to avoid referring explicitly to .gitmodules by the hardcoded file path. This makes it possible to access the submodules configuration in a more controlled way. Signed-off-by: Antonio Ospite --- git-submodule.sh | 8 1

[PATCH v6 00/10] Make submodules work if .gitmodules is not checked out

2018-10-05 Thread Antonio Ospite
specific. Thank you, Antonio Antonio Ospite (10): submodule: add a print_config_from_gitmodules() helper submodule: factor out a config_set_in_gitmodules_file_gently function t7411: merge tests 5 and 6 t7411: be nicer to future tests and really clean things up submodule--helpe

[PATCH v6 03/10] t7411: merge tests 5 and 6

2018-10-05 Thread Antonio Ospite
Tests 5 and 6 check for the effects of the same commit, merge the two tests to make it more straightforward to clean things up after the test has finished. The cleanup will be added in a future commit. Signed-off-by: Antonio Ospite --- t/t7411-submodule-config.sh | 18 +- 1

Re: [PATCH v5 9/9] submodule: support reading .gitmodules when it's not in the working tree

2018-10-01 Thread Antonio Ospite
On Thu, 27 Sep 2018 11:00:52 -0700 Stefan Beller wrote: > On Thu, Sep 27, 2018 at 7:44 AM Antonio Ospite wrote: [...] > > OK, so the plan for v6 is: > > > > - avoid the corruption issues spotted by Gábor by removing the call > > to repo_read_gitmodules in buil

Re: [PATCH v5 9/9] submodule: support reading .gitmodules when it's not in the working tree

2018-09-27 Thread Antonio Ospite
On Fri, 21 Sep 2018 09:19:45 -0700 Junio C Hamano wrote: > Antonio Ospite writes: > > > Protecting the problematic submodules function could work for now, but > > I'd like to have more comments, my proposal is: > > > > diff --git a/builtin/grep.c b/built

Re: [PATCH v5 9/9] submodule: support reading .gitmodules when it's not in the working tree

2018-09-27 Thread Antonio Ospite
Hi Stefan, On Mon, 24 Sep 2018 14:00:50 -0700 Stefan Beller wrote: > On Mon, Sep 24, 2018 at 3:20 AM Antonio Ospite wrote: > [...] > > This is a limitation of the object store in git, there is no equivalent > > of get_oid() to get the oid from a specific repositor

Re: [PATCH v5 1/9] submodule: add a print_config_from_gitmodules() helper

2018-09-24 Thread Antonio Ospite
On Mon, 17 Sep 2018 16:09:32 +0200 Antonio Ospite wrote: > Add a new print_config_from_gitmodules() helper function to print values > from .gitmodules just like "git config -f .gitmodules" would. > [...] > +int print_config_from_gitmodules(const char *key) I am

Re: [PATCH v5 9/9] submodule: support reading .gitmodules when it's not in the working tree

2018-09-24 Thread Antonio Ospite
On Tue, 18 Sep 2018 19:12:57 +0200 SZEDER Gábor wrote: [...] > On Mon, Sep 17, 2018 at 04:09:40PM +0200, Antonio Ospite wrote: > > When the .gitmodules file is not available in the working tree, try > > using the content from the index and from the current branch. > > &qu

Re: [PATCH v5 9/9] submodule: support reading .gitmodules when it's not in the working tree

2018-09-20 Thread Antonio Ospite
is obviously wrong in this > patch and could be responsible for the memory corruption, but there is > one thing I found strange, though: > > > On Mon, Sep 17, 2018 at 04:09:40PM +0200, Antonio Ospite wrote: > > When the .gitmodules file is not available in the working tree, try >

[PATCH v5 0/9] Make submodules work if .gitmodules is not checked out

2018-09-17 Thread Antonio Ospite
new' which erroneously slipped in a commit. * Update some comments and commit messages. Thank you, Antonio Antonio Ospite (9): submodule: add a print_config_from_gitmodules() helper submodule: factor out a config_set_in_gitmodules_file_gently function t7411: merge tests 5 and 6 t

[PATCH v5 1/9] submodule: add a print_config_from_gitmodules() helper

2018-09-17 Thread Antonio Ospite
Add a new print_config_from_gitmodules() helper function to print values from .gitmodules just like "git config -f .gitmodules" would. This will be used by a new submodule--helper subcommand to be able to access the .gitmodules file in a more controlled way. Signed-off-by: Anto

[PATCH v5 7/9] t7506: clean up .gitmodules properly before setting up new scenario

2018-09-17 Thread Antonio Ospite
ctually start afresh in the new scenario. This is more future-proof and does not break current tests. Signed-off-by: Antonio Ospite --- t/t7506-status-submodule.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh index 94

[PATCH v5 5/9] submodule--helper: add a new 'config' subcommand

2018-09-17 Thread Antonio Ospite
Add a new 'config' subcommand to 'submodule--helper', this extra level of indirection makes it possible to add some flexibility to how the submodules configuration is handled. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c | 14 ++ t/t7411-submodule-config.sh | 27

[PATCH v5 4/9] t7411: be nicer to future tests and really clean things up

2018-09-17 Thread Antonio Ospite
anymore. Signed-off-by: Antonio Ospite --- t/t7411-submodule-config.sh | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh index f2cd1f4a2c..b1f3c6489b 100755 --- a/t/t7411-submodule-config.sh +++ b/t/t7411-submodule

[PATCH v5 9/9] submodule: support reading .gitmodules when it's not in the working tree

2018-09-17 Thread Antonio Ospite
ot updated because config_set_in_gitmodules_file_gently failed). Finally, add t7416-submodule-sparse-gitmodules.sh to verify that reading from .gitmodules succeeds and that writing to it fails when the file is not checked out. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c

[PATCH v5 2/9] submodule: factor out a config_set_in_gitmodules_file_gently function

2018-09-17 Thread Antonio Ospite
dules". The purpose of the change is mainly to centralize the code that writes to the .gitmodules file to avoid some duplication. The naming follows git_config_set_in_file_gently() but the git_ prefix is removed to communicate that this is not a generic git-config API. Signed-off-by: Antonio Ospite ---

[PATCH v5 3/9] t7411: merge tests 5 and 6

2018-09-17 Thread Antonio Ospite
Tests 5 and 6 check for the effects of the same commit, merge the two tests to make it more straightforward to clean things up after the test has finished. The cleanup will be added in a future commit. Signed-off-by: Antonio Ospite --- t/t7411-submodule-config.sh | 18 +- 1

[PATCH v5 8/9] submodule: add a helper to check if it is safe to write to .gitmodules

2018-09-17 Thread Antonio Ospite
eable" command, as git scripts may want to perform the check before modifying submodules configuration. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c | 24 +++- cache.h | 2 ++ submodule.c | 18 ++ s

[PATCH v5 6/9] submodule: use the 'submodule--helper config' command

2018-09-17 Thread Antonio Ospite
Use the 'submodule--helper config' command in git-submodules.sh to avoid referring explicitly to .gitmodules by the hardcoded file path. This makes it possible to access the submodules configuration in a more controlled way. Signed-off-by: Antonio Ospite --- git-submodule.sh | 8 1

Re: What's cooking in git.git (Sep 2018, #03; Fri, 14)

2018-09-15 Thread Antonio Ospite
touches suggested by Ævar: https://public-inbox.org/git/87wosfesxl@evledraar.gmail.com/ Ciao, Antonio -- Antonio Ospite https://ao2.it https://twitter.com/ao2it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing?

Re: [PATCH v4 1/9] submodule: add a print_config_from_gitmodules() helper

2018-09-04 Thread Antonio Ospite
On Fri, 24 Aug 2018 18:52:51 +0200 Antonio Ospite wrote: [...] > I'll wait for other comments to see if a v5 is really needed. > Ping. In case someone missed v4. Thanks, Antonio -- Antonio Ospite https://ao2.it https://twitter.com/ao2it A: Because it messes up the order in which

Re: [PATCH v4 1/9] submodule: add a print_config_from_gitmodules() helper

2018-08-24 Thread Antonio Ospite
On Fri, 24 Aug 2018 16:32:38 +0200 Ævar Arnfjörð Bjarmason wrote: > > On Fri, Aug 24 2018, Antonio Ospite wrote: [...] > > +static int config_print_callback(const char *key_, const char *value_, > > void *cb_data) > > +{ > > + char *key = cb_data; >

[PATCH v4 1/9] submodule: add a print_config_from_gitmodules() helper

2018-08-24 Thread Antonio Ospite
Add a new print_config_from_gitmodules() helper function to print values from .gitmodules just like "git config -f .gitmodules" would. This will be used by a new submodule--helper subcommand to be able to access the .gitmodules file in a more controlled way. Signed-off-by: Anto

[PATCH v4 7/9] t7506: clean up .gitmodules properly before setting up new scenario

2018-08-24 Thread Antonio Ospite
ctually start afresh in the new scenario. This is more future-proof and does not break current tests. Signed-off-by: Antonio Ospite --- t/t7506-status-submodule.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh index 94

[PATCH v4 3/9] t7411: merge tests 5 and 6

2018-08-24 Thread Antonio Ospite
Tests 5 and 6 check for the effects of the same commit, merge the two tests to make it more straightforward to clean things up after the test has finished. The cleanup will be added in a future commit. Signed-off-by: Antonio Ospite --- t/t7411-submodule-config.sh | 18 +- 1

[PATCH v4 5/9] submodule--helper: add a new 'config' subcommand

2018-08-24 Thread Antonio Ospite
Add a new 'config' subcommand to 'submodule--helper', this extra level of indirection makes it possible to add some flexibility to how the submodules configuration is handled. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c | 14 ++ t/t7411-submodule-config.sh | 27

[PATCH v4 0/9] Make submodules work if .gitmodules is not checked out

2018-08-24 Thread Antonio Ospite
neusly slipped in a commit. * Update some comments and commit messages. Thanks, Antonio Antonio Ospite (9): submodule: add a print_config_from_gitmodules() helper submodule: factor out a config_set_in_gitmodules_file_gently function t7411: merge tests 5 and 6 t7411: be nicer to future

[PATCH v4 8/9] submodule: add a helper to check if it is safe to write to .gitmodules

2018-08-24 Thread Antonio Ospite
eable" command, as git scripts may want to perform the check before modifying submodules configuration. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c | 24 +++- cache.h | 2 ++ submodule.c | 18 ++ s

[PATCH v4 6/9] submodule: use the 'submodule--helper config' command

2018-08-24 Thread Antonio Ospite
Use the 'submodule--helper config' command in git-submodules.sh to avoid referring explicitly to .gitmodules by the hardcoded file path. This makes it possible to access the submodules configuration in a more controlled way. Signed-off-by: Antonio Ospite --- git-submodule.sh | 8 1

[PATCH v4 2/9] submodule: factor out a config_set_in_gitmodules_file_gently function

2018-08-24 Thread Antonio Ospite
dules". The purpose of the change is mainly to centralize the code that writes to the .gitmodules file to avoid some duplication. The naming follows git_config_set_in_file_gently() but the git_ prefix is removed to communicate that this is not a generic git-config API. Signed-off-by: Antonio Ospite ---

[PATCH v4 9/9] submodule: support reading .gitmodules when it's not in the working tree

2018-08-24 Thread Antonio Ospite
ot updated because config_set_in_gitmodules_file_gently failed). Finally, add t7416-submodule-sparse-gitmodules.sh to verify that reading from .gitmodules succeeds and that writing to it fails when the file is not checked out. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c

[PATCH v4 4/9] t7411: be nicer to future tests and really clean things up

2018-08-24 Thread Antonio Ospite
anymore. Signed-off-by: Antonio Ospite --- t/t7411-submodule-config.sh | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh index f2cd1f4a2c..b1f3c6489b 100755 --- a/t/t7411-submodule-config.sh +++ b/t/t7411-submodule

Re: [PATCH v3 7/7] submodule: support reading .gitmodules even when it's not checked out

2018-08-23 Thread Antonio Ospite
On Wed, 22 Aug 2018 08:29:25 -0700 Junio C Hamano wrote: > Antonio Ospite writes: > [...] > >> > > + else if (get_oid(GITMODULES_HEAD, ) >= 0) > >> > > + config_source.blob = GITMODULES_HEAD; > >> > > >

Re: [PATCH v3 7/7] submodule: support reading .gitmodules even when it's not checked out

2018-08-22 Thread Antonio Ospite
On Mon, 20 Aug 2018 23:37:55 +0200 Antonio Ospite wrote: > On Tue, 14 Aug 2018 13:36:17 -0700 > Junio C Hamano wrote: > > > Antonio Ospite writes: [...] > > > > > > + # For more details about this check, see > > > + # builtin/submodule--help

Re: [PATCH v3 7/7] submodule: support reading .gitmodules even when it's not checked out

2018-08-20 Thread Antonio Ospite
On Tue, 14 Aug 2018 13:36:17 -0700 Junio C Hamano wrote: > Antonio Ospite writes: > > > /* Equivalent to ACTION_SET in builtin/config.c */ > > - if (argc == 3) > > + if (argc == 3) { > > + struct object_id oid; > > + > > +

Re: [PATCH v3 4/7] submodule--helper: add a new 'config' subcommand

2018-08-20 Thread Antonio Ospite
On Tue, 14 Aug 2018 10:10:58 -0700 Brandon Williams wrote: > On 08/14, Antonio Ospite wrote: > > Add a new 'config' subcommand to 'submodule--helper', this extra level > > of indirection makes it possible to add some flexibility to how the > > submodules configuration is han

Re: [PATCH v3 3/7] t7411: be nicer to future tests and really clean things up

2018-08-20 Thread Antonio Ospite
On Tue, 14 Aug 2018 13:16:38 -0700 Junio C Hamano wrote: > Antonio Ospite writes: > [...] > > test_expect_success 'error message contains blob reference' ' > > + # Remove the error introduced in the previous test. > > + # It is not needed in the following tests. &g

[PATCH v3 6/7] t7506: clean up .gitmodules properly before setting up new scenario

2018-08-14 Thread Antonio Ospite
ctually start afresh in the new scenario. This is more future-proof and does not break current tests. Signed-off-by: Antonio Ospite --- t/t7506-status-submodule.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh index 94

[PATCH v3 1/7] submodule: add a print_config_from_gitmodules() helper

2018-08-14 Thread Antonio Ospite
Add a new print_config_from_gitmodules() helper function to print values from .gitmodules just like "git config -f .gitmodules" would. This will be used by a new submodule--helper subcommand to be able to access the .gitmodules file in a more controlled way. Signed-off-by: Anto

[PATCH v3 0/7] Make submodules work if .gitmodules is not checked out

2018-08-14 Thread Antonio Ospite
as they are orthogonal to this series. I will send them as a standalone series. * Minor wording fixes here and there. The series looks a lot cleaner and more to the point, thanks for the review. Ciao, Antonio Antonio Ospite (7): submodule: add a print_config_from_gitmodules() helper su

[PATCH v3 2/7] submodule: factor out a config_set_in_gitmodules_file_gently function

2018-08-14 Thread Antonio Ospite
dules". The purpose of the change is mainly to centralize the code that writes to the .gitmodules file to avoid some duplication. The naming follows git_config_set_in_file_gently() but the git_ prefix is removed to communicate that this is not a generic git-config API. Signed-off-by: Antonio Ospite ---

[PATCH v3 4/7] submodule--helper: add a new 'config' subcommand

2018-08-14 Thread Antonio Ospite
Add a new 'config' subcommand to 'submodule--helper', this extra level of indirection makes it possible to add some flexibility to how the submodules configuration is handled. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c | 14 ++ new | 0 t

[PATCH v3 5/7] submodule: use the 'submodule--helper config' command

2018-08-14 Thread Antonio Ospite
Use the 'submodule--helper config' command in git-submodules.sh to avoid referring explicitly to .gitmodules by the hardcoded file path. This makes it possible to access the submodules configuration in a more controlled way. Signed-off-by: Antonio Ospite --- git-submodule.sh | 8 1

[PATCH v3 7/7] submodule: support reading .gitmodules even when it's not checked out

2018-08-14 Thread Antonio Ospite
ed because config_set_in_gitmodules_file_gently failed). Finally, add t7416-submodule-sparse-gitmodules.sh to verify that reading from .gitmodules succeeds and that writing to it fails when the file is not checked out. Signed-off-by: Antonio Ospite --- Maybe the check in config_set_in_gitmodules_f

[PATCH v3 3/7] t7411: be nicer to future tests and really clean things up

2018-08-14 Thread Antonio Ospite
anymore. The error introduced in test 5 is also required by test 6, so the two commits from above are removed respectively in tests 6 and 8. Signed-off-by: Antonio Ospite --- t/t7411-submodule-config.sh | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/t/t7411-submodule

Re: [RFC PATCH v2 03/12] t7411: be nicer to future tests and really clean things up

2018-08-09 Thread Antonio Ospite
a revert be any different? > The config --unset already fixes the gitmodules file, > so I think we can rather do > > git commit -a -m 'now the .gitmodules file is fixed at HEAD \ > but has a messy history' > > But as I have only read up to here, not knowing what the

Re: [RFC PATCH v2 01/12] submodule: add a print_config_from_gitmodules() helper

2018-08-09 Thread Antonio Ospite
On Thu, 2 Aug 2018 11:05:02 -0700 Stefan Beller wrote: > On Thu, Aug 2, 2018 at 6:47 AM Antonio Ospite wrote: > > [...] > > +extern int print_config_from_gitmodules(const char *key); > > The only real pushback for this patch I'd have is lack of documentation > in

Re: [RFC PATCH v2 10/12] t7416: add new test about HEAD:.gitmodules and not existing .gitmodules

2018-08-09 Thread Antonio Ospite
On Thu, 2 Aug 2018 13:43:05 -0700 Stefan Beller wrote: > On Thu, Aug 2, 2018 at 6:47 AM Antonio Ospite wrote: > > > > git submodule commands can now access .gitmodules from the current > > branch even when it's not in the working tree, add some tests for that > > s

Re: [RFC PATCH v2 06/12] submodule--helper: add a '--stage' option to the 'config' sub command

2018-08-07 Thread Antonio Ospite
On Mon, 06 Aug 2018 10:38:20 -0700 Junio C Hamano wrote: > Antonio Ospite writes: > > >> I also do not see a reason why we want to stop referring to > >> .gitmodules explicitly by name. We do not hide the fact that > >> in-tree .gitignore and .git

Re: [RFC PATCH v2 06/12] submodule--helper: add a '--stage' option to the 'config' sub command

2018-08-06 Thread Antonio Ospite
On Fri, 03 Aug 2018 09:24:14 -0700 Junio C Hamano wrote: > Antonio Ospite writes: > > > The rationale behind the change is to close the circle started with 04 > > and 05 and stop referring to .gitmodules explicitly by file path in git > > commands. The chang

Re: [RFC PATCH v2 06/12] submodule--helper: add a '--stage' option to the 'config' sub command

2018-08-03 Thread Antonio Ospite
On Thu, 02 Aug 2018 11:57:14 -0700 Junio C Hamano wrote: > Antonio Ospite writes: > > > Add a --stage option to the 'submodule--helper config' command so that > > the .gitmodules file can be staged without referring to it explicitly by > > its file path. > >

Re: [RFC PATCH v2 04/12] submodule--helper: add a new 'config' subcommand

2018-08-03 Thread Antonio Ospite
> if (argc == 3) > return ... > > die("need 1 or 2 arguments"); > Hi Jeff, I like that, I'll see how this plays out after patch 06 which adds another option, and decide whether to use this style; validating arguments beforehand may still look a little cleaner. Thanks for the comment. Ciao, Antonio -- Antonio Ospite https://ao2.it https://twitter.com/ao2it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing?

Re: [RFC PATCH v2 12/12] submodule: remove the .gitmodules file when it is empty

2018-08-03 Thread Antonio Ospite
On Thu, 2 Aug 2018 14:15:54 -0700 Stefan Beller wrote: > On Thu, Aug 2, 2018 at 6:47 AM Antonio Ospite wrote: > > > > In particular this makes it possible to really clean things up when > > removing the last submodule with "git rm". > > This sentence

Re: [RFC PATCH v2 11/12] dir: move is_empty_file() from builtin/am.c to dir.c and make it public

2018-08-03 Thread Antonio Ospite
On Thu, 2 Aug 2018 13:50:55 -0700 Stefan Beller wrote: > On Thu, Aug 2, 2018 at 6:47 AM Antonio Ospite wrote: > > > > The is_empty_file() function can be generally useful, move it to dir.c > > and make it public. > > > > Signed-off-by: Antonio Ospite >

[RFC PATCH v2 04/12] submodule--helper: add a new 'config' subcommand

2018-08-02 Thread Antonio Ospite
Add a new 'config' subcommand to 'submodule--helper', this extra level of indirection makes it possible to add some flexibility to how the submodules configuration is handled. Signed-off-by: Antonio Ospite --- Note that the tests follow the predominant style in the file: subshell and cd right

[RFC PATCH v2 10/12] t7416: add new test about HEAD:.gitmodules and not existing .gitmodules

2018-08-02 Thread Antonio Ospite
git submodule commands can now access .gitmodules from the current branch even when it's not in the working tree, add some tests for that scenario. Signed-off-by: Antonio Ospite --- For the test files I used the most used style in other tests, Stefan suggested to avoid subshells and use "g

[RFC PATCH v2 08/12] t7506: cleanup .gitmodules properly before setting up new scenario

2018-08-02 Thread Antonio Ospite
rt afresh in the new scenario. This is more future-proof and does not break current tests. Signed-off-by: Antonio Ospite --- t/t7506-status-submodule.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh index b4b74dbe2

[RFC PATCH v2 11/12] dir: move is_empty_file() from builtin/am.c to dir.c and make it public

2018-08-02 Thread Antonio Ospite
The is_empty_file() function can be generally useful, move it to dir.c and make it public. Signed-off-by: Antonio Ospite --- builtin/am.c | 15 --- dir.c| 16 dir.h| 1 + 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/builtin/am.c

[RFC PATCH v2 06/12] submodule--helper: add a '--stage' option to the 'config' sub command

2018-08-02 Thread Antonio Ospite
st they will complain. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c | 54 +++-- t/t7411-submodule-config.sh | 35 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submod

[RFC PATCH v2 07/12] submodule: use 'submodule--helper config --stage' to stage .gitmodules

2018-08-02 Thread Antonio Ospite
Use 'git submodule--helper config --stage' in git-submodule.sh to remove the last place where the .gitmodules file is mentioned explicitly by its file path. Signed-off-by: Antonio Ospite --- git-submodule.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-submodule.sh b

[RFC PATCH v2 02/12] submodule: factor out a config_set_in_gitmodules_file_gently function

2018-08-02 Thread Antonio Ospite
dules". The purpose of the change is mainly to centralize the code that writes to the .gitmodules file to avoid some duplication. The naming follows git_config_set_in_file_gently() but the git_ prefix is removed to communicate that this is not a generic git-config API. Signed-off-by: Antonio Ospite ---

[RFC PATCH v2 01/12] submodule: add a print_config_from_gitmodules() helper

2018-08-02 Thread Antonio Ospite
This will be used to print values just like "git config -f .gitmodules" would. Signed-off-by: Antonio Ospite --- submodule-config.c | 25 + submodule-config.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/submodule-config.c b/submodule-conf

[RFC PATCH v2 00/12] Make submodules work if .gitmodules is not checked out

2018-08-02 Thread Antonio Ospite
when appropriate. * Renamed t7415-submodule-sparse-gitmodules.sh to t7416-submodule-sparse-gitmodules.sh because t7415 was taken by t7415-submodule-names.sh * Made "git mv" and "git rm" work again when .gitmodules does not exist. * Remo

[RFC PATCH v2 05/12] submodule: use the 'submodule--helper config' command

2018-08-02 Thread Antonio Ospite
Use the 'submodule--helper config' command in git-submodules.sh to avoid referring explicitly to .gitmodules by the hardcoded file path. This makes it possible to access the submodules configuration in a more controlled way. Signed-off-by: Antonio Ospite --- Note that there are other instances

[RFC PATCH v2 03/12] t7411: be nicer to future tests and really clean things up

2018-08-02 Thread Antonio Ospite
of them. The modified line is in the last test of the file, so this does not change the current behavior, it only affects future tests. Signed-off-by: Antonio Ospite --- Note that test_when_finished is not used here, both to keep the current style and also because it does not work in sub-shells. t

[RFC PATCH v2 09/12] submodule: support reading .gitmodules even when it's not checked out

2018-08-02 Thread Antonio Ospite
at least the 'git submodule' commands which *read* the gitmodules configuration file without fully populating the working tree. Writing to .gitmodules will still require that the file is checked out, so check for that before calling config_set_in_gitmodules_file_gently. Signed-off-by: Antonio Ospite

[RFC PATCH v2 12/12] submodule: remove the .gitmodules file when it is empty

2018-08-02 Thread Antonio Ospite
In particular this makes it possible to really clean things up when removing the last submodule with "git rm". The rationale is that if git creates .gitmodules when adding the first submodule it should also remove it when removing the last submodule. Signed-off-by: Anto

Re: [PATCH v2 5/6] submodule-config: pass repository as argument to config_from_gitmodules

2018-06-26 Thread Antonio Ospite
On Tue, 26 Jun 2018 13:15:33 -0700 Junio C Hamano wrote: > Antonio Ospite writes: > > > Generlize config_from_gitmodules to accept a repository as an argument. > > generalize??? > Of course I was going to miss a typo in the first word of the commit message :| If th

Re: [PATCH v2 2/6] submodule-config: add helper function to get 'fetch' config from .gitmodules

2018-06-26 Thread Antonio Ospite
On Tue, 26 Jun 2018 13:11:40 -0700 Junio C Hamano wrote: > Antonio Ospite writes: > > > Add a helper function to make it clearer that retrieving 'fetch' > > configuration from the .gitmodules file is a special case supported > > solely for backwar

[PATCH v2 4/6] submodule-config: make 'config_from_gitmodules' private

2018-06-26 Thread Antonio Ospite
Now that 'config_from_gitmodules' is not used in the open, it can be marked as private. Hopefully this will prevent its usage for retrieving arbitrary configuration form the '.gitmodules' file. Signed-off-by: Antonio Ospite --- submodule-config.c | 8 submodule-config.h | 12

[PATCH v2 1/6] config: move config_from_gitmodules to submodule-config.c

2018-06-26 Thread Antonio Ospite
file. Signed-off-by: Antonio Ospite --- config.c | 17 - config.h | 10 -- submodule-config.c | 17 + submodule-config.h | 11 +++ 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/config.c b/config.c index a0a6ae198

[PATCH v2 6/6] submodule-config: reuse config_from_gitmodules in repo_read_gitmodules

2018-06-26 Thread Antonio Ospite
to submodules. The check about the repo's worktree is removed from repo_read_gitmodules because it's already performed in config_from_gitmodules. The config_from_gitmodules function is moved up in the file —unchanged— before its users to avoid a forward declaration. Signed-off-by: Antonio Ospite

[PATCH v2 3/6] submodule-config: add helper to get 'update-clone' config from .gitmodules

2018-06-26 Thread Antonio Ospite
arbitrary configuration in the repository that any command can retrieve. Signed-off-by: Antonio Ospite --- builtin/submodule--helper.c | 8 submodule-config.c | 14 ++ submodule-config.h | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) diff --git

[PATCH v2 2/6] submodule-config: add helper function to get 'fetch' config from .gitmodules

2018-06-26 Thread Antonio Ospite
to communicate better that .gitmodules is not to be used as a mechanism to store arbitrary configuration in the repository that any command can retrieve. Signed-off-by: Antonio Ospite --- builtin/fetch.c| 15 +-- submodule-config.c | 28 submodule

  1   2   >