]> git.proxmox.com Git - libgit2.git/blame - include/git2/deprecated.h
Update upstream source from tag 'upstream/1.0.0+dfsg.1'
[libgit2.git] / include / git2 / deprecated.h
CommitLineData
ac3d33df
JK
1/*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7#ifndef INCLUDE_git_deprecated_h__
8#define INCLUDE_git_deprecated_h__
9
0c9c969a
UG
10#include "attr.h"
11#include "config.h"
ac3d33df 12#include "common.h"
0c9c969a 13#include "blame.h"
ac3d33df 14#include "buffer.h"
0c9c969a
UG
15#include "checkout.h"
16#include "cherrypick.h"
17#include "clone.h"
18#include "describe.h"
19#include "diff.h"
ac3d33df
JK
20#include "errors.h"
21#include "index.h"
0c9c969a
UG
22#include "indexer.h"
23#include "merge.h"
ac3d33df 24#include "object.h"
0c9c969a 25#include "proxy.h"
ac3d33df 26#include "refs.h"
0c9c969a
UG
27#include "rebase.h"
28#include "remote.h"
29#include "trace.h"
30#include "repository.h"
31#include "revert.h"
32#include "stash.h"
33#include "status.h"
34#include "submodule.h"
35#include "worktree.h"
36#include "credential.h"
37#include "credential_helpers.h"
ac3d33df
JK
38
39/*
40 * Users can avoid deprecated functions by defining `GIT_DEPRECATE_HARD`.
41 */
42#ifndef GIT_DEPRECATE_HARD
43
66a70851
UG
44/*
45 * The credential structures are now opaque by default, and their
46 * definition has moved into the `sys/credential.h` header; include
47 * them here for backward compatibility.
48 */
49#include "sys/credential.h"
50
ac3d33df
JK
51/**
52 * @file git2/deprecated.h
53 * @brief libgit2 deprecated functions and values
54 * @ingroup Git
55 * @{
56 */
57GIT_BEGIN_DECL
58
0c9c969a
UG
59/** @name Deprecated Attribute Constants
60 *
61 * These enumeration values are retained for backward compatibility.
62 * The newer versions of these functions should be preferred in all
63 * new code.
64 *
65 * There is no plan to remove these backward compatibility values at
66 * this time.
67 */
68/**@{*/
69
70#define GIT_ATTR_UNSPECIFIED_T GIT_ATTR_VALUE_UNSPECIFIED
71#define GIT_ATTR_TRUE_T GIT_ATTR_VALUE_TRUE
72#define GIT_ATTR_FALSE_T GIT_ATTR_VALUE_FALSE
73#define GIT_ATTR_VALUE_T GIT_ATTR_VALUE_STRING
74
75#define GIT_ATTR_TRUE(attr) GIT_ATTR_IS_TRUE(attr)
76#define GIT_ATTR_FALSE(attr) GIT_ATTR_IS_FALSE(attr)
77#define GIT_ATTR_UNSPECIFIED(attr) GIT_ATTR_IS_UNSPECIFIED(attr)
78
79typedef git_attr_value_t git_attr_t;
80
81/**@}*/
82
83/** @name Deprecated Blob Functions
84 *
85 * These functions are retained for backward compatibility. The newer
86 * versions of these functions should be preferred in all new code.
87 *
88 * There is no plan to remove these backward compatibility values at
89 * this time.
90 */
91/**@{*/
92
93GIT_EXTERN(int) git_blob_create_fromworkdir(git_oid *id, git_repository *repo, const char *relative_path);
94GIT_EXTERN(int) git_blob_create_fromdisk(git_oid *id, git_repository *repo, const char *path);
95GIT_EXTERN(int) git_blob_create_fromstream(
96 git_writestream **out,
97 git_repository *repo,
98 const char *hintpath);
99GIT_EXTERN(int) git_blob_create_fromstream_commit(
100 git_oid *out,
101 git_writestream *stream);
102GIT_EXTERN(int) git_blob_create_frombuffer(
103 git_oid *id, git_repository *repo, const void *buffer, size_t len);
104
105/** Deprecated in favor of @see git_blob_filter */
106GIT_EXTERN(int) git_blob_filtered_content(
107 git_buf *out,
108 git_blob *blob,
109 const char *as_path,
110 int check_for_binary_data);
111
112/**@}*/
113
ac3d33df
JK
114/** @name Deprecated Buffer Functions
115 *
116 * These functions and enumeration values are retained for backward
117 * compatibility. The newer versions of these functions should be
118 * preferred in all new code.
119 *
120 * There is no plan to remove these backward compatibility values at
121 * this time.
122 */
123/**@{*/
124
125/**
126 * Free the memory referred to by the git_buf. This is an alias of
127 * `git_buf_dispose` and is preserved for backward compatibility.
128 *
129 * This function is deprecated, but there is no plan to remove this
130 * function at this time.
131 *
132 * @deprecated Use git_buf_dispose
133 * @see git_buf_dispose
134 */
135GIT_EXTERN(void) git_buf_free(git_buf *buffer);
136
137/**@}*/
138
0c9c969a
UG
139/** @name Deprecated Config Functions and Constants
140 */
141/**@{*/
142
143#define GIT_CVAR_FALSE GIT_CONFIGMAP_FALSE
144#define GIT_CVAR_TRUE GIT_CONFIGMAP_TRUE
145#define GIT_CVAR_INT32 GIT_CONFIGMAP_INT32
146#define GIT_CVAR_STRING GIT_CONFIGMAP_STRING
147
148typedef git_configmap git_cvar_map;
149
150/**@}*/
151
ac3d33df
JK
152/** @name Deprecated Error Functions and Constants
153 *
154 * These functions and enumeration values are retained for backward
155 * compatibility. The newer versions of these functions and values
156 * should be preferred in all new code.
157 *
158 * There is no plan to remove these backward compatibility values at
159 * this time.
160 */
161/**@{*/
162
163#define GITERR_NONE GIT_ERROR_NONE
164#define GITERR_NOMEMORY GIT_ERROR_NOMEMORY
165#define GITERR_OS GIT_ERROR_OS
166#define GITERR_INVALID GIT_ERROR_INVALID
167#define GITERR_REFERENCE GIT_ERROR_REFERENCE
168#define GITERR_ZLIB GIT_ERROR_ZLIB
169#define GITERR_REPOSITORY GIT_ERROR_REPOSITORY
170#define GITERR_CONFIG GIT_ERROR_CONFIG
171#define GITERR_REGEX GIT_ERROR_REGEX
172#define GITERR_ODB GIT_ERROR_ODB
173#define GITERR_INDEX GIT_ERROR_INDEX
174#define GITERR_OBJECT GIT_ERROR_OBJECT
175#define GITERR_NET GIT_ERROR_NET
176#define GITERR_TAG GIT_ERROR_TAG
177#define GITERR_TREE GIT_ERROR_TREE
178#define GITERR_INDEXER GIT_ERROR_INDEXER
179#define GITERR_SSL GIT_ERROR_SSL
180#define GITERR_SUBMODULE GIT_ERROR_SUBMODULE
181#define GITERR_THREAD GIT_ERROR_THREAD
182#define GITERR_STASH GIT_ERROR_STASH
183#define GITERR_CHECKOUT GIT_ERROR_CHECKOUT
184#define GITERR_FETCHHEAD GIT_ERROR_FETCHHEAD
185#define GITERR_MERGE GIT_ERROR_MERGE
186#define GITERR_SSH GIT_ERROR_SSH
187#define GITERR_FILTER GIT_ERROR_FILTER
188#define GITERR_REVERT GIT_ERROR_REVERT
189#define GITERR_CALLBACK GIT_ERROR_CALLBACK
190#define GITERR_CHERRYPICK GIT_ERROR_CHERRYPICK
191#define GITERR_DESCRIBE GIT_ERROR_DESCRIBE
192#define GITERR_REBASE GIT_ERROR_REBASE
193#define GITERR_FILESYSTEM GIT_ERROR_FILESYSTEM
194#define GITERR_PATCH GIT_ERROR_PATCH
195#define GITERR_WORKTREE GIT_ERROR_WORKTREE
196#define GITERR_SHA1 GIT_ERROR_SHA1
197
198/**
199 * Return the last `git_error` object that was generated for the
200 * current thread. This is an alias of `git_error_last` and is
201 * preserved for backward compatibility.
202 *
203 * This function is deprecated, but there is no plan to remove this
204 * function at this time.
205 *
206 * @deprecated Use git_error_last
207 * @see git_error_last
208 */
209GIT_EXTERN(const git_error *) giterr_last(void);
210
211/**
212 * Clear the last error. This is an alias of `git_error_last` and is
213 * preserved for backward compatibility.
214 *
215 * This function is deprecated, but there is no plan to remove this
216 * function at this time.
217 *
218 * @deprecated Use git_error_clear
219 * @see git_error_clear
220 */
221GIT_EXTERN(void) giterr_clear(void);
222
223/**
224 * Sets the error message to the given string. This is an alias of
225 * `git_error_set_str` and is preserved for backward compatibility.
226 *
227 * This function is deprecated, but there is no plan to remove this
228 * function at this time.
229 *
230 * @deprecated Use git_error_set_str
231 * @see git_error_set_str
232 */
233GIT_EXTERN(void) giterr_set_str(int error_class, const char *string);
234
235/**
236 * Indicates that an out-of-memory situation occured. This is an alias
237 * of `git_error_set_oom` and is preserved for backward compatibility.
238 *
239 * This function is deprecated, but there is no plan to remove this
240 * function at this time.
241 *
242 * @deprecated Use git_error_set_oom
243 * @see git_error_set_oom
244 */
245GIT_EXTERN(void) giterr_set_oom(void);
246
247/**@}*/
248
0c9c969a 249/** @name Deprecated Index Functions and Constants
ac3d33df 250 *
0c9c969a
UG
251 * These functions and enumeration values are retained for backward
252 * compatibility. The newer versions of these values should be
253 * preferred in all new code.
ac3d33df
JK
254 *
255 * There is no plan to remove these backward compatibility values at
256 * this time.
257 */
258/**@{*/
259
260#define GIT_IDXENTRY_NAMEMASK GIT_INDEX_ENTRY_NAMEMASK
261#define GIT_IDXENTRY_STAGEMASK GIT_INDEX_ENTRY_STAGEMASK
262#define GIT_IDXENTRY_STAGESHIFT GIT_INDEX_ENTRY_STAGESHIFT
263
264/* The git_indxentry_flag_t enum */
265#define GIT_IDXENTRY_EXTENDED GIT_INDEX_ENTRY_EXTENDED
266#define GIT_IDXENTRY_VALID GIT_INDEX_ENTRY_VALID
267
268#define GIT_IDXENTRY_STAGE(E) GIT_INDEX_ENTRY_STAGE(E)
269#define GIT_IDXENTRY_STAGE_SET(E,S) GIT_INDEX_ENTRY_STAGE_SET(E,S)
270
271/* The git_idxentry_extended_flag_t enum */
272#define GIT_IDXENTRY_INTENT_TO_ADD GIT_INDEX_ENTRY_INTENT_TO_ADD
273#define GIT_IDXENTRY_SKIP_WORKTREE GIT_INDEX_ENTRY_SKIP_WORKTREE
274#define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_INDEX_ENTRY_INTENT_TO_ADD | GIT_INDEX_ENTRY_SKIP_WORKTREE)
275#define GIT_IDXENTRY_EXTENDED2 (1 << 15)
276#define GIT_IDXENTRY_UPDATE (1 << 0)
277#define GIT_IDXENTRY_REMOVE (1 << 1)
278#define GIT_IDXENTRY_UPTODATE (1 << 2)
279#define GIT_IDXENTRY_ADDED (1 << 3)
280#define GIT_IDXENTRY_HASHED (1 << 4)
281#define GIT_IDXENTRY_UNHASHED (1 << 5)
282#define GIT_IDXENTRY_WT_REMOVE (1 << 6)
283#define GIT_IDXENTRY_CONFLICTED (1 << 7)
284#define GIT_IDXENTRY_UNPACKED (1 << 8)
285#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
286
287/* The git_index_capability_t enum */
288#define GIT_INDEXCAP_IGNORE_CASE GIT_INDEX_CAPABILITY_IGNORE_CASE
289#define GIT_INDEXCAP_NO_FILEMODE GIT_INDEX_CAPABILITY_NO_FILEMODE
290#define GIT_INDEXCAP_NO_SYMLINKS GIT_INDEX_CAPABILITY_NO_SYMLINKS
291#define GIT_INDEXCAP_FROM_OWNER GIT_INDEX_CAPABILITY_FROM_OWNER
292
0c9c969a
UG
293GIT_EXTERN(int) git_index_add_frombuffer(
294 git_index *index,
295 const git_index_entry *entry,
296 const void *buffer, size_t len);
297
ac3d33df
JK
298/**@}*/
299
300/** @name Deprecated Object Constants
301 *
302 * These enumeration values are retained for backward compatibility. The
303 * newer versions of these values should be preferred in all new code.
304 *
305 * There is no plan to remove these backward compatibility values at
306 * this time.
307 */
308/**@{*/
309
310#define git_otype git_object_t
311
312#define GIT_OBJ_ANY GIT_OBJECT_ANY
313#define GIT_OBJ_BAD GIT_OBJECT_INVALID
314#define GIT_OBJ__EXT1 0
315#define GIT_OBJ_COMMIT GIT_OBJECT_COMMIT
316#define GIT_OBJ_TREE GIT_OBJECT_TREE
317#define GIT_OBJ_BLOB GIT_OBJECT_BLOB
318#define GIT_OBJ_TAG GIT_OBJECT_TAG
319#define GIT_OBJ__EXT2 5
320#define GIT_OBJ_OFS_DELTA GIT_OBJECT_OFS_DELTA
321#define GIT_OBJ_REF_DELTA GIT_OBJECT_REF_DELTA
322
0c9c969a
UG
323/**
324 * Get the size in bytes for the structure which
325 * acts as an in-memory representation of any given
326 * object type.
327 *
328 * For all the core types, this would the equivalent
329 * of calling `sizeof(git_commit)` if the core types
330 * were not opaque on the external API.
331 *
332 * @param type object type to get its size
333 * @return size in bytes of the object
334 */
335GIT_EXTERN(size_t) git_object__size(git_object_t type);
336
ac3d33df
JK
337/**@}*/
338
339/** @name Deprecated Reference Constants
340 *
341 * These enumeration values are retained for backward compatibility. The
342 * newer versions of these values should be preferred in all new code.
343 *
344 * There is no plan to remove these backward compatibility values at
345 * this time.
346 */
347/**@{*/
348
349 /** Basic type of any Git reference. */
350#define git_ref_t git_reference_t
351#define git_reference_normalize_t git_reference_format_t
352
353#define GIT_REF_INVALID GIT_REFERENCE_INVALID
354#define GIT_REF_OID GIT_REFERENCE_DIRECT
355#define GIT_REF_SYMBOLIC GIT_REFERENCE_SYMBOLIC
356#define GIT_REF_LISTALL GIT_REFERENCE_ALL
357
358#define GIT_REF_FORMAT_NORMAL GIT_REFERENCE_FORMAT_NORMAL
359#define GIT_REF_FORMAT_ALLOW_ONELEVEL GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL
360#define GIT_REF_FORMAT_REFSPEC_PATTERN GIT_REFERENCE_FORMAT_REFSPEC_PATTERN
361#define GIT_REF_FORMAT_REFSPEC_SHORTHAND GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND
362
0c9c969a
UG
363GIT_EXTERN(int) git_tag_create_frombuffer(
364 git_oid *oid,
365 git_repository *repo,
366 const char *buffer,
367 int force);
368
369/**@}*/
370
371/** @name Deprecated Credential Types
372 *
373 * These types are retained for backward compatibility. The newer
374 * versions of these values should be preferred in all new code.
375 *
376 * There is no plan to remove these backward compatibility values at
377 * this time.
378 */
379
380typedef git_credential git_cred;
381typedef git_credential_userpass_plaintext git_cred_userpass_plaintext;
382typedef git_credential_username git_cred_username;
383typedef git_credential_default git_cred_default;
384typedef git_credential_ssh_key git_cred_ssh_key;
385typedef git_credential_ssh_interactive git_cred_ssh_interactive;
386typedef git_credential_ssh_custom git_cred_ssh_custom;
387
388typedef git_credential_acquire_cb git_cred_acquire_cb;
389typedef git_credential_sign_cb git_cred_sign_callback;
390typedef git_credential_sign_cb git_cred_sign_cb;
391typedef git_credential_ssh_interactive_cb git_cred_ssh_interactive_callback;
392typedef git_credential_ssh_interactive_cb git_cred_ssh_interactive_cb;
393
394#define git_credtype_t git_credential_t
395
396#define GIT_CREDTYPE_USERPASS_PLAINTEXT GIT_CREDENTIAL_USERPASS_PLAINTEXT
397#define GIT_CREDTYPE_SSH_KEY GIT_CREDENTIAL_SSH_KEY
398#define GIT_CREDTYPE_SSH_CUSTOM GIT_CREDENTIAL_SSH_CUSTOM
399#define GIT_CREDTYPE_DEFAULT GIT_CREDENTIAL_DEFAULT
400#define GIT_CREDTYPE_SSH_INTERACTIVE GIT_CREDENTIAL_SSH_INTERACTIVE
401#define GIT_CREDTYPE_USERNAME GIT_CREDENTIAL_USERNAME
402#define GIT_CREDTYPE_SSH_MEMORY GIT_CREDENTIAL_SSH_MEMORY
403
404GIT_EXTERN(void) git_cred_free(git_credential *cred);
405GIT_EXTERN(int) git_cred_has_username(git_credential *cred);
406GIT_EXTERN(const char *) git_cred_get_username(git_credential *cred);
407GIT_EXTERN(int) git_cred_userpass_plaintext_new(
408 git_credential **out,
409 const char *username,
410 const char *password);
411GIT_EXTERN(int) git_cred_default_new(git_credential **out);
412GIT_EXTERN(int) git_cred_username_new(git_credential **out, const char *username);
413GIT_EXTERN(int) git_cred_ssh_key_new(
414 git_credential **out,
415 const char *username,
416 const char *publickey,
417 const char *privatekey,
418 const char *passphrase);
419GIT_EXTERN(int) git_cred_ssh_key_memory_new(
420 git_credential **out,
421 const char *username,
422 const char *publickey,
423 const char *privatekey,
424 const char *passphrase);
425GIT_EXTERN(int) git_cred_ssh_interactive_new(
426 git_credential **out,
427 const char *username,
428 git_credential_ssh_interactive_cb prompt_callback,
429 void *payload);
430GIT_EXTERN(int) git_cred_ssh_key_from_agent(
431 git_credential **out,
432 const char *username);
433GIT_EXTERN(int) git_cred_ssh_custom_new(
434 git_credential **out,
435 const char *username,
436 const char *publickey,
437 size_t publickey_len,
438 git_credential_sign_cb sign_callback,
439 void *payload);
440
441/* Deprecated Credential Helper Types */
442
443typedef git_credential_userpass_payload git_cred_userpass_payload;
444
445GIT_EXTERN(int) git_cred_userpass(
446 git_credential **out,
447 const char *url,
448 const char *user_from_url,
449 unsigned int allowed_types,
450 void *payload);
451
452/**@}*/
453
454/** @name Deprecated Trace Callback Types
455 *
456 * These types are retained for backward compatibility. The newer
457 * versions of these values should be preferred in all new code.
458 *
459 * There is no plan to remove these backward compatibility values at
460 * this time.
461 */
462/**@{*/
463
464typedef git_trace_cb git_trace_callback;
465
466/**@}*/
467
468/** @name Deprecated Object ID Types
469 *
470 * These types are retained for backward compatibility. The newer
471 * versions of these values should be preferred in all new code.
472 *
473 * There is no plan to remove these backward compatibility values at
474 * this time.
475 */
476/**@{*/
477
478GIT_EXTERN(int) git_oid_iszero(const git_oid *id);
479
480/**@}*/
481
482/** @name Deprecated Transfer Progress Types
483 *
484 * These types are retained for backward compatibility. The newer
485 * versions of these values should be preferred in all new code.
486 *
487 * There is no plan to remove these backward compatibility values at
488 * this time.
489 */
490/**@{*/
491
492/**
493 * This structure is used to provide callers information about the
494 * progress of indexing a packfile.
495 *
496 * This type is deprecated, but there is no plan to remove this
497 * type definition at this time.
498 */
499typedef git_indexer_progress git_transfer_progress;
500
501/**
502 * Type definition for progress callbacks during indexing.
503 *
504 * This type is deprecated, but there is no plan to remove this
505 * type definition at this time.
506 */
507typedef git_indexer_progress_cb git_transfer_progress_cb;
508
509/**
510 * Type definition for push transfer progress callbacks.
511 *
512 * This type is deprecated, but there is no plan to remove this
513 * type definition at this time.
514 */
515typedef git_push_transfer_progress_cb git_push_transfer_progress;
516
517 /** The type of a remote completion event */
518#define git_remote_completion_type git_remote_completion_t
519
520/**
521 * Callback for listing the remote heads
522 */
523typedef int GIT_CALLBACK(git_headlist_cb)(git_remote_head *rhead, void *payload);
524
525/**@}*/
526
527/** @name Deprecated Options Initialization Functions
528 *
529 * These functions are retained for backward compatibility. The newer
530 * versions of these functions should be preferred in all new code.
531 *
532 * There is no plan to remove these backward compatibility functions at
533 * this time.
534 */
535/**@{*/
536
537GIT_EXTERN(int) git_blame_init_options(git_blame_options *opts, unsigned int version);
538GIT_EXTERN(int) git_checkout_init_options(git_checkout_options *opts, unsigned int version);
539GIT_EXTERN(int) git_cherrypick_init_options(git_cherrypick_options *opts, unsigned int version);
540GIT_EXTERN(int) git_clone_init_options(git_clone_options *opts, unsigned int version);
541GIT_EXTERN(int) git_describe_init_options(git_describe_options *opts, unsigned int version);
542GIT_EXTERN(int) git_describe_init_format_options(git_describe_format_options *opts, unsigned int version);
543GIT_EXTERN(int) git_diff_init_options(git_diff_options *opts, unsigned int version);
544GIT_EXTERN(int) git_diff_find_init_options(git_diff_find_options *opts, unsigned int version);
545GIT_EXTERN(int) git_diff_format_email_init_options(git_diff_format_email_options *opts, unsigned int version);
546GIT_EXTERN(int) git_diff_patchid_init_options(git_diff_patchid_options *opts, unsigned int version);
547GIT_EXTERN(int) git_fetch_init_options(git_fetch_options *opts, unsigned int version);
548GIT_EXTERN(int) git_indexer_init_options(git_indexer_options *opts, unsigned int version);
549GIT_EXTERN(int) git_merge_init_options(git_merge_options *opts, unsigned int version);
550GIT_EXTERN(int) git_merge_file_init_input(git_merge_file_input *input, unsigned int version);
551GIT_EXTERN(int) git_merge_file_init_options(git_merge_file_options *opts, unsigned int version);
552GIT_EXTERN(int) git_proxy_init_options(git_proxy_options *opts, unsigned int version);
553GIT_EXTERN(int) git_push_init_options(git_push_options *opts, unsigned int version);
554GIT_EXTERN(int) git_rebase_init_options(git_rebase_options *opts, unsigned int version);
555GIT_EXTERN(int) git_remote_create_init_options(git_remote_create_options *opts, unsigned int version);
556GIT_EXTERN(int) git_repository_init_init_options(git_repository_init_options *opts, unsigned int version);
557GIT_EXTERN(int) git_revert_init_options(git_revert_options *opts, unsigned int version);
558GIT_EXTERN(int) git_stash_apply_init_options(git_stash_apply_options *opts, unsigned int version);
559GIT_EXTERN(int) git_status_init_options(git_status_options *opts, unsigned int version);
560GIT_EXTERN(int) git_submodule_update_init_options(git_submodule_update_options *opts, unsigned int version);
561GIT_EXTERN(int) git_worktree_add_init_options(git_worktree_add_options *opts, unsigned int version);
562GIT_EXTERN(int) git_worktree_prune_init_options(git_worktree_prune_options *opts, unsigned int version);
563
ac3d33df
JK
564/**@}*/
565
566/** @} */
567GIT_END_DECL
568
569#endif
570
571#endif