Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit f711150

Browse files
committed
libgit2 1.3.0
1 parent 9c3ba7c commit f711150

20 files changed

+367
-134
lines changed

include/git2.h

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "git2/deprecated.h"
2727
#include "git2/describe.h"
2828
#include "git2/diff.h"
29+
#include "git2/email.h"
2930
#include "git2/errors.h"
3031
#include "git2/filter.h"
3132
#include "git2/global.h"

include/git2/attr.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,17 @@ typedef struct {
147147
/** A combination of GIT_ATTR_CHECK flags */
148148
unsigned int flags;
149149

150+
#ifdef GIT_DEPRECATE_HARD
151+
void *reserved;
152+
#else
153+
git_oid *commit_id;
154+
#endif
155+
150156
/**
151157
* The commit to load attributes from, when
152158
* `GIT_ATTR_CHECK_INCLUDE_COMMIT` is specified.
153159
*/
154-
git_oid *commit_id;
160+
git_oid attr_commit_id;
155161
} git_attr_options;
156162

157163
#define GIT_ATTR_OPTIONS_VERSION 1

include/git2/blob.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,17 @@ typedef struct {
135135
/** Flags to control the filtering process, see `git_blob_filter_flag_t` above */
136136
uint32_t flags;
137137

138+
#ifdef GIT_DEPRECATE_HARD
139+
void *reserved;
140+
#else
141+
git_oid *commit_id;
142+
#endif
143+
138144
/**
139145
* The commit to load attributes from, when
140146
* `GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT` is specified.
141147
*/
142-
git_oid *commit_id;
148+
git_oid attr_commit_id;
143149
} git_blob_filter_options;
144150

145151
#define GIT_BLOB_FILTER_OPTIONS_VERSION 1

