Skip to content

Commit a7d0d14

Browse files
committed
deprecation: move deprecated bits to deprecated.h
1 parent 1c3dacc commit a7d0d14

File tree

7 files changed

+242
-210
lines changed

7 files changed

+242
-210
lines changed

include/git2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "git2/commit.h"
2222
#include "git2/common.h"
2323
#include "git2/config.h"
24+
#include "git2/deprecated.h"
2425
#include "git2/describe.h"
2526
#include "git2/diff.h"
2627
#include "git2/errors.h"

include/git2/buffer.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,6 @@ typedef struct {
7171
*/
7272
GIT_EXTERN(void) git_buf_dispose(git_buf *buffer);
7373

74-
/**
75-
* Alias of `git_buf_dispose`.
76-
*
77-
* This function is directly calls `git_buf_dispose` now and is deprecated.
78-
* Going forward, we refer to functions freeing the internal state of a
79-
* structure a `dispose` function, while functions freeing the structure
80-
* themselves will be called a `free` function.
81-
*
82-
* This function is going to be removed in v0.30.0.
83-
*/
84-
GIT_DEPRECATED(GIT_EXTERN(void)) git_buf_free(git_buf *buffer);
85-
8674
/**
8775
* Resize the buffer allocation to make more space.
8876
*

include/git2/deprecated.h

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
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 "common.h"
11+
#include "buffer.h"
12+
#include "errors.h"
13+
#include "index.h"
14+
#include "object.h"
15+
#include "refs.h"
16+
17+
/**
18+
* @file git2/deprecated.h
19+
* @brief libgit2 deprecated functions and values
20+
* @ingroup Git
21+
* @{
22+
*/
23+
GIT_BEGIN_DECL
24+
25+
/** @name Deprecated Buffer Functions
26+
*
27+
* These functions and enumeration values are retained for backward
28+
* compatibility. The newer versions of these functions should be
29+
* preferred in all new code.
30+
*
31+
* There is no plan to remove these backward compatibility values at
32+
* this time.
33+
*/
34+
/**@{*/
35+
36+
/**
37+
* Free the memory referred to by the git_buf. This is an alias of
38+
* `git_buf_dispose` and is preserved for backward compatibility.
39+
*
40+
* This function is deprecated, but there is no plan to remove this
41+
* function at this time.
42+
*
43+
* @see git_buf_dispose
44+
*/
45+
GIT_EXTERN(void) git_buf_free(git_buf *buffer);
46+
47+
/**@}*/
48+
49+
/** @name Deprecated Error Functions and Constants
50+
*
51+
* These functions and enumeration values are retained for backward
52+
* compatibility. The newer versions of these functions and values
53+
* should be preferred in all new code.
54+
*
55+
* There is no plan to remove these backward compatibility values at
56+
* this time.
57+
*/
58+
/**@{*/
59+
60+
#define GITERR_NONE GIT_ERROR_NONE
61+
#define GITERR_NOMEMORY GIT_ERROR_NOMEMORY
62+
#define GITERR_OS GIT_ERROR_OS
63+
#define GITERR_INVALID GIT_ERROR_INVALID
64+
#define GITERR_REFERENCE GIT_ERROR_REFERENCE
65+
#define GITERR_ZLIB GIT_ERROR_ZLIB
66+
#define GITERR_REPOSITORY GIT_ERROR_REPOSITORY
67+
#define GITERR_CONFIG GIT_ERROR_CONFIG
68+
#define GITERR_REGEX GIT_ERROR_REGEX
69+
#define GITERR_ODB GIT_ERROR_ODB
70+
#define GITERR_INDEX GIT_ERROR_INDEX
71+
#define GITERR_OBJECT GIT_ERROR_OBJECT
72+
#define GITERR_NET GIT_ERROR_NET
73+
#define GITERR_TAG GIT_ERROR_TAG
74+
#define GITERR_TREE GIT_ERROR_TREE
75+
#define GITERR_INDEXER GIT_ERROR_INDEXER
76+
#define GITERR_SSL GIT_ERROR_SSL
77+
#define GITERR_SUBMODULE GIT_ERROR_SUBMODULE
78+
#define GITERR_THREAD GIT_ERROR_THREAD
79+
#define GITERR_STASH GIT_ERROR_STASH
80+
#define GITERR_CHECKOUT GIT_ERROR_CHECKOUT
81+
#define GITERR_FETCHHEAD GIT_ERROR_FETCHHEAD
82+
#define GITERR_MERGE GIT_ERROR_MERGE
83+
#define GITERR_SSH GIT_ERROR_SSH
84+
#define GITERR_FILTER GIT_ERROR_FILTER
85+
#define GITERR_REVERT GIT_ERROR_REVERT
86+
#define GITERR_CALLBACK GIT_ERROR_CALLBACK
87+
#define GITERR_CHERRYPICK GIT_ERROR_CHERRYPICK
88+
#define GITERR_DESCRIBE GIT_ERROR_DESCRIBE
89+
#define GITERR_REBASE GIT_ERROR_REBASE
90+
#define GITERR_FILESYSTEM GIT_ERROR_FILESYSTEM
91+
#define GITERR_PATCH GIT_ERROR_PATCH
92+
#define GITERR_WORKTREE GIT_ERROR_WORKTREE
93+
#define GITERR_SHA1 GIT_ERROR_SHA1
94+
95+
/**
96+
* Return the last `git_error` object that was generated for the
97+
* current thread. This is an alias of `git_error_last` and is
98+
* preserved for backward compatibility.
99+
*
100+
* This function is deprecated, but there is no plan to remove this
101+
* function at this time.
102+
*
103+
* @see git_error_last
104+
*/
105+
GIT_EXTERN(const git_error *) giterr_last(void);
106+
107+
/**
108+
* Clear the last error. This is an alias of `git_error_last` and is
109+
* preserved for backward compatibility.
110+
*
111+
* This function is deprecated, but there is no plan to remove this
112+
* function at this time.
113+
*
114+
* @see git_error_clear
115+
*/
116+
GIT_EXTERN(void) giterr_clear(void);
117+
118+
/**
119+
* Sets the error message to the given string. This is an alias of
120+
* `git_error_set_str` and is preserved for backward compatibility.
121+
*
122+
* This function is deprecated, but there is no plan to remove this
123+
* function at this time.
124+
*
125+
* @see git_error_set_str
126+
*/
127+
GIT_EXTERN(void) giterr_set_str(int error_class, const char *string);
128+
129+
/**
130+
* Indicates that an out-of-memory situation occured. This is an alias
131+
* of `git_error_set_oom` and is preserved for backward compatibility.
132+
*
133+
* This function is deprecated, but there is no plan to remove this
134+
* function at this time.
135+
*
136+
* @see git_error_set_oom
137+
*/
138+
GIT_EXTERN(void) giterr_set_oom(void);
139+
140+
/**@}*/
141+
142+
/** @name Deprecated Index Constants
143+
*
144+
* These enumeration values are retained for backward compatibility.
145+
* The newer versions of these values should be preferred in all new code.
146+
*
147+
* There is no plan to remove these backward compatibility values at
148+
* this time.
149+
*/
150+
/**@{*/
151+
152+
#define GIT_IDXENTRY_NAMEMASK GIT_INDEX_ENTRY_NAMEMASK
153+
#define GIT_IDXENTRY_STAGEMASK GIT_INDEX_ENTRY_STAGEMASK
154+
#define GIT_IDXENTRY_STAGESHIFT GIT_INDEX_ENTRY_STAGESHIFT
155+
156+
/* The git_indxentry_flag_t enum */
157+
#define GIT_IDXENTRY_EXTENDED GIT_INDEX_ENTRY_EXTENDED
158+
#define GIT_IDXENTRY_VALID GIT_INDEX_ENTRY_VALID
159+
160+
#define GIT_IDXENTRY_STAGE(E) GIT_INDEX_ENTRY_STAGE(E)
161+
#define GIT_IDXENTRY_STAGE_SET(E,S) GIT_INDEX_ENTRY_STAGE_SET(E,S)
162+
163+
/* The git_idxentry_extended_flag_t enum */
164+
#define GIT_IDXENTRY_INTENT_TO_ADD GIT_INDEX_ENTRY_INTENT_TO_ADD
165+
#define GIT_IDXENTRY_SKIP_WORKTREE GIT_INDEX_ENTRY_SKIP_WORKTREE
166+
#define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_INDEX_ENTRY_INTENT_TO_ADD | GIT_INDEX_ENTRY_SKIP_WORKTREE)
167+
#define GIT_IDXENTRY_EXTENDED2 (1 << 15)
168+
#define GIT_IDXENTRY_UPDATE (1 << 0)
169+
#define GIT_IDXENTRY_REMOVE (1 << 1)
170+
#define GIT_IDXENTRY_UPTODATE (1 << 2)
171+
#define GIT_IDXENTRY_ADDED (1 << 3)
172+
#define GIT_IDXENTRY_HASHED (1 << 4)
173+
#define GIT_IDXENTRY_UNHASHED (1 << 5)
174+
#define GIT_IDXENTRY_WT_REMOVE (1 << 6)
175+
#define GIT_IDXENTRY_CONFLICTED (1 << 7)
176+
#define GIT_IDXENTRY_UNPACKED (1 << 8)
177+
#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
178+
179+
/* The git_index_capability_t enum */
180+
#define GIT_INDEXCAP_IGNORE_CASE GIT_INDEX_CAPABILITY_IGNORE_CASE
181+
#define GIT_INDEXCAP_NO_FILEMODE GIT_INDEX_CAPABILITY_NO_FILEMODE
182+
#define GIT_INDEXCAP_NO_SYMLINKS GIT_INDEX_CAPABILITY_NO_SYMLINKS
183+
#define GIT_INDEXCAP_FROM_OWNER GIT_INDEX_CAPABILITY_FROM_OWNER
184+
185+
/**@}*/
186+
187+
/** @name Deprecated Object Constants
188+
*
189+
* These enumeration values are retained for backward compatibility. The
190+
* newer versions of these values should be preferred in all new code.
191+
*
192+
* There is no plan to remove these backward compatibility values at
193+
* this time.
194+
*/
195+
/**@{*/
196+
197+
#define git_otype git_object_t
198+
199+
#define GIT_OBJ_ANY GIT_OBJECT_ANY
200+
#define GIT_OBJ_BAD GIT_OBJECT_INVALID
201+
#define GIT_OBJ__EXT1 0
202+
#define GIT_OBJ_COMMIT GIT_OBJECT_COMMIT
203+
#define GIT_OBJ_TREE GIT_OBJECT_TREE
204+
#define GIT_OBJ_BLOB GIT_OBJECT_BLOB
205+
#define GIT_OBJ_TAG GIT_OBJECT_TAG
206+
#define GIT_OBJ__EXT2 5
207+
#define GIT_OBJ_OFS_DELTA GIT_OBJECT_OFS_DELTA
208+
#define GIT_OBJ_REF_DELTA GIT_OBJECT_REF_DELTA
209+
210+
/**@}*/
211+
212+
/** @name Deprecated Reference Constants
213+
*
214+
* These enumeration values are retained for backward compatibility. The
215+
* newer versions of these values should be preferred in all new code.
216+
*
217+
* There is no plan to remove these backward compatibility values at
218+
* this time.
219+
*/
220+
/**@{*/
221+
222+
/** Basic type of any Git reference. */
223+
#define git_ref_t git_reference_t
224+
#define git_reference_normalize_t git_reference_format_t
225+
226+
#define GIT_REF_INVALID GIT_REFERENCE_INVALID
227+
#define GIT_REF_OID GIT_REFERENCE_DIRECT
228+
#define GIT_REF_SYMBOLIC GIT_REFERENCE_SYMBOLIC
229+
#define GIT_REF_LISTALL GIT_REFERENCE_ALL
230+
231+
#define GIT_REF_FORMAT_NORMAL GIT_REFERENCE_FORMAT_NORMAL
232+
#define GIT_REF_FORMAT_ALLOW_ONELEVEL GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL
233+
#define GIT_REF_FORMAT_REFSPEC_PATTERN GIT_REFERENCE_FORMAT_REFSPEC_PATTERN
234+
#define GIT_REF_FORMAT_REFSPEC_SHORTHAND GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND
235+
236+
/**@}*/
237+
238+
/** @} */
239+
GIT_END_DECL
240+
241+
#endif

include/git2/errors.h

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,6 @@ typedef enum {
109109
GIT_ERROR_SHA1
110110
} git_error_t;
111111

112-
/** @name Error Functions
113-
*
114-
* These functions report or set error information.
115-
*/
116-
/**@{*/
117-
118112
/**
119113
* Return the last `git_error` object that was generated for the
120114
* current thread.
@@ -162,88 +156,6 @@ GIT_EXTERN(void) git_error_set_str(int error_class, const char *string);
162156
*/
163157
GIT_EXTERN(void) git_error_set_oom(void);
164158

165-
/**@}*/
166-
167-
/** @name Deprecated Error Functions
168-
*
169-
* These functions and enumeration values are retained for backward
170-
* compatibility. The newer versions of these functions should be
171-
* preferred in all new code.
172-
*/
173-
/**@{*/
174-
175-
GIT_DEPRECATED(static const int) GITERR_NONE = GIT_ERROR_NONE;
176-
GIT_DEPRECATED(static const int) GITERR_NOMEMORY = GIT_ERROR_NOMEMORY;
177-
GIT_DEPRECATED(static const int) GITERR_OS = GIT_ERROR_OS;
178-
GIT_DEPRECATED(static const int) GITERR_INVALID = GIT_ERROR_INVALID;
179-
GIT_DEPRECATED(static const int) GITERR_REFERENCE = GIT_ERROR_REFERENCE;
180-
GIT_DEPRECATED(static const int) GITERR_ZLIB = GIT_ERROR_ZLIB;
181-
GIT_DEPRECATED(static const int) GITERR_REPOSITORY = GIT_ERROR_REPOSITORY;
182-
GIT_DEPRECATED(static const int) GITERR_CONFIG = GIT_ERROR_CONFIG;
183-
GIT_DEPRECATED(static const int) GITERR_REGEX = GIT_ERROR_REGEX;
184-
GIT_DEPRECATED(static const int) GITERR_ODB = GIT_ERROR_ODB;
185-
GIT_DEPRECATED(static const int) GITERR_INDEX = GIT_ERROR_INDEX;
186-
GIT_DEPRECATED(static const int) GITERR_OBJECT = GIT_ERROR_OBJECT;
187-
GIT_DEPRECATED(static const int) GITERR_NET = GIT_ERROR_NET;
188-
GIT_DEPRECATED(static const int) GITERR_TAG = GIT_ERROR_TAG;
189-
GIT_DEPRECATED(static const int) GITERR_TREE = GIT_ERROR_TREE;
190-
GIT_DEPRECATED(static const int) GITERR_INDEXER = GIT_ERROR_INDEXER;
191-
GIT_DEPRECATED(static const int) GITERR_SSL = GIT_ERROR_SSL;
192-
GIT_DEPRECATED(static const int) GITERR_SUBMODULE = GIT_ERROR_SUBMODULE;
193-
GIT_DEPRECATED(static const int) GITERR_THREAD = GIT_ERROR_THREAD;
194-
GIT_DEPRECATED(static const int) GITERR_STASH = GIT_ERROR_STASH;
195-
GIT_DEPRECATED(static const int) GITERR_CHECKOUT = GIT_ERROR_CHECKOUT;
196-
GIT_DEPRECATED(static const int) GITERR_FETCHHEAD = GIT_ERROR_FETCHHEAD;
197-
GIT_DEPRECATED(static const int) GITERR_MERGE = GIT_ERROR_MERGE;
198-
GIT_DEPRECATED(static const int) GITERR_SSH = GIT_ERROR_SSH;
199-
GIT_DEPRECATED(static const int) GITERR_FILTER = GIT_ERROR_FILTER;
200-
GIT_DEPRECATED(static const int) GITERR_REVERT = GIT_ERROR_REVERT;
201-
GIT_DEPRECATED(static const int) GITERR_CALLBACK = GIT_ERROR_CALLBACK;
202-
GIT_DEPRECATED(static const int) GITERR_CHERRYPICK = GIT_ERROR_CHERRYPICK;
203-
GIT_DEPRECATED(static const int) GITERR_DESCRIBE = GIT_ERROR_DESCRIBE;
204-
GIT_DEPRECATED(static const int) GITERR_REBASE = GIT_ERROR_REBASE;
205-
GIT_DEPRECATED(static const int) GITERR_FILESYSTEM = GIT_ERROR_FILESYSTEM;
206-
GIT_DEPRECATED(static const int) GITERR_PATCH = GIT_ERROR_PATCH;
207-
GIT_DEPRECATED(static const int) GITERR_WORKTREE = GIT_ERROR_WORKTREE;
208-
GIT_DEPRECATED(static const int) GITERR_SHA1 = GIT_ERROR_SHA1;
209-
210-
/**
211-
* Return the last `git_error` object that was generated for the
212-
* current thread. This function is deprecated and will be removed
213-
* in a future release; `git_error_last` should be used instead.
214-
*
215-
* @see git_error_last
216-
*/
217-
GIT_DEPRECATED(GIT_EXTERN(const git_error *)) giterr_last(void);
218-
219-
/**
220-
* Clear the last error. This function is deprecated and will be
221-
* removed in a future release; `giterr_clear` should be used instead.
222-
*
223-
* @see git_error_last
224-
*/
225-
GIT_DEPRECATED(GIT_EXTERN(void)) giterr_clear(void);
226-
227-
/**
228-
* Sets the error message to the given string. This function is
229-
* deprecated and will be removed in a future release; `giterr_clear`
230-
* should be used instead.
231-
*
232-
* @see git_error_set_str
233-
*/
234-
GIT_DEPRECATED(GIT_EXTERN(void)) giterr_set_str(int error_class, const char *string);
235-
236-
/**
237-
* Indicates that an out-of-memory situation occured. This function
238-
* is deprecated and will be removed in a future release; `giterr_clear`
239-
* should be used instead.
240-
*
241-
* @see git_error_set_oom
242-
*/
243-
GIT_DEPRECATED(GIT_EXTERN(void)) giterr_set_oom(void);
244-
245-
/**@}*/
246-
247159
/** @} */
248160
GIT_END_DECL
249161
#endif

0 commit comments

Comments
 (0)