#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "status_helpers.h"
#include "../submodule/submodule_helpers.h"
g_repo = setup_fixture_submodules();
- cl_assert(git_path_isdir("submodules/.git"));
- cl_assert(git_path_isdir("submodules/testrepo/.git"));
- cl_assert(git_path_isfile("submodules/.gitmodules"));
+ cl_assert(git_fs_path_isdir("submodules/.git"));
+ cl_assert(git_fs_path_isdir("submodules/testrepo/.git"));
+ cl_assert(git_fs_path_isfile("submodules/.gitmodules"));
cl_git_pass(
git_status_foreach(g_repo, cb_status__count, &counts)
int idx = counts->entry_count++;
clar__assert_equal(
- counts->file, counts->line,
+ counts->file, counts->func, counts->line,
"Status path mismatch", 1,
"%s", counts->expected_paths[idx], p);
clar__assert_equal(
- counts->file, counts->line,
+ counts->file, counts->func, counts->line,
"Status code mismatch", 1,
"%o", counts->expected_statuses[idx], s);
g_repo = setup_fixture_submodules();
- cl_assert(git_path_isdir("submodules/.git"));
- cl_assert(git_path_isdir("submodules/testrepo/.git"));
- cl_assert(git_path_isfile("submodules/.gitmodules"));
+ cl_assert(git_fs_path_isdir("submodules/.git"));
+ cl_assert(git_fs_path_isdir("submodules/testrepo/.git"));
+ cl_assert(git_fs_path_isfile("submodules/.gitmodules"));
status_counts_init(counts, expected_files, expected_status);
/* move submodule HEAD to c47800c7266a2be04c571c04d5a6614691ea99bd */
cl_git_pass(
git_oid_fromstr(&oid, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
- cl_git_pass(git_repository_set_head_detached(smrepo, &oid, NULL, NULL));
+ cl_git_pass(git_repository_set_head_detached(smrepo, &oid));
/* first do a normal status, which should now include the submodule */
cl_git_pass(git_signature_now(&sig, "Sloppy Submoduler", "sloppy@example.com"));
cl_git_pass(git_tree_lookup(&tree, repo, &tree_id));
cl_git_pass(git_commit_create(&commit_id, repo, NULL, sig, sig, NULL, "message", tree, 0, NULL));
- cl_git_pass(git_reference_create(&ref, repo, "refs/heads/master", &commit_id, 1, sig, "commit: foo"));
+ cl_git_pass(git_reference_create(&ref, repo, "refs/heads/master", &commit_id, 1, "commit: foo"));
git_reference_free(ref);
git_signature_free(sig);
}
git_tree_free(tree);
git_repository_free(repo);
}
+
+void test_status_submodules__mixed_case(void)
+{
+ git_status_list *status;
+ git_status_options status_opts = GIT_STATUS_OPTIONS_INIT;
+ const git_status_entry *s;
+ size_t i;
+
+ status_opts.flags =
+ GIT_STATUS_OPT_INCLUDE_UNTRACKED |
+ GIT_STATUS_OPT_INCLUDE_IGNORED |
+ GIT_STATUS_OPT_INCLUDE_UNMODIFIED |
+ GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS |
+ GIT_STATUS_OPT_RECURSE_IGNORED_DIRS |
+ GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX |
+ GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR |
+ GIT_STATUS_OPT_RENAMES_FROM_REWRITES |
+ GIT_STATUS_OPT_INCLUDE_UNREADABLE |
+ GIT_STATUS_OPT_INCLUDE_UNREADABLE_AS_UNTRACKED;
+
+ g_repo = setup_fixture_submod3();
+
+ cl_git_pass(git_status_list_new(&status, g_repo, &status_opts));
+
+ for (i = 0; i < git_status_list_entrycount(status); i++) {
+ s = git_status_byindex(status, i);
+
+ if (s->head_to_index &&
+ strcmp(s->head_to_index->old_file.path, ".gitmodules") == 0)
+ continue;
+
+ cl_assert_equal_i(0, s->status);
+ }
+
+ git_status_list_free(status);
+}
+