Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
eb94199f
Commit
eb94199f
authored
Jul 02, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3286 from libgit2/cmn/submodule-duplicate
Correctly delimit the keys for submodule lookup
parents
bf7d2761
e0af3cb3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletions
+24
-1
src/submodule.c
+1
-1
tests/submodule/lookup.c
+23
-0
No files found.
src/submodule.c
View file @
eb94199f
...
...
@@ -1385,7 +1385,7 @@ int git_submodule_reload(git_submodule *sm, int force)
git_buf_sets
(
&
path
,
"submodule
\\
."
);
git_buf_text_puts_escape_regex
(
&
path
,
sm
->
name
);
git_buf_puts
(
&
path
,
".*"
);
git_buf_puts
(
&
path
,
"
\\
.
.*"
);
if
(
git_buf_oom
(
&
path
))
{
error
=
-
1
;
...
...
tests/submodule/lookup.c
View file @
eb94199f
...
...
@@ -269,3 +269,26 @@ void test_submodule_lookup__just_added(void)
refute_submodule_exists
(
g_repo
,
"sm_just_added_head"
,
GIT_EEXISTS
);
}
/* Test_App and Test_App2 are fairly similar names, make sure we load the right one */
void
test_submodule_lookup__prefix_name
(
void
)
{
git_submodule
*
sm
;
cl_git_rewritefile
(
"submod2/.gitmodules"
,
"[submodule
\"
Test_App
\"
]
\n
"
" path = Test_App
\n
"
" url = ../Test_App
\n
"
"[submodule
\"
Test_App2
\"
]
\n
"
" path = Test_App2
\n
"
" url = ../Test_App
\n
"
);
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
g_repo
,
"Test_App"
));
cl_assert_equal_s
(
"Test_App"
,
git_submodule_name
(
sm
));
git_submodule_free
(
sm
);
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
g_repo
,
"Test_App2"
));
cl_assert_equal_s
(
"Test_App2"
,
git_submodule_name
(
sm
));
git_submodule_free
(
sm
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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