diff options
author | Russell Belfer <arrbee@arrbee.com> | 2012-03-19 16:10:11 -0700 |
---|---|---|
committer | Russell Belfer <arrbee@arrbee.com> | 2012-03-19 16:10:11 -0700 |
commit | 7c7ff7d11e2d22f7b9c7f8152f5c58dde37ac207 (patch) | |
tree | 838380af916490eb68e3004bc3ec10cc7ac8cf1f /src/iterator.c | |
parent | fd7714273cb9646d63f4da8d81450a0f9f9295f5 (diff) | |
download | libgit2-7c7ff7d11e2d22f7b9c7f8152f5c58dde37ac207.tar.gz |
Migrate index, oid, and utils to new errors
This includes a few cleanups that came up while converting
these files.
This commit introduces a could new git error classes, including
the catchall class: GITERR_INVALID which I'm using as the class
for invalid and out of range values which are detected at too low
a level of library to use a higher level classification. For
example, an overflow error in parsing an integer or a bad letter
in parsing an OID string would generate an error in this class.
Diffstat (limited to 'src/iterator.c')
-rw-r--r-- | src/iterator.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/iterator.c b/src/iterator.c index 5cc01ccbc..cc15b5f67 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -395,7 +395,6 @@ static void workdir_iterator__free(git_iterator *self) static int workdir_iterator__update_entry(workdir_iterator *wi) { - int error; git_path_with_stat *ps = git_vector_get(&wi->stack->entries, wi->stack->index); git_buf_truncate(&wi->path, wi->root_len); @@ -412,24 +411,18 @@ static int workdir_iterator__update_entry(workdir_iterator *wi) /* if there is an error processing the entry, treat as ignored */ wi->is_ignored = 1; - /* TODO: remove shared code for struct stat conversion with index.c */ - wi->entry.ctime.seconds = (git_time_t)ps->st.st_ctime; - wi->entry.mtime.seconds = (git_time_t)ps->st.st_mtime; - wi->entry.dev = ps->st.st_rdev; - wi->entry.ino = ps->st.st_ino; + git_index__init_entry_from_stat(&ps->st, &wi->entry); + + /* need different mode here to keep directories during iteration */ wi->entry.mode = git_futils_canonical_mode(ps->st.st_mode); - wi->entry.uid = ps->st.st_uid; - wi->entry.gid = ps->st.st_gid; - wi->entry.file_size = ps->st.st_size; /* if this is a file type we don't handle, treat as ignored */ if (wi->entry.mode == 0) return 0; /* okay, we are far enough along to look up real ignore rule */ - error = git_ignore__lookup(&wi->ignores, wi->entry.path, &wi->is_ignored); - if (error < 0) - return 0; + if (git_ignore__lookup(&wi->ignores, wi->entry.path, &wi->is_ignored) < 0) + return 0; /* if error, ignore it and ignore file */ /* detect submodules */ if (S_ISDIR(wi->entry.mode) && |