Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
65839b78
Commit
65839b78
authored
4 years ago
by
Rhys Arkins
Browse files
Options
Downloads
Patches
Plain Diff
fix(git-submodules): add try-catch around extract phase
parent
989caae2
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/manager/git-submodules/extract.ts
+45
-32
45 additions, 32 deletions
lib/manager/git-submodules/extract.ts
with
45 additions
and
32 deletions
lib/manager/git-submodules/extract.ts
+
45
−
32
View file @
65839b78
...
@@ -3,6 +3,7 @@ import Git from 'simple-git/promise';
...
@@ -3,6 +3,7 @@ import Git from 'simple-git/promise';
import
upath
from
'
upath
'
;
import
upath
from
'
upath
'
;
import
*
as
datasourceGitSubmodules
from
'
../../datasource/git-submodules
'
;
import
*
as
datasourceGitSubmodules
from
'
../../datasource/git-submodules
'
;
import
{
logger
}
from
'
../../logger
'
;
import
{
ManagerConfig
,
PackageFile
}
from
'
../common
'
;
import
{
ManagerConfig
,
PackageFile
}
from
'
../common
'
;
type
GitModule
=
{
type
GitModule
=
{
...
@@ -52,26 +53,28 @@ async function getModules(
...
@@ -52,26 +53,28 @@ async function getModules(
git
:
Git
.
SimpleGit
,
git
:
Git
.
SimpleGit
,
gitModulesPath
:
string
gitModulesPath
:
string
):
Promise
<
GitModule
[]
>
{
):
Promise
<
GitModule
[]
>
{
const
modules
=
(
(
await
git
.
raw
([
'
config
'
,
'
--file
'
,
gitModulesPath
,
'
--get-regexp
'
,
'
path
'
,
]))
??
/* istanbul ignore next: should never happen */
''
)
.
trim
()
.
split
(
/
\n
/
)
.
filter
((
s
)
=>
!!
s
);
const
res
:
GitModule
[]
=
[];
const
res
:
GitModule
[]
=
[];
try
{
const
modules
=
(
(
await
git
.
raw
([
'
config
'
,
'
--file
'
,
gitModulesPath
,
'
--get-regexp
'
,
'
path
'
,
]))
??
/* istanbul ignore next: should never happen */
''
)
.
trim
()
.
split
(
/
\n
/
)
.
filter
((
s
)
=>
!!
s
);
for
(
const
line
of
modules
)
{
for
(
const
line
of
modules
)
{
const
[,
name
,
path
]
=
line
.
split
(
/submodule
\.(
.+
?)\.
path
\s(
.+
)
/
);
const
[,
name
,
path
]
=
line
.
split
(
/submodule
\.(
.+
?)\.
path
\s(
.+
)
/
);
res
.
push
({
name
,
path
});
res
.
push
({
name
,
path
});
}
}
catch
(
err
)
/* istanbul ignore next */
{
logger
.
warn
({
err
},
'
Error getting git submodules during extract
'
);
}
}
return
res
;
return
res
;
}
}
...
@@ -89,21 +92,31 @@ export default async function extractPackageFile(
...
@@ -89,21 +92,31 @@ export default async function extractPackageFile(
return
null
;
return
null
;
}
}
const
deps
=
await
Promise
.
all
(
const
deps
=
(
depNames
.
map
(
async
({
name
,
path
})
=>
{
await
Promise
.
all
(
const
[
currentValue
]
=
(
await
git
.
subModule
([
'
status
'
,
path
]))
depNames
.
map
(
async
({
name
,
path
})
=>
{
.
trim
()
try
{
.
split
(
/
[
+
\s]
/
);
const
[
currentValue
]
=
(
await
git
.
subModule
([
'
status
'
,
path
]))
const
submoduleBranch
=
await
getBranch
(
gitModulesPath
,
name
);
.
trim
()
const
subModuleUrl
=
await
getUrl
(
git
,
gitModulesPath
,
name
);
.
split
(
/
[
+
\s]
/
);
return
{
const
submoduleBranch
=
await
getBranch
(
gitModulesPath
,
name
);
depName
:
path
,
const
subModuleUrl
=
await
getUrl
(
git
,
gitModulesPath
,
name
);
registryUrls
:
[
subModuleUrl
,
submoduleBranch
],
return
{
currentValue
,
depName
:
path
,
currentDigest
:
currentValue
,
registryUrls
:
[
subModuleUrl
,
submoduleBranch
],
};
currentValue
,
})
currentDigest
:
currentValue
,
);
};
}
catch
(
err
)
/* istanbul ignore next */
{
logger
.
warn
(
{
err
},
'
Error mapping git submodules during extraction
'
);
return
null
;
}
})
)
).
filter
(
Boolean
);
return
{
deps
,
datasource
:
datasourceGitSubmodules
.
id
};
return
{
deps
,
datasource
:
datasourceGitSubmodules
.
id
};
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment