]> git.proxmox.com Git - libgit2.git/commitdiff
examples: adjust to submodule status API change
authorCarlos Martín Nieto <cmn@dwim.me>
Sat, 9 May 2015 08:42:00 +0000 (10:42 +0200)
committerCarlos Martín Nieto <cmn@dwim.me>
Mon, 22 Jun 2015 15:02:55 +0000 (17:02 +0200)
examples/status.c

index 62cb5b24f0373520a8fb1f73707d70df6f55bc8a..8e242dd398bf04146b7449d004bd35b85e3eb1ef 100644 (file)
@@ -384,25 +384,19 @@ static void print_short(git_repository *repo, git_status_list *status)
                if (s->index_to_workdir &&
                        s->index_to_workdir->new_file.mode == GIT_FILEMODE_COMMIT)
                {
-                       git_submodule *sm = NULL;
                        unsigned int smstatus = 0;
 
-                       if (!git_submodule_lookup(
-                                       &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)";
-                               }
+                       if (!git_submodule_status(&smstatus, repo, s->index_to_workdir->new_file.path,
+                                                 GIT_SUBMODULE_IGNORE_FALLBACK)) {
+                               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);
                }
 
                /**