| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -294,6 +294,102 @@ typedef git_configmap git_cvar_map; | |||
| 294 | 294 | ||
| 295 | 295 | /**@}*/ | |
| 296 | 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 | + | ||
| 297 | 393 | /** @name Deprecated Error Functions and Constants | |
| 298 | 394 | * | |
| 299 | 395 | * These functions and enumeration values are retained for backward | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1376,99 +1376,6 @@ GIT_EXTERN(int) git_diff_stats_to_buf( | |||
| 1376 | 1376 | */ | |
| 1377 | 1377 | GIT_EXTERN(void) git_diff_stats_free(git_diff_stats *stats); | |
| 1378 | 1378 | ||
| 1379 | - /** | ||
| 1380 | - * Formatting options for diff e-mail generation | ||
| 1381 | - */ | ||
| 1382 | - typedef enum { | ||
| 1383 | - /** Normal patch, the default */ | ||
| 1384 | - GIT_DIFF_FORMAT_EMAIL_NONE = 0, | ||
| 1385 | - | ||
| 1386 | - /** Don't insert "[PATCH]" in the subject header*/ | ||
| 1387 | - GIT_DIFF_FORMAT_EMAIL_EXCLUDE_SUBJECT_PATCH_MARKER = (1 << 0), | ||
| 1388 | - | ||
| 1389 | - } git_diff_format_email_flags_t; | ||
| 1390 | - | ||
| 1391 | - /** | ||
| 1392 | - * Options for controlling the formatting of the generated e-mail. | ||
| 1393 | - */ | ||
| 1394 | - typedef struct { | ||
| 1395 | - unsigned int version; | ||
| 1396 | - | ||
| 1397 | - /** see `git_diff_format_email_flags_t` above */ | ||
| 1398 | - uint32_t flags; | ||
| 1399 | - | ||
| 1400 | - /** This patch number */ | ||
| 1401 | - size_t patch_no; | ||
| 1402 | - | ||
| 1403 | - /** Total number of patches in this series */ | ||
| 1404 | - size_t total_patches; | ||
| 1405 | - | ||
| 1406 | - /** id to use for the commit */ | ||
| 1407 | - const git_oid *id; | ||
| 1408 | - | ||
| 1409 | - /** Summary of the change */ | ||
| 1410 | - const char *summary; | ||
| 1411 | - | ||
| 1412 | - /** Commit message's body */ | ||
| 1413 | - const char *body; | ||
| 1414 | - | ||
| 1415 | - /** Author of the change */ | ||
| 1416 | - const git_signature *author; | ||
| 1417 | - } git_diff_format_email_options; | ||
| 1418 | - | ||
| 1419 | - #define GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION 1 | ||
| 1420 | - #define GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT {GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION, 0, 1, 1, NULL, NULL, NULL, NULL} | ||
| 1421 | - | ||
| 1422 | - /** | ||
| 1423 | - * Create an e-mail ready patch from a diff. | ||
| 1424 | - * | ||
| 1425 | - * @param out buffer to store the e-mail patch in | ||
| 1426 | - * @param diff containing the commit | ||
| 1427 | - * @param opts structure with options to influence content and formatting. | ||
| 1428 | - * @return 0 or an error code | ||
| 1429 | - */ | ||
| 1430 | - GIT_EXTERN(int) git_diff_format_email( | ||
| 1431 | - git_buf *out, | ||
| 1432 | - git_diff *diff, | ||
| 1433 | - const git_diff_format_email_options *opts); | ||
| 1434 | - | ||
| 1435 | - /** | ||
| 1436 | - * Create an e-mail ready patch for a commit. | ||
| 1437 | - * | ||
| 1438 | - * Does not support creating patches for merge commits (yet). | ||
| 1439 | - * | ||
| 1440 | - * @param out buffer to store the e-mail patch in | ||
| 1441 | - * @param repo containing the commit | ||
| 1442 | - * @param commit pointer to up commit | ||
| 1443 | - * @param patch_no patch number of the commit | ||
| 1444 | - * @param total_patches total number of patches in the patch set | ||
| 1445 | - * @param flags determines the formatting of the e-mail | ||
| 1446 | - * @param diff_opts structure with options to influence diff or NULL for defaults. | ||
| 1447 | - * @return 0 or an error code | ||
| 1448 | - */ | ||
| 1449 | - GIT_EXTERN(int) git_diff_commit_as_email( | ||
| 1450 | - git_buf *out, | ||
| 1451 | - git_repository *repo, | ||
| 1452 | - git_commit *commit, | ||
| 1453 | - size_t patch_no, | ||
| 1454 | - size_t total_patches, | ||
| 1455 | - uint32_t flags, | ||
| 1456 | - const git_diff_options *diff_opts); | ||
| 1457 | - | ||
| 1458 | - /** | ||
| 1459 | - * Initialize git_diff_format_email_options structure | ||
| 1460 | - * | ||
| 1461 | - * Initializes a `git_diff_format_email_options` with default values. Equivalent | ||
| 1462 | - * to creating an instance with GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT. | ||
| 1463 | - * | ||
| 1464 | - * @param opts The `git_blame_options` struct to initialize. | ||
| 1465 | - * @param version The struct version; pass `GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION`. | ||
| 1466 | - * @return Zero on success; -1 on failure. | ||
| 1467 | - */ | ||
| 1468 | - GIT_EXTERN(int) git_diff_format_email_options_init( | ||
| 1469 | - git_diff_format_email_options *opts, | ||
| 1470 | - unsigned int version); | ||
| 1471 | - | ||
| 1472 | 1379 | /** | |
| 1473 | 1380 | * Patch ID options structure | |
| 1474 | 1381 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,13 +7,15 @@ | |||
| 7 | 7 | ||
| 8 | 8 | #include "diff.h" | |
| 9 | 9 | ||
| 10 | - #include "git2/version.h" | ||
| 11 | - #include "git2/email.h" | ||
| 12 | - #include "diff_generate.h" | ||
| 10 | + #include "common.h" | ||
| 13 | 11 | #include "patch.h" | |
| 14 | 12 | #include "email.h" | |
| 15 | 13 | #include "commit.h" | |
| 16 | 14 | #include "index.h" | |
| 15 | + #include "diff_generate.h" | ||
| 16 | + | ||
| 17 | + #include "git2/version.h" | ||
| 18 | + #include "git2/email.h" | ||
| 17 | 19 | ||
| 18 | 20 | struct patch_id_args { | |
| 19 | 21 | git_hash_ctx ctx; | |
@@ -152,6 +154,8 @@ int git_diff_foreach( | |||
| 152 | 154 | return error; | |
| 153 | 155 | } | |
| 154 | 156 | ||
| 157 | + #ifndef GIT_DEPRECATE_HARD | ||
| 158 | + | ||
| 155 | 159 | int git_diff_format_email( | |
| 156 | 160 | git_buf *out, | |
| 157 | 161 | git_diff *diff, | |
@@ -216,35 +220,16 @@ int git_diff_commit_as_email( | |||
| 216 | 220 | return error; | |
| 217 | 221 | } | |
| 218 | 222 | ||
| 219 | - int git_diff_options_init(git_diff_options *opts, unsigned int version) | ||
| 220 | - { | ||
| 221 | - GIT_INIT_STRUCTURE_FROM_TEMPLATE( | ||
| 222 | - opts, version, git_diff_options, GIT_DIFF_OPTIONS_INIT); | ||
| 223 | - return 0; | ||
| 224 | - } | ||
| 225 | - | ||
| 226 | - #ifndef GIT_DEPRECATE_HARD | ||
| 227 | 223 | int git_diff_init_options(git_diff_options *opts, unsigned int version) | |
| 228 | 224 | { | |
| 229 | 225 | return git_diff_options_init(opts, version); | |
| 230 | 226 | } | |
| 231 | - #endif | ||
| 232 | 227 | ||
| 233 | - int git_diff_find_options_init( | ||
| 234 | - git_diff_find_options *opts, unsigned int version) | ||
| 235 | - { | ||
| 236 | - GIT_INIT_STRUCTURE_FROM_TEMPLATE( | ||
| 237 | - opts, version, git_diff_find_options, GIT_DIFF_FIND_OPTIONS_INIT); | ||
| 238 | - return 0; | ||
| 239 | - } | ||
| 240 | - | ||
| 241 | - #ifndef GIT_DEPRECATE_HARD | ||
| 242 | 228 | int git_diff_find_init_options( | |
| 243 | 229 | git_diff_find_options *opts, unsigned int version) | |
| 244 | 230 | { | |
| 245 | 231 | return git_diff_find_options_init(opts, version); | |
| 246 | 232 | } | |
| 247 | - #endif | ||
| 248 | 233 | ||
| 249 | 234 | int git_diff_format_email_options_init( | |
| 250 | 235 | git_diff_format_email_options *opts, unsigned int version) | |
@@ -255,14 +240,29 @@ int git_diff_format_email_options_init( | |||
| 255 | 240 | return 0; | |
| 256 | 241 | } | |
| 257 | 242 | ||
| 258 | - #ifndef GIT_DEPRECATE_HARD | ||
| 259 | 243 | int git_diff_format_email_init_options( | |
| 260 | 244 | git_diff_format_email_options *opts, unsigned int version) | |
| 261 | 245 | { | |
| 262 | 246 | return git_diff_format_email_options_init(opts, version); | |
| 263 | 247 | } | |
| 248 | + | ||
| 264 | 249 | #endif | |
| 265 | 250 | ||
| 251 | + int git_diff_options_init(git_diff_options *opts, unsigned int version) | ||
| 252 | + { | ||
| 253 | + GIT_INIT_STRUCTURE_FROM_TEMPLATE( | ||
| 254 | + opts, version, git_diff_options, GIT_DIFF_OPTIONS_INIT); | ||
| 255 | + return 0; | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + int git_diff_find_options_init( | ||
| 259 | + git_diff_find_options *opts, unsigned int version) | ||
| 260 | + { | ||
| 261 | + GIT_INIT_STRUCTURE_FROM_TEMPLATE( | ||
| 262 | + opts, version, git_diff_find_options, GIT_DIFF_FIND_OPTIONS_INIT); | ||
| 263 | + return 0; | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | 266 | static int flush_hunk(git_oid *result, git_hash_ctx *ctx) | |
| 267 | 267 | { | |
| 268 | 268 | git_oid hash; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments