summaryrefslogtreecommitdiff
path: root/src/status.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-04-29 15:05:58 -0700
committerRussell Belfer <rb@github.com>2014-05-02 09:21:33 -0700
commit9c8ed4999740e921ecc2966bbcd0dbcfc725f59a (patch)
treecf801e2026c9fca6b4e28bfc2c35e981d9ccea6e /src/status.c
parent7a2e56a3f6115c3a145e4f73d0aa8bea6dded899 (diff)
downloadlibgit2-9c8ed4999740e921ecc2966bbcd0dbcfc725f59a.tar.gz
Remove trace / add git_diff_perfdata struct + api
Diffstat (limited to 'src/status.c')
-rw-r--r--src/status.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/status.c b/src/status.c
index e418cf7b6..aab838bcf 100644
--- a/src/status.c
+++ b/src/status.c
@@ -518,14 +518,38 @@ int git_status_should_ignore(
return git_ignore_path_is_ignored(ignored, repo, path);
}
-int git_status_init_options(git_status_options* opts, int version)
+int git_status_init_options(git_status_options* opts, unsigned int version)
{
- if (version != GIT_STATUS_OPTIONS_VERSION) {
+ git_status_options o = GIT_STATUS_OPTIONS_INIT;
+ if (version != o.version) {
giterr_set(GITERR_INVALID, "Invalid version %d for git_status_options", version);
return -1;
- } else {
- git_status_options o = GIT_STATUS_OPTIONS_INIT;
- memcpy(opts, &o, sizeof(o));
- return 0;
}
+ memcpy(opts, &o, sizeof(o));
+ return 0;
+}
+
+int git_status_list_get_perfdata(
+ git_diff_perfdata *out, const git_status_list *status)
+{
+ if (!out || out->version != GIT_DIFF_PERFDATA_VERSION) {
+ giterr_set(GITERR_INVALID, "Invalid version %d for git_diff_perfdata",
+ out ? out->version : 0);
+ return -1;
+ }
+
+ out->stat_calls = 0;
+ out->oid_calculations = 0;
+
+ if (status->head2idx) {
+ out->stat_calls += status->head2idx->perf.stat_calls;
+ out->oid_calculations += status->head2idx->perf.oid_calculations;
+ }
+ if (status->idx2wd) {
+ out->stat_calls += status->idx2wd->perf.stat_calls;
+ out->oid_calculations += status->idx2wd->perf.oid_calculations;
+ }
+
+ return 0;
}
+