diff options
author | Vicent Martà <tanoku@gmail.com> | 2012-04-11 19:19:12 +0200 |
---|---|---|
committer | Vicent Martà <tanoku@gmail.com> | 2012-04-11 19:19:12 +0200 |
commit | 64b402f8567d1a6c2ac206863d0f7e0fefb96ec4 (patch) | |
tree | 9d2a568c35ba19d9c1de4418dbc0b305d7301f8c | |
parent | e1f6f94a92408920b73b2ab6769ee758cbb87d13 (diff) | |
download | libgit2-64b402f8567d1a6c2ac206863d0f7e0fefb96ec4.tar.gz |
status: Remove status_old
This is Git yo. You can fetch stuff from the history if you need it.
-rw-r--r-- | src/status.c | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/src/status.c b/src/status.c index 7cd914f21..95e4588b7 100644 --- a/src/status.c +++ b/src/status.c @@ -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; |