Skip to content

Commit e102daa

Browse files
author
Edward Thomson
committed
Merge pull request libgit2#3798 from mmuman/stat-test-fix
test: Fix stat() test to mask out unwanted bits
2 parents 06f42b6 + 407f2e9 commit e102daa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/checkout/index.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,12 @@ void test_checkout_index__options_dir_modes(void)
294294
(void)p_umask(um = p_umask(022));
295295

296296
cl_git_pass(p_stat("./testrepo/a", &st));
297-
cl_assert_equal_i_fmt(st.st_mode, (GIT_FILEMODE_TREE | 0701) & ~um, "%07o");
297+
/* Haiku & Hurd use other mode bits, so we must mask them out */
298+
cl_assert_equal_i_fmt(st.st_mode & (S_IFMT | 07777), (GIT_FILEMODE_TREE | 0701) & ~um, "%07o");
298299

299300
/* File-mode test, since we're on the 'dir' branch */
300301
cl_git_pass(p_stat("./testrepo/a/b.txt", &st));
301-
cl_assert_equal_i_fmt(st.st_mode, GIT_FILEMODE_BLOB_EXECUTABLE & ~um, "%07o");
302+
cl_assert_equal_i_fmt(st.st_mode & (S_IFMT | 07777), GIT_FILEMODE_BLOB_EXECUTABLE & ~um, "%07o");
302303

303304
git_commit_free(commit);
304305
}

0 commit comments

Comments
 (0)