summaryrefslogtreecommitdiff
path: root/src/status.c
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-02-01 17:35:11 +0100
committerVicent Martí <tanoku@gmail.com>2012-02-01 17:35:11 +0100
commitbf0107d1ece702d67e13f4e7e5063fbcabf6c040 (patch)
treebf6a32694a2950b046bc896e8524a068b3b98668 /src/status.c
parent771cde43181d0ba2fffdc9f533f5ef572b1482ee (diff)
parente4eb94a2559ca669412d318112a200ead1222466 (diff)
downloadlibgit2-bf0107d1ece702d67e13f4e7e5063fbcabf6c040.tar.gz
Merge remote-tracking branch 'arrbee/status-bugs' into development
Diffstat (limited to 'src/status.c')
-rw-r--r--src/status.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/status.c b/src/status.c
index 492edf568..d10491c24 100644
--- a/src/status.c
+++ b/src/status.c
@@ -124,7 +124,7 @@ static int status_entry_is_ignorable(struct status_entry *e)
return (e->status_flags == GIT_STATUS_WT_NEW);
}
-static int status_entry_update_ignore(struct status_entry *e, git_vector *ignores, const char *path)
+static int status_entry_update_ignore(struct status_entry *e, git_ignores *ignores, const char *path)
{
int error, ignored;
@@ -141,7 +141,7 @@ struct status_st {
git_vector *vector;
git_index *index;
git_tree *tree;
- git_vector *ignores;
+ git_ignores *ignores;
int workdir_path_len;
git_buf head_tree_relative_path;
@@ -233,7 +233,7 @@ static int process_folder(
if (full_path != NULL && path_type == GIT_STATUS_PATH_FOLDER) {
- git_vector ignores = GIT_VECTOR_INIT, *old_ignores;
+ git_ignores ignores, *old_ignores;
if ((error = git_ignore__for_path(st->repo,
full_path->ptr + st->workdir_path_len, &ignores)) == GIT_SUCCESS)
@@ -321,8 +321,18 @@ static int determine_status(
}
/* Last option, we're dealing with a leftover folder tree entry */
- assert(in_head && !in_index && !in_workdir && (tree_entry_type == GIT_OBJ_TREE));
- return process_folder(st, tree_entry, full_path, path_type);
+ if (tree_entry_type == GIT_OBJ_TREE) {
+ assert(in_head && !in_index && !in_workdir);
+ return process_folder(st, tree_entry, full_path, path_type);
+ }
+ else {
+ /* skip anything else we found (such as a submodule) */
+ if (in_head)
+ st->tree_position++;
+ if (in_index)
+ st->index_position++;
+ return GIT_SUCCESS;
+ }
}
static int path_type_from(git_buf *full_path, int is_dir)
@@ -451,7 +461,8 @@ int git_status_foreach(
int (*callback)(const char *, unsigned int, void *),
void *payload)
{
- git_vector entries, ignores = GIT_VECTOR_INIT;
+ git_vector entries;
+ git_ignores ignores;
git_index *index = NULL;
git_buf temp_path = GIT_BUF_INIT;
struct status_st dirent_st = {0};
@@ -533,7 +544,7 @@ exit:
git_buf_free(&dirent_st.head_tree_relative_path);
git_buf_free(&temp_path);
git_vector_free(&entries);
- git_vector_free(&ignores);
+ git_ignore__free(&ignores);
git_tree_free(tree);
return error;
}
@@ -651,7 +662,7 @@ int git_status_file(unsigned int *status_flags, git_repository *repo, const char
}
if (status_entry_is_ignorable(e)) {
- git_vector ignores = GIT_VECTOR_INIT;
+ git_ignores ignores;
if ((error = git_ignore__for_path(repo, path, &ignores)) == GIT_SUCCESS)
error = status_entry_update_ignore(e, &ignores, path);
@@ -766,7 +777,7 @@ static int alphasorted_futils_direach(
int git_status_should_ignore(git_repository *repo, const char *path, int *ignored)
{
int error;
- git_vector ignores = GIT_VECTOR_INIT;
+ git_ignores ignores;
if ((error = git_ignore__for_path(repo, path, &ignores)) == GIT_SUCCESS)
error = git_ignore__lookup(&ignores, path, ignored);