drop ObjectCombo
[TortoiseGit.git] / ext / gitdll / gitdll.h
blob0bb81a7ceefcfc58a27afb905a1683710fa5269b
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 #ifndef __GITDLL__
8 #define __GITDLL__
10 #ifdef __cplusplus
11 #define EXTERN extern "C"
12 #else
13 #define EXTERN
14 #endif
16 #ifdef GITDLL_EXPORTS
17 #define GITDLL_API EXTERN __declspec(dllexport)
18 #else
19 #define GITDLL_API EXTERN __declspec(dllimport)
20 #endif
22 #if 0
23 // This class is exported from the gitdll.dll
24 class GITDLL_API Cgitdll {
25 public:
26 Cgitdll(void);
27 // TODO: add your methods here.
29 #endif
31 #define GIT_HASH_SIZE 20
33 typedef unsigned char GIT_HASH[GIT_HASH_SIZE];
35 typedef void * GIT_HANDLE;
36 typedef void * GIT_LOG;
38 typedef void * GIT_DIFF;
39 typedef void * GIT_FILE;
40 typedef void * GIT_COMMIT_LIST;
42 struct GIT_COMMIT_AUTHOR
44 char *Name;
45 int NameSize;
46 char *Email;
47 int EmailSize;
48 int Date;
49 int TimeZone;
52 typedef struct GIT_COMMIT_DATA
54 GIT_HASH m_hash;
55 struct GIT_COMMIT_AUTHOR m_Author;
56 struct GIT_COMMIT_AUTHOR m_Committer;
57 char * m_Subject;
58 int m_SubjectSize;
59 char * m_Body;
60 int m_BodySize;
61 void * m_pGitCommit; /** internal used */
62 char * m_Encode;
63 int m_EncodeSize;
65 } GIT_COMMIT;
68 GITDLL_API int ngitdll;
70 GITDLL_API int fngitdll(void);
71 /**
72 * Get Git Last Error string.
74 GITDLL_API char * get_git_last_error();
75 /**
76 * Get hash value.
77 * @param name [IN] Reference name, such as HEAD, master, ...
78 * @param sha1 [OUT] char[20] hash value. Caller prepare char[20] buffer.
79 * @return 0 success.
81 GITDLL_API int git_get_sha1(const char *name, GIT_HASH sha1);
82 /**
83 * Init git dll
84 * @remark, this function must be call before other function.
85 * @return 0 success
87 GITDLL_API int git_init();
89 GITDLL_API int git_open_log(GIT_LOG * handle, char * arg);
90 GITDLL_API int git_get_log_firstcommit(GIT_LOG handle);
91 GITDLL_API int git_get_log_estimate_commit_count(GIT_LOG handle);
93 /**
94 * Get Next Commit
95 * @param handle [IN]handle Get handle from git_open_log
96 * @param commit [OUT]commit Caller need prepare buffer for this call
97 * @return 0 success
98 * @remark Caller need call git_free_commit to free internal buffer after use it;
100 GITDLL_API int git_get_log_nextcommit(GIT_LOG handle, GIT_COMMIT *commit);
102 GITDLL_API int git_close_log(GIT_LOG handle);
105 * Get Commit information from commit hash
106 * @param commit [OUT] output commit information
107 * @param hash [in] hash
108 * @return 0 success
110 GITDLL_API int git_get_commit_from_hash(GIT_COMMIT *commit, GIT_HASH hash);
111 GITDLL_API int git_parse_commit(GIT_COMMIT *commit);
113 GITDLL_API int git_get_commit_first_parent(GIT_COMMIT *commit,GIT_COMMIT_LIST *list);
114 GITDLL_API int git_get_commit_next_parent(GIT_COMMIT_LIST *list, GIT_HASH hash);
116 GITDLL_API int git_free_commit(GIT_COMMIT *commit);
118 GITDLL_API int git_open_diff(GIT_DIFF *diff, char * arg);
119 GITDLL_API int git_diff(GIT_DIFF diff, GIT_HASH hash1,GIT_HASH hash2, GIT_FILE * file, int *count, int isstat);
120 GITDLL_API int git_root_diff(GIT_DIFF diff, GIT_HASH hash,GIT_FILE *file, int *count,int isstat);
121 GITDLL_API int git_diff_flush(GIT_DIFF diff);
122 GITDLL_API int git_close_diff(GIT_DIFF diff);
125 GITDLL_API int git_get_diff_file(GIT_DIFF diff,GIT_FILE file, int i,char **newname, char **oldname, int *mode, int *IsBin, int *inc, int *dec);
127 #define READ_TREE_RECURSIVE 1
128 typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int, void *);
130 GITDLL_API int git_read_tree(GIT_HASH hash,read_tree_fn_t fn, void *context);
133 typedef void * EXCLUDE_LIST;
135 GITDLL_API int git_create_exclude_list(EXCLUDE_LIST *which);
137 GITDLL_API int git_add_exclude(const char *string, const char *base,
138 int baselen, EXCLUDE_LIST which);
140 GITDLL_API int git_check_excluded_1(const char *pathname,
141 int pathlen, const char *basename, int *dtype,
142 EXCLUDE_LIST el);
144 #define DT_UNKNOWN 0
145 #define DT_DIR 1
146 #define DT_REG 2
147 #define DT_LNK 3
149 GITDLL_API int git_free_exclude_list(EXCLUDE_LIST which);
151 //caller need free p_note
152 GITDLL_API int git_get_notes(GIT_HASH hash, char **p_note);
154 GITDLL_API int git_run_cmd(char *cmd, char *arg);
156 #define REF_ISSYMREF 01
157 #define REF_ISPACKED 02
159 typedef int each_ref_fn(const char *refname, const unsigned char *sha1, int flags, void *cb_data);
160 GITDLL_API int git_head_ref(each_ref_fn, void *);
161 GITDLL_API int git_for_each_ref_in(const char *, each_ref_fn, void *);
162 GITDLL_API const char *git_resolve_ref(const char *path, unsigned char *sha1, int, int *);
164 typedef int each_reflog_ent_fn(unsigned char *osha1, unsigned char *nsha1, const char *, unsigned long, int, const char *, void *);
165 GITDLL_API int git_for_each_reflog_ent(const char *ref, each_reflog_ent_fn fn, void *cb_data);
166 GITDLL_API int git_deref_tag(const unsigned char *tagsha1,GIT_HASH refhash);
168 GITDLL_API int git_checkout_file(const char *ref, const char *path, const char *outputpath);
170 GITDLL_API int git_get_config(const char *key, char *buffer, int size, char* git_path);
172 typedef enum
174 CONFIG_LOCAL,
175 CONFIG_GLOBAL,
176 CONFIG_SYSTEM,
178 }CONFIG_TYPE;
180 GITDLL_API int get_set_config(const char *key, char *value, CONFIG_TYPE type, char *git_path);
182 #endif