2 * Copyright (C) the libgit2 contributors. All rights reserved.
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.
7 #ifndef INCLUDE_git_deprecated_h__
8 #define INCLUDE_git_deprecated_h__
16 #include "cherrypick.h"
30 #include "repository.h"
34 #include "submodule.h"
36 #include "credential.h"
37 #include "credential_helpers.h"
40 * Users can avoid deprecated functions by defining `GIT_DEPRECATE_HARD`.
42 #ifndef GIT_DEPRECATE_HARD
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.
49 #include "sys/credential.h"
52 * @file git2/deprecated.h
53 * @brief libgit2 deprecated functions and values
59 /** @name Deprecated Attribute Constants
61 * These enumeration values are retained for backward compatibility.
62 * The newer versions of these functions should be preferred in all
65 * There is no plan to remove these backward compatibility values at
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
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)
79 typedef git_attr_value_t git_attr_t
;
83 /** @name Deprecated Blob Functions
85 * These functions are retained for backward compatibility. The newer
86 * versions of these functions should be preferred in all new code.
88 * There is no plan to remove these backward compatibility values at
93 GIT_EXTERN(int) git_blob_create_fromworkdir(git_oid
*id
, git_repository
*repo
, const char *relative_path
);
94 GIT_EXTERN(int) git_blob_create_fromdisk(git_oid
*id
, git_repository
*repo
, const char *path
);
95 GIT_EXTERN(int) git_blob_create_fromstream(
96 git_writestream
**out
,
98 const char *hintpath
);
99 GIT_EXTERN(int) git_blob_create_fromstream_commit(
101 git_writestream
*stream
);
102 GIT_EXTERN(int) git_blob_create_frombuffer(
103 git_oid
*id
, git_repository
*repo
, const void *buffer
, size_t len
);
105 /** Deprecated in favor of @see git_blob_filter */
106 GIT_EXTERN(int) git_blob_filtered_content(
110 int check_for_binary_data
);
114 /** @name Deprecated Buffer Functions
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.
120 * There is no plan to remove these backward compatibility values at
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.
129 * This function is deprecated, but there is no plan to remove this
130 * function at this time.
132 * @deprecated Use git_buf_dispose
133 * @see git_buf_dispose
135 GIT_EXTERN(void) git_buf_free(git_buf
*buffer
);
139 /** @name Deprecated Config Functions and Constants
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
148 typedef git_configmap git_cvar_map
;
152 /** @name Deprecated Error Functions and Constants
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.
158 * There is no plan to remove these backward compatibility values at
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
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.
203 * This function is deprecated, but there is no plan to remove this
204 * function at this time.
206 * @deprecated Use git_error_last
207 * @see git_error_last
209 GIT_EXTERN(const git_error
*) giterr_last(void);
212 * Clear the last error. This is an alias of `git_error_last` and is
213 * preserved for backward compatibility.
215 * This function is deprecated, but there is no plan to remove this
216 * function at this time.
218 * @deprecated Use git_error_clear
219 * @see git_error_clear
221 GIT_EXTERN(void) giterr_clear(void);
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.
227 * This function is deprecated, but there is no plan to remove this
228 * function at this time.
230 * @deprecated Use git_error_set_str
231 * @see git_error_set_str
233 GIT_EXTERN(void) giterr_set_str(int error_class
, const char *string
);
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.
239 * This function is deprecated, but there is no plan to remove this
240 * function at this time.
242 * @deprecated Use git_error_set_oom
243 * @see git_error_set_oom
245 GIT_EXTERN(void) giterr_set_oom(void);
249 /** @name Deprecated Index Functions and Constants
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.
255 * There is no plan to remove these backward compatibility values at
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
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
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)
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)
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
293 GIT_EXTERN(int) git_index_add_frombuffer(
295 const git_index_entry
*entry
,
296 const void *buffer
, size_t len
);
300 /** @name Deprecated Object Constants
302 * These enumeration values are retained for backward compatibility. The
303 * newer versions of these values should be preferred in all new code.
305 * There is no plan to remove these backward compatibility values at
310 #define git_otype git_object_t
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
324 * Get the size in bytes for the structure which
325 * acts as an in-memory representation of any given
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.
332 * @param type object type to get its size
333 * @return size in bytes of the object
335 GIT_EXTERN(size_t) git_object__size(git_object_t type
);
339 /** @name Deprecated Reference Constants
341 * These enumeration values are retained for backward compatibility. The
342 * newer versions of these values should be preferred in all new code.
344 * There is no plan to remove these backward compatibility values at
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
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
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
363 GIT_EXTERN(int) git_tag_create_frombuffer(
365 git_repository
*repo
,
371 /** @name Deprecated Credential Types
373 * These types are retained for backward compatibility. The newer
374 * versions of these values should be preferred in all new code.
376 * There is no plan to remove these backward compatibility values at
380 typedef git_credential git_cred
;
381 typedef git_credential_userpass_plaintext git_cred_userpass_plaintext
;
382 typedef git_credential_username git_cred_username
;
383 typedef git_credential_default git_cred_default
;
384 typedef git_credential_ssh_key git_cred_ssh_key
;
385 typedef git_credential_ssh_interactive git_cred_ssh_interactive
;
386 typedef git_credential_ssh_custom git_cred_ssh_custom
;
388 typedef git_credential_acquire_cb git_cred_acquire_cb
;
389 typedef git_credential_sign_cb git_cred_sign_callback
;
390 typedef git_credential_sign_cb git_cred_sign_cb
;
391 typedef git_credential_ssh_interactive_cb git_cred_ssh_interactive_callback
;
392 typedef git_credential_ssh_interactive_cb git_cred_ssh_interactive_cb
;
394 #define git_credtype_t git_credential_t
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
404 GIT_EXTERN(void) git_cred_free(git_credential
*cred
);
405 GIT_EXTERN(int) git_cred_has_username(git_credential
*cred
);
406 GIT_EXTERN(const char *) git_cred_get_username(git_credential
*cred
);
407 GIT_EXTERN(int) git_cred_userpass_plaintext_new(
408 git_credential
**out
,
409 const char *username
,
410 const char *password
);
411 GIT_EXTERN(int) git_cred_default_new(git_credential
**out
);
412 GIT_EXTERN(int) git_cred_username_new(git_credential
**out
, const char *username
);
413 GIT_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
);
419 GIT_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
);
425 GIT_EXTERN(int) git_cred_ssh_interactive_new(
426 git_credential
**out
,
427 const char *username
,
428 git_credential_ssh_interactive_cb prompt_callback
,
430 GIT_EXTERN(int) git_cred_ssh_key_from_agent(
431 git_credential
**out
,
432 const char *username
);
433 GIT_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
,
441 /* Deprecated Credential Helper Types */
443 typedef git_credential_userpass_payload git_cred_userpass_payload
;
445 GIT_EXTERN(int) git_cred_userpass(
446 git_credential
**out
,
448 const char *user_from_url
,
449 unsigned int allowed_types
,
454 /** @name Deprecated Trace Callback Types
456 * These types are retained for backward compatibility. The newer
457 * versions of these values should be preferred in all new code.
459 * There is no plan to remove these backward compatibility values at
464 typedef git_trace_cb git_trace_callback
;
468 /** @name Deprecated Object ID Types
470 * These types are retained for backward compatibility. The newer
471 * versions of these values should be preferred in all new code.
473 * There is no plan to remove these backward compatibility values at
478 GIT_EXTERN(int) git_oid_iszero(const git_oid
*id
);
482 /** @name Deprecated Transfer Progress Types
484 * These types are retained for backward compatibility. The newer
485 * versions of these values should be preferred in all new code.
487 * There is no plan to remove these backward compatibility values at
493 * This structure is used to provide callers information about the
494 * progress of indexing a packfile.
496 * This type is deprecated, but there is no plan to remove this
497 * type definition at this time.
499 typedef git_indexer_progress git_transfer_progress
;
502 * Type definition for progress callbacks during indexing.
504 * This type is deprecated, but there is no plan to remove this
505 * type definition at this time.
507 typedef git_indexer_progress_cb git_transfer_progress_cb
;
510 * Type definition for push transfer progress callbacks.
512 * This type is deprecated, but there is no plan to remove this
513 * type definition at this time.
515 typedef git_push_transfer_progress_cb git_push_transfer_progress
;
517 /** The type of a remote completion event */
518 #define git_remote_completion_type git_remote_completion_t
521 * Callback for listing the remote heads
523 typedef int GIT_CALLBACK(git_headlist_cb
)(git_remote_head
*rhead
, void *payload
);
527 /** @name Deprecated Options Initialization Functions
529 * These functions are retained for backward compatibility. The newer
530 * versions of these functions should be preferred in all new code.
532 * There is no plan to remove these backward compatibility functions at
537 GIT_EXTERN(int) git_blame_init_options(git_blame_options
*opts
, unsigned int version
);
538 GIT_EXTERN(int) git_checkout_init_options(git_checkout_options
*opts
, unsigned int version
);
539 GIT_EXTERN(int) git_cherrypick_init_options(git_cherrypick_options
*opts
, unsigned int version
);
540 GIT_EXTERN(int) git_clone_init_options(git_clone_options
*opts
, unsigned int version
);
541 GIT_EXTERN(int) git_describe_init_options(git_describe_options
*opts
, unsigned int version
);
542 GIT_EXTERN(int) git_describe_init_format_options(git_describe_format_options
*opts
, unsigned int version
);
543 GIT_EXTERN(int) git_diff_init_options(git_diff_options
*opts
, unsigned int version
);
544 GIT_EXTERN(int) git_diff_find_init_options(git_diff_find_options
*opts
, unsigned int version
);
545 GIT_EXTERN(int) git_diff_format_email_init_options(git_diff_format_email_options
*opts
, unsigned int version
);
546 GIT_EXTERN(int) git_diff_patchid_init_options(git_diff_patchid_options
*opts
, unsigned int version
);
547 GIT_EXTERN(int) git_fetch_init_options(git_fetch_options
*opts
, unsigned int version
);
548 GIT_EXTERN(int) git_indexer_init_options(git_indexer_options
*opts
, unsigned int version
);
549 GIT_EXTERN(int) git_merge_init_options(git_merge_options
*opts
, unsigned int version
);
550 GIT_EXTERN(int) git_merge_file_init_input(git_merge_file_input
*input
, unsigned int version
);
551 GIT_EXTERN(int) git_merge_file_init_options(git_merge_file_options
*opts
, unsigned int version
);
552 GIT_EXTERN(int) git_proxy_init_options(git_proxy_options
*opts
, unsigned int version
);
553 GIT_EXTERN(int) git_push_init_options(git_push_options
*opts
, unsigned int version
);
554 GIT_EXTERN(int) git_rebase_init_options(git_rebase_options
*opts
, unsigned int version
);
555 GIT_EXTERN(int) git_remote_create_init_options(git_remote_create_options
*opts
, unsigned int version
);
556 GIT_EXTERN(int) git_repository_init_init_options(git_repository_init_options
*opts
, unsigned int version
);
557 GIT_EXTERN(int) git_revert_init_options(git_revert_options
*opts
, unsigned int version
);
558 GIT_EXTERN(int) git_stash_apply_init_options(git_stash_apply_options
*opts
, unsigned int version
);
559 GIT_EXTERN(int) git_status_init_options(git_status_options
*opts
, unsigned int version
);
560 GIT_EXTERN(int) git_submodule_update_init_options(git_submodule_update_options
*opts
, unsigned int version
);
561 GIT_EXTERN(int) git_worktree_add_init_options(git_worktree_add_options
*opts
, unsigned int version
);
562 GIT_EXTERN(int) git_worktree_prune_init_options(git_worktree_prune_options
*opts
, unsigned int version
);