Skip to content

Commit 8ec46d7

Browse files
bk2204gitster
authored andcommitted
builtin/rm: convert to use struct object_id
Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 110d26f commit 8ec46d7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

builtin/rm.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int check_submodules_use_gitfiles(void)
107107
return errs;
108108
}
109109

110-
static int check_local_mod(unsigned char *head, int index_only)
110+
static int check_local_mod(struct object_id *head, int index_only)
111111
{
112112
/*
113113
* Items in list are already sorted in the cache order,
@@ -123,13 +123,13 @@ static int check_local_mod(unsigned char *head, int index_only)
123123
struct string_list files_submodule = STRING_LIST_INIT_NODUP;
124124
struct string_list files_local = STRING_LIST_INIT_NODUP;
125125

126-
no_head = is_null_sha1(head);
126+
no_head = is_null_oid(head);
127127
for (i = 0; i < list.nr; i++) {
128128
struct stat st;
129129
int pos;
130130
const struct cache_entry *ce;
131131
const char *name = list.entry[i].name;
132-
unsigned char sha1[20];
132+
struct object_id oid;
133133
unsigned mode;
134134
int local_changes = 0;
135135
int staged_changes = 0;
@@ -197,9 +197,9 @@ static int check_local_mod(unsigned char *head, int index_only)
197197
* way as changed from the HEAD.
198198
*/
199199
if (no_head
200-
|| get_tree_entry(head, name, sha1, &mode)
200+
|| get_tree_entry(head->hash, name, oid.hash, &mode)
201201
|| ce->ce_mode != create_ce_mode(mode)
202-
|| hashcmp(ce->oid.hash, sha1))
202+
|| oidcmp(&ce->oid, &oid))
203203
staged_changes = 1;
204204

205205
/*
@@ -351,10 +351,10 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
351351
* report no changes unless forced.
352352
*/
353353
if (!force) {
354-
unsigned char sha1[20];
355-
if (get_sha1("HEAD", sha1))
356-
hashclr(sha1);
357-
if (check_local_mod(sha1, index_only))
354+
struct object_id oid;
355+
if (get_oid("HEAD", &oid))
356+
oidclr(&oid);
357+
if (check_local_mod(&oid, index_only))
358358
exit(1);
359359
} else if (!index_only) {
360360
if (check_submodules_use_gitfiles())

0 commit comments

Comments
 (0)