diff options
author | Russell Belfer <rb@github.com> | 2014-03-25 20:14:48 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-03-25 20:14:48 +0400 |
commit | a15c7802c86cf995fa658ef0624c46d352ce9a81 (patch) | |
tree | 25bebc086059abc13e74a3a8b4e461c0cf06dc64 /examples | |
parent | f210cb5b1442f82e2f930909d8430f7cc6661c5f (diff) |
Make submodules externally refcounted
`git_submodule` objects were already refcounted internally in case
the submodule name was different from the path at which it was
stored. This makes that refcounting externally used as well, so
`git_submodule_lookup` and `git_submodule_add_setup` return an
object that requires a `git_submodule_free` when done.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/status.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/examples/status.c b/examples/status.c index 3adfe0d5d..feba77f84 100644 --- a/examples/status.c +++ b/examples/status.c @@ -363,18 +363,21 @@ static void print_short(git_repository *repo, git_status_list *status) unsigned int smstatus = 0; if (!git_submodule_lookup( - &sm, repo, s->index_to_workdir->new_file.path) && - !git_submodule_status(&smstatus, sm)) - { - if (smstatus & GIT_SUBMODULE_STATUS_WD_MODIFIED) - extra = " (new commits)"; - else if (smstatus & GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED) - extra = " (modified content)"; - else if (smstatus & GIT_SUBMODULE_STATUS_WD_WD_MODIFIED) - extra = " (modified content)"; - else if (smstatus & GIT_SUBMODULE_STATUS_WD_UNTRACKED) - extra = " (untracked content)"; + &sm, repo, s->index_to_workdir->new_file.path)) { + + if (!git_submodule_status(&smstatus, sm)) { + if (smstatus & GIT_SUBMODULE_STATUS_WD_MODIFIED) + extra = " (new commits)"; + else if (smstatus & GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED) + extra = " (modified content)"; + else if (smstatus & GIT_SUBMODULE_STATUS_WD_WD_MODIFIED) + extra = " (modified content)"; + else if (smstatus & GIT_SUBMODULE_STATUS_WD_UNTRACKED) + extra = " (untracked content)"; + } } + + git_submodule_free(sm); } /** |