4 #include "GitStatus.h"
\r
5 #include "GitAdminDir.h"
\r
11 CGitCall(CString cmd):m_Cmd(cmd){}
\r
13 CString GetCmd()const{return m_Cmd;}
\r
14 void SetCmd(CString cmd){m_Cmd=cmd;}
\r
16 //This function is called when command output data is available.
\r
17 //When this function returns 'true' the git command should be aborted.
\r
18 //This behavior is not implemented yet.
\r
19 virtual bool OnOutputData(const BYTE* data, size_t size)=0;
\r
20 virtual void OnEnd(){}
\r
32 GitAdminDir m_GitDir;
\r
34 static BOOL CheckMsysGitDir();
\r
35 static CString ms_LastMsysGitDir; // the last msysgitdir added to the path, blank if none
\r
36 static int m_LogEncode;
\r
37 // static CString m_MsysGitPath;
\r
41 int Run(CString cmd, CString* output,int code);
\r
42 int Run(CString cmd, BYTE_VECTOR *byte_array);
\r
43 int Run(CGitCall* pcall);
\r
45 int RunAsync(CString cmd,PROCESS_INFORMATION *pi, HANDLE* hRead, CString *StdioFile=NULL);
\r
46 int RunLogFile(CString cmd, CString &filename);
\r
47 CString GetConfigValue(CString name);
\r
48 CString GetUserName(void);
\r
49 CString GetUserEmail(void);
\r
50 CString GetCurrentBranch(void);
\r
51 CString GetSymbolicRef(const wchar_t* symbolicRefName = L"HEAD", bool bStripRefsHeads = true);
\r
52 // read current branch name from HEAD file, returns 0 on success, -1 on failure, 1 detached (branch name "HEAD" returned)
\r
53 int GetCurrentBranchFromFile(const CString &sProjectRoot, CString &sBranchOut);
\r
54 BOOL CheckCleanWorkTree();
\r
55 int Revert(CTGitPath &path,bool keep=true);
\r
56 int Revert(CTGitPathList &list,bool keep=true);
\r
58 bool SetCurrentDir(CString path)
\r
60 return m_GitDir.HasAdminDir(path,&m_CurrentDir);
\r
62 CString m_CurrentDir;
\r
68 BRANCH_ALL=BRANCH_LOCAL|BRANCH_REMOTE,
\r
74 LOG_INFO_FILESTATE=0x2,
\r
76 LOG_INFO_FULLHISTORY=0x8,
\r
77 LOG_INFO_BOUNDARY=0x10,
\r
78 LOG_INFO_ALL_BRANCH=0x20,
\r
79 LOG_INFO_ONLY_HASH=0x40,
\r
80 LOG_INFO_DETECT_RENAME=0x80,
\r
81 LOG_INFO_DETECT_COPYRENAME=0x100,
\r
82 LOG_INFO_FIRST_PARENT = 0x200,
\r
83 LOG_INFO_NO_MERGE = 0x400,
\r
84 LOG_INFO_FOLLOW = 0x800,
\r
85 LOG_INFO_SHOW_MERGEDFILE=0x1000
\r
88 int GetRemoteList(STRING_VECTOR &list);
\r
89 int GetBranchList(STRING_VECTOR &list, int *Current,BRANCH_TYPE type=BRANCH_LOCAL);
\r
90 int GetTagList(STRING_VECTOR &list);
\r
91 int GetMapHashToFriendName(MAP_HASH_NAME &map);
\r
93 //hash is empty means all. -1 means all
\r
95 int GetLog(CGitCall* pgitCall, CString &hash, CTGitPath *path = NULL,int count=-1,int InfoMask=LOG_INFO_STAT|LOG_INFO_FILESTATE|LOG_INFO_BOUNDARY|LOG_INFO_DETECT_COPYRENAME|LOG_INFO_SHOW_MERGEDFILE,
\r
96 CString *from=NULL,CString *to=NULL);
\r
97 int GetLog(BYTE_VECTOR& logOut,CString &hash, CTGitPath *path = NULL,int count=-1,int InfoMask=LOG_INFO_STAT|LOG_INFO_FILESTATE|LOG_INFO_BOUNDARY|LOG_INFO_DETECT_COPYRENAME|LOG_INFO_SHOW_MERGEDFILE,
\r
98 CString *from=NULL,CString *to=NULL);
\r
100 BOOL EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData);
\r
102 git_revnum_t GetHash(const CString &friendname);
\r
104 int BuildOutputFormat(CString &format,bool IsFull=TRUE);
\r
105 //int GetShortLog(CString &log,CTGitPath * path=NULL, int count =-1);
\r
106 static void StringAppend(CString *str,BYTE *p,int code=CP_UTF8,int length=-1);
\r
108 BOOL IsInitRepos();
\r
109 int ListConflictFile(CTGitPathList &list,CTGitPath *path=NULL);
\r
110 int GetRefList(STRING_VECTOR &list);
\r
113 //Removes 'refs/heads/' or just 'refs'
\r
114 static CString StripRefName(CString refName);
\r
117 extern void GetTempPath(CString &path);
\r
118 extern CString GetTempFile();
\r
123 inline static BOOL wgEnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData) { return g_Git.EnumFiles(pszProjectPath, pszSubPath, nFlags, pEnumCb, pUserData); }
\r