summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/update-index.c4
-rw-r--r--combine-diff.c2
-rw-r--r--diff-lib.c2
-rw-r--r--dir.c4
-rw-r--r--read-cache.c2
-rw-r--r--refs.c6
-rw-r--r--refs.h2
-rw-r--r--sha1_file.c2
-rw-r--r--unpack-trees.c2
9 files changed, 13 insertions, 13 deletions
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 24f4b28951..fefbe60167 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -328,7 +328,7 @@ static int process_directory(const char *path, int len, struct stat *st)
if (S_ISGITLINK(ce->ce_mode)) {
/* Do nothing to the index if there is no HEAD! */
- if (resolve_gitlink_ref(path, "HEAD", oid.hash) < 0)
+ if (resolve_gitlink_ref(path, "HEAD", &oid) < 0)
return 0;
return add_one_path(ce, path, len, st);
@@ -354,7 +354,7 @@ static int process_directory(const char *path, int len, struct stat *st)
}
/* No match - should we add it as a gitlink? */
- if (!resolve_gitlink_ref(path, "HEAD", oid.hash))
+ if (!resolve_gitlink_ref(path, "HEAD", &oid))
return add_one_path(NULL, path, len, st);
/* Error out. */
diff --git a/combine-diff.c b/combine-diff.c
index 9e163d5ada..82f6070977 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -1014,7 +1014,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
elem->mode = canon_mode(st.st_mode);
} else if (S_ISDIR(st.st_mode)) {
struct object_id oid;
- if (resolve_gitlink_ref(elem->path, "HEAD", oid.hash) < 0)
+ if (resolve_gitlink_ref(elem->path, "HEAD", &oid) < 0)
result = grab_blob(&elem->oid, elem->mode,
&result_size, NULL, NULL);
else
diff --git a/diff-lib.c b/diff-lib.c
index af4f1b7865..d2ea02f4d7 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -50,7 +50,7 @@ static int check_removed(const struct cache_entry *ce, struct stat *st)
* a directory --- the blob was removed!
*/
if (!S_ISGITLINK(ce->ce_mode) &&
- resolve_gitlink_ref(ce->name, "HEAD", sub.hash))
+ resolve_gitlink_ref(ce->name, "HEAD", &sub))
return 1;
}
return 0;
diff --git a/dir.c b/dir.c
index a4198ba7fd..f09a31e102 100644
--- a/dir.c
+++ b/dir.c
@@ -1391,7 +1391,7 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
break;
if (!(dir->flags & DIR_NO_GITLINKS)) {
struct object_id oid;
- if (resolve_gitlink_ref(dirname, "HEAD", oid.hash) == 0)
+ if (resolve_gitlink_ref(dirname, "HEAD", &oid) == 0)
return path_untracked;
}
return path_recurse;
@@ -2282,7 +2282,7 @@ static int remove_dir_recurse(struct strbuf *path, int flag, int *kept_up)
struct object_id submodule_head;
if ((flag & REMOVE_DIR_KEEP_NESTED_GIT) &&
- !resolve_gitlink_ref(path->buf, "HEAD", submodule_head.hash)) {
+ !resolve_gitlink_ref(path->buf, "HEAD", &submodule_head)) {
/* Do not descend and nuke a nested git work tree. */
if (kept_up)
*kept_up = 1;
diff --git a/read-cache.c b/read-cache.c
index 131485b3a6..7766196aff 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -201,7 +201,7 @@ static int ce_compare_gitlink(const struct cache_entry *ce)
*
* If so, we consider it always to match.
*/
- if (resolve_gitlink_ref(ce->name, "HEAD", oid.hash) < 0)
+ if (resolve_gitlink_ref(ce->name, "HEAD", &oid) < 0)
return 0;
return oidcmp(&oid, &ce->oid);
}
diff --git a/refs.c b/refs.c
index 37485283c0..90219d6e13 100644
--- a/refs.c
+++ b/refs.c
@@ -1498,7 +1498,7 @@ const char *resolve_ref_unsafe(const char *refname, int resolve_flags,
}
int resolve_gitlink_ref(const char *submodule, const char *refname,
- unsigned char *sha1)
+ struct object_id *oid)
{
struct ref_store *refs;
int flags;
@@ -1508,8 +1508,8 @@ int resolve_gitlink_ref(const char *submodule, const char *refname,
if (!refs)
return -1;
- if (!refs_resolve_ref_unsafe(refs, refname, 0, sha1, &flags) ||
- is_null_sha1(sha1))
+ if (!refs_resolve_ref_unsafe(refs, refname, 0, oid->hash, &flags) ||
+ is_null_oid(oid))
return -1;
return 0;
}
diff --git a/refs.h b/refs.h
index 50f6f0dbd7..ee07a457af 100644
--- a/refs.h
+++ b/refs.h
@@ -130,7 +130,7 @@ int peel_ref(const char *refname, struct object_id *oid);
* otherwise, return a non-zero value.
*/
int resolve_gitlink_ref(const char *submodule, const char *refname,
- unsigned char *sha1);
+ struct object_id *oid);
/*
* Return true iff abbrev_name is a possible abbreviation for
diff --git a/sha1_file.c b/sha1_file.c
index cd910b2103..0f4435192f 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1841,7 +1841,7 @@ int index_path(struct object_id *oid, const char *path, struct stat *st, unsigne
strbuf_release(&sb);
break;
case S_IFDIR:
- return resolve_gitlink_ref(path, "HEAD", oid->hash);
+ return resolve_gitlink_ref(path, "HEAD", oid);
default:
return error("%s: unsupported file type", path);
}
diff --git a/unpack-trees.c b/unpack-trees.c
index 0dc76eddfe..25740cb593 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1542,7 +1542,7 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
if (S_ISGITLINK(ce->ce_mode)) {
struct object_id oid;
- int sub_head = resolve_gitlink_ref(ce->name, "HEAD", oid.hash);
+ int sub_head = resolve_gitlink_ref(ce->name, "HEAD", &oid);
/*
* If we are not going to update the submodule, then
* we don't care.