Permalink
Browse files

Cannot set workdir to a nonexistent dir

  • Loading branch information...
1 parent 64b402f commit 1de77cd31432a1bdff060181c6d9ec25a412a0c2 @arrbee arrbee committed Apr 11, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 tests-clar/repo/setters.c
@@ -1,18 +1,21 @@
#include "clar_libgit2.h"
#include "buffer.h"
+#include "posix.h"
static git_repository *repo;
void test_repo_setters__initialize(void)
{
cl_fixture_sandbox("testrepo.git");
cl_git_pass(git_repository_open(&repo, "testrepo.git"));
+ cl_must_pass(p_mkdir("new_workdir", 0777));
}
void test_repo_setters__cleanup(void)
{
git_repository_free(repo);
cl_fixture_cleanup("testrepo.git");
+ cl_must_pass(p_rmdir("new_workdir"));
}
void test_repo_setters__setting_a_workdir_turns_a_bare_repository_into_a_standard_one(void)

2 comments on commit 1de77cd

Member

nulltoken replied Apr 11, 2012

@arrbee In the original (less than optimal #622 :) ) proposal, there was a TODO stating "/* TODO: Should we check that the directory actually exists? */".

I wrote it because the tests were passing on Windows (and I was willing to add as little code as possible). However I wasn't able to figure a use case when a missing workdir would be valid.

If the tests fail on *nix (p_realpath?) maybe should we add a #ifdef GIT_WIN32 and ensure git_path_isdir() == true?

Member

nulltoken replied Apr 11, 2012

Or, maybe better, pushing down this test in the win32 posix implementation of p_realpath()?

Please sign in to comment.