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