Convert remaining callers of resolve_gitlink_ref to object_id
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Oct 15, 2017 at 22:07 UTC
1053fe829c037c5a725786bac35d05a113c91f55
4 files changed
+13
-13
diff-lib.c
+2
-2
@@ -36,7 +36,7 @@ static int check_removed(const struct cache_entry *ce, struct stat *st)
36
if (has_symlink_leading_path(ce->name, ce_namelen(ce)))
37
return 1;
38
if (S_ISDIR(st->st_mode)) {
39
- unsigned char sub[20];
39
+ struct object_id sub;
40
41
/*
42
* If ce is already a gitlink, we can have a plain
@@ -50,7 +50,7 @@ static int check_removed(const struct cache_entry *ce, struct stat *st)
50
* a directory --- the blob was removed!
51
*/
52
if (!S_ISGITLINK(ce->ce_mode) &&
53
- resolve_gitlink_ref(ce->name, "HEAD", sub))
53
+ resolve_gitlink_ref(ce->name, "HEAD", sub.hash))
54
return 1;
55
}
56
return 0;
dir.c
+4
-4
@@ -1390,8 +1390,8 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
1390
if (dir->flags & DIR_SHOW_OTHER_DIRECTORIES)
1391
break;
1392
if (!(dir->flags & DIR_NO_GITLINKS)) {
1393
- unsigned char sha1[20];
1394
- if (resolve_gitlink_ref(dirname, "HEAD", sha1) == 0)
1393
+ struct object_id oid;
1394
+ if (resolve_gitlink_ref(dirname, "HEAD", oid.hash) == 0)
1395
return path_untracked;
1396
}
1397
return path_recurse;
@@ -2279,10 +2279,10 @@ static int remove_dir_recurse(struct strbuf *path, int flag, int *kept_up)
2279
int ret = 0, original_len = path->len, len, kept_down = 0;
2280
int only_empty = (flag & REMOVE_DIR_EMPTY_ONLY);
2281
int keep_toplevel = (flag & REMOVE_DIR_KEEP_TOPLEVEL);
2282
- unsigned char submodule_head[20];
2282
+ struct object_id submodule_head;
2283
2284
if ((flag & REMOVE_DIR_KEEP_NESTED_GIT) &&
2285
- !resolve_gitlink_ref(path->buf, "HEAD", submodule_head)) {
2285
+ !resolve_gitlink_ref(path->buf, "HEAD", submodule_head.hash)) {
2286
/* Do not descend and nuke a nested git work tree. */
2287
if (kept_up)
2288
*kept_up = 1;
read-cache.c
+3
-3
@@ -191,7 +191,7 @@ static int ce_compare_link(const struct cache_entry *ce, size_t expected_size)
191
192
static int ce_compare_gitlink(const struct cache_entry *ce)
193
{
194
- unsigned char sha1[20];
194
+ struct object_id oid;
195
196
/*
197
* We don't actually require that the .git directory
@@ -201,9 +201,9 @@ static int ce_compare_gitlink(const struct cache_entry *ce)
201
*
202
* If so, we consider it always to match.
203
*/
204
- if (resolve_gitlink_ref(ce->name, "HEAD", sha1) < 0)
204
+ if (resolve_gitlink_ref(ce->name, "HEAD", oid.hash) < 0)
205
return 0;
206
- return hashcmp(sha1, ce->oid.hash);
206
+ return oidcmp(&oid, &ce->oid);
207
}
208
209
static int ce_modified_check_fs(const struct cache_entry *ce, struct stat *st)
unpack-trees.c
+4
-4
@@ -1541,15 +1541,15 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
1541
int cnt = 0;
1542
1543
if (S_ISGITLINK(ce->ce_mode)) {
1544
- unsigned char sha1[20];
1545
- int sub_head = resolve_gitlink_ref(ce->name, "HEAD", sha1);
1544
+ struct object_id oid;
1545
+ int sub_head = resolve_gitlink_ref(ce->name, "HEAD", oid.hash);
1546
/*
1547
* If we are not going to update the submodule, then
1548
* we don't care.
1549
*/
1550
- if (!sub_head && !hashcmp(sha1, ce->oid.hash))
1550
+ if (!sub_head && !oidcmp(&oid, &ce->oid))
1551
return 0;
1552
- return verify_clean_submodule(sub_head ? NULL : sha1_to_hex(sha1),
1552
+ return verify_clean_submodule(sub_head ? NULL : oid_to_hex(&oid),
1553
ce, error_type, o);
1554
}
1555