@@ -63,7 +63,7 @@ int update_path_in_gitmodules(const char *oldpath, const char *newpath)
6363 struct strbuf entry = STRBUF_INIT ;
6464 const struct submodule * submodule ;
6565
66- if (!file_exists (".gitmodules" )) /* Do nothing without .gitmodules */
66+ if (!file_exists (GITMODULES_FILE )) /* Do nothing without .gitmodules */
6767 return -1 ;
6868
6969 if (gitmodules_is_unmerged )
@@ -77,7 +77,7 @@ int update_path_in_gitmodules(const char *oldpath, const char *newpath)
7777 strbuf_addstr (& entry , "submodule." );
7878 strbuf_addstr (& entry , submodule -> name );
7979 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 ) {
8181 /* Maybe the user already did that, don't error out here */
8282 warning (_ ("Could not update .gitmodules entry %s" ), entry .buf );
8383 strbuf_release (& entry );
@@ -97,7 +97,7 @@ int remove_path_from_gitmodules(const char *path)
9797 struct strbuf sect = STRBUF_INIT ;
9898 const struct submodule * submodule ;
9999
100- if (!file_exists (".gitmodules" )) /* Do nothing without .gitmodules */
100+ if (!file_exists (GITMODULES_FILE )) /* Do nothing without .gitmodules */
101101 return -1 ;
102102
103103 if (gitmodules_is_unmerged )
@@ -110,7 +110,7 @@ int remove_path_from_gitmodules(const char *path)
110110 }
111111 strbuf_addstr (& sect , "submodule." );
112112 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 ) {
114114 /* Maybe the user already did that, don't error out here */
115115 warning (_ ("Could not remove .gitmodules entry for %s" ), path );
116116 strbuf_release (& sect );
@@ -122,7 +122,7 @@ int remove_path_from_gitmodules(const char *path)
122122
123123void stage_updated_gitmodules (void )
124124{
125- if (add_file_to_cache (".gitmodules" , 0 ))
125+ if (add_file_to_cache (GITMODULES_FILE , 0 ))
126126 die (_ ("staging updated .gitmodules failed" ));
127127}
128128
@@ -230,21 +230,21 @@ void gitmodules_config(void)
230230 struct strbuf gitmodules_path = STRBUF_INIT ;
231231 int pos ;
232232 strbuf_addstr (& gitmodules_path , work_tree );
233- strbuf_addstr (& gitmodules_path , "/.gitmodules" );
233+ strbuf_addstr (& gitmodules_path , "/" GITMODULES_FILE );
234234 if (read_cache () < 0 )
235235 die ("index file corrupt" );
236- pos = cache_name_pos (".gitmodules" , 11 );
236+ pos = cache_name_pos (GITMODULES_FILE , 11 );
237237 if (pos < 0 ) { /* .gitmodules not found or isn't merged */
238238 pos = -1 - pos ;
239239 if (active_nr > pos ) { /* there is a .gitmodules */
240240 const struct cache_entry * ce = active_cache [pos ];
241241 if (ce_namelen (ce ) == 11 &&
242- !memcmp (ce -> name , ".gitmodules" , 11 ))
242+ !memcmp (ce -> name , GITMODULES_FILE , 11 ))
243243 gitmodules_is_unmerged = 1 ;
244244 }
245245 } else if (pos < active_nr ) {
246246 struct stat st ;
247- if (lstat (".gitmodules" , & st ) == 0 &&
247+ if (lstat (GITMODULES_FILE , & st ) == 0 &&
248248 ce_match_stat (active_cache [pos ], & st , 0 ) & DATA_CHANGED )
249249 gitmodules_is_modified = 1 ;
250250 }
@@ -264,7 +264,7 @@ static int gitmodules_cb(const char *var, const char *value, void *data)
264264
265265void repo_read_gitmodules (struct repository * repo )
266266{
267- char * gitmodules_path = repo_worktree_path (repo , ".gitmodules" );
267+ char * gitmodules_path = repo_worktree_path (repo , GITMODULES_FILE );
268268
269269 git_config_from_file (gitmodules_cb , gitmodules_path , repo );
270270 free (gitmodules_path );
0 commit comments