path: root/builtin/rm.c
diff options
authorJunio C Hamano <>2016-09-19 20:47:19 (GMT)
committerJunio C Hamano <>2016-09-19 20:47:19 (GMT)
commit4af9a7d344b0e1c3b504c0cfb650dabdb1df1852 (patch)
tree243319fc09235a1e046ea94f40f7837ed9f02ea2 /builtin/rm.c
parent4322f3848a224843a2df81055f07899ce1a1b388 (diff)
parent3a5d7c55f76681ad9dcef8564275217881c9ace0 (diff)
Merge branch 'bc/object-id'
The "unsigned char sha1[20]" to "struct object_id" conversion continues. Notable changes in this round includes that ce->sha1, i.e. the object name recorded in the cache_entry, turns into an object_id. It had merge conflicts with a few topics in flight (Christian's "apply.c split", Dscho's "cat-file --filters" and Jeff Hostetler's "status --porcelain-v2"). Extra sets of eyes double-checking for mismerges are highly appreciated. * bc/object-id: builtin/reset: convert to use struct object_id builtin/commit-tree: convert to struct object_id builtin/am: convert to struct object_id refs: add an update_ref_oid function. sha1_name: convert get_sha1_mb to struct object_id builtin/update-index: convert file to struct object_id notes: convert init_notes to use struct object_id builtin/rm: convert to use struct object_id builtin/blame: convert file to use struct object_id Convert read_mmblob to take struct object_id. notes-merge: convert struct notes_merge_pair to struct object_id builtin/checkout: convert some static functions to struct object_id streaming: make stream_blob_to_fd take struct object_id builtin: convert textconv_object to use struct object_id builtin/cat-file: convert some static functions to struct object_id builtin/cat-file: convert struct expand_data to use struct object_id builtin/log: convert some static functions to use struct object_id builtin/blame: convert struct origin to use struct object_id builtin/apply: convert static functions to struct object_id cache: convert struct cache_entry to use struct object_id
Diffstat (limited to 'builtin/rm.c')
1 files changed, 9 insertions, 9 deletions
diff --git a/builtin/rm.c b/builtin/rm.c
index b2fee3e..3f3e24e 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -107,7 +107,7 @@ static int check_submodules_use_gitfiles(void)
return errs;
-static int check_local_mod(unsigned char *head, int index_only)
+static int check_local_mod(struct object_id *head, int index_only)
* 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)
struct string_list files_submodule = STRING_LIST_INIT_NODUP;
struct string_list files_local = STRING_LIST_INIT_NODUP;
- no_head = is_null_sha1(head);
+ no_head = is_null_oid(head);
for (i = 0; i <; i++) {
struct stat st;
int pos;
const struct cache_entry *ce;
const char *name = list.entry[i].name;
- unsigned char sha1[20];
+ struct object_id oid;
unsigned mode;
int local_changes = 0;
int staged_changes = 0;
@@ -197,9 +197,9 @@ static int check_local_mod(unsigned char *head, int index_only)
* way as changed from the HEAD.
if (no_head
- || get_tree_entry(head, name, sha1, &mode)
+ || get_tree_entry(head->hash, name, oid.hash, &mode)
|| ce->ce_mode != create_ce_mode(mode)
- || hashcmp(ce->sha1, sha1))
+ || oidcmp(&ce->oid, &oid))
staged_changes = 1;
@@ -351,10 +351,10 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
* report no changes unless forced.
if (!force) {
- unsigned char sha1[20];
- if (get_sha1("HEAD", sha1))
- hashclr(sha1);
- if (check_local_mod(sha1, index_only))
+ struct object_id oid;
+ if (get_oid("HEAD", &oid))
+ oidclr(&oid);
+ if (check_local_mod(&oid, index_only))
} else if (!index_only) {
if (check_submodules_use_gitfiles())