OSDN Git Service

add have_git_dir() function
authorDmitry Potapov <dpotapov@gmail.com>
Sat, 27 Sep 2008 08:41:50 +0000 (12:41 +0400)
committerShawn O. Pearce <spearce@spearce.org>
Tue, 30 Sep 2008 21:30:06 +0000 (14:30 -0700)
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 <dpotapov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
cache.h
environment.c

diff --git a/cache.h b/cache.h
index 99af83a..818804d 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -313,6 +313,7 @@ extern int is_bare_repository(void);
 extern int is_inside_git_dir(void);
 extern char *git_work_tree_cfg;
 extern int is_inside_work_tree(void);
+extern int have_git_dir(void);
 extern const char *get_git_dir(void);
 extern char *get_object_directory(void);
 extern char *get_index_file(void);
index 0c6d11f..0693cd9 100644 (file)
@@ -80,6 +80,11 @@ int is_bare_repository(void)
        return is_bare_repository_cfg && !get_git_work_tree();
 }
 
+int have_git_dir(void)
+{
+       return !!git_dir;
+}
+
 const char *get_git_dir(void)
 {
        if (!git_dir)