diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2015-05-04 17:09:21 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-22 17:02:55 +0200 |
| commit | 64bbd47a32e6aaed539bafd109eef624f24fbae7 (patch) | |
| tree | 041d8dedeb30610522d413e424abd2ea6c4d17c3 /src/submodule.c | |
| parent | 5a9fc6c83c2fd12ce312d1042ec2c1e6abad4033 (diff) | |
| download | libgit2-64bbd47a32e6aaed539bafd109eef624f24fbae7.tar.gz | |
submodule: don't let status change an existing instance
As submodules are becomes more like values, we should not let a status
check to update its properties. Instead of taking a submodule, have
status take a repo and submodule name.
Diffstat (limited to 'src/submodule.c')
| -rw-r--r-- | src/submodule.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/submodule.c b/src/submodule.c index 78bf5198c..2faaa734d 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -1067,7 +1067,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio memcpy(&clone_options.fetch_opts, &update_options.fetch_opts, sizeof(git_fetch_options)); /* Get the status of the submodule to determine if it is already initialized */ - if ((error = git_submodule_status(&submodule_status, sm)) < 0) + if ((error = git_submodule_status(&submodule_status, sm->repo, sm->name)) < 0) goto done; /* @@ -1511,11 +1511,20 @@ int git_submodule__status( return 0; } -int git_submodule_status(unsigned int *status, git_submodule *sm) +int git_submodule_status(unsigned int *status, git_repository *repo, const char *name) { - assert(status && sm); + git_submodule *sm; + int error; + + assert(status && repo && name); + + if ((error = git_submodule_lookup(&sm, repo, name)) < 0) + return error; + + error = git_submodule__status(status, NULL, NULL, NULL, sm, 0); + git_submodule_free(sm); - return git_submodule__status(status, NULL, NULL, NULL, sm, 0); + return error; } int git_submodule_location(unsigned int *location, git_submodule *sm) |
