Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
221aaf95
Commit
221aaf95
authored
Aug 16, 2022
by
Waqar Ahmed
Browse files
Git: Fix matching submodule path setting
parent
e460a8cb
Pipeline
#218715
passed with stage
in 5 minutes and 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
addons/project/gitwidget.cpp
View file @
221aaf95
...
...
@@ -403,6 +403,10 @@ void GitWidget::setSubmodulesPaths()
p
.
append
(
QLatin1Char
(
'/'
));
}
}
// Sort by size so that we can early out on matching paths later.
std
::
sort
(
m_submodulePaths
.
begin
(),
m_submodulePaths
.
end
(),
[](
const
QString
&
l
,
const
QString
&
r
)
{
return
l
.
size
()
>
r
.
size
();
});
setActiveGitDir
();
}
git
->
deleteLater
();
...
...
@@ -423,14 +427,11 @@ void GitWidget::setActiveGitDir()
int
idx
=
0
;
int
activeSubmoduleIdx
=
-
1
;
int
maxMatchLen
=
0
;
QString
path
=
av
->
document
()
->
url
().
toLocalFile
();
for
(
const
auto
&
submodulePath
:
m_submodulePaths
)
{
if
(
path
.
indexOf
(
submodulePath
)
!=
-
1
)
{
if
(
path
.
size
()
>
maxMatchLen
)
{
maxMatchLen
=
path
.
size
();
activeSubmoduleIdx
=
idx
;
}
const
QString
path
=
av
->
document
()
->
url
().
toLocalFile
();
for
(
const
auto
&
submodulePath
:
std
::
as_const
(
m_submodulePaths
))
{
if
(
path
.
startsWith
(
submodulePath
))
{
activeSubmoduleIdx
=
idx
;
break
;
}
idx
++
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment