@@ -65,14 +65,16 @@ void test_win32_longpath__workdir_path_validated(void)
6565}
6666
6767#ifdef GIT_WIN32
68- static void assert_longpath_status_and_add (git_repository * repo ) {
68+ static void assert_longpath_status_and_add (git_repository * repo , const char * wddata , const char * repodata ) {
6969 git_index * index ;
70+ git_blob * blob ;
7071 git_buf out = GIT_BUF_INIT ;
72+ const git_index_entry * entry ;
7173 unsigned int status_flags ;
7274
7375 cl_git_pass (git_repository_workdir_path (& out , repo , LONG_FILENAME ));
7476
75- cl_git_rewritefile (out .ptr , "This is a long path.\r\n" );
77+ cl_git_rewritefile (out .ptr , wddata );
7678
7779 cl_git_pass (git_status_file (& status_flags , repo , LONG_FILENAME ));
7880 cl_assert_equal_i (GIT_STATUS_WT_NEW , status_flags );
@@ -83,6 +85,11 @@ static void assert_longpath_status_and_add(git_repository* repo) {
8385 cl_git_pass (git_status_file (& status_flags , repo , LONG_FILENAME ));
8486 cl_assert_equal_i (GIT_STATUS_INDEX_NEW , status_flags );
8587
88+ cl_assert ((entry = git_index_get_bypath (index , LONG_FILENAME , 0 )) != NULL );
89+ cl_git_pass (git_blob_lookup (& blob , repo , & entry -> id ));
90+ cl_assert_equal_s (repodata , git_blob_rawcontent (blob ));
91+
92+ git_blob_free (blob );
8693 git_index_free (index );
8794 git_buf_dispose (& out );
8895}
@@ -95,7 +102,13 @@ void test_win32_longpath__status_and_add(void)
95102
96103 cl_repo_set_bool (repo , "core.longpaths" , true);
97104
98- assert_longpath_status_and_add (repo );
105+ /*
106+ * Doing no content filtering, we expect the data we add
107+ * to be the data in the repository.
108+ */
109+ assert_longpath_status_and_add (repo ,
110+ "This is a long path.\r\n" ,
111+ "This is a long path.\r\n" );
99112#endif
100113}
101114
@@ -107,6 +120,12 @@ void test_win32_longpath__status_and_add_with_filter(void)
107120 cl_repo_set_bool (repo , "core.longpaths" , true);
108121 cl_repo_set_bool (repo , "core.autocrlf" , true);
109122
110- assert_longpath_status_and_add (repo );
123+ /*
124+ * With `core.autocrlf`, we expect the data we add to have
125+ * newline conversion performed.
126+ */
127+ assert_longpath_status_and_add (repo ,
128+ "This is a long path.\r\n" ,
129+ "This is a long path.\n" );
111130#endif
112131}
0 commit comments