Skip to content

Commit

Permalink
Merge pull request #3798 from mmuman/stat-test-fix
Browse files Browse the repository at this point in the history
test: Fix stat() test to mask out unwanted bits
  • Loading branch information
Edward Thomson committed May 26, 2016
2 parents 06f42b6 + 407f2e9 commit e102daa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/checkout/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,12 @@ void test_checkout_index__options_dir_modes(void)
(void)p_umask(um = p_umask(022));

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

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

git_commit_free(commit);
}
Expand Down

0 comments on commit e102daa

Please sign in to comment.