@@ -63,7 +63,7 @@ int update_path_in_gitmodules(const char *oldpath, const char *newpath)
63
63
struct strbuf entry = STRBUF_INIT ;
64
64
const struct submodule * submodule ;
65
65
66
- if (!file_exists (".gitmodules" )) /* Do nothing without .gitmodules */
66
+ if (!file_exists (GITMODULES_FILE )) /* Do nothing without .gitmodules */
67
67
return -1 ;
68
68
69
69
if (gitmodules_is_unmerged )
@@ -77,7 +77,7 @@ int update_path_in_gitmodules(const char *oldpath, const char *newpath)
77
77
strbuf_addstr (& entry , "submodule." );
78
78
strbuf_addstr (& entry , submodule -> name );
79
79
strbuf_addstr (& entry , ".path" );
80
- if (git_config_set_in_file_gently (".gitmodules" , entry .buf , newpath ) < 0 ) {
80
+ if (git_config_set_in_file_gently (GITMODULES_FILE , entry .buf , newpath ) < 0 ) {
81
81
/* Maybe the user already did that, don't error out here */
82
82
warning (_ ("Could not update .gitmodules entry %s" ), entry .buf );
83
83
strbuf_release (& entry );
@@ -97,7 +97,7 @@ int remove_path_from_gitmodules(const char *path)
97
97
struct strbuf sect = STRBUF_INIT ;
98
98
const struct submodule * submodule ;
99
99
100
- if (!file_exists (".gitmodules" )) /* Do nothing without .gitmodules */
100
+ if (!file_exists (GITMODULES_FILE )) /* Do nothing without .gitmodules */
101
101
return -1 ;
102
102
103
103
if (gitmodules_is_unmerged )
@@ -110,7 +110,7 @@ int remove_path_from_gitmodules(const char *path)
110
110
}
111
111
strbuf_addstr (& sect , "submodule." );
112
112
strbuf_addstr (& sect , submodule -> name );
113
- if (git_config_rename_section_in_file (".gitmodules" , sect .buf , NULL ) < 0 ) {
113
+ if (git_config_rename_section_in_file (GITMODULES_FILE , sect .buf , NULL ) < 0 ) {
114
114
/* Maybe the user already did that, don't error out here */
115
115
warning (_ ("Could not remove .gitmodules entry for %s" ), path );
116
116
strbuf_release (& sect );
@@ -122,7 +122,7 @@ int remove_path_from_gitmodules(const char *path)
122
122
123
123
void stage_updated_gitmodules (void )
124
124
{
125
- if (add_file_to_cache (".gitmodules" , 0 ))
125
+ if (add_file_to_cache (GITMODULES_FILE , 0 ))
126
126
die (_ ("staging updated .gitmodules failed" ));
127
127
}
128
128
@@ -230,21 +230,21 @@ void gitmodules_config(void)
230
230
struct strbuf gitmodules_path = STRBUF_INIT ;
231
231
int pos ;
232
232
strbuf_addstr (& gitmodules_path , work_tree );
233
- strbuf_addstr (& gitmodules_path , "/.gitmodules" );
233
+ strbuf_addstr (& gitmodules_path , "/" GITMODULES_FILE );
234
234
if (read_cache () < 0 )
235
235
die ("index file corrupt" );
236
- pos = cache_name_pos (".gitmodules" , 11 );
236
+ pos = cache_name_pos (GITMODULES_FILE , 11 );
237
237
if (pos < 0 ) { /* .gitmodules not found or isn't merged */
238
238
pos = -1 - pos ;
239
239
if (active_nr > pos ) { /* there is a .gitmodules */
240
240
const struct cache_entry * ce = active_cache [pos ];
241
241
if (ce_namelen (ce ) == 11 &&
242
- !memcmp (ce -> name , ".gitmodules" , 11 ))
242
+ !memcmp (ce -> name , GITMODULES_FILE , 11 ))
243
243
gitmodules_is_unmerged = 1 ;
244
244
}
245
245
} else if (pos < active_nr ) {
246
246
struct stat st ;
247
- if (lstat (".gitmodules" , & st ) == 0 &&
247
+ if (lstat (GITMODULES_FILE , & st ) == 0 &&
248
248
ce_match_stat (active_cache [pos ], & st , 0 ) & DATA_CHANGED )
249
249
gitmodules_is_modified = 1 ;
250
250
}
@@ -264,7 +264,7 @@ static int gitmodules_cb(const char *var, const char *value, void *data)
264
264
265
265
void repo_read_gitmodules (struct repository * repo )
266
266
{
267
- char * gitmodules_path = repo_worktree_path (repo , ".gitmodules" );
267
+ char * gitmodules_path = repo_worktree_path (repo , GITMODULES_FILE );
268
268
269
269
git_config_from_file (gitmodules_cb , gitmodules_path , repo );
270
270
free (gitmodules_path );
0 commit comments