Commit 64b402f8 by Vicent Martí

status: Remove status_old

This is Git yo. You can fetch stuff from the history if you need it.
parent e1f6f94a
......@@ -654,88 +654,6 @@ static int dirent_cb(void *state, git_buf *a)
}
}
static int status_cmp(const void *a, const void *b)
{
const struct status_entry *entry_a = (const struct status_entry *)(a);
const struct status_entry *entry_b = (const struct status_entry *)(b);
return strcmp(entry_a->path, entry_b->path);
}
#define DEFAULT_SIZE 16
int git_status_foreach_old(
git_repository *repo,
int (*callback)(const char *, unsigned int, void *),
void *payload)
{
git_vector entries;
git_ignores ignores;
git_index *index = NULL;
git_buf temp_path = GIT_BUF_INIT;
struct status_st dirent_st = {0};
int error = 0;
unsigned int i;
git_tree *tree;
struct status_entry *e;
const char *workdir;
assert(repo);
if ((workdir = git_repository_workdir(repo)) == NULL ||
!git_path_isdir(workdir))
{
giterr_set(GITERR_OS, "Cannot get status - invalid working directory");
return GIT_ENOTFOUND;
}
if ((error = git_repository_index__weakptr(&index, repo)) < 0 ||
(error = retrieve_head_tree(&tree, repo)) < 0)
return error;
if ((error = git_vector_init(&entries, DEFAULT_SIZE, status_cmp)) < 0)
goto exit;
dirent_st.repo = repo;
dirent_st.vector = &entries;
dirent_st.index = index;
dirent_st.tree = tree;
dirent_st.ignores = &ignores;
dirent_st.workdir_path_len = strlen(workdir);
git_buf_init(&dirent_st.head_tree_relative_path, 0);
dirent_st.head_tree_relative_path_len = 0;
dirent_st.tree_position = 0;
dirent_st.index_position = 0;
dirent_st.is_dir = 1;
git_buf_sets(&temp_path, workdir);
if ((error = git_ignore__for_path(repo, "", dirent_st.ignores)) < 0)
goto exit;
error = alphasorted_futils_direach(&temp_path, dirent_cb, &dirent_st);
if (!error)
error = dirent_cb(&dirent_st, NULL);
for (i = 0; i < entries.length; ++i) {
e = (struct status_entry *)git_vector_get(&entries, i);
if (!error)
error = callback(e->path, e->status_flags, payload);
git__free(e);
}
exit:
git_buf_free(&dirent_st.head_tree_relative_path);
git_buf_free(&temp_path);
git_vector_free(&entries);
git_ignore__free(&ignores);
git_tree_free(tree);
return error;
}
static int recurse_tree_entry(git_tree *tree, struct status_entry *e, const char *path)
{
char *dir_sep;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment