Merge pull request #4952 from libgit2/ethomson/deprecation Deprecate functions and constants more gently
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bc3f07c..eecc22d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -105,6 +105,9 @@ SET(LIBGIT2_VERSION_STRING "${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}.${
FILE(STRINGS "${libgit2_SOURCE_DIR}/include/git2/version.h" GIT2_HEADER_SOVERSION REGEX "^#define LIBGIT2_SOVERSION [0-9]+$")
STRING(REGEX REPLACE "^.*LIBGIT2_SOVERSION ([0-9]+)$" "\\1" LIBGIT2_SOVERSION "${GIT2_HEADER_SOVERSION}")
+# Ensure that we do not use deprecated functions internally
+ADD_DEFINITIONS(-DGIT_DEPRECATE_HARD)
+
# Platform specific compilation flags
IF (MSVC)
IF (STDCALL)
@@ -229,7 +232,6 @@ ELSE ()
ENABLE_WARNINGS(int-conversion)
DISABLE_WARNINGS(documentation-deprecated-sync)
-
IF (PROFILE)
SET(CMAKE_C_FLAGS "-pg ${CMAKE_C_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "-pg ${CMAKE_EXE_LINKER_FLAGS}")
diff --git a/docs/changelog.md b/docs/changelog.md
index 26899a5..f97f048 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -112,22 +112,30 @@ v0.27 + 1
### API removals
-### Breaking API changes
-
* The `git_buf_free` API is deprecated; it has been renamed to
`git_buf_dispose` for consistency. The `git_buf_free` API will be
- removed in a future release.
+ retained for backward compatibility for the foreseeable future.
* The `git_otype` enumeration and its members are deprecated and have
been renamed for consistency. The `GIT_OBJ_` enumeration values are
- now prefixed with `GIT_OBJECT_`. The `git_otype` enumeration will
- be removed in a future release.
+ now prefixed with `GIT_OBJECT_`. The old enumerations and macros
+ will be retained for backward compatibility for the foreseeable future.
* Several index-related APIs have been renamed for consistency. The
`GIT_IDXENTRY_` enumeration values and macros have been renamed to
be prefixed with `GIT_INDEX_ENTRY_`. The `GIT_INDEXCAP` enumeration
values are now prefixed with `GIT_INDEX_CAPABILITY_`. The old
- enumerations and macros will be removed in a future release.
+ enumerations and macros will be retained for backward compatibility
+ for the foreseeable future.
+
+* The error functions and enumeration values have been renamed for
+ consistency. The `giterr_` functions and values prefix have been
+ renamed to be prefixed with `git_error_`; similarly, the `GITERR_`
+ constants have been renamed to be prefixed with `GIT_ERROR_`.
+ The old enumerations and macros will be retained for backward
+ compatibility for the foreseeable future.
+
+### Breaking API changes
* The default checkout strategy changed from `DRY_RUN` to `SAFE` (#4531).
diff --git a/examples/general.c b/examples/general.c
index 0b93a2e..e0f5b5e 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -185,7 +185,7 @@ static void object_database(git_repository *repo, git_oid *oid)
int error;
git_odb_object *obj;
git_odb *odb;
- git_otype otype;
+ git_object_t otype;
git_repository_odb(&odb, repo);
@@ -416,7 +416,7 @@ static void commit_parsing(git_repository *repo)
static void tag_parsing(git_repository *repo)
{
git_commit *commit;
- git_otype type;
+ git_object_t type;
git_tag *tag;
git_oid oid;
const char *name, *message;
diff --git a/fuzzers/objects_fuzzer.c b/fuzzers/objects_fuzzer.c
index a1001ed..1feff77 100644
--- a/fuzzers/objects_fuzzer.c
+++ b/fuzzers/objects_fuzzer.c
@@ -25,7 +25,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
- const git_otype types[] = {
+ const git_object_t types[] = {
GIT_OBJECT_BLOB, GIT_OBJECT_TREE, GIT_OBJECT_COMMIT, GIT_OBJECT_TAG
};
git_object *object = NULL;
diff --git a/include/git2.h b/include/git2.h
index 9239b48..c07c260 100644
--- a/include/git2.h
+++ b/include/git2.h
@@ -21,6 +21,7 @@
#include "git2/commit.h"
#include "git2/common.h"
#include "git2/config.h"
+#include "git2/deprecated.h"
#include "git2/describe.h"
#include "git2/diff.h"
#include "git2/errors.h"
diff --git a/include/git2/buffer.h b/include/git2/buffer.h
index 050afb9..0027678 100644
--- a/include/git2/buffer.h
+++ b/include/git2/buffer.h
@@ -72,18 +72,6 @@ typedef struct {
GIT_EXTERN(void) git_buf_dispose(git_buf *buffer);
/**
- * Alias of `git_buf_dispose`.
- *
- * This function is directly calls `git_buf_dispose` now and is deprecated.
- * Going forward, we refer to functions freeing the internal state of a
- * structure a `dispose` function, while functions freeing the structure
- * themselves will be called a `free` function.
- *
- * This function is going to be removed in v0.30.0.
- */
-GIT_DEPRECATED(GIT_EXTERN(void)) git_buf_free(git_buf *buffer);
-
-/**
* Resize the buffer allocation to make more space.
*
* This will attempt to grow the buffer to accommodate the target size.
diff --git a/include/git2/deprecated.h b/include/git2/deprecated.h
new file mode 100644
index 0000000..9d3a091
--- /dev/null
+++ b/include/git2/deprecated.h
@@ -0,0 +1,253 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+#ifndef INCLUDE_git_deprecated_h__
+#define INCLUDE_git_deprecated_h__
+
+#include "common.h"
+#include "buffer.h"
+#include "errors.h"
+#include "index.h"
+#include "object.h"
+#include "refs.h"
+
+/*
+ * Users can avoid deprecated functions by defining `GIT_DEPRECATE_HARD`.
+ */
+#ifndef GIT_DEPRECATE_HARD
+
+/**
+ * @file git2/deprecated.h
+ * @brief libgit2 deprecated functions and values
+ * @ingroup Git
+ * @{
+ */
+GIT_BEGIN_DECL
+
+/** @name Deprecated Buffer Functions
+ *
+ * These functions and enumeration values are retained for backward
+ * compatibility. The newer versions of these functions should be
+ * preferred in all new code.
+ *
+ * There is no plan to remove these backward compatibility values at
+ * this time.
+ */
+/**@{*/
+
+/**
+ * Free the memory referred to by the git_buf. This is an alias of
+ * `git_buf_dispose` and is preserved for backward compatibility.
+ *
+ * This function is deprecated, but there is no plan to remove this
+ * function at this time.
+ *
+ * @deprecated Use git_buf_dispose
+ * @see git_buf_dispose
+ */
+GIT_EXTERN(void) git_buf_free(git_buf *buffer);
+
+/**@}*/
+
+/** @name Deprecated Error Functions and Constants
+ *
+ * These functions and enumeration values are retained for backward
+ * compatibility. The newer versions of these functions and values
+ * should be preferred in all new code.
+ *
+ * There is no plan to remove these backward compatibility values at
+ * this time.
+ */
+/**@{*/
+
+#define GITERR_NONE GIT_ERROR_NONE
+#define GITERR_NOMEMORY GIT_ERROR_NOMEMORY
+#define GITERR_OS GIT_ERROR_OS
+#define GITERR_INVALID GIT_ERROR_INVALID
+#define GITERR_REFERENCE GIT_ERROR_REFERENCE
+#define GITERR_ZLIB GIT_ERROR_ZLIB
+#define GITERR_REPOSITORY GIT_ERROR_REPOSITORY
+#define GITERR_CONFIG GIT_ERROR_CONFIG
+#define GITERR_REGEX GIT_ERROR_REGEX
+#define GITERR_ODB GIT_ERROR_ODB
+#define GITERR_INDEX GIT_ERROR_INDEX
+#define GITERR_OBJECT GIT_ERROR_OBJECT
+#define GITERR_NET GIT_ERROR_NET
+#define GITERR_TAG GIT_ERROR_TAG
+#define GITERR_TREE GIT_ERROR_TREE
+#define GITERR_INDEXER GIT_ERROR_INDEXER
+#define GITERR_SSL GIT_ERROR_SSL
+#define GITERR_SUBMODULE GIT_ERROR_SUBMODULE
+#define GITERR_THREAD GIT_ERROR_THREAD
+#define GITERR_STASH GIT_ERROR_STASH
+#define GITERR_CHECKOUT GIT_ERROR_CHECKOUT
+#define GITERR_FETCHHEAD GIT_ERROR_FETCHHEAD
+#define GITERR_MERGE GIT_ERROR_MERGE
+#define GITERR_SSH GIT_ERROR_SSH
+#define GITERR_FILTER GIT_ERROR_FILTER
+#define GITERR_REVERT GIT_ERROR_REVERT
+#define GITERR_CALLBACK GIT_ERROR_CALLBACK
+#define GITERR_CHERRYPICK GIT_ERROR_CHERRYPICK
+#define GITERR_DESCRIBE GIT_ERROR_DESCRIBE
+#define GITERR_REBASE GIT_ERROR_REBASE
+#define GITERR_FILESYSTEM GIT_ERROR_FILESYSTEM
+#define GITERR_PATCH GIT_ERROR_PATCH
+#define GITERR_WORKTREE GIT_ERROR_WORKTREE
+#define GITERR_SHA1 GIT_ERROR_SHA1
+
+/**
+ * Return the last `git_error` object that was generated for the
+ * current thread. This is an alias of `git_error_last` and is
+ * preserved for backward compatibility.
+ *
+ * This function is deprecated, but there is no plan to remove this
+ * function at this time.
+ *
+ * @deprecated Use git_error_last
+ * @see git_error_last
+ */
+GIT_EXTERN(const git_error *) giterr_last(void);
+
+/**
+ * Clear the last error. This is an alias of `git_error_last` and is
+ * preserved for backward compatibility.
+ *
+ * This function is deprecated, but there is no plan to remove this
+ * function at this time.
+ *
+ * @deprecated Use git_error_clear
+ * @see git_error_clear
+ */
+GIT_EXTERN(void) giterr_clear(void);
+
+/**
+ * Sets the error message to the given string. This is an alias of
+ * `git_error_set_str` and is preserved for backward compatibility.
+ *
+ * This function is deprecated, but there is no plan to remove this
+ * function at this time.
+ *
+ * @deprecated Use git_error_set_str
+ * @see git_error_set_str
+ */
+GIT_EXTERN(void) giterr_set_str(int error_class, const char *string);
+
+/**
+ * Indicates that an out-of-memory situation occured. This is an alias
+ * of `git_error_set_oom` and is preserved for backward compatibility.
+ *
+ * This function is deprecated, but there is no plan to remove this
+ * function at this time.
+ *
+ * @deprecated Use git_error_set_oom
+ * @see git_error_set_oom
+ */
+GIT_EXTERN(void) giterr_set_oom(void);
+
+/**@}*/
+
+/** @name Deprecated Index Constants
+ *
+ * These enumeration values are retained for backward compatibility.
+ * The newer versions of these values should be preferred in all new code.
+ *
+ * There is no plan to remove these backward compatibility values at
+ * this time.
+ */
+/**@{*/
+
+#define GIT_IDXENTRY_NAMEMASK GIT_INDEX_ENTRY_NAMEMASK
+#define GIT_IDXENTRY_STAGEMASK GIT_INDEX_ENTRY_STAGEMASK
+#define GIT_IDXENTRY_STAGESHIFT GIT_INDEX_ENTRY_STAGESHIFT
+
+/* The git_indxentry_flag_t enum */
+#define GIT_IDXENTRY_EXTENDED GIT_INDEX_ENTRY_EXTENDED
+#define GIT_IDXENTRY_VALID GIT_INDEX_ENTRY_VALID
+
+#define GIT_IDXENTRY_STAGE(E) GIT_INDEX_ENTRY_STAGE(E)
+#define GIT_IDXENTRY_STAGE_SET(E,S) GIT_INDEX_ENTRY_STAGE_SET(E,S)
+
+/* The git_idxentry_extended_flag_t enum */
+#define GIT_IDXENTRY_INTENT_TO_ADD GIT_INDEX_ENTRY_INTENT_TO_ADD
+#define GIT_IDXENTRY_SKIP_WORKTREE GIT_INDEX_ENTRY_SKIP_WORKTREE
+#define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_INDEX_ENTRY_INTENT_TO_ADD | GIT_INDEX_ENTRY_SKIP_WORKTREE)
+#define GIT_IDXENTRY_EXTENDED2 (1 << 15)
+#define GIT_IDXENTRY_UPDATE (1 << 0)
+#define GIT_IDXENTRY_REMOVE (1 << 1)
+#define GIT_IDXENTRY_UPTODATE (1 << 2)
+#define GIT_IDXENTRY_ADDED (1 << 3)
+#define GIT_IDXENTRY_HASHED (1 << 4)
+#define GIT_IDXENTRY_UNHASHED (1 << 5)
+#define GIT_IDXENTRY_WT_REMOVE (1 << 6)
+#define GIT_IDXENTRY_CONFLICTED (1 << 7)
+#define GIT_IDXENTRY_UNPACKED (1 << 8)
+#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
+
+/* The git_index_capability_t enum */
+#define GIT_INDEXCAP_IGNORE_CASE GIT_INDEX_CAPABILITY_IGNORE_CASE
+#define GIT_INDEXCAP_NO_FILEMODE GIT_INDEX_CAPABILITY_NO_FILEMODE
+#define GIT_INDEXCAP_NO_SYMLINKS GIT_INDEX_CAPABILITY_NO_SYMLINKS
+#define GIT_INDEXCAP_FROM_OWNER GIT_INDEX_CAPABILITY_FROM_OWNER
+
+/**@}*/
+
+/** @name Deprecated Object Constants
+ *
+ * These enumeration values are retained for backward compatibility. The
+ * newer versions of these values should be preferred in all new code.
+ *
+ * There is no plan to remove these backward compatibility values at
+ * this time.
+ */
+/**@{*/
+
+#define git_otype git_object_t
+
+#define GIT_OBJ_ANY GIT_OBJECT_ANY
+#define GIT_OBJ_BAD GIT_OBJECT_INVALID
+#define GIT_OBJ__EXT1 0
+#define GIT_OBJ_COMMIT GIT_OBJECT_COMMIT
+#define GIT_OBJ_TREE GIT_OBJECT_TREE
+#define GIT_OBJ_BLOB GIT_OBJECT_BLOB
+#define GIT_OBJ_TAG GIT_OBJECT_TAG
+#define GIT_OBJ__EXT2 5
+#define GIT_OBJ_OFS_DELTA GIT_OBJECT_OFS_DELTA
+#define GIT_OBJ_REF_DELTA GIT_OBJECT_REF_DELTA
+
+/**@}*/
+
+/** @name Deprecated Reference Constants
+ *
+ * These enumeration values are retained for backward compatibility. The
+ * newer versions of these values should be preferred in all new code.
+ *
+ * There is no plan to remove these backward compatibility values at
+ * this time.
+ */
+/**@{*/
+
+ /** Basic type of any Git reference. */
+#define git_ref_t git_reference_t
+#define git_reference_normalize_t git_reference_format_t
+
+#define GIT_REF_INVALID GIT_REFERENCE_INVALID
+#define GIT_REF_OID GIT_REFERENCE_DIRECT
+#define GIT_REF_SYMBOLIC GIT_REFERENCE_SYMBOLIC
+#define GIT_REF_LISTALL GIT_REFERENCE_ALL
+
+#define GIT_REF_FORMAT_NORMAL GIT_REFERENCE_FORMAT_NORMAL
+#define GIT_REF_FORMAT_ALLOW_ONELEVEL GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL
+#define GIT_REF_FORMAT_REFSPEC_PATTERN GIT_REFERENCE_FORMAT_REFSPEC_PATTERN
+#define GIT_REF_FORMAT_REFSPEC_SHORTHAND GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND
+
+/**@}*/
+
+/** @} */
+GIT_END_DECL
+
+#endif
+
+#endif
diff --git a/include/git2/errors.h b/include/git2/errors.h
index f00385b..4e19f89 100644
--- a/include/git2/errors.h
+++ b/include/git2/errors.h
@@ -109,12 +109,6 @@ typedef enum {
GIT_ERROR_SHA1
} git_error_t;
-/** @name Error Functions
- *
- * These functions report or set error information.
- */
-/**@{*/
-
/**
* Return the last `git_error` object that was generated for the
* current thread.
@@ -162,88 +156,6 @@ GIT_EXTERN(void) git_error_set_str(int error_class, const char *string);
*/
GIT_EXTERN(void) git_error_set_oom(void);
-/**@}*/
-
-/** @name Deprecated Error Functions
- *
- * These functions and enumeration values are retained for backward
- * compatibility. The newer versions of these functions should be
- * preferred in all new code.
- */
-/**@{*/
-
-GIT_DEPRECATED(static const int) GITERR_NONE = GIT_ERROR_NONE;
-GIT_DEPRECATED(static const int) GITERR_NOMEMORY = GIT_ERROR_NOMEMORY;
-GIT_DEPRECATED(static const int) GITERR_OS = GIT_ERROR_OS;
-GIT_DEPRECATED(static const int) GITERR_INVALID = GIT_ERROR_INVALID;
-GIT_DEPRECATED(static const int) GITERR_REFERENCE = GIT_ERROR_REFERENCE;
-GIT_DEPRECATED(static const int) GITERR_ZLIB = GIT_ERROR_ZLIB;
-GIT_DEPRECATED(static const int) GITERR_REPOSITORY = GIT_ERROR_REPOSITORY;
-GIT_DEPRECATED(static const int) GITERR_CONFIG = GIT_ERROR_CONFIG;
-GIT_DEPRECATED(static const int) GITERR_REGEX = GIT_ERROR_REGEX;
-GIT_DEPRECATED(static const int) GITERR_ODB = GIT_ERROR_ODB;
-GIT_DEPRECATED(static const int) GITERR_INDEX = GIT_ERROR_INDEX;
-GIT_DEPRECATED(static const int) GITERR_OBJECT = GIT_ERROR_OBJECT;
-GIT_DEPRECATED(static const int) GITERR_NET = GIT_ERROR_NET;
-GIT_DEPRECATED(static const int) GITERR_TAG = GIT_ERROR_TAG;
-GIT_DEPRECATED(static const int) GITERR_TREE = GIT_ERROR_TREE;
-GIT_DEPRECATED(static const int) GITERR_INDEXER = GIT_ERROR_INDEXER;
-GIT_DEPRECATED(static const int) GITERR_SSL = GIT_ERROR_SSL;
-GIT_DEPRECATED(static const int) GITERR_SUBMODULE = GIT_ERROR_SUBMODULE;
-GIT_DEPRECATED(static const int) GITERR_THREAD = GIT_ERROR_THREAD;
-GIT_DEPRECATED(static const int) GITERR_STASH = GIT_ERROR_STASH;
-GIT_DEPRECATED(static const int) GITERR_CHECKOUT = GIT_ERROR_CHECKOUT;
-GIT_DEPRECATED(static const int) GITERR_FETCHHEAD = GIT_ERROR_FETCHHEAD;
-GIT_DEPRECATED(static const int) GITERR_MERGE = GIT_ERROR_MERGE;
-GIT_DEPRECATED(static const int) GITERR_SSH = GIT_ERROR_SSH;
-GIT_DEPRECATED(static const int) GITERR_FILTER = GIT_ERROR_FILTER;
-GIT_DEPRECATED(static const int) GITERR_REVERT = GIT_ERROR_REVERT;
-GIT_DEPRECATED(static const int) GITERR_CALLBACK = GIT_ERROR_CALLBACK;
-GIT_DEPRECATED(static const int) GITERR_CHERRYPICK = GIT_ERROR_CHERRYPICK;
-GIT_DEPRECATED(static const int) GITERR_DESCRIBE = GIT_ERROR_DESCRIBE;
-GIT_DEPRECATED(static const int) GITERR_REBASE = GIT_ERROR_REBASE;
-GIT_DEPRECATED(static const int) GITERR_FILESYSTEM = GIT_ERROR_FILESYSTEM;
-GIT_DEPRECATED(static const int) GITERR_PATCH = GIT_ERROR_PATCH;
-GIT_DEPRECATED(static const int) GITERR_WORKTREE = GIT_ERROR_WORKTREE;
-GIT_DEPRECATED(static const int) GITERR_SHA1 = GIT_ERROR_SHA1;
-
-/**
- * Return the last `git_error` object that was generated for the
- * current thread. This function is deprecated and will be removed
- * in a future release; `git_error_last` should be used instead.
- *
- * @see git_error_last
- */
-GIT_DEPRECATED(GIT_EXTERN(const git_error *)) giterr_last(void);
-
-/**
- * Clear the last error. This function is deprecated and will be
- * removed in a future release; `giterr_clear` should be used instead.
- *
- * @see git_error_last
- */
-GIT_DEPRECATED(GIT_EXTERN(void)) giterr_clear(void);
-
-/**
- * Sets the error message to the given string. This function is
- * deprecated and will be removed in a future release; `giterr_clear`
- * should be used instead.
- *
- * @see git_error_set_str
- */
-GIT_DEPRECATED(GIT_EXTERN(void)) giterr_set_str(int error_class, const char *string);
-
-/**
- * Indicates that an out-of-memory situation occured. This function
- * is deprecated and will be removed in a future release; `giterr_clear`
- * should be used instead.
- *
- * @see git_error_set_oom
- */
-GIT_DEPRECATED(GIT_EXTERN(void)) giterr_set_oom(void);
-
-/**@}*/
-
/** @} */
GIT_END_DECL
#endif
diff --git a/include/git2/index.h b/include/git2/index.h
index 80e15c6..419184c 100644
--- a/include/git2/index.h
+++ b/include/git2/index.h
@@ -165,12 +165,6 @@ typedef enum {
GIT_INDEX_STAGE_THEIRS = 3,
} git_index_stage_t;
-/** @name Index File Functions
- *
- * These functions work on the index file itself.
- */
-/**@{*/
-
/**
* Create a new bare Git index object as a memory representation
* of the Git index file in 'index_path', without a repository
@@ -834,51 +828,6 @@ GIT_EXTERN(int) git_index_conflict_next(
GIT_EXTERN(void) git_index_conflict_iterator_free(
git_index_conflict_iterator *iterator);
-/**@}*/
-
-/** @name Deprecated Index Structures
- *
- * These macros, structures and enumerations are retained for backward
- * compatibility. The newer versions of these functions and structures
- * should be preferred in all new code.
- */
-/**@{*/
-
-#define GIT_IDXENTRY_NAMEMASK GIT_INDEX_ENTRY_NAMEMASK
-#define GIT_IDXENTRY_STAGEMASK GIT_INDEX_ENTRY_STAGEMASK
-#define GIT_IDXENTRY_STAGESHIFT GIT_INDEX_ENTRY_STAGESHIFT
-
-/* The git_indxentry_flag_t enum */
-#define GIT_IDXENTRY_EXTENDED GIT_INDEX_ENTRY_EXTENDED
-#define GIT_IDXENTRY_VALID GIT_INDEX_ENTRY_VALID
-
-#define GIT_IDXENTRY_STAGE(E) GIT_INDEX_ENTRY_STAGE(E)
-#define GIT_IDXENTRY_STAGE_SET(E,S) GIT_INDEX_ENTRY_STAGE_SET(E,S)
-
-/* The git_idxentry_extended_flag_t enum */
-#define GIT_IDXENTRY_INTENT_TO_ADD GIT_INDEX_ENTRY_INTENT_TO_ADD
-#define GIT_IDXENTRY_SKIP_WORKTREE GIT_INDEX_ENTRY_SKIP_WORKTREE
-#define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_INDEX_ENTRY_INTENT_TO_ADD | GIT_INDEX_ENTRY_SKIP_WORKTREE)
-#define GIT_IDXENTRY_EXTENDED2 (1 << 15)
-#define GIT_IDXENTRY_UPDATE (1 << 0)
-#define GIT_IDXENTRY_REMOVE (1 << 1)
-#define GIT_IDXENTRY_UPTODATE (1 << 2)
-#define GIT_IDXENTRY_ADDED (1 << 3)
-#define GIT_IDXENTRY_HASHED (1 << 4)
-#define GIT_IDXENTRY_UNHASHED (1 << 5)
-#define GIT_IDXENTRY_WT_REMOVE (1 << 6)
-#define GIT_IDXENTRY_CONFLICTED (1 << 7)
-#define GIT_IDXENTRY_UNPACKED (1 << 8)
-#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
-
-/* The git_index_capability_t enum */
-#define GIT_INDEXCAP_IGNORE_CASE GIT_INDEX_CAPABILITY_IGNORE_CASE
-#define GIT_INDEXCAP_NO_FILEMODE GIT_INDEX_CAPABILITY_NO_FILEMODE
-#define GIT_INDEXCAP_NO_SYMLINKS GIT_INDEX_CAPABILITY_NO_SYMLINKS
-#define GIT_INDEXCAP_FROM_OWNER GIT_INDEX_CAPABILITY_FROM_OWNER
-
-/**@}*/
-
/** @} */
GIT_END_DECL
#endif
diff --git a/include/git2/refs.h b/include/git2/refs.h
index c11947b..8eeab7e 100644
--- a/include/git2/refs.h
+++ b/include/git2/refs.h
@@ -21,12 +21,6 @@
*/
GIT_BEGIN_DECL
-/** @name Reference Functions
- *
- * These functions read, write and analyze references.
- */
-/**@{*/
-
/**
* Lookup a reference by name in a repository.
*
@@ -749,35 +743,6 @@ GIT_EXTERN(int) git_reference_is_valid_name(const char *refname);
*/
GIT_EXTERN(const char *) git_reference_shorthand(const git_reference *ref);
-/**@}*/
-
-/** @name Deprecated Reference Constants
- *
- * These enumeration values are retained for backward compatibility. The
- * newer versions of these functions should be preferred in all new code.
- */
-/**@{*/
-
- /** Basic type of any Git reference. */
-#define git_ref_t git_reference_t
-#define git_reference_normalize_t git_reference_format_t
-
-GIT_DEPRECATED(static const git_ref_t) GIT_REF_INVALID = GIT_REFERENCE_INVALID;
-GIT_DEPRECATED(static const git_ref_t) GIT_REF_OID = GIT_REFERENCE_DIRECT;
-GIT_DEPRECATED(static const git_ref_t) GIT_REF_SYMBOLIC = GIT_REFERENCE_SYMBOLIC;
-GIT_DEPRECATED(static const git_ref_t) GIT_REF_LISTALL = GIT_REFERENCE_ALL;
-
-GIT_DEPRECATED(static const git_reference_normalize_t) GIT_REF_FORMAT_NORMAL =
- GIT_REFERENCE_FORMAT_NORMAL;
-GIT_DEPRECATED(static const git_reference_normalize_t) GIT_REF_FORMAT_ALLOW_ONELEVEL =
- GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL;
-GIT_DEPRECATED(static const git_reference_normalize_t) GIT_REF_FORMAT_REFSPEC_PATTERN =
- GIT_REFERENCE_FORMAT_REFSPEC_PATTERN;
-GIT_DEPRECATED(static const git_reference_normalize_t) GIT_REF_FORMAT_REFSPEC_SHORTHAND =
- GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND;
-
-/**@}*/
-
/** @} */
GIT_END_DECL
#endif
diff --git a/include/git2/sys/stream.h b/include/git2/sys/stream.h
index 255c93e..6f93cc4 100644
--- a/include/git2/sys/stream.h
+++ b/include/git2/sys/stream.h
@@ -98,13 +98,16 @@ typedef enum {
GIT_EXTERN(int) git_stream_register(
git_stream_t type, git_stream_registration *registration);
+#ifndef GIT_DEPRECATE_HARD
+
/** @name Deprecated TLS Stream Registration Functions
*
- * These typedefs and functions are retained for backward compatibility.
- * The newer versions of these functions and structures should be preferred
- * in all new code.
+ * These functions are retained for backward compatibility. The newer
+ * versions of these values should be preferred in all new code.
+ *
+ * There is no plan to remove these backward compatibility values at
+ * this time.
*/
-
/**@{*/
/**
@@ -115,14 +118,20 @@ typedef int GIT_CALLBACK(git_stream_cb)(git_stream **out, const char *host, cons
/**
* Register a TLS stream constructor for the library to use. This stream
- * will not support HTTP CONNECT proxies.
+ * will not support HTTP CONNECT proxies. This internally calls
+ * `git_stream_register` and is preserved for backward compatibility.
+ *
+ * This function is deprecated, but there is no plan to remove this
+ * function at this time.
*
* @deprecated Provide a git_stream_registration to git_stream_register
* @see git_stream_register
*/
GIT_EXTERN(int) git_stream_register_tls(git_stream_cb ctor);
- /**@}*/
+/**@}*/
+
+#endif
GIT_END_DECL
diff --git a/include/git2/types.h b/include/git2/types.h
index 386958d..6c57ed0 100644
--- a/include/git2/types.h
+++ b/include/git2/types.h
@@ -441,30 +441,6 @@ struct git_writestream {
/** Representation of .mailmap file state. */
typedef struct git_mailmap git_mailmap;
-/** @name Deprecated Index Structures
- *
- * These macros, structures and enumerations are retained for backward
- * compatibility. The newer versions of these functions and structures
- * should be preferred in all new code.
- */
-
-/**@{*/
-
-#define git_otype git_object_t
-
-GIT_DEPRECATED(static const git_otype) GIT_OBJ_ANY = GIT_OBJECT_ANY;
-GIT_DEPRECATED(static const git_otype) GIT_OBJ_BAD = GIT_OBJECT_INVALID;
-GIT_DEPRECATED(static const git_otype) GIT_OBJ__EXT1 = 0;
-GIT_DEPRECATED(static const git_otype) GIT_OBJ_COMMIT = GIT_OBJECT_COMMIT;
-GIT_DEPRECATED(static const git_otype) GIT_OBJ_TREE = GIT_OBJECT_TREE;
-GIT_DEPRECATED(static const git_otype) GIT_OBJ_BLOB = GIT_OBJECT_BLOB;
-GIT_DEPRECATED(static const git_otype) GIT_OBJ_TAG = GIT_OBJECT_TAG;
-GIT_DEPRECATED(static const git_otype) GIT_OBJ__EXT2 = 5;
-GIT_DEPRECATED(static const git_otype) GIT_OBJ_OFS_DELTA = GIT_OBJECT_OFS_DELTA;
-GIT_DEPRECATED(static const git_otype) GIT_OBJ_REF_DELTA = GIT_OBJECT_REF_DELTA;
-
-/**@}*/
-
/** @} */
GIT_END_DECL
diff --git a/src/streams/registry.c b/src/streams/registry.c
index b6cf489..3300320 100644
--- a/src/streams/registry.c
+++ b/src/streams/registry.c
@@ -100,7 +100,9 @@ int git_stream_register(git_stream_t type, git_stream_registration *registration
return 0;
}
-int git_stream_register_tls(git_stream_cb ctor)
+
+int git_stream_register_tls(
+ int GIT_CALLBACK(ctor)(git_stream **out, const char *host, const char *port))
{
git_stream_registration registration = {0};
diff --git a/tests/core/stream.c b/tests/core/stream.c
deleted file mode 100644
index f15dce3..0000000
--- a/tests/core/stream.c
+++ /dev/null
@@ -1,151 +0,0 @@
-#include "clar_libgit2.h"
-#include "git2/sys/stream.h"
-#include "streams/tls.h"
-#include "streams/socket.h"
-#include "stream.h"
-
-static git_stream test_stream;
-static int ctor_called;
-
-void test_core_stream__cleanup(void)
-{
- cl_git_pass(git_stream_register(GIT_STREAM_TLS | GIT_STREAM_STANDARD, NULL));
-}
-
-static int test_stream_init(git_stream **out, const char *host, const char *port)
-{
- GIT_UNUSED(host);
- GIT_UNUSED(port);
-
- ctor_called = 1;
- *out = &test_stream;
-
- return 0;
-}
-
-static int test_stream_wrap(git_stream **out, git_stream *in, const char *host)
-{
- GIT_UNUSED(in);
- GIT_UNUSED(host);
-
- ctor_called = 1;
- *out = &test_stream;
-
- return 0;
-}
-
-void test_core_stream__register_insecure(void)
-{
- git_stream *stream;
- git_stream_registration registration = {0};
-
- registration.version = 1;
- registration.init = test_stream_init;
- registration.wrap = test_stream_wrap;
-
- ctor_called = 0;
- cl_git_pass(git_stream_register(GIT_STREAM_STANDARD, ®istration));
- cl_git_pass(git_socket_stream_new(&stream, "localhost", "80"));
- cl_assert_equal_i(1, ctor_called);
- cl_assert_equal_p(&test_stream, stream);
-
- ctor_called = 0;
- stream = NULL;
- cl_git_pass(git_stream_register(GIT_STREAM_STANDARD, NULL));
- cl_git_pass(git_socket_stream_new(&stream, "localhost", "80"));
-
- cl_assert_equal_i(0, ctor_called);
- cl_assert(&test_stream != stream);
-
- git_stream_free(stream);
-}
-
-void test_core_stream__register_tls(void)
-{
- git_stream *stream;
- git_stream_registration registration = {0};
- int error;
-
- registration.version = 1;
- registration.init = test_stream_init;
- registration.wrap = test_stream_wrap;
-
- ctor_called = 0;
- cl_git_pass(git_stream_register(GIT_STREAM_TLS, ®istration));
- cl_git_pass(git_tls_stream_new(&stream, "localhost", "443"));
- cl_assert_equal_i(1, ctor_called);
- cl_assert_equal_p(&test_stream, stream);
-
- ctor_called = 0;
- stream = NULL;
- cl_git_pass(git_stream_register(GIT_STREAM_TLS, NULL));
- error = git_tls_stream_new(&stream, "localhost", "443");
-
- /* We don't have TLS support enabled, or we're on Windows,
- * which has no arbitrary TLS stream support.
- */
-#if defined(GIT_WIN32) || !defined(GIT_HTTPS)
- cl_git_fail_with(-1, error);
-#else
- cl_git_pass(error);
-#endif
-
- cl_assert_equal_i(0, ctor_called);
- cl_assert(&test_stream != stream);
-
- git_stream_free(stream);
-}
-
-void test_core_stream__register_both(void)
-{
- git_stream *stream;
- git_stream_registration registration = {0};
-
- registration.version = 1;
- registration.init = test_stream_init;
- registration.wrap = test_stream_wrap;
-
- cl_git_pass(git_stream_register(GIT_STREAM_STANDARD | GIT_STREAM_TLS, ®istration));
-
- ctor_called = 0;
- cl_git_pass(git_tls_stream_new(&stream, "localhost", "443"));
- cl_assert_equal_i(1, ctor_called);
- cl_assert_equal_p(&test_stream, stream);
-
- ctor_called = 0;
- cl_git_pass(git_socket_stream_new(&stream, "localhost", "80"));
- cl_assert_equal_i(1, ctor_called);
- cl_assert_equal_p(&test_stream, stream);
-}
-
-void test_core_stream__register_tls_deprecated(void)
-{
- git_stream *stream;
- int error;
-
- ctor_called = 0;
- cl_git_pass(git_stream_register_tls(test_stream_init));
- cl_git_pass(git_tls_stream_new(&stream, "localhost", "443"));
- cl_assert_equal_i(1, ctor_called);
- cl_assert_equal_p(&test_stream, stream);
-
- ctor_called = 0;
- stream = NULL;
- cl_git_pass(git_stream_register_tls(NULL));
- error = git_tls_stream_new(&stream, "localhost", "443");
-
- /*
- * We don't have TLS support enabled, or we're on Windows,
- * which has no arbitrary TLS stream support.
- */
-#if defined(GIT_WIN32) || !defined(GIT_HTTPS)
- cl_git_fail_with(-1, error);
-#else
- cl_git_pass(error);
-#endif
-
- cl_assert_equal_i(0, ctor_called);
- cl_assert(&test_stream != stream);
-
- git_stream_free(stream);
-}
diff --git a/tests/stream/deprecated.c b/tests/stream/deprecated.c
new file mode 100644
index 0000000..2c2bbfd
--- /dev/null
+++ b/tests/stream/deprecated.c
@@ -0,0 +1,58 @@
+#undef GIT_DEPRECATE_HARD
+
+#include "clar_libgit2.h"
+#include "git2/sys/stream.h"
+#include "streams/tls.h"
+#include "streams/socket.h"
+#include "stream.h"
+
+static git_stream test_stream;
+static int ctor_called;
+
+void test_stream_deprecated__cleanup(void)
+{
+ cl_git_pass(git_stream_register(GIT_STREAM_TLS | GIT_STREAM_STANDARD, NULL));
+}
+
+static int test_stream_init(git_stream **out, const char *host, const char *port)
+{
+ GIT_UNUSED(host);
+ GIT_UNUSED(port);
+
+ ctor_called = 1;
+ *out = &test_stream;
+
+ return 0;
+}
+
+void test_stream_deprecated__register_tls(void)
+{
+ git_stream *stream;
+ int error;
+
+ ctor_called = 0;
+ cl_git_pass(git_stream_register_tls(test_stream_init));
+ cl_git_pass(git_tls_stream_new(&stream, "localhost", "443"));
+ cl_assert_equal_i(1, ctor_called);
+ cl_assert_equal_p(&test_stream, stream);
+
+ ctor_called = 0;
+ stream = NULL;
+ cl_git_pass(git_stream_register_tls(NULL));
+ error = git_tls_stream_new(&stream, "localhost", "443");
+
+ /*
+ * We don't have TLS support enabled, or we're on Windows,
+ * which has no arbitrary TLS stream support.
+ */
+#if defined(GIT_WIN32) || !defined(GIT_HTTPS)
+ cl_git_fail_with(-1, error);
+#else
+ cl_git_pass(error);
+#endif
+
+ cl_assert_equal_i(0, ctor_called);
+ cl_assert(&test_stream != stream);
+
+ git_stream_free(stream);
+}
diff --git a/tests/stream/registration.c b/tests/stream/registration.c
new file mode 100644
index 0000000..bf3c205
--- /dev/null
+++ b/tests/stream/registration.c
@@ -0,0 +1,119 @@
+#include "clar_libgit2.h"
+#include "git2/sys/stream.h"
+#include "streams/tls.h"
+#include "streams/socket.h"
+#include "stream.h"
+
+static git_stream test_stream;
+static int ctor_called;
+
+void test_stream_registration__cleanup(void)
+{
+ cl_git_pass(git_stream_register(GIT_STREAM_TLS | GIT_STREAM_STANDARD, NULL));
+}
+
+static int test_stream_init(git_stream **out, const char *host, const char *port)
+{
+ GIT_UNUSED(host);
+ GIT_UNUSED(port);
+
+ ctor_called = 1;
+ *out = &test_stream;
+
+ return 0;
+}
+
+static int test_stream_wrap(git_stream **out, git_stream *in, const char *host)
+{
+ GIT_UNUSED(in);
+ GIT_UNUSED(host);
+
+ ctor_called = 1;
+ *out = &test_stream;
+
+ return 0;
+}
+
+void test_stream_registration__insecure(void)
+{
+ git_stream *stream;
+ git_stream_registration registration = {0};
+
+ registration.version = 1;
+ registration.init = test_stream_init;
+ registration.wrap = test_stream_wrap;
+
+ ctor_called = 0;
+ cl_git_pass(git_stream_register(GIT_STREAM_STANDARD, ®istration));
+ cl_git_pass(git_socket_stream_new(&stream, "localhost", "80"));
+ cl_assert_equal_i(1, ctor_called);
+ cl_assert_equal_p(&test_stream, stream);
+
+ ctor_called = 0;
+ stream = NULL;
+ cl_git_pass(git_stream_register(GIT_STREAM_STANDARD, NULL));
+ cl_git_pass(git_socket_stream_new(&stream, "localhost", "80"));
+
+ cl_assert_equal_i(0, ctor_called);
+ cl_assert(&test_stream != stream);
+
+ git_stream_free(stream);
+}
+
+void test_stream_registration__tls(void)
+{
+ git_stream *stream;
+ git_stream_registration registration = {0};
+ int error;
+
+ registration.version = 1;
+ registration.init = test_stream_init;
+ registration.wrap = test_stream_wrap;
+
+ ctor_called = 0;
+ cl_git_pass(git_stream_register(GIT_STREAM_TLS, ®istration));
+ cl_git_pass(git_tls_stream_new(&stream, "localhost", "443"));
+ cl_assert_equal_i(1, ctor_called);
+ cl_assert_equal_p(&test_stream, stream);
+
+ ctor_called = 0;
+ stream = NULL;
+ cl_git_pass(git_stream_register(GIT_STREAM_TLS, NULL));
+ error = git_tls_stream_new(&stream, "localhost", "443");
+
+ /* We don't have TLS support enabled, or we're on Windows,
+ * which has no arbitrary TLS stream support.
+ */
+#if defined(GIT_WIN32) || !defined(GIT_HTTPS)
+ cl_git_fail_with(-1, error);
+#else
+ cl_git_pass(error);
+#endif
+
+ cl_assert_equal_i(0, ctor_called);
+ cl_assert(&test_stream != stream);
+
+ git_stream_free(stream);
+}
+
+void test_stream_registration__both(void)
+{
+ git_stream *stream;
+ git_stream_registration registration = {0};
+
+ registration.version = 1;
+ registration.init = test_stream_init;
+ registration.wrap = test_stream_wrap;
+
+ cl_git_pass(git_stream_register(GIT_STREAM_STANDARD | GIT_STREAM_TLS, ®istration));
+
+ ctor_called = 0;
+ cl_git_pass(git_tls_stream_new(&stream, "localhost", "443"));
+ cl_assert_equal_i(1, ctor_called);
+ cl_assert_equal_p(&test_stream, stream);
+
+ ctor_called = 0;
+ cl_git_pass(git_socket_stream_new(&stream, "localhost", "80"));
+ cl_assert_equal_i(1, ctor_called);
+ cl_assert_equal_p(&test_stream, stream);
+}