include/git2/clone.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ typedef struct git_clone_options {
133133
* The name of the branch to checkout. NULL means use the
134134
* remote's default branch.
135135
*/
136-
const char* checkout_branch;
136+
const char *checkout_branch;
137137

138138
/**
139139
* A callback used to create the new repository into which to

include/git2/common.h

+19-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ typedef enum {
209209
GIT_OPT_GET_MWINDOW_FILE_LIMIT,
210210
GIT_OPT_SET_MWINDOW_FILE_LIMIT,
211211
GIT_OPT_SET_ODB_PACKED_PRIORITY,
212-
GIT_OPT_SET_ODB_LOOSE_PRIORITY
212+
GIT_OPT_SET_ODB_LOOSE_PRIORITY,
213+
GIT_OPT_GET_EXTENSIONS,
214+
GIT_OPT_SET_EXTENSIONS
213215
} git_libgit2_opt_t;
214216

215217
/**
@@ -431,6 +433,22 @@ typedef enum {
431433
* > Override the default priority of the loose ODB backend which
432434
* > is added when default backends are assigned to a repository
433435
*
436+
* opts(GIT_OPT_GET_EXTENSIONS, git_strarray *out)
437+
* > Returns the list of git extensions that are supported. This
438+
* > is the list of built-in extensions supported by libgit2 and
439+
* > custom extensions that have been added with
440+
* > `GIT_OPT_SET_EXTENSIONS`. Extensions that have been negated
441+
* > will not be returned. The returned list should be released
442+
* > with `git_strarray_dispose`.
443+
*
444+
* opts(GIT_OPT_SET_EXTENSIONS, const char **extensions, size_t len)
445+
* > Set that the given git extensions are supported by the caller.
446+
* > Extensions supported by libgit2 may be negated by prefixing
447+
* > them with a `!`. For example: setting extensions to
448+
* > { "!noop", "newext" } indicates that the caller does not want
449+
* > to support repositories with the `noop` extension but does want
450+
* > to support repositories with the `newext` extension.
451+
*
434452
* @param option Option key
435453
* @param ... value to set the option
436454
* @return 0 on success, <0 on failure

include/git2/deprecated.h

+120
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,102 @@ typedef git_configmap git_cvar_map;
294294

295295
/**@}*/
296296

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+
297393
/** @name Deprecated Error Functions and Constants
298394
*
299395
* These functions and enumeration values are retained for backward
@@ -683,6 +779,30 @@ GIT_EXTERN(int) git_oid_iszero(const git_oid *id);
683779

684780
/**@}*/
685781

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+
686806
/** @name Deprecated Transfer Progress Types
687807
*
688808
* These types are retained for backward compatibility. The newer

include/git2/diff.h

+3-98
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ typedef enum {
133133
*/
134134
GIT_DIFF_INDENT_HEURISTIC = (1u << 18),
135135

136+
/** Ignore blank lines */
137+
GIT_DIFF_IGNORE_BLANK_LINES = (1u << 19),
138+
136139
/** Treat all files as text, disabling binary attributes & detection */
137140
GIT_DIFF_FORCE_TEXT = (1u << 20),
138141
/** Treat all files as binary, disabling text diffs */
@@ -168,11 +171,6 @@ typedef enum {
168171
* can apply given diff information to binary files.
169172
*/
170173
GIT_DIFF_SHOW_BINARY = (1u << 30),
171-
172-
/** Ignore blank lines */
173-
/* Jeroen: commented out for -pedantic compatibility */
174-
//GIT_DIFF_IGNORE_BLANK_LINES = (1u << 31),
175-
176174
} git_diff_option_t;
177175

178176
/**
@@ -1377,99 +1375,6 @@ GIT_EXTERN(int) git_diff_stats_to_buf(
13771375
*/
13781376
GIT_EXTERN(void) git_diff_stats_free(git_diff_stats *stats);
13791377

1380-
/**
1381-
* Formatting options for diff e-mail generation
1382-
*/
1383-
typedef enum {
1384-
/** Normal patch, the default */
1385-
GIT_DIFF_FORMAT_EMAIL_NONE = 0,
1386-
1387-
/** Don't insert "[PATCH]" in the subject header*/
1388-
GIT_DIFF_FORMAT_EMAIL_EXCLUDE_SUBJECT_PATCH_MARKER = (1 << 0),
1389-
1390-
} git_diff_format_email_flags_t;
1391-
1392-
/**
1393-
* Options for controlling the formatting of the generated e-mail.
1394-
*/
1395-
typedef struct {
1396-
unsigned int version;
1397-
1398-
/** see `git_diff_format_email_flags_t` above */
1399-
uint32_t flags;
1400-
1401-
/** This patch number */
1402-
size_t patch_no;
1403-
1404-
/** Total number of patches in this series */
1405-
size_t total_patches;
1406-
1407-
/** id to use for the commit */
1408-
const git_oid *id;
1409-
1410-
/** Summary of the change */
1411-
const char *summary;
1412-
1413-
/** Commit message's body */
1414-
const char *body;
1415-
1416-
/** Author of the change */
1417-
const git_signature *author;
1418-
} git_diff_format_email_options;
1419-
1420-
#define GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION 1
1421-
#define GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT {GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION, 0, 1, 1, NULL, NULL, NULL, NULL}
1422-
1423-
/**
1424-
* Create an e-mail ready patch from a diff.
1425-
*
1426-
* @param out buffer to store the e-mail patch in
1427-
* @param diff containing the commit
1428-
* @param opts structure with options to influence content and formatting.
1429-
* @return 0 or an error code
1430-
*/
1431-
GIT_EXTERN(int) git_diff_format_email(
1432-
git_buf *out,
1433-
git_diff *diff,
1434-
const git_diff_format_email_options *opts);
1435-
1436-
/**
1437-
* Create an e-mail ready patch for a commit.
1438-
*
1439-
* Does not support creating patches for merge commits (yet).
1440-
*
1441-
* @param out buffer to store the e-mail patch in
1442-
* @param repo containing the commit
1443-
* @param commit pointer to up commit
1444-
* @param patch_no patch number of the commit
1445-
* @param total_patches total number of patches in the patch set
1446-
* @param flags determines the formatting of the e-mail
1447-
* @param diff_opts structure with options to influence diff or NULL for defaults.
1448-
* @return 0 or an error code
1449-
*/
1450-
GIT_EXTERN(int) git_diff_commit_as_email(
1451-
git_buf *out,
1452-
git_repository *repo,
1453-
git_commit *commit,
1454-
size_t patch_no,
1455-
size_t total_patches,
1456-
uint32_t flags,
1457-
const git_diff_options *diff_opts);
1458-
1459-
/**
1460-
* Initialize git_diff_format_email_options structure
1461-
*
1462-
* Initializes a `git_diff_format_email_options` with default values. Equivalent
1463-
* to creating an instance with GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT.
1464-
*
1465-
* @param opts The `git_blame_options` struct to initialize.
1466-
* @param version The struct version; pass `GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION`.
1467-
* @return Zero on success; -1 on failure.
1468-
*/
1469-
GIT_EXTERN(int) git_diff_format_email_options_init(
1470-
git_diff_format_email_options *opts,
1471-
unsigned int version);
1472-
14731378
/**
14741379
* Patch ID options structure
14751380
*

0 commit comments

Comments
 (0)