@@ -103,15 +103,20 @@ def _git_create_remote_tag(self, name, tag):
103
103
self ._git_remote (['commit' , '--no-gpg-sign' , '--allow-empty' , '-m' , f'tag { tag } commit' ], name )
104
104
self ._git_remote (['tag' , '--no-sign' , tag ], name )
105
105
106
- def _wrap_create_git (self , name , revision = 'master' ):
106
+ def _wrap_create_git (self , name , revision = 'master' , depth = None ):
107
107
path = self .root_dir / name
108
108
with open (str ((self .subprojects_dir / name ).with_suffix ('.wrap' )), 'w' , encoding = 'utf-8' ) as f :
109
+ if depth is None :
110
+ depth_line = ''
111
+ else :
112
+ depth_line = 'depth = {}' .format (depth )
109
113
f .write (textwrap .dedent (
110
114
'''
111
115
[wrap-git]
112
116
url={}
113
117
revision={}
114
- ''' .format (os .path .abspath (str (path )), revision )))
118
+ {}
119
+ ''' .format (os .path .abspath (str (path )), revision , depth_line )))
115
120
116
121
def _wrap_create_file (self , name , tarball = 'dummy.tar.gz' ):
117
122
path = self .root_dir / tarball
@@ -138,6 +143,14 @@ def test_git_update(self):
138
143
self .assertPathExists (str (self .subprojects_dir / subp_name ))
139
144
self ._git_config (self .subprojects_dir / subp_name )
140
145
146
+ # Create a fake remote git repository and a wrap file targeting
147
+ # HEAD and depth = 1. Checks that "meson subprojects download" works.
148
+ self ._git_create_remote_repo (subp_name )
149
+ self ._wrap_create_git (subp_name , revision = 'head' , depth = '1' )
150
+ self ._subprojects_cmd (['download' ])
151
+ self .assertPathExists (str (self .subprojects_dir / subp_name ))
152
+ self ._git_config (self .subprojects_dir / subp_name )
153
+
141
154
# Create a new remote branch and update the wrap file. Checks that
142
155
# "meson subprojects update --reset" checkout the new branch.
143
156
self ._git_create_remote_branch (subp_name , 'newbranch' )
0 commit comments