@@ -65,14 +65,16 @@ void test_win32_longpath__workdir_path_validated(void)
65
65
}
66
66
67
67
#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 ) {
69
69
git_index * index ;
70
+ git_blob * blob ;
70
71
git_buf out = GIT_BUF_INIT ;
72
+ const git_index_entry * entry ;
71
73
unsigned int status_flags ;
72
74
73
75
cl_git_pass (git_repository_workdir_path (& out , repo , LONG_FILENAME ));
74
76
75
- cl_git_rewritefile (out .ptr , "This is a long path.\r\n" );
77
+ cl_git_rewritefile (out .ptr , wddata );
76
78
77
79
cl_git_pass (git_status_file (& status_flags , repo , LONG_FILENAME ));
78
80
cl_assert_equal_i (GIT_STATUS_WT_NEW , status_flags );
@@ -83,6 +85,11 @@ static void assert_longpath_status_and_add(git_repository* repo) {
83
85
cl_git_pass (git_status_file (& status_flags , repo , LONG_FILENAME ));
84
86
cl_assert_equal_i (GIT_STATUS_INDEX_NEW , status_flags );
85
87
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 );
86
93
git_index_free (index );
87
94
git_buf_dispose (& out );
88
95
}
@@ -95,7 +102,13 @@ void test_win32_longpath__status_and_add(void)
95
102
96
103
cl_repo_set_bool (repo , "core.longpaths" , true);
97
104
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" );
99
112
#endif
100
113
}
101
114
@@ -107,6 +120,12 @@ void test_win32_longpath__status_and_add_with_filter(void)
107
120
cl_repo_set_bool (repo , "core.longpaths" , true);
108
121
cl_repo_set_bool (repo , "core.autocrlf" , true);
109
122
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" );
111
130
#endif
112
131
}
0 commit comments