Git DLL get commit information basic work.
[TortoiseGit.git] / ext / gitdll / gitdll.h
blob3cec3d70b0fffaee5d70add2e5eb23a6c29f28fd
1 // The following ifdef block is the standard way of creating macros which make exporting
2 // from a DLL simpler. All files within this DLL are compiled with the GITDLL_EXPORTS
3 // symbol defined on the command line. this symbol should not be defined on any project
4 // that uses this DLL. This way any other project whose source files include this file see
5 // GITDLL_API functions as being imported from a DLL, whereas this DLL sees symbols
6 // defined with this macro as being exported.
7 #ifdef __cplusplus
8 #define EXTERN extern "C"
9 #else
10 #define EXTERN
11 #endif
13 #ifdef GITDLL_EXPORTS
14 #define GITDLL_API __declspec(dllexport) EXTERN
15 #else
16 #define GITDLL_API __declspec(dllimport) EXTERN
17 #endif
19 #if 0
20 // This class is exported from the gitdll.dll
21 class GITDLL_API Cgitdll {
22 public:
23 Cgitdll(void);
24 // TODO: add your methods here.
26 #endif
28 #define GIT_HASH_SIZE 20
30 typedef unsigned char GIT_HASH[GIT_HASH_SIZE];
31 typedef unsigned int GIT_HANDLE;
32 typedef unsigned int GIT_LOG;
34 typedef unsigned int GIT_DIFF;
35 typedef unsigned int GIT_FILE;
37 struct GIT_COMMIT_AUTHOR
39 char *Name;
40 int NameSize;
41 char *Email;
42 int EmailSize;
43 int Date;
44 int TimeZone;
47 typedef struct GIT_COMMIT_DATA
49 GIT_HASH m_hash;
50 struct GIT_COMMIT_AUTHOR m_Author;
51 struct GIT_COMMIT_AUTHOR m_Committer;
52 char * m_Subject;
53 int m_SubjectSize;
54 char * m_Body;
55 int m_BodySize;
56 void * m_pGitCommit; /** internal used */
58 } GIT_COMMIT;
61 GITDLL_API int ngitdll;
63 GITDLL_API int fngitdll(void);
64 /**
65 * Get Git Last Error string.
67 GITDLL_API char * get_git_last_error();
68 /**
69 * Get hash value.
70 * @param name [IN] Reference name, such as HEAD, master, ...
71 * @param sha1 [OUT] char[20] hash value. Caller prepare char[20] buffer.
72 * @return 0 success.
74 GITDLL_API int git_get_sha1(const char *name, GIT_HASH sha1);
75 /**
76 * Init git dll
77 * @remark, this function must be call before other function.
78 * @return 0 success
80 GITDLL_API int git_init();
82 GITDLL_API int git_open_log(GIT_LOG * handle, char * arg);
83 GITDLL_API int git_get_log_count(GIT_LOG handle);
84 GITDLL_API int git_get_log_firstcommit(GIT_LOG handle, GIT_COMMIT *commit);
85 GITDLL_API int git_get_log_nextcommit(GIT_LOG handle, GIT_COMMIT *commit, int skip);
86 GITDLL_API int git_close_log(GIT_LOG handle);
88 GITDLL_API int git_get_commit_from_hash(GIT_COMMIT *commit, GIT_HASH hash);
90 GITDLL_API int git_get_diff(GIT_COMMIT commit, GIT_DIFF *diff);
91 GITDLL_API int git_get_diff_firstfile(GIT_DIFF diff, GIT_FILE * file);
92 GITDLL_API int git_get_diff_nextfile(GIT_DIFF diff, GIT_FILE *file);
93 GITDLL_API int git_get_diff_status(GIT_DIFF diff, int * status);
94 GITDLL_API int git_get_diff_stat(GIT_FILE file, int *inc, int *dec, int *mode);
95 GITDLL_API int git_get_diff_file(GIT_FILE file, char *newname, int newsize, char *oldname, int oldsize, int *mode);