Skip to content

Commit d2b0708

Browse files
dmpotspearce
authored andcommitted
add have_git_dir() function
This function is used to learn whether git_dir is already set up or not. It is necessary, because we want to read configuration in compat/cygwin.c Signed-off-by: Dmitry Potapov <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent 8b745e3 commit d2b0708

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ extern int is_bare_repository(void);
313313
extern int is_inside_git_dir(void);
314314
extern char *git_work_tree_cfg;
315315
extern int is_inside_work_tree(void);
316+
extern int have_git_dir(void);
316317
extern const char *get_git_dir(void);
317318
extern char *get_object_directory(void);
318319
extern char *get_index_file(void);

environment.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ int is_bare_repository(void)
8080
return is_bare_repository_cfg && !get_git_work_tree();
8181
}
8282

83+
int have_git_dir(void)
84+
{
85+
return !!git_dir;
86+
}
87+
8388
const char *get_git_dir(void)
8489
{
8590
if (!git_dir)

0 commit comments

Comments
 (0)