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 bool b = m_GitDir.HasAdminDir(path,&m_CurrentDir);
\r
61 if(m_CurrentDir.GetLength() == 2 && m_CurrentDir[1] == _T(':')) //C: D:
\r
63 m_CurrentDir+=_T('\\');
\r
67 CString m_CurrentDir;
\r
73 BRANCH_ALL=BRANCH_LOCAL|BRANCH_REMOTE,
\r
79 LOG_INFO_FILESTATE=0x2,
\r
81 LOG_INFO_FULLHISTORY=0x8,
\r
82 LOG_INFO_BOUNDARY=0x10,
\r
83 LOG_INFO_ALL_BRANCH=0x20,
\r
84 LOG_INFO_ONLY_HASH=0x40,
\r
85 LOG_INFO_DETECT_RENAME=0x80,
\r
86 LOG_INFO_DETECT_COPYRENAME=0x100,
\r
87 LOG_INFO_FIRST_PARENT = 0x200,
\r
88 LOG_INFO_NO_MERGE = 0x400,
\r
89 LOG_INFO_FOLLOW = 0x800,
\r
90 LOG_INFO_SHOW_MERGEDFILE=0x1000
\r
93 int GetRemoteList(STRING_VECTOR &list);
\r
94 int GetBranchList(STRING_VECTOR &list, int *Current,BRANCH_TYPE type=BRANCH_LOCAL);
\r
95 int GetTagList(STRING_VECTOR &list);
\r
96 int GetMapHashToFriendName(MAP_HASH_NAME &map);
\r
98 //hash is empty means all. -1 means all
\r
100 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
101 CString *from=NULL,CString *to=NULL);
\r
102 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
103 CString *from=NULL,CString *to=NULL);
\r
105 BOOL EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData);
\r
107 git_revnum_t GetHash(const CString &friendname);
\r
109 int BuildOutputFormat(CString &format,bool IsFull=TRUE);
\r
110 //int GetShortLog(CString &log,CTGitPath * path=NULL, int count =-1);
\r
111 static void StringAppend(CString *str,BYTE *p,int code=CP_UTF8,int length=-1);
\r
113 BOOL IsInitRepos();
\r
114 int ListConflictFile(CTGitPathList &list,CTGitPath *path=NULL);
\r
115 int GetRefList(STRING_VECTOR &list);
\r
118 //Example: master -> refs/heads/master
\r
119 CString GetFullRefName(CString shortRefName);
\r
120 //Removes 'refs/heads/' or just 'refs'. Example: refs/heads/master -> master
\r
121 static CString StripRefName(CString refName);
\r
124 extern void GetTempPath(CString &path);
\r
125 extern CString GetTempFile();
\r
130 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