File tree 3 files changed +30
-0
lines changed
3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,12 @@ int git_blob__create_from_paths(
185
185
(error = git_repository_odb (& odb , repo )) < 0 )
186
186
goto done ;
187
187
188
+ if (S_ISDIR (st .st_mode )) {
189
+ giterr_set (GITERR_ODB , "cannot create blob from '%s'; it is a directory" , content_path );
190
+ error = GIT_EDIRECTORY ;
191
+ goto done ;
192
+ }
193
+
188
194
if (out_st )
189
195
memcpy (out_st , & st , sizeof (st ));
190
196
Original file line number Diff line number Diff line change
1
+ #include "clar_libgit2.h"
2
+ #include "repository.h"
3
+ #include "../submodule/submodule_helpers.h"
4
+
5
+ static git_repository * g_repo ;
6
+ static git_index * g_idx ;
7
+
8
+ void test_index_bypath__initialize (void )
9
+ {
10
+ g_repo = setup_fixture_submod2 ();
11
+ cl_git_pass (git_repository_index__weakptr (& g_idx , g_repo ));
12
+ }
13
+
14
+ void test_index_bypath__cleanup (void )
15
+ {
16
+ g_repo = NULL ;
17
+ g_idx = NULL ;
18
+ }
19
+
20
+ void test_index_bypath__add_directory (void )
21
+ {
22
+ cl_git_fail_with (GIT_EDIRECTORY , git_index_add_bypath (g_idx , "just_a_dir" ));
23
+ }
Original file line number Diff line number Diff line change 4
4
#include "submodule_helpers.h"
5
5
#include "config/config_helpers.h"
6
6
#include "fileops.h"
7
+ #include "repository.h"
7
8
8
9
static git_repository * g_repo = NULL ;
9
10
You can’t perform that action at this time.
0 commit comments