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
6dfb983c
Commit
6dfb983c
authored
Mar 15, 2017
by
Edward Thomson
Committed by
GitHub
Mar 15, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4161 from pks-t/pks/submodule-index-fix
submodule: catch when submodule is not staged on update
parents
8051b47f
32ecc98e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
+9
-1
src/submodule.c
+9
-1
No files found.
src/submodule.c
View file @
6dfb983c
...
...
@@ -1212,6 +1212,8 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
(
error
=
git_checkout_head
(
sub_repo
,
&
update_options
.
checkout_opts
))
!=
0
)
goto
done
;
}
else
{
const
git_oid
*
oid
;
/**
* Work dir is initialized - look up the commit in the parent repository's index,
* update the workdir contents of the subrepository, and set the subrepository's
...
...
@@ -1220,8 +1222,14 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
if
((
error
=
git_submodule_open
(
&
sub_repo
,
sm
))
<
0
)
goto
done
;
if
((
oid
=
git_submodule_index_id
(
sm
))
==
NULL
)
{
giterr_set
(
GITERR_SUBMODULE
,
"could not get ID of submodule in index"
);
error
=
-
1
;
goto
done
;
}
/* Look up the target commit in the submodule. */
if
((
error
=
git_object_lookup
(
&
target_commit
,
sub_repo
,
git_submodule_index_id
(
sm
)
,
GIT_OBJ_COMMIT
))
<
0
)
{
if
((
error
=
git_object_lookup
(
&
target_commit
,
sub_repo
,
oid
,
GIT_OBJ_COMMIT
))
<
0
)
{
/* If it isn't found then fetch and try again. */
if
(
error
!=
GIT_ENOTFOUND
||
!
update_options
.
allow_fetch
||
(
error
=
lookup_default_remote
(
&
remote
,
sub_repo
))
<
0
||
...
...
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