summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-12-20 16:16:22 -0800
committerRussell Belfer <rb@github.com>2013-01-04 15:47:43 -0800
commita9a730075eee70444db4ab4bbb928c29a812bbbf (patch)
treec6b0794dfca3557330e202ad95e9bea425a081a9 /include/git2
parent6f58332f3ab04f910103b945348b6a0a314c1793 (diff)
downloadlibgit2-a9a730075eee70444db4ab4bbb928c29a812bbbf.tar.gz
Submodule caching fix and location API
This adds a new API to the submodule interface that just returns where information about the submodule was found (e.g. config file only or in the HEAD, index, or working directory). Also, the old "refresh" call was potentially keeping some stale submodule data around, so this simplfies that code and literally discards the old cache, then reallocates.
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/submodule.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index 90e45cebd..444b3a967 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -504,6 +504,24 @@ GIT_EXTERN(int) git_submodule_status(
unsigned int *status,
git_submodule *submodule);
+/**
+ * Get the locations of submodule information.
+ *
+ * This is a bit like a very lightweight version of `git_submodule_status`.
+ * It just returns a made of the first four submodule status values (i.e.
+ * the ones like GIT_SUBMODULE_STATUS_IN_HEAD, etc) that tell you where the
+ * submodule data comes from (i.e. the HEAD commit, gitmodules file, etc.).
+ * This can be useful if you want to know if the submodule is present in the
+ * working directory at this point in time, etc.
+ *
+ * @param status Combination of first four `GIT_SUBMODULE_STATUS` flags
+ * @param submodule Submodule for which to get status
+ * @return 0 on success, <0 on error
+ */
+GIT_EXTERN(int) git_submodule_location(
+ unsigned int *location_status,
+ git_submodule *submodule);
+
/** @} */
GIT_END_DECL
#endif