Commit 763b8381 by Ben Straub

Fixing rev-parse-induced Travis errors.

parent 6c08e69f
...@@ -582,6 +582,11 @@ static int revparse_global_grep(git_object **out, git_repository *repo, const ch ...@@ -582,6 +582,11 @@ static int revparse_global_grep(git_object **out, git_repository *repo, const ch
git_revwalk *walk; git_revwalk *walk;
int retcode = GIT_ERROR; int retcode = GIT_ERROR;
if (!pattern[0]) {
giterr_set(GITERR_REGEX, "Empty pattern");
return GIT_ERROR;
}
if (!git_revwalk_new(&walk, repo)) { if (!git_revwalk_new(&walk, repo)) {
regex_t preg; regex_t preg;
int reg_error; int reg_error;
......
...@@ -72,7 +72,7 @@ void test_refs_branches_listall__retrieve_remote_symbolic_HEAD_when_present(void ...@@ -72,7 +72,7 @@ void test_refs_branches_listall__retrieve_remote_symbolic_HEAD_when_present(void
cl_git_pass(git_branch_list(&branch_list, repo, GIT_BRANCH_REMOTE)); cl_git_pass(git_branch_list(&branch_list, repo, GIT_BRANCH_REMOTE));
cl_assert_equal_i(2, branch_list.count); cl_assert_equal_i(3, branch_list.count);
assert_branch_list_contains(&branch_list, "refs/remotes/nulltoken/HEAD"); assert_branch_list_contains(&branch_list, "refs/remotes/nulltoken/HEAD");
assert_branch_list_contains(&branch_list, "refs/remotes/nulltoken/master"); assert_branch_list_contains(&branch_list, "refs/remotes/nulltoken/master");
} }
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
static git_repository *g_repo; static git_repository *g_repo;
static git_object *g_obj; static git_object *g_obj;
static char g_orig_tz[16] = {0};
...@@ -23,6 +24,10 @@ static void test_object(const char *spec, const char *expected_oid) ...@@ -23,6 +24,10 @@ static void test_object(const char *spec, const char *expected_oid)
void test_refs_revparse__initialize(void) void test_refs_revparse__initialize(void)
{ {
char *tz = getenv("TZ");
if (tz)
strcpy(g_orig_tz, tz);
setenv("TZ", "UTC", 1);
g_repo = cl_git_sandbox_init("testrepo.git"); g_repo = cl_git_sandbox_init("testrepo.git");
} }
...@@ -30,6 +35,7 @@ void test_refs_revparse__cleanup(void) ...@@ -30,6 +35,7 @@ void test_refs_revparse__cleanup(void)
{ {
cl_git_sandbox_cleanup(); cl_git_sandbox_cleanup();
g_obj = NULL; g_obj = NULL;
setenv("TZ", g_orig_tz, 1);
} }
...@@ -145,10 +151,8 @@ void test_refs_revparse__date(void) ...@@ -145,10 +151,8 @@ void test_refs_revparse__date(void)
test_object("HEAD@{10 years ago}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"); test_object("HEAD@{10 years ago}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
test_object("HEAD@{1 second}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); test_object("HEAD@{1 second}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
test_object("master@{2012-4-30 10:23:20 -0800}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"); test_object("master@{2012-4-30 10:23:20 -0800}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
test_object("master@{2012-4-30 10:24 -0800}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); test_object("master@{2012-4-30 18:24 -0800}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
test_object("master@{2012-4-30 16:24 -0200}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); test_object("master@{2012-4-30 23:24 -0300}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
test_object("master@{1335806600}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
test_object("master@{1335816640}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
/* Core git gives a65fedf, because they don't take time zones into account. */ /* Core git gives a65fedf, because they don't take time zones into account. */
test_object("master@{1335806640}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"); test_object("master@{1335806640}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment