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 unsigned int Hash2int(CString &hash);
\r
38 // static CString m_MsysGitPath;
\r
40 PROCESS_INFORMATION m_CurrentGitPi;
\r
45 int Run(CString cmd, CString* output,int code);
\r
46 int Run(CString cmd, BYTE_VECTOR *byte_array);
\r
47 int Run(CGitCall* pcall);
\r
49 int RunAsync(CString cmd,PROCESS_INFORMATION *pi, HANDLE* hRead, CString *StdioFile=NULL);
\r
50 int RunLogFile(CString cmd, CString &filename);
\r
52 bool IsFastForward(CString &from, CString &to);
\r
53 CString GetConfigValue(CString name);
\r
54 CString GetUserName(void);
\r
55 CString GetUserEmail(void);
\r
56 CString GetCurrentBranch(void);
\r
57 CString GetSymbolicRef(const wchar_t* symbolicRefName = L"HEAD", bool bStripRefsHeads = true);
\r
58 // read current branch name from HEAD file, returns 0 on success, -1 on failure, 1 detached (branch name "HEAD" returned)
\r
59 int GetCurrentBranchFromFile(const CString &sProjectRoot, CString &sBranchOut);
\r
60 BOOL CheckCleanWorkTree();
\r
61 int Revert(CTGitPath &path,bool keep=true);
\r
62 int Revert(CTGitPathList &list,bool keep=true);
\r
64 bool SetCurrentDir(CString path)
\r
66 bool b = m_GitDir.HasAdminDir(path,&m_CurrentDir);
\r
67 if(m_CurrentDir.GetLength() == 2 && m_CurrentDir[1] == _T(':')) //C: D:
\r
69 m_CurrentDir+=_T('\\');
\r
73 CString m_CurrentDir;
\r
79 BRANCH_ALL=BRANCH_LOCAL|BRANCH_REMOTE,
\r
85 LOG_INFO_FILESTATE=0x2,
\r
87 LOG_INFO_FULLHISTORY=0x8,
\r
88 LOG_INFO_BOUNDARY=0x10,
\r
89 LOG_INFO_ALL_BRANCH=0x20,
\r
90 LOG_INFO_ONLY_HASH=0x40,
\r
91 LOG_INFO_DETECT_RENAME=0x80,
\r
92 LOG_INFO_DETECT_COPYRENAME=0x100,
\r
93 LOG_INFO_FIRST_PARENT = 0x200,
\r
94 LOG_INFO_NO_MERGE = 0x400,
\r
95 LOG_INFO_FOLLOW = 0x800,
\r
96 LOG_INFO_SHOW_MERGEDFILE=0x1000
\r
99 int GetRemoteList(STRING_VECTOR &list);
\r
100 int GetBranchList(STRING_VECTOR &list, int *Current,BRANCH_TYPE type=BRANCH_LOCAL);
\r
101 int GetTagList(STRING_VECTOR &list);
\r
102 int GetMapHashToFriendName(MAP_HASH_NAME &map);
\r
104 //hash is empty means all. -1 means all
\r
106 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
107 CString *from=NULL,CString *to=NULL);
\r
108 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
109 CString *from=NULL,CString *to=NULL);
\r
111 BOOL EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData);
\r
113 git_revnum_t GetHash(const CString &friendname);
\r
115 int BuildOutputFormat(CString &format,bool IsFull=TRUE);
\r
116 //int GetShortLog(CString &log,CTGitPath * path=NULL, int count =-1);
\r
117 static void StringAppend(CString *str,BYTE *p,int code=CP_UTF8,int length=-1);
\r
119 BOOL IsInitRepos();
\r
120 int ListConflictFile(CTGitPathList &list,CTGitPath *path=NULL);
\r
121 int GetRefList(STRING_VECTOR &list);
\r
124 //Example: master -> refs/heads/master
\r
125 CString GetFullRefName(CString shortRefName);
\r
126 //Removes 'refs/heads/' or just 'refs'. Example: refs/heads/master -> master
\r
127 static CString StripRefName(CString refName);
\r
129 int GetCommitDiffList(CString &rev1,CString &rev2,CTGitPathList &outpathlist);
\r
132 extern void GetTempPath(CString &path);
\r
133 extern CString GetTempFile();
\r
138 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