summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/grep.c b/grep.c
index 47cee45..a240b4c 100644
--- a/grep.c
+++ b/grep.c
@@ -1403,7 +1403,7 @@ 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:
@@ -1747,9 +1747,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;
@@ -1772,7 +1771,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;
@@ -1784,7 +1783,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;
@@ -1795,7 +1794,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;
}
@@ -1841,8 +1840,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: