]> git.proxmox.com Git - libgit2.git/blob - include/git2/deprecated.h
37b9fa0e2f1549bb64a83f6dc551a29715676b77
[libgit2.git] / include / git2 / deprecated.h
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
10 #include "attr.h"
11 #include "config.h"
12 #include "common.h"
13 #include "blame.h"
14 #include "buffer.h"
15 #include "checkout.h"
16 #include "cherrypick.h"
17 #include "clone.h"
18 #include "describe.h"
19 #include "diff.h"
20 #include "errors.h"
21 #include "filter.h"
22 #include "index.h"
23 #include "indexer.h"
24 #include "merge.h"
25 #include "object.h"
26 #include "proxy.h"
27 #include "refs.h"
28 #include "rebase.h"
29 #include "remote.h"
30 #include "trace.h"
31 #include "repository.h"
32 #include "revert.h"
33 #include "revparse.h"
34 #include "stash.h"
35 #include "status.h"
36 #include "submodule.h"
37 #include "worktree.h"
38 #include "credential.h"
39 #include "credential_helpers.h"
40
41 /*
42 * Users can avoid deprecated functions by defining `GIT_DEPRECATE_HARD`.
43 */
44 #ifndef GIT_DEPRECATE_HARD
45
46 /*
47 * The credential structures are now opaque by default, and their
48 * definition has moved into the `sys/credential.h` header; include
49 * them here for backward compatibility.
50 */
51 #include "sys/credential.h"
52
53 /**
54 * @file git2/deprecated.h
55 * @brief libgit2 deprecated functions and values
56 * @ingroup Git
57 * @{
58 */
59 GIT_BEGIN_DECL
60
61 /** @name Deprecated Attribute Constants
62 *
63 * These enumeration values are retained for backward compatibility.
64 * The newer versions of these functions should be preferred in all
65 * new code.
66 *
67 * There is no plan to remove these backward compatibility values at
68 * this time.
69 */
70 /**@{*/
71
72 #define GIT_ATTR_UNSPECIFIED_T GIT_ATTR_VALUE_UNSPECIFIED
73 #define GIT_ATTR_TRUE_T GIT_ATTR_VALUE_TRUE
74 #define GIT_ATTR_FALSE_T GIT_ATTR_VALUE_FALSE
75 #define GIT_ATTR_VALUE_T GIT_ATTR_VALUE_STRING
76
77 #define GIT_ATTR_TRUE(attr) GIT_ATTR_IS_TRUE(attr)
78 #define GIT_ATTR_FALSE(attr) GIT_ATTR_IS_FALSE(attr)
79 #define GIT_ATTR_UNSPECIFIED(attr) GIT_ATTR_IS_UNSPECIFIED(attr)
80
81 typedef git_attr_value_t git_attr_t;
82
83 /**@}*/
84
85 /** @name Deprecated Blob Functions and Constants
86 *
87 * These functions and enumeration values are retained for backward
88 * compatibility. The newer versions of these functions and values
89 * should be preferred in all new code.
90 *
91 * There is no plan to remove these backward compatibility values at
92 * this time.
93 */
94 /**@{*/
95
96 #define GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD
97
98 GIT_EXTERN(int) git_blob_create_fromworkdir(git_oid *id, git_repository *repo, const char *relative_path);
99 GIT_EXTERN(int) git_blob_create_fromdisk(git_oid *id, git_repository *repo, const char *path);
100 GIT_EXTERN(int) git_blob_create_fromstream(
101 git_writestream **out,
102 git_repository *repo,
103 const char *hintpath);
104 GIT_EXTERN(int) git_blob_create_fromstream_commit(
105 git_oid *out,
106 git_writestream *stream);
107 GIT_EXTERN(int) git_blob_create_frombuffer(
108 git_oid *id, git_repository *repo, const void *buffer, size_t len);
109
110 /** Deprecated in favor of `git_blob_filter`.
111 *
112 * @deprecated Use git_blob_filter
113 * @see git_blob_filter
114 */
115 GIT_EXTERN(int) git_blob_filtered_content(
116 git_buf *out,
117 git_blob *blob,
118 const char *as_path,
119 int check_for_binary_data);
120
121 /**@}*/
122
123 /** @name Deprecated Filter Functions
124 *
125 * These functions are retained for backward compatibility. The
126 * newer versions of these functions should be preferred in all
127 * new code.
128 *
129 * There is no plan to remove these backward compatibility values at
130 * this time.
131 */
132 /**@{*/
133
134 /** Deprecated in favor of `git_filter_list_stream_buffer`.
135 *
136 * @deprecated Use git_filter_list_stream_buffer
137 * @see Use git_filter_list_stream_buffer
138 */
139 GIT_EXTERN(int) git_filter_list_stream_data(
140 git_filter_list *filters,
141 git_buf *data,
142 git_writestream *target);
143
144 /** Deprecated in favor of `git_filter_list_apply_to_buffer`.
145 *
146 * @deprecated Use git_filter_list_apply_to_buffer
147 * @see Use git_filter_list_apply_to_buffer
148 */
149 GIT_EXTERN(int) git_filter_list_apply_to_data(
150 git_buf *out,
151 git_filter_list *filters,
152 git_buf *in);
153
154 /**@}*/
155
156 /** @name Deprecated Tree Functions
157 *
158 * These functions are retained for backward compatibility. The
159 * newer versions of these functions and values should be preferred
160 * in all new code.
161 *
162 * There is no plan to remove these backward compatibility values at
163 * this time.
164 */
165 /**@{*/
166
167 /**
168 * Write the contents of the tree builder as a tree object.
169 * This is an alias of `git_treebuilder_write` and is preserved
170 * for backward compatibility.
171 *
172 * This function is deprecated, but there is no plan to remove this
173 * function at this time.
174 *
175 * @deprecated Use git_treebuilder_write
176 * @see git_treebuilder_write
177 */
178 GIT_EXTERN(int) git_treebuilder_write_with_buffer(
179 git_oid *oid, git_treebuilder *bld, git_buf *tree);
180
181 /**@}*/
182
183 /** @name Deprecated Buffer Functions
184 *
185 * These functions and enumeration values are retained for backward
186 * compatibility. The newer versions of these functions should be
187 * preferred in all new code.
188 *
189 * There is no plan to remove these backward compatibility values at
190 * this time.
191 */
192 /**@{*/
193
194 /**
195 * Static initializer for git_buf from static buffer
196 */
197 #define GIT_BUF_INIT_CONST(STR,LEN) { (char *)(STR), 0, (size_t)(LEN) }
198
199 /**
200 * Resize the buffer allocation to make more space.
201 *
202 * This will attempt to grow the buffer to accommodate the target size.
203 *
204 * If the buffer refers to memory that was not allocated by libgit2 (i.e.
205 * the `asize` field is zero), then `ptr` will be replaced with a newly
206 * allocated block of data. Be careful so that memory allocated by the
207 * caller is not lost. As a special variant, if you pass `target_size` as
208 * 0 and the memory is not allocated by libgit2, this will allocate a new
209 * buffer of size `size` and copy the external data into it.
210 *
211 * Currently, this will never shrink a buffer, only expand it.
212 *
213 * If the allocation fails, this will return an error and the buffer will be
214 * marked as invalid for future operations, invaliding the contents.
215 *
216 * @param buffer The buffer to be resized; may or may not be allocated yet
217 * @param target_size The desired available size
218 * @return 0 on success, -1 on allocation failure
219 */
220 GIT_EXTERN(int) git_buf_grow(git_buf *buffer, size_t target_size);
221
222 /**
223 * Set buffer to a copy of some raw data.
224 *
225 * @param buffer The buffer to set
226 * @param data The data to copy into the buffer
227 * @param datalen The length of the data to copy into the buffer
228 * @return 0 on success, -1 on allocation failure
229 */
230 GIT_EXTERN(int) git_buf_set(
231 git_buf *buffer, const void *data, size_t datalen);
232
233 /**
234 * Check quickly if buffer looks like it contains binary data
235 *
236 * @param buf Buffer to check
237 * @return 1 if buffer looks like non-text data
238 */
239 GIT_EXTERN(int) git_buf_is_binary(const git_buf *buf);
240
241 /**
242 * Check quickly if buffer contains a NUL byte
243 *
244 * @param buf Buffer to check
245 * @return 1 if buffer contains a NUL byte
246 */
247 GIT_EXTERN(int) git_buf_contains_nul(const git_buf *buf);
248
249 /**
250 * Free the memory referred to by the git_buf. This is an alias of
251 * `git_buf_dispose` and is preserved for backward compatibility.
252 *
253 * This function is deprecated, but there is no plan to remove this
254 * function at this time.
255 *
256 * @deprecated Use git_buf_dispose
257 * @see git_buf_dispose
258 */
259 GIT_EXTERN(void) git_buf_free(git_buf *buffer);
260
261 /**@}*/
262
263 /** @name Deprecated Commit Definitions
264 */
265 /**@{*/
266
267 /**
268 * Provide a commit signature during commit creation.
269 *
270 * Callers should instead define a `git_commit_create_cb` that
271 * generates a commit buffer using `git_commit_create_buffer`, sign
272 * that buffer and call `git_commit_create_with_signature`.
273 *
274 * @deprecated use a `git_commit_create_cb` instead
275 */
276 typedef int (*git_commit_signing_cb)(
277 git_buf *signature,
278 git_buf *signature_field,
279 const char *commit_content,
280 void *payload);
281
282 /**@}*/
283
284 /** @name Deprecated Config Functions and Constants
285 */
286 /**@{*/
287
288 #define GIT_CVAR_FALSE GIT_CONFIGMAP_FALSE
289 #define GIT_CVAR_TRUE GIT_CONFIGMAP_TRUE
290 #define GIT_CVAR_INT32 GIT_CONFIGMAP_INT32
291 #define GIT_CVAR_STRING GIT_CONFIGMAP_STRING
292
293 typedef git_configmap git_cvar_map;
294
295 /**@}*/
296
297 /** @name Deprecated Diff Functions and Constants
298 *
299 * These functions and enumeration values are retained for backward
300 * compatibility. The newer versions of these functions and values
301 * should be preferred in all new code.
302 *
303 * There is no plan to remove these backward compatibility values at
304 * this time.
305 */
306 /**@{*/
307
308 /**
309 * Formatting options for diff e-mail generation
310 */
311 typedef enum {
312 /** Normal patch, the default */
313 GIT_DIFF_FORMAT_EMAIL_NONE = 0,
314
315 /** Don't insert "[PATCH]" in the subject header*/
316 GIT_DIFF_FORMAT_EMAIL_EXCLUDE_SUBJECT_PATCH_MARKER = (1 << 0),
317
318 } git_diff_format_email_flags_t;
319
320 /**
321 * Options for controlling the formatting of the generated e-mail.
322 */
323 typedef struct {
324 unsigned int version;
325
326 /** see `git_diff_format_email_flags_t` above */
327 uint32_t flags;
328
329 /** This patch number */
330 size_t patch_no;
331
332 /** Total number of patches in this series */
333 size_t total_patches;
334
335 /** id to use for the commit */
336 const git_oid *id;
337
338 /** Summary of the change */
339 const char *summary;
340
341 /** Commit message's body */
342 const char *body;
343
344 /** Author of the change */
345 const git_signature *author;
346 } git_diff_format_email_options;
347
348 #define GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION 1
349 #define GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT {GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION, 0, 1, 1, NULL, NULL, NULL, NULL}
350
351 /**
352 * Create an e-mail ready patch from a diff.
353 *
354 * @deprecated git_email_create_from_diff
355 * @see git_email_create_from_diff
356 */
357 GIT_EXTERN(int) git_diff_format_email(
358 git_buf *out,
359 git_diff *diff,
360 const git_diff_format_email_options *opts);
361
362 /**
363 * Create an e-mail ready patch for a commit.
364 *
365 * @deprecated git_email_create_from_commit
366 * @see git_email_create_from_commit
367 */
368 GIT_EXTERN(int) git_diff_commit_as_email(
369 git_buf *out,
370 git_repository *repo,
371 git_commit *commit,
372 size_t patch_no,
373 size_t total_patches,
374 uint32_t flags,
375 const git_diff_options *diff_opts);
376
377 /**
378 * Initialize git_diff_format_email_options structure
379 *
380 * Initializes a `git_diff_format_email_options` with default values. Equivalent
381 * to creating an instance with GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT.
382 *
383 * @param opts The `git_blame_options` struct to initialize.
384 * @param version The struct version; pass `GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION`.
385 * @return Zero on success; -1 on failure.
386 */
387 GIT_EXTERN(int) git_diff_format_email_options_init(
388 git_diff_format_email_options *opts,
389 unsigned int version);
390
391 /**@}*/
392
393 /** @name Deprecated Error Functions and Constants
394 *
395 * These functions and enumeration values are retained for backward
396 * compatibility. The newer versions of these functions and values
397 * should be preferred in all new code.
398 *
399 * There is no plan to remove these backward compatibility values at
400 * this time.
401 */
402 /**@{*/
403
404 #define GITERR_NONE GIT_ERROR_NONE
405 #define GITERR_NOMEMORY GIT_ERROR_NOMEMORY
406 #define GITERR_OS GIT_ERROR_OS
407 #define GITERR_INVALID GIT_ERROR_INVALID
408 #define GITERR_REFERENCE GIT_ERROR_REFERENCE
409 #define GITERR_ZLIB GIT_ERROR_ZLIB
410 #define GITERR_REPOSITORY GIT_ERROR_REPOSITORY
411 #define GITERR_CONFIG GIT_ERROR_CONFIG
412 #define GITERR_REGEX GIT_ERROR_REGEX
413 #define GITERR_ODB GIT_ERROR_ODB
414 #define GITERR_INDEX GIT_ERROR_INDEX
415 #define GITERR_OBJECT GIT_ERROR_OBJECT
416 #define GITERR_NET GIT_ERROR_NET
417 #define GITERR_TAG GIT_ERROR_TAG
418 #define GITERR_TREE GIT_ERROR_TREE
419 #define GITERR_INDEXER GIT_ERROR_INDEXER
420 #define GITERR_SSL GIT_ERROR_SSL
421 #define GITERR_SUBMODULE GIT_ERROR_SUBMODULE
422 #define GITERR_THREAD GIT_ERROR_THREAD
423 #define GITERR_STASH GIT_ERROR_STASH
424 #define GITERR_CHECKOUT GIT_ERROR_CHECKOUT
425 #define GITERR_FETCHHEAD GIT_ERROR_FETCHHEAD
426 #define GITERR_MERGE GIT_ERROR_MERGE
427 #define GITERR_SSH GIT_ERROR_SSH
428 #define GITERR_FILTER GIT_ERROR_FILTER
429 #define GITERR_REVERT GIT_ERROR_REVERT
430 #define GITERR_CALLBACK GIT_ERROR_CALLBACK
431 #define GITERR_CHERRYPICK GIT_ERROR_CHERRYPICK
432 #define GITERR_DESCRIBE GIT_ERROR_DESCRIBE
433 #define GITERR_REBASE GIT_ERROR_REBASE
434 #define GITERR_FILESYSTEM GIT_ERROR_FILESYSTEM
435 #define GITERR_PATCH GIT_ERROR_PATCH
436 #define GITERR_WORKTREE GIT_ERROR_WORKTREE
437 #define GITERR_SHA1 GIT_ERROR_SHA1
438
439 /**
440 * Return the last `git_error` object that was generated for the
441 * current thread. This is an alias of `git_error_last` and is
442 * preserved for backward compatibility.
443 *
444 * This function is deprecated, but there is no plan to remove this
445 * function at this time.
446 *
447 * @deprecated Use git_error_last
448 * @see git_error_last
449 */
450 GIT_EXTERN(const git_error *) giterr_last(void);
451
452 /**
453 * Clear the last error. This is an alias of `git_error_last` and is
454 * preserved for backward compatibility.
455 *
456 * This function is deprecated, but there is no plan to remove this
457 * function at this time.
458 *
459 * @deprecated Use git_error_clear
460 * @see git_error_clear
461 */
462 GIT_EXTERN(void) giterr_clear(void);
463
464 /**
465 * Sets the error message to the given string. This is an alias of
466 * `git_error_set_str` and is preserved for backward compatibility.
467 *
468 * This function is deprecated, but there is no plan to remove this
469 * function at this time.
470 *
471 * @deprecated Use git_error_set_str
472 * @see git_error_set_str
473 */
474 GIT_EXTERN(void) giterr_set_str(int error_class, const char *string);
475
476 /**
477 * Indicates that an out-of-memory situation occurred. This is an alias
478 * of `git_error_set_oom` and is preserved for backward compatibility.
479 *
480 * This function is deprecated, but there is no plan to remove this
481 * function at this time.
482 *
483 * @deprecated Use git_error_set_oom
484 * @see git_error_set_oom
485 */
486 GIT_EXTERN(void) giterr_set_oom(void);
487
488 /**@}*/
489
490 /** @name Deprecated Index Functions and Constants
491 *
492 * These functions and enumeration values are retained for backward
493 * compatibility. The newer versions of these values should be
494 * preferred in all new code.
495 *
496 * There is no plan to remove these backward compatibility values at
497 * this time.
498 */
499 /**@{*/
500
501 #define GIT_IDXENTRY_NAMEMASK GIT_INDEX_ENTRY_NAMEMASK
502 #define GIT_IDXENTRY_STAGEMASK GIT_INDEX_ENTRY_STAGEMASK
503 #define GIT_IDXENTRY_STAGESHIFT GIT_INDEX_ENTRY_STAGESHIFT
504
505 /* The git_indxentry_flag_t enum */
506 #define GIT_IDXENTRY_EXTENDED GIT_INDEX_ENTRY_EXTENDED
507 #define GIT_IDXENTRY_VALID GIT_INDEX_ENTRY_VALID
508
509 #define GIT_IDXENTRY_STAGE(E) GIT_INDEX_ENTRY_STAGE(E)
510 #define GIT_IDXENTRY_STAGE_SET(E,S) GIT_INDEX_ENTRY_STAGE_SET(E,S)
511
512 /* The git_idxentry_extended_flag_t enum */
513 #define GIT_IDXENTRY_INTENT_TO_ADD GIT_INDEX_ENTRY_INTENT_TO_ADD
514 #define GIT_IDXENTRY_SKIP_WORKTREE GIT_INDEX_ENTRY_SKIP_WORKTREE
515 #define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_INDEX_ENTRY_INTENT_TO_ADD | GIT_INDEX_ENTRY_SKIP_WORKTREE)
516 #define GIT_IDXENTRY_EXTENDED2 (1 << 15)
517 #define GIT_IDXENTRY_UPDATE (1 << 0)
518 #define GIT_IDXENTRY_REMOVE (1 << 1)
519 #define GIT_IDXENTRY_UPTODATE (1 << 2)
520 #define GIT_IDXENTRY_ADDED (1 << 3)
521 #define GIT_IDXENTRY_HASHED (1 << 4)
522 #define GIT_IDXENTRY_UNHASHED (1 << 5)
523 #define GIT_IDXENTRY_WT_REMOVE (1 << 6)
524 #define GIT_IDXENTRY_CONFLICTED (1 << 7)
525 #define GIT_IDXENTRY_UNPACKED (1 << 8)
526 #define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
527
528 /* The git_index_capability_t enum */
529 #define GIT_INDEXCAP_IGNORE_CASE GIT_INDEX_CAPABILITY_IGNORE_CASE
530 #define GIT_INDEXCAP_NO_FILEMODE GIT_INDEX_CAPABILITY_NO_FILEMODE
531 #define GIT_INDEXCAP_NO_SYMLINKS GIT_INDEX_CAPABILITY_NO_SYMLINKS
532 #define GIT_INDEXCAP_FROM_OWNER GIT_INDEX_CAPABILITY_FROM_OWNER
533
534 GIT_EXTERN(int) git_index_add_frombuffer(
535 git_index *index,
536 const git_index_entry *entry,
537 const void *buffer, size_t len);
538
539 /**@}*/
540
541 /** @name Deprecated Object Constants
542 *
543 * These enumeration values are retained for backward compatibility. The
544 * newer versions of these values should be preferred in all new code.
545 *
546 * There is no plan to remove these backward compatibility values at
547 * this time.
548 */
549 /**@{*/
550
551 #define git_otype git_object_t
552
553 #define GIT_OBJ_ANY GIT_OBJECT_ANY
554 #define GIT_OBJ_BAD GIT_OBJECT_INVALID
555 #define GIT_OBJ__EXT1 0
556 #define GIT_OBJ_COMMIT GIT_OBJECT_COMMIT
557 #define GIT_OBJ_TREE GIT_OBJECT_TREE
558 #define GIT_OBJ_BLOB GIT_OBJECT_BLOB
559 #define GIT_OBJ_TAG GIT_OBJECT_TAG
560 #define GIT_OBJ__EXT2 5
561 #define GIT_OBJ_OFS_DELTA GIT_OBJECT_OFS_DELTA
562 #define GIT_OBJ_REF_DELTA GIT_OBJECT_REF_DELTA
563
564 /**
565 * Get the size in bytes for the structure which
566 * acts as an in-memory representation of any given
567 * object type.
568 *
569 * For all the core types, this would the equivalent
570 * of calling `sizeof(git_commit)` if the core types
571 * were not opaque on the external API.
572 *
573 * @param type object type to get its size
574 * @return size in bytes of the object
575 */
576 GIT_EXTERN(size_t) git_object__size(git_object_t type);
577
578 /**@}*/
579
580 /** @name Deprecated Remote Functions
581 *
582 * These functions are retained for backward compatibility. The newer
583 * versions of these functions should be preferred in all new code.
584 *
585 * There is no plan to remove these backward compatibility functions at
586 * this time.
587 */
588 /**@{*/
589
590 /**
591 * Ensure the remote name is well-formed.
592 *
593 * @deprecated Use git_remote_name_is_valid
594 * @param remote_name name to be checked.
595 * @return 1 if the reference name is acceptable; 0 if it isn't
596 */
597 GIT_EXTERN(int) git_remote_is_valid_name(const char *remote_name);
598
599 /**@}*/
600
601 /** @name Deprecated Reference Functions and Constants
602 *
603 * These functions and enumeration values are retained for backward
604 * compatibility. The newer versions of these values should be
605 * preferred in all new code.
606 *
607 * There is no plan to remove these backward compatibility values at
608 * this time.
609 */
610 /**@{*/
611
612 /** Basic type of any Git reference. */
613 #define git_ref_t git_reference_t
614 #define git_reference_normalize_t git_reference_format_t
615
616 #define GIT_REF_INVALID GIT_REFERENCE_INVALID
617 #define GIT_REF_OID GIT_REFERENCE_DIRECT
618 #define GIT_REF_SYMBOLIC GIT_REFERENCE_SYMBOLIC
619 #define GIT_REF_LISTALL GIT_REFERENCE_ALL
620
621 #define GIT_REF_FORMAT_NORMAL GIT_REFERENCE_FORMAT_NORMAL
622 #define GIT_REF_FORMAT_ALLOW_ONELEVEL GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL
623 #define GIT_REF_FORMAT_REFSPEC_PATTERN GIT_REFERENCE_FORMAT_REFSPEC_PATTERN
624 #define GIT_REF_FORMAT_REFSPEC_SHORTHAND GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND
625
626 /**
627 * Ensure the reference name is well-formed.
628 *
629 * Valid reference names must follow one of two patterns:
630 *
631 * 1. Top-level names must contain only capital letters and underscores,
632 * and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
633 * 2. Names prefixed with "refs/" can be almost anything. You must avoid
634 * the characters '~', '^', ':', '\\', '?', '[', and '*', and the
635 * sequences ".." and "@{" which have special meaning to revparse.
636 *
637 * @deprecated Use git_reference_name_is_valid
638 * @param refname name to be checked.
639 * @return 1 if the reference name is acceptable; 0 if it isn't
640 */
641 GIT_EXTERN(int) git_reference_is_valid_name(const char *refname);
642
643 GIT_EXTERN(int) git_tag_create_frombuffer(
644 git_oid *oid,
645 git_repository *repo,
646 const char *buffer,
647 int force);
648
649 /**@}*/
650
651 /** @name Deprecated Revspec Constants
652 *
653 * These enumeration values are retained for backward compatibility.
654 * The newer versions of these values should be preferred in all new
655 * code.
656 *
657 * There is no plan to remove these backward compatibility values at
658 * this time.
659 */
660 /**@{*/
661
662 typedef git_revspec_t git_revparse_mode_t;
663
664 #define GIT_REVPARSE_SINGLE GIT_REVSPEC_SINGLE
665 #define GIT_REVPARSE_RANGE GIT_REVSPEC_RANGE
666 #define GIT_REVPARSE_MERGE_BASE GIT_REVSPEC_MERGE_BASE
667
668 /**@}*/
669
670 /** @name Deprecated Credential Types
671 *
672 * These types are retained for backward compatibility. The newer
673 * versions of these values should be preferred in all new code.
674 *
675 * There is no plan to remove these backward compatibility values at
676 * this time.
677 */
678 /**@{*/
679
680 typedef git_credential git_cred;
681 typedef git_credential_userpass_plaintext git_cred_userpass_plaintext;
682 typedef git_credential_username git_cred_username;
683 typedef git_credential_default git_cred_default;
684 typedef git_credential_ssh_key git_cred_ssh_key;
685 typedef git_credential_ssh_interactive git_cred_ssh_interactive;
686 typedef git_credential_ssh_custom git_cred_ssh_custom;
687
688 typedef git_credential_acquire_cb git_cred_acquire_cb;
689 typedef git_credential_sign_cb git_cred_sign_callback;
690 typedef git_credential_sign_cb git_cred_sign_cb;
691 typedef git_credential_ssh_interactive_cb git_cred_ssh_interactive_callback;
692 typedef git_credential_ssh_interactive_cb git_cred_ssh_interactive_cb;
693
694 #define git_credtype_t git_credential_t
695
696 #define GIT_CREDTYPE_USERPASS_PLAINTEXT GIT_CREDENTIAL_USERPASS_PLAINTEXT
697 #define GIT_CREDTYPE_SSH_KEY GIT_CREDENTIAL_SSH_KEY
698 #define GIT_CREDTYPE_SSH_CUSTOM GIT_CREDENTIAL_SSH_CUSTOM
699 #define GIT_CREDTYPE_DEFAULT GIT_CREDENTIAL_DEFAULT
700 #define GIT_CREDTYPE_SSH_INTERACTIVE GIT_CREDENTIAL_SSH_INTERACTIVE
701 #define GIT_CREDTYPE_USERNAME GIT_CREDENTIAL_USERNAME
702 #define GIT_CREDTYPE_SSH_MEMORY GIT_CREDENTIAL_SSH_MEMORY
703
704 GIT_EXTERN(void) git_cred_free(git_credential *cred);
705 GIT_EXTERN(int) git_cred_has_username(git_credential *cred);
706 GIT_EXTERN(const char *) git_cred_get_username(git_credential *cred);
707 GIT_EXTERN(int) git_cred_userpass_plaintext_new(
708 git_credential **out,
709 const char *username,
710 const char *password);
711 GIT_EXTERN(int) git_cred_default_new(git_credential **out);
712 GIT_EXTERN(int) git_cred_username_new(git_credential **out, const char *username);
713 GIT_EXTERN(int) git_cred_ssh_key_new(
714 git_credential **out,
715 const char *username,
716 const char *publickey,
717 const char *privatekey,
718 const char *passphrase);
719 GIT_EXTERN(int) git_cred_ssh_key_memory_new(
720 git_credential **out,
721 const char *username,
722 const char *publickey,
723 const char *privatekey,
724 const char *passphrase);
725 GIT_EXTERN(int) git_cred_ssh_interactive_new(
726 git_credential **out,
727 const char *username,
728 git_credential_ssh_interactive_cb prompt_callback,
729 void *payload);
730 GIT_EXTERN(int) git_cred_ssh_key_from_agent(
731 git_credential **out,
732 const char *username);
733 GIT_EXTERN(int) git_cred_ssh_custom_new(
734 git_credential **out,
735 const char *username,
736 const char *publickey,
737 size_t publickey_len,
738 git_credential_sign_cb sign_callback,
739 void *payload);
740
741 /* Deprecated Credential Helper Types */
742
743 typedef git_credential_userpass_payload git_cred_userpass_payload;
744
745 GIT_EXTERN(int) git_cred_userpass(
746 git_credential **out,
747 const char *url,
748 const char *user_from_url,
749 unsigned int allowed_types,
750 void *payload);
751
752 /**@}*/
753
754 /** @name Deprecated Trace Callback Types
755 *
756 * These types are retained for backward compatibility. The newer
757 * versions of these values should be preferred in all new code.
758 *
759 * There is no plan to remove these backward compatibility values at
760 * this time.
761 */
762 /**@{*/
763
764 typedef git_trace_cb git_trace_callback;
765
766 /**@}*/
767
768 /** @name Deprecated Object ID Types
769 *
770 * These types are retained for backward compatibility. The newer
771 * versions of these values should be preferred in all new code.
772 *
773 * There is no plan to remove these backward compatibility values at
774 * this time.
775 */
776 /**@{*/
777
778 GIT_EXTERN(int) git_oid_iszero(const git_oid *id);
779
780 /**@}*/
781
782 /** @name Deprecated OID Array Functions
783 *
784 * These types are retained for backward compatibility. The newer
785 * versions of these values should be preferred in all new code.
786 *
787 * There is no plan to remove these backward compatibility values at
788 * this time.
789 */
790 /**@{*/
791
792 /**
793 * Free the memory referred to by the git_oidarray. This is an alias of
794 * `git_oidarray_dispose` and is preserved for backward compatibility.
795 *
796 * This function is deprecated, but there is no plan to remove this
797 * function at this time.
798 *
799 * @deprecated Use git_oidarray_dispose
800 * @see git_oidarray_dispose
801 */
802 GIT_EXTERN(void) git_oidarray_free(git_oidarray *array);
803
804 /**@}*/
805
806 /** @name Deprecated Transfer Progress Types
807 *
808 * These types are retained for backward compatibility. The newer
809 * versions of these values should be preferred in all new code.
810 *
811 * There is no plan to remove these backward compatibility values at
812 * this time.
813 */
814 /**@{*/
815
816 /**
817 * This structure is used to provide callers information about the
818 * progress of indexing a packfile.
819 *
820 * This type is deprecated, but there is no plan to remove this
821 * type definition at this time.
822 */
823 typedef git_indexer_progress git_transfer_progress;
824
825 /**
826 * Type definition for progress callbacks during indexing.
827 *
828 * This type is deprecated, but there is no plan to remove this
829 * type definition at this time.
830 */
831 typedef git_indexer_progress_cb git_transfer_progress_cb;
832
833 /**
834 * Type definition for push transfer progress callbacks.
835 *
836 * This type is deprecated, but there is no plan to remove this
837 * type definition at this time.
838 */
839 typedef git_push_transfer_progress_cb git_push_transfer_progress;
840
841 /** The type of a remote completion event */
842 #define git_remote_completion_type git_remote_completion_t
843
844 /**
845 * Callback for listing the remote heads
846 */
847 typedef int GIT_CALLBACK(git_headlist_cb)(git_remote_head *rhead, void *payload);
848
849 /**@}*/
850
851 /** @name Deprecated String Array Functions
852 *
853 * These types are retained for backward compatibility. The newer
854 * versions of these values should be preferred in all new code.
855 *
856 * There is no plan to remove these backward compatibility values at
857 * this time.
858 */
859 /**@{*/
860
861 /**
862 * Copy a string array object from source to target.
863 *
864 * This function is deprecated, but there is no plan to remove this
865 * function at this time.
866 *
867 * @param tgt target
868 * @param src source
869 * @return 0 on success, < 0 on allocation failure
870 */
871 GIT_EXTERN(int) git_strarray_copy(git_strarray *tgt, const git_strarray *src);
872
873 /**
874 * Free the memory referred to by the git_strarray. This is an alias of
875 * `git_strarray_dispose` and is preserved for backward compatibility.
876 *
877 * This function is deprecated, but there is no plan to remove this
878 * function at this time.
879 *
880 * @deprecated Use git_strarray_dispose
881 * @see git_strarray_dispose
882 */
883 GIT_EXTERN(void) git_strarray_free(git_strarray *array);
884
885 /**@}*/
886
887 /** @name Deprecated Options Initialization Functions
888 *
889 * These functions are retained for backward compatibility. The newer
890 * versions of these functions should be preferred in all new code.
891 *
892 * There is no plan to remove these backward compatibility functions at
893 * this time.
894 */
895 /**@{*/
896
897 GIT_EXTERN(int) git_blame_init_options(git_blame_options *opts, unsigned int version);
898 GIT_EXTERN(int) git_checkout_init_options(git_checkout_options *opts, unsigned int version);
899 GIT_EXTERN(int) git_cherrypick_init_options(git_cherrypick_options *opts, unsigned int version);
900 GIT_EXTERN(int) git_clone_init_options(git_clone_options *opts, unsigned int version);
901 GIT_EXTERN(int) git_describe_init_options(git_describe_options *opts, unsigned int version);
902 GIT_EXTERN(int) git_describe_init_format_options(git_describe_format_options *opts, unsigned int version);
903 GIT_EXTERN(int) git_diff_init_options(git_diff_options *opts, unsigned int version);
904 GIT_EXTERN(int) git_diff_find_init_options(git_diff_find_options *opts, unsigned int version);
905 GIT_EXTERN(int) git_diff_format_email_init_options(git_diff_format_email_options *opts, unsigned int version);
906 GIT_EXTERN(int) git_diff_patchid_init_options(git_diff_patchid_options *opts, unsigned int version);
907 GIT_EXTERN(int) git_fetch_init_options(git_fetch_options *opts, unsigned int version);
908 GIT_EXTERN(int) git_indexer_init_options(git_indexer_options *opts, unsigned int version);
909 GIT_EXTERN(int) git_merge_init_options(git_merge_options *opts, unsigned int version);
910 GIT_EXTERN(int) git_merge_file_init_input(git_merge_file_input *input, unsigned int version);
911 GIT_EXTERN(int) git_merge_file_init_options(git_merge_file_options *opts, unsigned int version);
912 GIT_EXTERN(int) git_proxy_init_options(git_proxy_options *opts, unsigned int version);
913 GIT_EXTERN(int) git_push_init_options(git_push_options *opts, unsigned int version);
914 GIT_EXTERN(int) git_rebase_init_options(git_rebase_options *opts, unsigned int version);
915 GIT_EXTERN(int) git_remote_create_init_options(git_remote_create_options *opts, unsigned int version);
916 GIT_EXTERN(int) git_repository_init_init_options(git_repository_init_options *opts, unsigned int version);
917 GIT_EXTERN(int) git_revert_init_options(git_revert_options *opts, unsigned int version);
918 GIT_EXTERN(int) git_stash_apply_init_options(git_stash_apply_options *opts, unsigned int version);
919 GIT_EXTERN(int) git_status_init_options(git_status_options *opts, unsigned int version);
920 GIT_EXTERN(int) git_submodule_update_init_options(git_submodule_update_options *opts, unsigned int version);
921 GIT_EXTERN(int) git_worktree_add_init_options(git_worktree_add_options *opts, unsigned int version);
922 GIT_EXTERN(int) git_worktree_prune_init_options(git_worktree_prune_options *opts, unsigned int version);
923
924 /**@}*/
925
926 /** @} */
927 GIT_END_DECL
928
929 #endif
930
931 #endif