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>
This commit is contained in:
parent
bcd2986473
commit
1053fe829c
@ -36,7 +36,7 @@ static int check_removed(const struct cache_entry *ce, struct stat *st)
|
|||||||
if (has_symlink_leading_path(ce->name, ce_namelen(ce)))
|
if (has_symlink_leading_path(ce->name, ce_namelen(ce)))
|
||||||
return 1;
|
return 1;
|
||||||
if (S_ISDIR(st->st_mode)) {
|
if (S_ISDIR(st->st_mode)) {
|
||||||
unsigned char sub[20];
|
struct object_id sub;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If ce is already a gitlink, we can have a plain
|
* 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)
|
|||||||
* a directory --- the blob was removed!
|
* a directory --- the blob was removed!
|
||||||
*/
|
*/
|
||||||
if (!S_ISGITLINK(ce->ce_mode) &&
|
if (!S_ISGITLINK(ce->ce_mode) &&
|
||||||
resolve_gitlink_ref(ce->name, "HEAD", sub))
|
resolve_gitlink_ref(ce->name, "HEAD", sub.hash))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
8
dir.c
8
dir.c
@ -1390,8 +1390,8 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
|
|||||||
if (dir->flags & DIR_SHOW_OTHER_DIRECTORIES)
|
if (dir->flags & DIR_SHOW_OTHER_DIRECTORIES)
|
||||||
break;
|
break;
|
||||||
if (!(dir->flags & DIR_NO_GITLINKS)) {
|
if (!(dir->flags & DIR_NO_GITLINKS)) {
|
||||||
unsigned char sha1[20];
|
struct object_id oid;
|
||||||
if (resolve_gitlink_ref(dirname, "HEAD", sha1) == 0)
|
if (resolve_gitlink_ref(dirname, "HEAD", oid.hash) == 0)
|
||||||
return path_untracked;
|
return path_untracked;
|
||||||
}
|
}
|
||||||
return path_recurse;
|
return path_recurse;
|
||||||
@ -2279,10 +2279,10 @@ static int remove_dir_recurse(struct strbuf *path, int flag, int *kept_up)
|
|||||||
int ret = 0, original_len = path->len, len, kept_down = 0;
|
int ret = 0, original_len = path->len, len, kept_down = 0;
|
||||||
int only_empty = (flag & REMOVE_DIR_EMPTY_ONLY);
|
int only_empty = (flag & REMOVE_DIR_EMPTY_ONLY);
|
||||||
int keep_toplevel = (flag & REMOVE_DIR_KEEP_TOPLEVEL);
|
int keep_toplevel = (flag & REMOVE_DIR_KEEP_TOPLEVEL);
|
||||||
unsigned char submodule_head[20];
|
struct object_id submodule_head;
|
||||||
|
|
||||||
if ((flag & REMOVE_DIR_KEEP_NESTED_GIT) &&
|
if ((flag & REMOVE_DIR_KEEP_NESTED_GIT) &&
|
||||||
!resolve_gitlink_ref(path->buf, "HEAD", submodule_head)) {
|
!resolve_gitlink_ref(path->buf, "HEAD", submodule_head.hash)) {
|
||||||
/* Do not descend and nuke a nested git work tree. */
|
/* Do not descend and nuke a nested git work tree. */
|
||||||
if (kept_up)
|
if (kept_up)
|
||||||
*kept_up = 1;
|
*kept_up = 1;
|
||||||
|
@ -191,7 +191,7 @@ static int ce_compare_link(const struct cache_entry *ce, size_t expected_size)
|
|||||||
|
|
||||||
static int ce_compare_gitlink(const struct cache_entry *ce)
|
static int ce_compare_gitlink(const struct cache_entry *ce)
|
||||||
{
|
{
|
||||||
unsigned char sha1[20];
|
struct object_id oid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't actually require that the .git directory
|
* We don't actually require that the .git directory
|
||||||
@ -201,9 +201,9 @@ static int ce_compare_gitlink(const struct cache_entry *ce)
|
|||||||
*
|
*
|
||||||
* If so, we consider it always to match.
|
* If so, we consider it always to match.
|
||||||
*/
|
*/
|
||||||
if (resolve_gitlink_ref(ce->name, "HEAD", sha1) < 0)
|
if (resolve_gitlink_ref(ce->name, "HEAD", oid.hash) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
return hashcmp(sha1, ce->oid.hash);
|
return oidcmp(&oid, &ce->oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ce_modified_check_fs(const struct cache_entry *ce, struct stat *st)
|
static int ce_modified_check_fs(const struct cache_entry *ce, struct stat *st)
|
||||||
|
@ -1541,15 +1541,15 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
|
|||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
if (S_ISGITLINK(ce->ce_mode)) {
|
if (S_ISGITLINK(ce->ce_mode)) {
|
||||||
unsigned char sha1[20];
|
struct object_id oid;
|
||||||
int sub_head = resolve_gitlink_ref(ce->name, "HEAD", sha1);
|
int sub_head = resolve_gitlink_ref(ce->name, "HEAD", oid.hash);
|
||||||
/*
|
/*
|
||||||
* If we are not going to update the submodule, then
|
* If we are not going to update the submodule, then
|
||||||
* we don't care.
|
* we don't care.
|
||||||
*/
|
*/
|
||||||
if (!sub_head && !hashcmp(sha1, ce->oid.hash))
|
if (!sub_head && !oidcmp(&oid, &ce->oid))
|
||||||
return 0;
|
return 0;
|
||||||
return verify_clean_submodule(sub_head ? NULL : sha1_to_hex(sha1),
|
return verify_clean_submodule(sub_head ? NULL : oid_to_hex(&oid),
|
||||||
ce, error_type, o);
|
ce, error_type, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user