Commit 16b83019 by Russell Belfer Committed by Russell Belfer

Fix usage of "new" for fieldname in public header

This should restore the ability to include libgit2 headers
in C++ projects.

Cherry picked 2de60205 from
development into new-error-handling.
parent b8802146
...@@ -57,8 +57,8 @@ typedef struct { ...@@ -57,8 +57,8 @@ typedef struct {
uint32_t flags; /**< defaults to GIT_DIFF_NORMAL */ uint32_t flags; /**< defaults to GIT_DIFF_NORMAL */
uint16_t context_lines; /**< defaults to 3 */ uint16_t context_lines; /**< defaults to 3 */
uint16_t interhunk_lines; /**< defaults to 3 */ uint16_t interhunk_lines; /**< defaults to 3 */
char *src_prefix; /**< defaults to "a" */ char *old_prefix; /**< defaults to "a" */
char *dst_prefix; /**< defaults to "b" */ char *new_prefix; /**< defaults to "b" */
git_strarray pathspec; /**< defaults to show all paths */ git_strarray pathspec; /**< defaults to show all paths */
} git_diff_options; } git_diff_options;
...@@ -115,11 +115,11 @@ typedef struct { ...@@ -115,11 +115,11 @@ typedef struct {
* It will just use the git attributes for those files. * It will just use the git attributes for those files.
*/ */
typedef struct { typedef struct {
git_diff_file old; git_diff_file old_file;
git_diff_file new; git_diff_file new_file;
git_delta_t status; git_delta_t status;
unsigned int similarity; /**< for RENAMED and COPIED, value from 0 to 100 */ unsigned int similarity; /**< for RENAMED and COPIED, value 0-100 */
int binary; int binary;
} git_diff_delta; } git_diff_delta;
/** /**
...@@ -208,15 +208,15 @@ GIT_EXTERN(void) git_diff_list_free(git_diff_list *diff); ...@@ -208,15 +208,15 @@ GIT_EXTERN(void) git_diff_list_free(git_diff_list *diff);
* *
* @param repo The repository containing the trees. * @param repo The repository containing the trees.
* @param opts Structure with options to influence diff or NULL for defaults. * @param opts Structure with options to influence diff or NULL for defaults.
* @param old A git_tree object to diff from. * @param old_tree A git_tree object to diff from.
* @param new A git_tree object to diff to. * @param new_tree A git_tree object to diff to.
* @param diff A pointer to a git_diff_list pointer that will be allocated. * @param diff A pointer to a git_diff_list pointer that will be allocated.
*/ */
GIT_EXTERN(int) git_diff_tree_to_tree( GIT_EXTERN(int) git_diff_tree_to_tree(
git_repository *repo, git_repository *repo,
const git_diff_options *opts, /**< can be NULL for defaults */ const git_diff_options *opts, /**< can be NULL for defaults */
git_tree *old, git_tree *old_tree,
git_tree *new, git_tree *new_tree,
git_diff_list **diff); git_diff_list **diff);
/** /**
...@@ -224,13 +224,13 @@ GIT_EXTERN(int) git_diff_tree_to_tree( ...@@ -224,13 +224,13 @@ GIT_EXTERN(int) git_diff_tree_to_tree(
* *
* @param repo The repository containing the tree and index. * @param repo The repository containing the tree and index.
* @param opts Structure with options to influence diff or NULL for defaults. * @param opts Structure with options to influence diff or NULL for defaults.
* @param old A git_tree object to diff from. * @param old_tree A git_tree object to diff from.
* @param diff A pointer to a git_diff_list pointer that will be allocated. * @param diff A pointer to a git_diff_list pointer that will be allocated.
*/ */
GIT_EXTERN(int) git_diff_index_to_tree( GIT_EXTERN(int) git_diff_index_to_tree(
git_repository *repo, git_repository *repo,
const git_diff_options *opts, /**< can be NULL for defaults */ const git_diff_options *opts, /**< can be NULL for defaults */
git_tree *old, git_tree *old_tree,
git_diff_list **diff); git_diff_list **diff);
/** /**
...@@ -259,13 +259,13 @@ GIT_EXTERN(int) git_diff_workdir_to_index( ...@@ -259,13 +259,13 @@ GIT_EXTERN(int) git_diff_workdir_to_index(
* *
* @param repo The repository containing the tree. * @param repo The repository containing the tree.
* @param opts Structure with options to influence diff or NULL for defaults. * @param opts Structure with options to influence diff or NULL for defaults.
* @param old A git_tree object to diff from. * @param old_tree A git_tree object to diff from.
* @param diff A pointer to a git_diff_list pointer that will be allocated. * @param diff A pointer to a git_diff_list pointer that will be allocated.
*/ */
GIT_EXTERN(int) git_diff_workdir_to_tree( GIT_EXTERN(int) git_diff_workdir_to_tree(
git_repository *repo, git_repository *repo,
const git_diff_options *opts, /**< can be NULL for defaults */ const git_diff_options *opts, /**< can be NULL for defaults */
git_tree *old, git_tree *old_tree,
git_diff_list **diff); git_diff_list **diff);
/** /**
...@@ -340,8 +340,8 @@ GIT_EXTERN(int) git_diff_print_patch( ...@@ -340,8 +340,8 @@ GIT_EXTERN(int) git_diff_print_patch(
*/ */
GIT_EXTERN(int) git_diff_blobs( GIT_EXTERN(int) git_diff_blobs(
git_repository *repo, git_repository *repo,
git_blob *old, git_blob *old_blob,
git_blob *new, git_blob *new_blob,
git_diff_options *options, git_diff_options *options,
void *cb_data, void *cb_data,
git_diff_hunk_fn hunk_cb, git_diff_hunk_fn hunk_cb,
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
#include "repository.h" #include "repository.h"
#include "pool.h" #include "pool.h"
#define DIFF_SRC_PREFIX_DEFAULT "a/" #define DIFF_OLD_PREFIX_DEFAULT "a/"
#define DIFF_DST_PREFIX_DEFAULT "b/" #define DIFF_NEW_PREFIX_DEFAULT "b/"
enum { enum {
GIT_DIFFCAPS_HAS_SYMLINKS = (1 << 0), /* symlinks on platform? */ GIT_DIFFCAPS_HAS_SYMLINKS = (1 << 0), /* symlinks on platform? */
......
...@@ -150,7 +150,7 @@ int git_status_foreach_ext( ...@@ -150,7 +150,7 @@ int git_status_foreach_ext(
if (show == GIT_STATUS_SHOW_INDEX_THEN_WORKDIR) { if (show == GIT_STATUS_SHOW_INDEX_THEN_WORKDIR) {
for (i = 0; !err && i < idx2head->deltas.length; i++) { for (i = 0; !err && i < idx2head->deltas.length; i++) {
i2h = GIT_VECTOR_GET(&idx2head->deltas, i); i2h = GIT_VECTOR_GET(&idx2head->deltas, i);
err = cb(i2h->old.path, index_delta2status(i2h->status), cbdata); err = cb(i2h->old_file.path, index_delta2status(i2h->status), cbdata);
} }
git_diff_list_free(idx2head); git_diff_list_free(idx2head);
idx2head = NULL; idx2head = NULL;
...@@ -163,16 +163,16 @@ int git_status_foreach_ext( ...@@ -163,16 +163,16 @@ int git_status_foreach_ext(
i2h = idx2head ? GIT_VECTOR_GET(&idx2head->deltas,i) : NULL; i2h = idx2head ? GIT_VECTOR_GET(&idx2head->deltas,i) : NULL;
w2i = wd2idx ? GIT_VECTOR_GET(&wd2idx->deltas,j) : NULL; w2i = wd2idx ? GIT_VECTOR_GET(&wd2idx->deltas,j) : NULL;
cmp = !w2i ? -1 : !i2h ? 1 : strcmp(i2h->old.path, w2i->old.path); cmp = !w2i ? -1 : !i2h ? 1 : strcmp(i2h->old_file.path, w2i->old_file.path);
if (cmp < 0) { if (cmp < 0) {
err = cb(i2h->old.path, index_delta2status(i2h->status), cbdata); err = cb(i2h->old_file.path, index_delta2status(i2h->status), cbdata);
i++; i++;
} else if (cmp > 0) { } else if (cmp > 0) {
err = cb(w2i->old.path, workdir_delta2status(w2i->status), cbdata); err = cb(w2i->old_file.path, workdir_delta2status(w2i->status), cbdata);
j++; j++;
} else { } else {
err = cb(i2h->old.path, index_delta2status(i2h->status) | err = cb(i2h->old_file.path, index_delta2status(i2h->status) |
workdir_delta2status(w2i->status), cbdata); workdir_delta2status(w2i->status), cbdata);
i++; j++; i++; j++;
} }
......
...@@ -59,8 +59,8 @@ check_range: ...@@ -59,8 +59,8 @@ check_range:
cl_assert_equal_i(0, range->new_lines); cl_assert_equal_i(0, range->new_lines);
check_delta: check_delta:
cl_assert_equal_s("subdir.txt", delta->old.path); cl_assert_equal_s("subdir.txt", delta->old_file.path);
cl_assert_equal_s("subdir.txt", delta->new.path); cl_assert_equal_s("subdir.txt", delta->new_file.path);
cl_assert_equal_i(GIT_DELTA_DELETED, delta->status); cl_assert_equal_i(GIT_DELTA_DELETED, delta->status);
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment