drop VSNETHack
[TortoiseGit.git] / src / Git / GitAdminDir.h
blob62696fe9be183488719daf7b2e910330a8a79345
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2011 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
22 class GitAdminDir
24 public:
25 GitAdminDir(void);
26 ~GitAdminDir(void);
27 /**
28 * Initializes the global object. Call this after apr is initialized but
29 * before using any other methods of this class.
31 bool Init();
32 /**
33 * Clears the memory pool. Call this before you clear *all* pools
34 * with apr_pool_terminate(). If you don't use apr_pool_terminate(), then
35 * this method doesn't need to be called, because the deconstructor will
36 * do the same too.
38 bool Close();
40 /// Returns true if \a name is the admin dir name
41 bool IsAdminDirName(const CString& name) const;
43 /// Returns true if the path points to or below an admin directory
44 bool IsAdminDirPath(const CString& path) const;
46 /// Returns true if the path points is a bare repository
47 bool IsBareRepo(const CString& path) const;
49 /// Returns true if the path (file or folder) has an admin directory
50 /// associated, i.e. if the path is in a working copy.
51 bool HasAdminDir(const CString& path) const;
52 bool HasAdminDir(const CString& path,CString * ProjectTopDir) const;
53 bool HasAdminDir(const CString& path, bool bDir,CString * ProjectTopDir=NULL) const;
54 CString GetSuperProjectRoot(const CString& path);
56 CString GetGitTopDir(const CString& path);
58 CString GetAdminDirName() const {return _T(".git");}
60 private:
61 int m_nInit;
65 extern GitAdminDir g_GitAdminDir;