summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-06-19 19:38:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-06-19 19:38:44 (GMT)
commita6f38c109b6e70a1c788581194fc9b8669eea231 (patch)
treeb99d5c9b930d4c386789a5083fa2da804075d51c /grep.c
parentd04787e645abab1c50651fd41a748b43ac68c819 (diff)
parent94e327e973d320abf91c22307b87292911643c3b (diff)
downloadgit-a6f38c109b6e70a1c788581194fc9b8669eea231.zip
git-a6f38c109b6e70a1c788581194fc9b8669eea231.tar.gz
git-a6f38c109b6e70a1c788581194fc9b8669eea231.tar.bz2
Merge branch 'bw/object-id'
Conversion from uchar[20] to struct object_id continues. * bw/object-id: (33 commits) diff: rename diff_fill_sha1_info to diff_fill_oid_info diffcore-rename: use is_empty_blob_oid tree-diff: convert path_appendnew to object_id tree-diff: convert diff_tree_paths to struct object_id tree-diff: convert try_to_follow_renames to struct object_id builtin/diff-tree: cleanup references to sha1 diff-tree: convert diff_tree_sha1 to struct object_id notes-merge: convert write_note_to_worktree to struct object_id notes-merge: convert verify_notes_filepair to struct object_id notes-merge: convert find_notes_merge_pair_ps to struct object_id notes-merge: convert merge_from_diffs to struct object_id notes-merge: convert notes_merge* to struct object_id tree-diff: convert diff_root_tree_sha1 to struct object_id combine-diff: convert find_paths_* to struct object_id combine-diff: convert diff_tree_combined to struct object_id diff: convert diff_flush_patch_id to struct object_id patch-ids: convert to struct object_id diff: finish conversion for prepare_temp_file to struct object_id diff: convert reuse_worktree_file to struct object_id diff: convert fill_filespec to struct object_id ...
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/grep.c b/grep.c
index d0bf378..d7ef213 100644
--- a/grep.c
+++ b/grep.c
@@ -1584,11 +1584,11 @@ static int fill_textconv_grep(struct userdiff_driver *driver,
*/
df = alloc_filespec(gs->path);
switch (gs->type) {
- case GREP_SOURCE_SHA1:
+ case GREP_SOURCE_OID:
fill_filespec(df, gs->identifier, 1, 0100644);
break;
case GREP_SOURCE_FILE:
- fill_filespec(df, null_sha1, 0, 0100644);
+ fill_filespec(df, &null_oid, 0, 0100644);
break;
default:
die("BUG: attempt to textconv something without a path?");
@@ -1928,9 +1928,8 @@ void grep_source_init(struct grep_source *gs, enum grep_source_type type,
* If the identifier is non-NULL (in the submodule case) it
* will be a SHA1 that needs to be copied.
*/
- case GREP_SOURCE_SHA1:
- gs->identifier = xmalloc(20);
- hashcpy(gs->identifier, identifier);
+ case GREP_SOURCE_OID:
+ gs->identifier = oiddup(identifier);
break;
case GREP_SOURCE_BUF:
gs->identifier = NULL;
@@ -1953,7 +1952,7 @@ void grep_source_clear_data(struct grep_source *gs)
{
switch (gs->type) {
case GREP_SOURCE_FILE:
- case GREP_SOURCE_SHA1:
+ case GREP_SOURCE_OID:
case GREP_SOURCE_SUBMODULE:
free(gs->buf);
gs->buf = NULL;
@@ -1965,7 +1964,7 @@ void grep_source_clear_data(struct grep_source *gs)
}
}
-static int grep_source_load_sha1(struct grep_source *gs)
+static int grep_source_load_oid(struct grep_source *gs)
{
enum object_type type;
@@ -1976,7 +1975,7 @@ static int grep_source_load_sha1(struct grep_source *gs)
if (!gs->buf)
return error(_("'%s': unable to read %s"),
gs->name,
- sha1_to_hex(gs->identifier));
+ oid_to_hex(gs->identifier));
return 0;
}
@@ -2022,8 +2021,8 @@ static int grep_source_load(struct grep_source *gs)
switch (gs->type) {
case GREP_SOURCE_FILE:
return grep_source_load_file(gs);
- case GREP_SOURCE_SHA1:
- return grep_source_load_sha1(gs);
+ case GREP_SOURCE_OID:
+ return grep_source_load_oid(gs);
case GREP_SOURCE_BUF:
return gs->buf ? 0 : -1;
case GREP_SOURCE_SUBMODULE: