mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-06 21:53:29 +00:00
Adding new tests for new status command
This is a work in progress. This adds two new sets of tests, the issue_592 tests from @nulltoken's pull request #601 and some new tests for submodules. The submodule tests still have issues where the status is not reported correctly. That needs to be fixed before merge.
This commit is contained in:
parent
a48ea31d69
commit
95340398a1
@ -32,7 +32,6 @@ GIT_BEGIN_DECL
|
||||
#define GIT_STATUS_WT_DELETED (1 << 5)
|
||||
|
||||
#define GIT_STATUS_IGNORED (1 << 6)
|
||||
#define GIT_STATUS_WT_UNTRACKED (1 << 7)
|
||||
|
||||
/**
|
||||
* Gather file statuses and run a callback for each one.
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "fileops.h"
|
||||
#include "ignore.h"
|
||||
#include "status_data.h"
|
||||
|
||||
#include "posix.h"
|
||||
|
||||
/**
|
||||
* Auxiliary methods
|
||||
@ -43,7 +43,6 @@ cb_status__count(const char *p, unsigned int s, void *payload)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*
|
||||
@ -133,3 +132,87 @@ void test_status_worktree__ignores(void)
|
||||
);
|
||||
cl_assert(ignored);
|
||||
}
|
||||
|
||||
static int cb_status__check_592(const char *p, unsigned int s, void *payload)
|
||||
{
|
||||
GIT_UNUSED(payload);
|
||||
|
||||
if (s != GIT_STATUS_WT_DELETED || (payload != NULL && strcmp(p, (const char *)payload) != 0))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void test_status_worktree__issue_592(void)
|
||||
{
|
||||
git_repository *repo;
|
||||
git_buf path = GIT_BUF_INIT;
|
||||
|
||||
repo = cl_git_sandbox_init("issue_592");
|
||||
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "l.txt"));
|
||||
cl_git_pass(p_unlink(git_buf_cstr(&path)));
|
||||
|
||||
cl_git_pass(git_status_foreach(repo, cb_status__check_592, "l.txt"));
|
||||
|
||||
git_buf_free(&path);
|
||||
}
|
||||
|
||||
void test_status_worktree__issue_592_2(void)
|
||||
{
|
||||
git_repository *repo;
|
||||
git_buf path = GIT_BUF_INIT;
|
||||
|
||||
repo = cl_git_sandbox_init("issue_592");
|
||||
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "c/a.txt"));
|
||||
cl_git_pass(p_unlink(git_buf_cstr(&path)));
|
||||
|
||||
cl_git_pass(git_status_foreach(repo, cb_status__check_592, "c/a.txt"));
|
||||
|
||||
git_buf_free(&path);
|
||||
}
|
||||
|
||||
void test_status_worktree__issue_592_3(void)
|
||||
{
|
||||
git_repository *repo;
|
||||
git_buf path = GIT_BUF_INIT;
|
||||
|
||||
repo = cl_git_sandbox_init("issue_592");
|
||||
|
||||
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "c"));
|
||||
cl_git_pass(git_futils_rmdir_r(git_buf_cstr(&path), 1));
|
||||
|
||||
cl_git_pass(git_status_foreach(repo, cb_status__check_592, "c/a.txt"));
|
||||
|
||||
git_buf_free(&path);
|
||||
}
|
||||
|
||||
void test_status_worktree__issue_592_4(void)
|
||||
{
|
||||
git_repository *repo;
|
||||
git_buf path = GIT_BUF_INIT;
|
||||
|
||||
repo = cl_git_sandbox_init("issue_592");
|
||||
|
||||
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "t/b.txt"));
|
||||
cl_git_pass(p_unlink(git_buf_cstr(&path)));
|
||||
|
||||
cl_git_pass(git_status_foreach(repo, cb_status__check_592, "t/b.txt"));
|
||||
|
||||
git_buf_free(&path);
|
||||
}
|
||||
|
||||
void test_status_worktree__issue_592_5(void)
|
||||
{
|
||||
git_repository *repo;
|
||||
git_buf path = GIT_BUF_INIT;
|
||||
|
||||
repo = cl_git_sandbox_init("issue_592");
|
||||
|
||||
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "t"));
|
||||
cl_git_pass(git_futils_rmdir_r(git_buf_cstr(&path), 1));
|
||||
cl_git_pass(p_mkdir(git_buf_cstr(&path), 0777));
|
||||
|
||||
cl_git_pass(git_status_foreach(repo, cb_status__check_592, NULL));
|
||||
|
||||
git_buf_free(&path);
|
||||
}
|
||||
|
BIN
tests/resources/issue_592/.gitted/COMMIT_EDITMSG
Normal file
BIN
tests/resources/issue_592/.gitted/COMMIT_EDITMSG
Normal file
Binary file not shown.
BIN
tests/resources/issue_592/.gitted/HEAD
Normal file
BIN
tests/resources/issue_592/.gitted/HEAD
Normal file
Binary file not shown.
BIN
tests/resources/issue_592/.gitted/config
Normal file
BIN
tests/resources/issue_592/.gitted/config
Normal file
Binary file not shown.
BIN
tests/resources/issue_592/.gitted/index
Normal file
BIN
tests/resources/issue_592/.gitted/index
Normal file
Binary file not shown.
BIN
tests/resources/issue_592/.gitted/info/exclude
Normal file
BIN
tests/resources/issue_592/.gitted/info/exclude
Normal file
Binary file not shown.
BIN
tests/resources/issue_592/.gitted/logs/HEAD
Normal file
BIN
tests/resources/issue_592/.gitted/logs/HEAD
Normal file
Binary file not shown.
BIN
tests/resources/issue_592/.gitted/logs/refs/heads/master
Normal file
BIN
tests/resources/issue_592/.gitted/logs/refs/heads/master
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/resources/issue_592/.gitted/refs/heads/master
Normal file
BIN
tests/resources/issue_592/.gitted/refs/heads/master
Normal file
Binary file not shown.
BIN
tests/resources/issue_592/a.txt
Normal file
BIN
tests/resources/issue_592/a.txt
Normal file
Binary file not shown.
BIN
tests/resources/issue_592/c/a.txt
Normal file
BIN
tests/resources/issue_592/c/a.txt
Normal file
Binary file not shown.
BIN
tests/resources/issue_592/l.txt
Normal file
BIN
tests/resources/issue_592/l.txt
Normal file
Binary file not shown.
BIN
tests/resources/issue_592/t/a.txt
Normal file
BIN
tests/resources/issue_592/t/a.txt
Normal file
Binary file not shown.
BIN
tests/resources/issue_592/t/b.txt
Normal file
BIN
tests/resources/issue_592/t/b.txt
Normal file
Binary file not shown.
BIN
tests/resources/submodules/.gitted/HEAD
Normal file
BIN
tests/resources/submodules/.gitted/HEAD
Normal file
Binary file not shown.
BIN
tests/resources/submodules/.gitted/config
Normal file
BIN
tests/resources/submodules/.gitted/config
Normal file
Binary file not shown.
BIN
tests/resources/submodules/.gitted/description
Normal file
BIN
tests/resources/submodules/.gitted/description
Normal file
Binary file not shown.
BIN
tests/resources/submodules/.gitted/index
Normal file
BIN
tests/resources/submodules/.gitted/index
Normal file
Binary file not shown.
BIN
tests/resources/submodules/.gitted/info/exclude
Normal file
BIN
tests/resources/submodules/.gitted/info/exclude
Normal file
Binary file not shown.
BIN
tests/resources/submodules/.gitted/info/refs
Normal file
BIN
tests/resources/submodules/.gitted/info/refs
Normal file
Binary file not shown.
BIN
tests/resources/submodules/.gitted/logs/HEAD
Normal file
BIN
tests/resources/submodules/.gitted/logs/HEAD
Normal file
Binary file not shown.
BIN
tests/resources/submodules/.gitted/logs/refs/heads/master
Normal file
BIN
tests/resources/submodules/.gitted/logs/refs/heads/master
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/resources/submodules/.gitted/objects/info/packs
Normal file
BIN
tests/resources/submodules/.gitted/objects/info/packs
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/resources/submodules/.gitted/packed-refs
Normal file
BIN
tests/resources/submodules/.gitted/packed-refs
Normal file
Binary file not shown.
BIN
tests/resources/submodules/added
Normal file
BIN
tests/resources/submodules/added
Normal file
Binary file not shown.
BIN
tests/resources/submodules/gitmodules
Normal file
BIN
tests/resources/submodules/gitmodules
Normal file
Binary file not shown.
BIN
tests/resources/submodules/ignored
Normal file
BIN
tests/resources/submodules/ignored
Normal file
Binary file not shown.
BIN
tests/resources/submodules/modified
Normal file
BIN
tests/resources/submodules/modified
Normal file
Binary file not shown.
BIN
tests/resources/submodules/testrepo/.gitted/HEAD
Normal file
BIN
tests/resources/submodules/testrepo/.gitted/HEAD
Normal file
Binary file not shown.
BIN
tests/resources/submodules/testrepo/.gitted/config
Normal file
BIN
tests/resources/submodules/testrepo/.gitted/config
Normal file
Binary file not shown.
BIN
tests/resources/submodules/testrepo/.gitted/description
Normal file
BIN
tests/resources/submodules/testrepo/.gitted/description
Normal file
Binary file not shown.
BIN
tests/resources/submodules/testrepo/.gitted/index
Normal file
BIN
tests/resources/submodules/testrepo/.gitted/index
Normal file
Binary file not shown.
BIN
tests/resources/submodules/testrepo/.gitted/info/exclude
Normal file
BIN
tests/resources/submodules/testrepo/.gitted/info/exclude
Normal file
Binary file not shown.
BIN
tests/resources/submodules/testrepo/.gitted/logs/HEAD
Normal file
BIN
tests/resources/submodules/testrepo/.gitted/logs/HEAD
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/resources/submodules/testrepo/.gitted/packed-refs
Normal file
BIN
tests/resources/submodules/testrepo/.gitted/packed-refs
Normal file
Binary file not shown.
BIN
tests/resources/submodules/testrepo/.gitted/refs/heads/master
Normal file
BIN
tests/resources/submodules/testrepo/.gitted/refs/heads/master
Normal file
Binary file not shown.
Binary file not shown.
BIN
tests/resources/submodules/testrepo/README
Normal file
BIN
tests/resources/submodules/testrepo/README
Normal file
Binary file not shown.
BIN
tests/resources/submodules/testrepo/branch_file.txt
Normal file
BIN
tests/resources/submodules/testrepo/branch_file.txt
Normal file
Binary file not shown.
BIN
tests/resources/submodules/testrepo/new.txt
Normal file
BIN
tests/resources/submodules/testrepo/new.txt
Normal file
Binary file not shown.
BIN
tests/resources/submodules/unmodified
Normal file
BIN
tests/resources/submodules/unmodified
Normal file
Binary file not shown.
BIN
tests/resources/submodules/untracked
Normal file
BIN
tests/resources/submodules/untracked
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user