concourse / git-resource

tracks commits in a branch of a Git repository
Apache License 2.0
193 stars 289 forks source link

submodule_recursive: false - doesn't seems to work - all submodules are fetched #307

Open sfroee opened 4 years ago

sfroee commented 4 years ago

Hello,

All attempts to use git resource and clone only first level of submodules fails Perhaps it's a mistake I made , but I really tried many variation with the pipeline syntax.

I created a simple test scenario to show this issue, Create a root repo with submodule child , and child repo with another two submodules grandchild-1 and grandchild-2

root child

grandchild-1 grandchild-2

then I created a pipeline (maintained in the root repo)with below syntax You can see my source in : https://github.com/sfroee/root

pipeline.yml:

`--- resources:

jobs:

However when running this pipeline I see the git clone fetched all submodules including grandchilds This is the output of the fetch git resource:

=====

Cloning into '/tmp/build/get'... 469bb2a fix Submodule 'child' (https://github.com/sfroee/child) registered for path 'child' Cloning into '/tmp/build/get/child'... Submodule path 'child': checked out '1484c7198eda5698a3eded99b346e73587980d5c' Submodule 'grandchild-1' (https://github.com/sfroee/grandchild-1) registered for path 'child/grandchild-1' Submodule 'grandchild-2' (https://github.com/sfroee/grandchild-2) registered for path 'child/grandchild-2' Cloning into '/tmp/build/get/child/grandchild-1'... Cloning into '/tmp/build/get/child/grandchild-2'... Submodule path 'child/grandchild-1': checked out 'cf7f05605e583576db33c8b7ec0ba15ddf888e98' Submodule path 'child/grandchild-2': checked out '426e008e3d37d4915e8444c361ecc211a08d3a4e'

=====

then my task just print files (ls -R) and also shows all files were downloaded :

/tmp/build/eff7422d .: root

./root: README.md child pipeline.yml test.sh

./root/child: README.md grandchild-1 grandchild-2

./root/child/grandchild-1: README.md

./root/child/grandchild-2: README.md

=====

Hope I explained the issue well enough, if u have any question , please let me know Thanks an Regards Roy

sooncj commented 4 years ago

also seeing this on master

I was able to work around this by quoting false

submodule_recursive: "false"
sfroee commented 4 years ago

Thank You @sooncj

Using the quotes around the boolean value of false really did the work. It's still an issue to be solved , but at least the workaround is easy enough

for completeness, I updated the pipeline.yml file in my example to use the suggested solution, For anyone convenience ...

Thanks and Best Regards Roy

benjaminguttmann-avtq commented 3 years ago

hmm.. for me the workaround is not working :-(