Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJason Penny <jasonpenny4@gmail.com>2011-07-09 08:08:52 +0400
committerVicent Marti <tanoku@gmail.com>2011-07-09 15:49:50 +0400
commit3b2a423c3fb9e434c427b819d3281ae9e277091d (patch)
tree4c2a88c1f85a5c804cd2bce80ccd6f636aecaca8 /tests
parent2b90cc26de1c6b71059a7fc43be32a3be7fb35b9 (diff)
status: nonexistent file with git_status_file()
Throws GIT_ENOTFOUND error if given a filename that is not in HEAD, index, nor the work tree.
Diffstat (limited to 'tests')
-rw-r--r--tests/t18-status.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/t18-status.c b/tests/t18-status.c
index dfd87b3ab..a20d97b8f 100644
--- a/tests/t18-status.c
+++ b/tests/t18-status.c
@@ -184,9 +184,30 @@ BEGIN_TEST(singlestatus0, "test retrieving status for single file")
git_futils_rmdir_r(TEMP_STATUS_FOLDER, 1);
END_TEST
+BEGIN_TEST(singlestatus1, "test retrieving status for nonexistent file")
+ char path_statusfiles[GIT_PATH_MAX];
+ char temp_path[GIT_PATH_MAX];
+ git_repository *repo;
+ unsigned int status_flags;
+ int error;
+
+ must_pass(copy_status_repo(path_statusfiles, temp_path));
+
+ must_pass(git_repository_open(&repo, temp_path));
+
+ // "nonexistent" does not exist in HEAD, Index or the worktree
+ error = git_status_file(&status_flags, repo, "nonexistent");
+ must_be_true(error == GIT_ENOTFOUND);
+
+ git_repository_free(repo);
+
+ git_futils_rmdir_r(TEMP_STATUS_FOLDER, 1);
+END_TEST
+
BEGIN_SUITE(status)
ADD_TEST(file0);
ADD_TEST(statuscb0);
ADD_TEST(singlestatus0);
+ ADD_TEST(singlestatus1);
END_SUITE