mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-30 01:39:29 +00:00
diff: rename the file's 'oid' to 'id'
In the same vein as the previous commits in this series.
This commit is contained in:
parent
f000ee4e5b
commit
9950bb4e8d
@ -203,7 +203,7 @@ typedef struct git_diff git_diff;
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
GIT_DIFF_FLAG_BINARY = (1u << 0), /** file(s) treated as binary data */
|
GIT_DIFF_FLAG_BINARY = (1u << 0), /** file(s) treated as binary data */
|
||||||
GIT_DIFF_FLAG_NOT_BINARY = (1u << 1), /** file(s) treated as text data */
|
GIT_DIFF_FLAG_NOT_BINARY = (1u << 1), /** file(s) treated as text data */
|
||||||
GIT_DIFF_FLAG_VALID_OID = (1u << 2), /** `oid` value is known correct */
|
GIT_DIFF_FLAG_VALID_ID = (1u << 2), /** `id` value is known correct */
|
||||||
} git_diff_flag_t;
|
} git_diff_flag_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,7 +250,7 @@ typedef enum {
|
|||||||
* be restricted to one of the `git_filemode_t` values.
|
* be restricted to one of the `git_filemode_t` values.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
git_oid oid;
|
git_oid id;
|
||||||
const char *path;
|
const char *path;
|
||||||
git_off_t size;
|
git_off_t size;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
|
@ -92,10 +92,10 @@ static int checkout_notify(
|
|||||||
if (wditem) {
|
if (wditem) {
|
||||||
memset(&wdfile, 0, sizeof(wdfile));
|
memset(&wdfile, 0, sizeof(wdfile));
|
||||||
|
|
||||||
git_oid_cpy(&wdfile.oid, &wditem->id);
|
git_oid_cpy(&wdfile.id, &wditem->id);
|
||||||
wdfile.path = wditem->path;
|
wdfile.path = wditem->path;
|
||||||
wdfile.size = wditem->file_size;
|
wdfile.size = wditem->file_size;
|
||||||
wdfile.flags = GIT_DIFF_FLAG_VALID_OID;
|
wdfile.flags = GIT_DIFF_FLAG_VALID_ID;
|
||||||
wdfile.mode = wditem->mode;
|
wdfile.mode = wditem->mode;
|
||||||
|
|
||||||
workdir = &wdfile;
|
workdir = &wdfile;
|
||||||
@ -159,7 +159,7 @@ static bool checkout_is_workdir_modified(
|
|||||||
if (!sm_oid)
|
if (!sm_oid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (git_oid__cmp(&baseitem->oid, sm_oid) != 0);
|
return (git_oid__cmp(&baseitem->id, sm_oid) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look at the cache to decide if the workdir is modified. If not,
|
/* Look at the cache to decide if the workdir is modified. If not,
|
||||||
@ -170,7 +170,7 @@ static bool checkout_is_workdir_modified(
|
|||||||
if (wditem->mtime.seconds == ie->mtime.seconds &&
|
if (wditem->mtime.seconds == ie->mtime.seconds &&
|
||||||
wditem->mtime.nanoseconds == ie->mtime.nanoseconds &&
|
wditem->mtime.nanoseconds == ie->mtime.nanoseconds &&
|
||||||
wditem->file_size == ie->file_size)
|
wditem->file_size == ie->file_size)
|
||||||
return (git_oid__cmp(&baseitem->oid, &ie->id) != 0);
|
return (git_oid__cmp(&baseitem->id, &ie->id) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* depending on where base is coming from, we may or may not know
|
/* depending on where base is coming from, we may or may not know
|
||||||
@ -184,7 +184,7 @@ static bool checkout_is_workdir_modified(
|
|||||||
wditem->file_size, &oid) < 0)
|
wditem->file_size, &oid) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (git_oid__cmp(&baseitem->oid, &oid) != 0);
|
return (git_oid__cmp(&baseitem->id, &oid) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECKOUT_ACTION_IF(FLAG,YES,NO) \
|
#define CHECKOUT_ACTION_IF(FLAG,YES,NO) \
|
||||||
@ -1221,7 +1221,7 @@ static int checkout_update_index(
|
|||||||
memset(&entry, 0, sizeof(entry));
|
memset(&entry, 0, sizeof(entry));
|
||||||
entry.path = (char *)file->path; /* cast to prevent warning */
|
entry.path = (char *)file->path; /* cast to prevent warning */
|
||||||
git_index_entry__init_from_stat(&entry, st, true);
|
git_index_entry__init_from_stat(&entry, st, true);
|
||||||
git_oid_cpy(&entry.id, &file->oid);
|
git_oid_cpy(&entry.id, &file->id);
|
||||||
|
|
||||||
return git_index_add(data->index, &entry);
|
return git_index_add(data->index, &entry);
|
||||||
}
|
}
|
||||||
@ -1378,7 +1378,7 @@ static int checkout_blob(
|
|||||||
}
|
}
|
||||||
|
|
||||||
error = checkout_write_content(
|
error = checkout_write_content(
|
||||||
data, &file->oid, git_buf_cstr(&data->path), NULL, file->mode, &st);
|
data, &file->id, git_buf_cstr(&data->path), NULL, file->mode, &st);
|
||||||
|
|
||||||
/* update the index unless prevented */
|
/* update the index unless prevented */
|
||||||
if (!error && (data->strategy & GIT_CHECKOUT_DONT_UPDATE_INDEX) == 0)
|
if (!error && (data->strategy & GIT_CHECKOUT_DONT_UPDATE_INDEX) == 0)
|
||||||
|
32
src/diff.c
32
src/diff.c
@ -110,18 +110,18 @@ static int diff_delta__from_one(
|
|||||||
if (delta->status == GIT_DELTA_DELETED) {
|
if (delta->status == GIT_DELTA_DELETED) {
|
||||||
delta->old_file.mode = entry->mode;
|
delta->old_file.mode = entry->mode;
|
||||||
delta->old_file.size = entry->file_size;
|
delta->old_file.size = entry->file_size;
|
||||||
git_oid_cpy(&delta->old_file.oid, &entry->id);
|
git_oid_cpy(&delta->old_file.id, &entry->id);
|
||||||
} else /* ADDED, IGNORED, UNTRACKED */ {
|
} else /* ADDED, IGNORED, UNTRACKED */ {
|
||||||
delta->new_file.mode = entry->mode;
|
delta->new_file.mode = entry->mode;
|
||||||
delta->new_file.size = entry->file_size;
|
delta->new_file.size = entry->file_size;
|
||||||
git_oid_cpy(&delta->new_file.oid, &entry->id);
|
git_oid_cpy(&delta->new_file.id, &entry->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
delta->old_file.flags |= GIT_DIFF_FLAG_VALID_OID;
|
delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
|
|
||||||
if (delta->status == GIT_DELTA_DELETED ||
|
if (delta->status == GIT_DELTA_DELETED ||
|
||||||
!git_oid_iszero(&delta->new_file.oid))
|
!git_oid_iszero(&delta->new_file.id))
|
||||||
delta->new_file.flags |= GIT_DIFF_FLAG_VALID_OID;
|
delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
|
|
||||||
return diff_insert_delta(diff, delta, matched_pathspec);
|
return diff_insert_delta(diff, delta, matched_pathspec);
|
||||||
}
|
}
|
||||||
@ -156,24 +156,24 @@ static int diff_delta__from_two(
|
|||||||
GITERR_CHECK_ALLOC(delta);
|
GITERR_CHECK_ALLOC(delta);
|
||||||
delta->nfiles = 2;
|
delta->nfiles = 2;
|
||||||
|
|
||||||
git_oid_cpy(&delta->old_file.oid, &old_entry->id);
|
git_oid_cpy(&delta->old_file.id, &old_entry->id);
|
||||||
delta->old_file.size = old_entry->file_size;
|
delta->old_file.size = old_entry->file_size;
|
||||||
delta->old_file.mode = old_mode;
|
delta->old_file.mode = old_mode;
|
||||||
delta->old_file.flags |= GIT_DIFF_FLAG_VALID_OID;
|
delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
|
|
||||||
git_oid_cpy(&delta->new_file.oid, &new_entry->id);
|
git_oid_cpy(&delta->new_file.id, &new_entry->id);
|
||||||
delta->new_file.size = new_entry->file_size;
|
delta->new_file.size = new_entry->file_size;
|
||||||
delta->new_file.mode = new_mode;
|
delta->new_file.mode = new_mode;
|
||||||
|
|
||||||
if (new_oid) {
|
if (new_oid) {
|
||||||
if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_REVERSE))
|
if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_REVERSE))
|
||||||
git_oid_cpy(&delta->old_file.oid, new_oid);
|
git_oid_cpy(&delta->old_file.id, new_oid);
|
||||||
else
|
else
|
||||||
git_oid_cpy(&delta->new_file.oid, new_oid);
|
git_oid_cpy(&delta->new_file.id, new_oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_oid || !git_oid_iszero(&new_entry->id))
|
if (new_oid || !git_oid_iszero(&new_entry->id))
|
||||||
delta->new_file.flags |= GIT_DIFF_FLAG_VALID_OID;
|
delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
|
|
||||||
return diff_insert_delta(diff, delta, matched_pathspec);
|
return diff_insert_delta(diff, delta, matched_pathspec);
|
||||||
}
|
}
|
||||||
@ -189,21 +189,21 @@ static git_diff_delta *diff_delta__last_for_item(
|
|||||||
switch (delta->status) {
|
switch (delta->status) {
|
||||||
case GIT_DELTA_UNMODIFIED:
|
case GIT_DELTA_UNMODIFIED:
|
||||||
case GIT_DELTA_DELETED:
|
case GIT_DELTA_DELETED:
|
||||||
if (git_oid__cmp(&delta->old_file.oid, &item->id) == 0)
|
if (git_oid__cmp(&delta->old_file.id, &item->id) == 0)
|
||||||
return delta;
|
return delta;
|
||||||
break;
|
break;
|
||||||
case GIT_DELTA_ADDED:
|
case GIT_DELTA_ADDED:
|
||||||
if (git_oid__cmp(&delta->new_file.oid, &item->id) == 0)
|
if (git_oid__cmp(&delta->new_file.id, &item->id) == 0)
|
||||||
return delta;
|
return delta;
|
||||||
break;
|
break;
|
||||||
case GIT_DELTA_UNTRACKED:
|
case GIT_DELTA_UNTRACKED:
|
||||||
if (diff->strcomp(delta->new_file.path, item->path) == 0 &&
|
if (diff->strcomp(delta->new_file.path, item->path) == 0 &&
|
||||||
git_oid__cmp(&delta->new_file.oid, &item->id) == 0)
|
git_oid__cmp(&delta->new_file.id, &item->id) == 0)
|
||||||
return delta;
|
return delta;
|
||||||
break;
|
break;
|
||||||
case GIT_DELTA_MODIFIED:
|
case GIT_DELTA_MODIFIED:
|
||||||
if (git_oid__cmp(&delta->old_file.oid, &item->id) == 0 ||
|
if (git_oid__cmp(&delta->old_file.id, &item->id) == 0 ||
|
||||||
git_oid__cmp(&delta->new_file.oid, &item->id) == 0)
|
git_oid__cmp(&delta->new_file.id, &item->id) == 0)
|
||||||
return delta;
|
return delta;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -134,7 +134,7 @@ GIT_INLINE(int) git_diff_file__resolve_zero_size(
|
|||||||
return error;
|
return error;
|
||||||
|
|
||||||
error = git_odb__read_header_or_object(
|
error = git_odb__read_header_or_object(
|
||||||
odb_obj, &len, &type, odb, &file->oid);
|
odb_obj, &len, &type, odb, &file->id);
|
||||||
|
|
||||||
git_odb_free(odb);
|
git_odb_free(odb);
|
||||||
|
|
||||||
|
@ -143,10 +143,10 @@ int git_diff_file_content__init_from_blob(
|
|||||||
fc->flags |= GIT_DIFF_FLAG__NO_DATA;
|
fc->flags |= GIT_DIFF_FLAG__NO_DATA;
|
||||||
} else {
|
} else {
|
||||||
fc->flags |= GIT_DIFF_FLAG__LOADED;
|
fc->flags |= GIT_DIFF_FLAG__LOADED;
|
||||||
fc->file->flags |= GIT_DIFF_FLAG_VALID_OID;
|
fc->file->flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
fc->file->size = git_blob_rawsize(blob);
|
fc->file->size = git_blob_rawsize(blob);
|
||||||
fc->file->mode = GIT_FILEMODE_BLOB;
|
fc->file->mode = GIT_FILEMODE_BLOB;
|
||||||
git_oid_cpy(&fc->file->oid, git_blob_id(blob));
|
git_oid_cpy(&fc->file->id, git_blob_id(blob));
|
||||||
|
|
||||||
fc->map.len = (size_t)fc->file->size;
|
fc->map.len = (size_t)fc->file->size;
|
||||||
fc->map.data = (char *)git_blob_rawcontent(blob);
|
fc->map.data = (char *)git_blob_rawcontent(blob);
|
||||||
@ -171,10 +171,10 @@ int git_diff_file_content__init_from_raw(
|
|||||||
fc->flags |= GIT_DIFF_FLAG__NO_DATA;
|
fc->flags |= GIT_DIFF_FLAG__NO_DATA;
|
||||||
} else {
|
} else {
|
||||||
fc->flags |= GIT_DIFF_FLAG__LOADED;
|
fc->flags |= GIT_DIFF_FLAG__LOADED;
|
||||||
fc->file->flags |= GIT_DIFF_FLAG_VALID_OID;
|
fc->file->flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
fc->file->size = buflen;
|
fc->file->size = buflen;
|
||||||
fc->file->mode = GIT_FILEMODE_BLOB;
|
fc->file->mode = GIT_FILEMODE_BLOB;
|
||||||
git_odb_hash(&fc->file->oid, buf, buflen, GIT_OBJ_BLOB);
|
git_odb_hash(&fc->file->id, buf, buflen, GIT_OBJ_BLOB);
|
||||||
|
|
||||||
fc->map.len = buflen;
|
fc->map.len = buflen;
|
||||||
fc->map.data = (char *)buf;
|
fc->map.data = (char *)buf;
|
||||||
@ -205,19 +205,19 @@ static int diff_file_content_commit_to_str(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* update OID if we didn't have it previously */
|
/* update OID if we didn't have it previously */
|
||||||
if ((fc->file->flags & GIT_DIFF_FLAG_VALID_OID) == 0 &&
|
if ((fc->file->flags & GIT_DIFF_FLAG_VALID_ID) == 0 &&
|
||||||
((sm_head = git_submodule_wd_id(sm)) != NULL ||
|
((sm_head = git_submodule_wd_id(sm)) != NULL ||
|
||||||
(sm_head = git_submodule_head_id(sm)) != NULL))
|
(sm_head = git_submodule_head_id(sm)) != NULL))
|
||||||
{
|
{
|
||||||
git_oid_cpy(&fc->file->oid, sm_head);
|
git_oid_cpy(&fc->file->id, sm_head);
|
||||||
fc->file->flags |= GIT_DIFF_FLAG_VALID_OID;
|
fc->file->flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GIT_SUBMODULE_STATUS_IS_WD_DIRTY(sm_status))
|
if (GIT_SUBMODULE_STATUS_IS_WD_DIRTY(sm_status))
|
||||||
status = "-dirty";
|
status = "-dirty";
|
||||||
}
|
}
|
||||||
|
|
||||||
git_oid_tostr(oid, sizeof(oid), &fc->file->oid);
|
git_oid_tostr(oid, sizeof(oid), &fc->file->id);
|
||||||
if (git_buf_printf(&content, "Subproject commit %s%s\n", oid, status) < 0)
|
if (git_buf_printf(&content, "Subproject commit %s%s\n", oid, status) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ static int diff_file_content_load_blob(git_diff_file_content *fc)
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
git_odb_object *odb_obj = NULL;
|
git_odb_object *odb_obj = NULL;
|
||||||
|
|
||||||
if (git_oid_iszero(&fc->file->oid))
|
if (git_oid_iszero(&fc->file->id))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (fc->file->mode == GIT_FILEMODE_COMMIT)
|
if (fc->file->mode == GIT_FILEMODE_COMMIT)
|
||||||
@ -255,7 +255,7 @@ static int diff_file_content_load_blob(git_diff_file_content *fc)
|
|||||||
git_odb_object_free(odb_obj);
|
git_odb_object_free(odb_obj);
|
||||||
} else {
|
} else {
|
||||||
error = git_blob_lookup(
|
error = git_blob_lookup(
|
||||||
(git_blob **)&fc->blob, fc->repo, &fc->file->oid);
|
(git_blob **)&fc->blob, fc->repo, &fc->file->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
@ -368,10 +368,10 @@ static int diff_file_content_load_workdir(git_diff_file_content *fc)
|
|||||||
error = diff_file_content_load_workdir_file(fc, &path);
|
error = diff_file_content_load_workdir_file(fc, &path);
|
||||||
|
|
||||||
/* once data is loaded, update OID if we didn't have it previously */
|
/* once data is loaded, update OID if we didn't have it previously */
|
||||||
if (!error && (fc->file->flags & GIT_DIFF_FLAG_VALID_OID) == 0) {
|
if (!error && (fc->file->flags & GIT_DIFF_FLAG_VALID_ID) == 0) {
|
||||||
error = git_odb_hash(
|
error = git_odb_hash(
|
||||||
&fc->file->oid, fc->map.data, fc->map.len, GIT_OBJ_BLOB);
|
&fc->file->id, fc->map.data, fc->map.len, GIT_OBJ_BLOB);
|
||||||
fc->file->flags |= GIT_DIFF_FLAG_VALID_OID;
|
fc->file->flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_buf_free(&path);
|
git_buf_free(&path);
|
||||||
|
@ -133,9 +133,9 @@ static int diff_patch_load(git_patch *patch, git_diff_output *output)
|
|||||||
|
|
||||||
incomplete_data =
|
incomplete_data =
|
||||||
(((patch->ofile.flags & GIT_DIFF_FLAG__NO_DATA) != 0 ||
|
(((patch->ofile.flags & GIT_DIFF_FLAG__NO_DATA) != 0 ||
|
||||||
(patch->ofile.file->flags & GIT_DIFF_FLAG_VALID_OID) != 0) &&
|
(patch->ofile.file->flags & GIT_DIFF_FLAG_VALID_ID) != 0) &&
|
||||||
((patch->nfile.flags & GIT_DIFF_FLAG__NO_DATA) != 0 ||
|
((patch->nfile.flags & GIT_DIFF_FLAG__NO_DATA) != 0 ||
|
||||||
(patch->nfile.file->flags & GIT_DIFF_FLAG_VALID_OID) != 0));
|
(patch->nfile.file->flags & GIT_DIFF_FLAG_VALID_ID) != 0));
|
||||||
|
|
||||||
/* always try to load workdir content first because filtering may
|
/* always try to load workdir content first because filtering may
|
||||||
* need 2x data size and this minimizes peak memory footprint
|
* need 2x data size and this minimizes peak memory footprint
|
||||||
@ -169,7 +169,7 @@ static int diff_patch_load(git_patch *patch, git_diff_output *output)
|
|||||||
if (incomplete_data &&
|
if (incomplete_data &&
|
||||||
patch->ofile.file->mode == patch->nfile.file->mode &&
|
patch->ofile.file->mode == patch->nfile.file->mode &&
|
||||||
patch->ofile.file->mode != GIT_FILEMODE_COMMIT &&
|
patch->ofile.file->mode != GIT_FILEMODE_COMMIT &&
|
||||||
git_oid_equal(&patch->ofile.file->oid, &patch->nfile.file->oid) &&
|
git_oid_equal(&patch->ofile.file->id, &patch->nfile.file->id) &&
|
||||||
patch->delta->status == GIT_DELTA_MODIFIED) /* not RENAMED/COPIED! */
|
patch->delta->status == GIT_DELTA_MODIFIED) /* not RENAMED/COPIED! */
|
||||||
patch->delta->status = GIT_DELTA_UNMODIFIED;
|
patch->delta->status = GIT_DELTA_UNMODIFIED;
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ cleanup:
|
|||||||
patch->delta->status != GIT_DELTA_UNMODIFIED &&
|
patch->delta->status != GIT_DELTA_UNMODIFIED &&
|
||||||
(patch->ofile.map.len || patch->nfile.map.len) &&
|
(patch->ofile.map.len || patch->nfile.map.len) &&
|
||||||
(patch->ofile.map.len != patch->nfile.map.len ||
|
(patch->ofile.map.len != patch->nfile.map.len ||
|
||||||
!git_oid_equal(&patch->ofile.file->oid, &patch->nfile.file->oid)))
|
!git_oid_equal(&patch->ofile.file->id, &patch->nfile.file->id)))
|
||||||
patch->flags |= GIT_DIFF_PATCH_DIFFABLE;
|
patch->flags |= GIT_DIFF_PATCH_DIFFABLE;
|
||||||
|
|
||||||
patch->flags |= GIT_DIFF_PATCH_LOADED;
|
patch->flags |= GIT_DIFF_PATCH_LOADED;
|
||||||
@ -315,7 +315,7 @@ static int diff_single_generate(diff_patch_with_delta *pd, git_xdiff_output *xo)
|
|||||||
(has_old ? GIT_DELTA_MODIFIED : GIT_DELTA_ADDED) :
|
(has_old ? GIT_DELTA_MODIFIED : GIT_DELTA_ADDED) :
|
||||||
(has_old ? GIT_DELTA_DELETED : GIT_DELTA_UNTRACKED);
|
(has_old ? GIT_DELTA_DELETED : GIT_DELTA_UNTRACKED);
|
||||||
|
|
||||||
if (git_oid_equal(&patch->nfile.file->oid, &patch->ofile.file->oid))
|
if (git_oid_equal(&patch->nfile.file->id, &patch->ofile.file->id))
|
||||||
pd->delta.status = GIT_DELTA_UNMODIFIED;
|
pd->delta.status = GIT_DELTA_UNMODIFIED;
|
||||||
|
|
||||||
patch->delta = &pd->delta;
|
patch->delta = &pd->delta;
|
||||||
|
@ -170,8 +170,8 @@ static int diff_print_one_raw(
|
|||||||
|
|
||||||
git_buf_clear(out);
|
git_buf_clear(out);
|
||||||
|
|
||||||
git_oid_tostr(start_oid, pi->oid_strlen, &delta->old_file.oid);
|
git_oid_tostr(start_oid, pi->oid_strlen, &delta->old_file.id);
|
||||||
git_oid_tostr(end_oid, pi->oid_strlen, &delta->new_file.oid);
|
git_oid_tostr(end_oid, pi->oid_strlen, &delta->new_file.id);
|
||||||
|
|
||||||
git_buf_printf(
|
git_buf_printf(
|
||||||
out, ":%06o %06o %s... %s... %c",
|
out, ":%06o %06o %s... %s... %c",
|
||||||
@ -203,8 +203,8 @@ static int diff_print_oid_range(
|
|||||||
{
|
{
|
||||||
char start_oid[GIT_OID_HEXSZ+1], end_oid[GIT_OID_HEXSZ+1];
|
char start_oid[GIT_OID_HEXSZ+1], end_oid[GIT_OID_HEXSZ+1];
|
||||||
|
|
||||||
git_oid_tostr(start_oid, oid_strlen, &delta->old_file.oid);
|
git_oid_tostr(start_oid, oid_strlen, &delta->old_file.id);
|
||||||
git_oid_tostr(end_oid, oid_strlen, &delta->new_file.oid);
|
git_oid_tostr(end_oid, oid_strlen, &delta->new_file.id);
|
||||||
|
|
||||||
/* TODO: Match git diff more closely */
|
/* TODO: Match git diff more closely */
|
||||||
if (delta->old_file.mode == delta->new_file.mode) {
|
if (delta->old_file.mode == delta->new_file.mode) {
|
||||||
@ -235,11 +235,11 @@ static int diff_delta_format_with_paths(
|
|||||||
const char *oldpath = delta->old_file.path;
|
const char *oldpath = delta->old_file.path;
|
||||||
const char *newpath = delta->new_file.path;
|
const char *newpath = delta->new_file.path;
|
||||||
|
|
||||||
if (git_oid_iszero(&delta->old_file.oid)) {
|
if (git_oid_iszero(&delta->old_file.id)) {
|
||||||
oldpfx = "";
|
oldpfx = "";
|
||||||
oldpath = "/dev/null";
|
oldpath = "/dev/null";
|
||||||
}
|
}
|
||||||
if (git_oid_iszero(&delta->new_file.oid)) {
|
if (git_oid_iszero(&delta->new_file.id)) {
|
||||||
newpfx = "";
|
newpfx = "";
|
||||||
newpath = "/dev/null";
|
newpath = "/dev/null";
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ static git_diff_delta *diff_delta__merge_like_cgit(
|
|||||||
dup->status = a->status;
|
dup->status = a->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_oid_cpy(&dup->old_file.oid, &a->old_file.oid);
|
git_oid_cpy(&dup->old_file.id, &a->old_file.id);
|
||||||
dup->old_file.mode = a->old_file.mode;
|
dup->old_file.mode = a->old_file.mode;
|
||||||
dup->old_file.size = a->old_file.size;
|
dup->old_file.size = a->old_file.size;
|
||||||
dup->old_file.flags = a->old_file.flags;
|
dup->old_file.flags = a->old_file.flags;
|
||||||
@ -124,7 +124,7 @@ static git_diff_delta *diff_delta__merge_like_cgit_reversed(
|
|||||||
dup->status = b->status;
|
dup->status = b->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_oid_cpy(&dup->old_file.oid, &b->old_file.oid);
|
git_oid_cpy(&dup->old_file.id, &b->old_file.id);
|
||||||
dup->old_file.mode = b->old_file.mode;
|
dup->old_file.mode = b->old_file.mode;
|
||||||
dup->old_file.size = b->old_file.size;
|
dup->old_file.size = b->old_file.size;
|
||||||
dup->old_file.flags = b->old_file.flags;
|
dup->old_file.flags = b->old_file.flags;
|
||||||
@ -375,7 +375,7 @@ static int insert_delete_side_of_split(
|
|||||||
deleted->nfiles = 1;
|
deleted->nfiles = 1;
|
||||||
memset(&deleted->new_file, 0, sizeof(deleted->new_file));
|
memset(&deleted->new_file, 0, sizeof(deleted->new_file));
|
||||||
deleted->new_file.path = deleted->old_file.path;
|
deleted->new_file.path = deleted->old_file.path;
|
||||||
deleted->new_file.flags |= GIT_DIFF_FLAG_VALID_OID;
|
deleted->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
|
|
||||||
return git_vector_insert(onto, deleted);
|
return git_vector_insert(onto, deleted);
|
||||||
}
|
}
|
||||||
@ -408,7 +408,7 @@ static int apply_splits_and_deletes(
|
|||||||
delta->nfiles = 1;
|
delta->nfiles = 1;
|
||||||
memset(&delta->old_file, 0, sizeof(delta->old_file));
|
memset(&delta->old_file, 0, sizeof(delta->old_file));
|
||||||
delta->old_file.path = delta->new_file.path;
|
delta->old_file.path = delta->new_file.path;
|
||||||
delta->old_file.flags |= GIT_DIFF_FLAG_VALID_OID;
|
delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean up delta before inserting into new list */
|
/* clean up delta before inserting into new list */
|
||||||
@ -510,7 +510,7 @@ static int similarity_sig(
|
|||||||
(git_object **)&info->blob, info->repo,
|
(git_object **)&info->blob, info->repo,
|
||||||
info->odb_obj, GIT_OBJ_BLOB);
|
info->odb_obj, GIT_OBJ_BLOB);
|
||||||
else
|
else
|
||||||
error = git_blob_lookup(&info->blob, info->repo, &file->oid);
|
error = git_blob_lookup(&info->blob, info->repo, &file->id);
|
||||||
|
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
/* if lookup fails, just skip this item in similarity calc */
|
/* if lookup fails, just skip this item in similarity calc */
|
||||||
@ -572,21 +572,21 @@ static int similarity_measure(
|
|||||||
|
|
||||||
/* if exact match is requested, force calculation of missing OIDs now */
|
/* if exact match is requested, force calculation of missing OIDs now */
|
||||||
if (exact_match) {
|
if (exact_match) {
|
||||||
if (git_oid_iszero(&a_file->oid) &&
|
if (git_oid_iszero(&a_file->id) &&
|
||||||
diff->old_src == GIT_ITERATOR_TYPE_WORKDIR &&
|
diff->old_src == GIT_ITERATOR_TYPE_WORKDIR &&
|
||||||
!git_diff__oid_for_file(diff->repo, a_file->path,
|
!git_diff__oid_for_file(diff->repo, a_file->path,
|
||||||
a_file->mode, a_file->size, &a_file->oid))
|
a_file->mode, a_file->size, &a_file->id))
|
||||||
a_file->flags |= GIT_DIFF_FLAG_VALID_OID;
|
a_file->flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
|
|
||||||
if (git_oid_iszero(&b_file->oid) &&
|
if (git_oid_iszero(&b_file->id) &&
|
||||||
diff->new_src == GIT_ITERATOR_TYPE_WORKDIR &&
|
diff->new_src == GIT_ITERATOR_TYPE_WORKDIR &&
|
||||||
!git_diff__oid_for_file(diff->repo, b_file->path,
|
!git_diff__oid_for_file(diff->repo, b_file->path,
|
||||||
b_file->mode, b_file->size, &b_file->oid))
|
b_file->mode, b_file->size, &b_file->id))
|
||||||
b_file->flags |= GIT_DIFF_FLAG_VALID_OID;
|
b_file->flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check OID match as a quick test */
|
/* check OID match as a quick test */
|
||||||
if (git_oid__cmp(&a_file->oid, &b_file->oid) == 0) {
|
if (git_oid__cmp(&a_file->id, &b_file->id) == 0) {
|
||||||
*score = 100;
|
*score = 100;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -999,7 +999,7 @@ find_best_matches:
|
|||||||
memcpy(&src->old_file, &swap, sizeof(src->old_file));
|
memcpy(&src->old_file, &swap, sizeof(src->old_file));
|
||||||
memset(&src->new_file, 0, sizeof(src->new_file));
|
memset(&src->new_file, 0, sizeof(src->new_file));
|
||||||
src->new_file.path = src->old_file.path;
|
src->new_file.path = src->old_file.path;
|
||||||
src->new_file.flags |= GIT_DIFF_FLAG_VALID_OID;
|
src->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
|
|
||||||
num_updates++;
|
num_updates++;
|
||||||
|
|
||||||
@ -1024,7 +1024,7 @@ find_best_matches:
|
|||||||
src->nfiles = 1;
|
src->nfiles = 1;
|
||||||
memset(&src->old_file, 0, sizeof(src->old_file));
|
memset(&src->old_file, 0, sizeof(src->old_file));
|
||||||
src->old_file.path = src->new_file.path;
|
src->old_file.path = src->new_file.path;
|
||||||
src->old_file.flags |= GIT_DIFF_FLAG_VALID_OID;
|
src->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
|
|
||||||
src->flags &= ~GIT_DIFF_FLAG__TO_SPLIT;
|
src->flags &= ~GIT_DIFF_FLAG__TO_SPLIT;
|
||||||
num_rewrites--;
|
num_rewrites--;
|
||||||
|
@ -665,7 +665,7 @@ static int index_entry_similarity_calc(
|
|||||||
if ((error = git_blob_lookup(&blob, repo, &entry->id)) < 0)
|
if ((error = git_blob_lookup(&blob, repo, &entry->id)) < 0)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
git_oid_cpy(&diff_file.oid, &entry->id);
|
git_oid_cpy(&diff_file.id, &entry->id);
|
||||||
diff_file.path = entry->path;
|
diff_file.path = entry->path;
|
||||||
diff_file.size = entry->file_size;
|
diff_file.size = entry->file_size;
|
||||||
diff_file.mode = entry->mode;
|
diff_file.mode = entry->mode;
|
||||||
|
@ -108,7 +108,7 @@ int git_merge_file_input_from_diff_file(
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((error = git_repository_odb(&odb, repo)) < 0 ||
|
if ((error = git_repository_odb(&odb, repo)) < 0 ||
|
||||||
(error = git_odb_read(&input->odb_object, odb, &file->oid)) < 0)
|
(error = git_odb_read(&input->odb_object, odb, &file->id)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
input->mode = file->mode;
|
input->mode = file->mode;
|
||||||
|
@ -72,7 +72,7 @@ int git_reset_default(
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else {
|
} else {
|
||||||
entry.mode = delta->new_file.mode;
|
entry.mode = delta->new_file.mode;
|
||||||
git_oid_cpy(&entry.id, &delta->new_file.oid);
|
git_oid_cpy(&entry.id, &delta->new_file.id);
|
||||||
entry.path = (char *)delta->new_file.path;
|
entry.path = (char *)delta->new_file.path;
|
||||||
|
|
||||||
if ((error = git_index_add(index, &entry)) < 0)
|
if ((error = git_index_add(index, &entry)) < 0)
|
||||||
|
18
src/status.c
18
src/status.c
@ -38,7 +38,7 @@ static unsigned int index_delta2status(const git_diff_delta *head2idx)
|
|||||||
case GIT_DELTA_RENAMED:
|
case GIT_DELTA_RENAMED:
|
||||||
st = GIT_STATUS_INDEX_RENAMED;
|
st = GIT_STATUS_INDEX_RENAMED;
|
||||||
|
|
||||||
if (!git_oid_equal(&head2idx->old_file.oid, &head2idx->new_file.oid))
|
if (!git_oid_equal(&head2idx->old_file.id, &head2idx->new_file.id))
|
||||||
st |= GIT_STATUS_INDEX_MODIFIED;
|
st |= GIT_STATUS_INDEX_MODIFIED;
|
||||||
break;
|
break;
|
||||||
case GIT_DELTA_TYPECHANGE:
|
case GIT_DELTA_TYPECHANGE:
|
||||||
@ -74,25 +74,25 @@ static unsigned int workdir_delta2status(
|
|||||||
case GIT_DELTA_RENAMED:
|
case GIT_DELTA_RENAMED:
|
||||||
st = GIT_STATUS_WT_RENAMED;
|
st = GIT_STATUS_WT_RENAMED;
|
||||||
|
|
||||||
if (!git_oid_equal(&idx2wd->old_file.oid, &idx2wd->new_file.oid)) {
|
if (!git_oid_equal(&idx2wd->old_file.id, &idx2wd->new_file.id)) {
|
||||||
/* if OIDs don't match, we might need to calculate them now to
|
/* if OIDs don't match, we might need to calculate them now to
|
||||||
* discern between RENAMED vs RENAMED+MODIFED
|
* discern between RENAMED vs RENAMED+MODIFED
|
||||||
*/
|
*/
|
||||||
if (git_oid_iszero(&idx2wd->old_file.oid) &&
|
if (git_oid_iszero(&idx2wd->old_file.id) &&
|
||||||
diff->old_src == GIT_ITERATOR_TYPE_WORKDIR &&
|
diff->old_src == GIT_ITERATOR_TYPE_WORKDIR &&
|
||||||
!git_diff__oid_for_file(
|
!git_diff__oid_for_file(
|
||||||
diff->repo, idx2wd->old_file.path, idx2wd->old_file.mode,
|
diff->repo, idx2wd->old_file.path, idx2wd->old_file.mode,
|
||||||
idx2wd->old_file.size, &idx2wd->old_file.oid))
|
idx2wd->old_file.size, &idx2wd->old_file.id))
|
||||||
idx2wd->old_file.flags |= GIT_DIFF_FLAG_VALID_OID;
|
idx2wd->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
|
|
||||||
if (git_oid_iszero(&idx2wd->new_file.oid) &&
|
if (git_oid_iszero(&idx2wd->new_file.id) &&
|
||||||
diff->new_src == GIT_ITERATOR_TYPE_WORKDIR &&
|
diff->new_src == GIT_ITERATOR_TYPE_WORKDIR &&
|
||||||
!git_diff__oid_for_file(
|
!git_diff__oid_for_file(
|
||||||
diff->repo, idx2wd->new_file.path, idx2wd->new_file.mode,
|
diff->repo, idx2wd->new_file.path, idx2wd->new_file.mode,
|
||||||
idx2wd->new_file.size, &idx2wd->new_file.oid))
|
idx2wd->new_file.size, &idx2wd->new_file.id))
|
||||||
idx2wd->new_file.flags |= GIT_DIFF_FLAG_VALID_OID;
|
idx2wd->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
||||||
|
|
||||||
if (!git_oid_equal(&idx2wd->old_file.oid, &idx2wd->new_file.oid))
|
if (!git_oid_equal(&idx2wd->old_file.id, &idx2wd->new_file.id))
|
||||||
st |= GIT_STATUS_WT_MODIFIED;
|
st |= GIT_STATUS_WT_MODIFIED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -307,8 +307,8 @@ static int test_checkout_notify_cb(
|
|||||||
|
|
||||||
cl_assert_equal_i(GIT_CHECKOUT_NOTIFY_CONFLICT, why);
|
cl_assert_equal_i(GIT_CHECKOUT_NOTIFY_CONFLICT, why);
|
||||||
cl_assert_equal_s(expectations->file, path);
|
cl_assert_equal_s(expectations->file, path);
|
||||||
cl_assert_equal_i(0, git_oid_streq(&baseline->oid, expectations->sha));
|
cl_assert_equal_i(0, git_oid_streq(&baseline->id, expectations->sha));
|
||||||
cl_assert_equal_i(0, git_oid_streq(&target->oid, expectations->sha));
|
cl_assert_equal_i(0, git_oid_streq(&target->id, expectations->sha));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -167,9 +167,9 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
|
|||||||
delta = git_patch_get_delta(p);
|
delta = git_patch_get_delta(p);
|
||||||
cl_assert(delta != NULL);
|
cl_assert(delta != NULL);
|
||||||
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
|
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
|
||||||
cl_assert(git_oid_equal(git_blob_id(a), &delta->old_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(a), &delta->old_file.id));
|
||||||
cl_assert_equal_sz(git_blob_rawsize(a), delta->old_file.size);
|
cl_assert_equal_sz(git_blob_rawsize(a), delta->old_file.size);
|
||||||
cl_assert(git_oid_equal(git_blob_id(b), &delta->new_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(b), &delta->new_file.id));
|
||||||
cl_assert_equal_sz(git_blob_rawsize(b), delta->new_file.size);
|
cl_assert_equal_sz(git_blob_rawsize(b), delta->new_file.size);
|
||||||
|
|
||||||
cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
|
cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
|
||||||
@ -190,9 +190,9 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
|
|||||||
delta = git_patch_get_delta(p);
|
delta = git_patch_get_delta(p);
|
||||||
cl_assert(delta != NULL);
|
cl_assert(delta != NULL);
|
||||||
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
|
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
|
||||||
cl_assert(git_oid_equal(git_blob_id(b), &delta->old_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(b), &delta->old_file.id));
|
||||||
cl_assert_equal_sz(git_blob_rawsize(b), delta->old_file.size);
|
cl_assert_equal_sz(git_blob_rawsize(b), delta->old_file.size);
|
||||||
cl_assert(git_oid_equal(git_blob_id(c), &delta->new_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(c), &delta->new_file.id));
|
||||||
cl_assert_equal_sz(git_blob_rawsize(c), delta->new_file.size);
|
cl_assert_equal_sz(git_blob_rawsize(c), delta->new_file.size);
|
||||||
|
|
||||||
cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
|
cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
|
||||||
@ -213,9 +213,9 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
|
|||||||
delta = git_patch_get_delta(p);
|
delta = git_patch_get_delta(p);
|
||||||
cl_assert(delta != NULL);
|
cl_assert(delta != NULL);
|
||||||
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
|
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
|
||||||
cl_assert(git_oid_equal(git_blob_id(a), &delta->old_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(a), &delta->old_file.id));
|
||||||
cl_assert_equal_sz(git_blob_rawsize(a), delta->old_file.size);
|
cl_assert_equal_sz(git_blob_rawsize(a), delta->old_file.size);
|
||||||
cl_assert(git_oid_equal(git_blob_id(c), &delta->new_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(c), &delta->new_file.id));
|
||||||
cl_assert_equal_sz(git_blob_rawsize(c), delta->new_file.size);
|
cl_assert_equal_sz(git_blob_rawsize(c), delta->new_file.size);
|
||||||
|
|
||||||
cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
|
cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
|
||||||
@ -233,9 +233,9 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
|
|||||||
delta = git_patch_get_delta(p);
|
delta = git_patch_get_delta(p);
|
||||||
cl_assert(delta != NULL);
|
cl_assert(delta != NULL);
|
||||||
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
|
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
|
||||||
cl_assert(git_oid_equal(git_blob_id(c), &delta->old_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(c), &delta->old_file.id));
|
||||||
cl_assert_equal_sz(git_blob_rawsize(c), delta->old_file.size);
|
cl_assert_equal_sz(git_blob_rawsize(c), delta->old_file.size);
|
||||||
cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.id));
|
||||||
cl_assert_equal_sz(git_blob_rawsize(d), delta->new_file.size);
|
cl_assert_equal_sz(git_blob_rawsize(d), delta->new_file.size);
|
||||||
|
|
||||||
cl_assert_equal_i(2, (int)git_patch_num_hunks(p));
|
cl_assert_equal_i(2, (int)git_patch_num_hunks(p));
|
||||||
@ -328,9 +328,9 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
|
|||||||
delta = git_patch_get_delta(p);
|
delta = git_patch_get_delta(p);
|
||||||
cl_assert(delta != NULL);
|
cl_assert(delta != NULL);
|
||||||
cl_assert_equal_i(GIT_DELTA_DELETED, delta->status);
|
cl_assert_equal_i(GIT_DELTA_DELETED, delta->status);
|
||||||
cl_assert(git_oid_equal(git_blob_id(d), &delta->old_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(d), &delta->old_file.id));
|
||||||
cl_assert_equal_sz(git_blob_rawsize(d), delta->old_file.size);
|
cl_assert_equal_sz(git_blob_rawsize(d), delta->old_file.size);
|
||||||
cl_assert(git_oid_iszero(&delta->new_file.oid));
|
cl_assert(git_oid_iszero(&delta->new_file.id));
|
||||||
cl_assert_equal_sz(0, delta->new_file.size);
|
cl_assert_equal_sz(0, delta->new_file.size);
|
||||||
|
|
||||||
cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
|
cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
|
||||||
@ -353,9 +353,9 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
|
|||||||
delta = git_patch_get_delta(p);
|
delta = git_patch_get_delta(p);
|
||||||
cl_assert(delta != NULL);
|
cl_assert(delta != NULL);
|
||||||
cl_assert_equal_i(GIT_DELTA_ADDED, delta->status);
|
cl_assert_equal_i(GIT_DELTA_ADDED, delta->status);
|
||||||
cl_assert(git_oid_iszero(&delta->old_file.oid));
|
cl_assert(git_oid_iszero(&delta->old_file.id));
|
||||||
cl_assert_equal_sz(0, delta->old_file.size);
|
cl_assert_equal_sz(0, delta->old_file.size);
|
||||||
cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.id));
|
||||||
cl_assert_equal_sz(git_blob_rawsize(d), delta->new_file.size);
|
cl_assert_equal_sz(git_blob_rawsize(d), delta->new_file.size);
|
||||||
|
|
||||||
cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
|
cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
|
||||||
@ -446,9 +446,9 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
|
|||||||
cl_assert(delta != NULL);
|
cl_assert(delta != NULL);
|
||||||
cl_assert_equal_i(GIT_DELTA_UNMODIFIED, delta->status);
|
cl_assert_equal_i(GIT_DELTA_UNMODIFIED, delta->status);
|
||||||
cl_assert_equal_sz(delta->old_file.size, git_blob_rawsize(d));
|
cl_assert_equal_sz(delta->old_file.size, git_blob_rawsize(d));
|
||||||
cl_assert(git_oid_equal(git_blob_id(d), &delta->old_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(d), &delta->old_file.id));
|
||||||
cl_assert_equal_sz(delta->new_file.size, git_blob_rawsize(d));
|
cl_assert_equal_sz(delta->new_file.size, git_blob_rawsize(d));
|
||||||
cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.oid));
|
cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.id));
|
||||||
|
|
||||||
cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
|
cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
|
||||||
git_patch_free(p);
|
git_patch_free(p);
|
||||||
@ -460,9 +460,9 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
|
|||||||
cl_assert(delta != NULL);
|
cl_assert(delta != NULL);
|
||||||
cl_assert_equal_i(GIT_DELTA_UNMODIFIED, delta->status);
|
cl_assert_equal_i(GIT_DELTA_UNMODIFIED, delta->status);
|
||||||
cl_assert_equal_sz(0, delta->old_file.size);
|
cl_assert_equal_sz(0, delta->old_file.size);
|
||||||
cl_assert(git_oid_iszero(&delta->old_file.oid));
|
cl_assert(git_oid_iszero(&delta->old_file.id));
|
||||||
cl_assert_equal_sz(0, delta->new_file.size);
|
cl_assert_equal_sz(0, delta->new_file.size);
|
||||||
cl_assert(git_oid_iszero(&delta->new_file.oid));
|
cl_assert(git_oid_iszero(&delta->new_file.id));
|
||||||
|
|
||||||
cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
|
cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
|
||||||
git_patch_free(p);
|
git_patch_free(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user