diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2017-07-13 23:49:20 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-07-17 13:54:37 -0700 |
commit | cd73de47148c16760a62fa3f75cafe015ca764b2 (patch) | |
tree | 307e99cfba18e3b880af01bf9656a961298439fd /submodule.c | |
parent | d1a35e5c93eb57abd1133a8c55ba961cc55268a6 (diff) | |
download | git-cd73de47148c16760a62fa3f75cafe015ca764b2.tar.gz |
submodule: convert submodule config lookup to use object_id
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/submodule.c b/submodule.c index da2b484879..f39cb4f6ea 100644 --- a/submodule.c +++ b/submodule.c @@ -69,7 +69,7 @@ int update_path_in_gitmodules(const char *oldpath, const char *newpath) if (gitmodules_is_unmerged) die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first")); - submodule = submodule_from_path(null_sha1, oldpath); + submodule = submodule_from_path(&null_oid, oldpath); if (!submodule || !submodule->name) { warning(_("Could not find section in .gitmodules where path=%s"), oldpath); return -1; @@ -103,7 +103,7 @@ int remove_path_from_gitmodules(const char *path) if (gitmodules_is_unmerged) die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first")); - submodule = submodule_from_path(null_sha1, path); + submodule = submodule_from_path(&null_oid, path); if (!submodule || !submodule->name) { warning(_("Could not find section in .gitmodules where path=%s"), path); return -1; @@ -147,7 +147,7 @@ done: void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt, const char *path) { - const struct submodule *submodule = submodule_from_path(null_sha1, path); + const struct submodule *submodule = submodule_from_path(&null_oid, path); if (submodule) { if (submodule->ignore) handle_ignore_submodules_arg(diffopt, submodule->ignore); @@ -270,14 +270,14 @@ void repo_read_gitmodules(struct repository *repo) free(gitmodules_path); } -void gitmodules_config_sha1(const unsigned char *commit_sha1) +void gitmodules_config_oid(const struct object_id *commit_oid) { struct strbuf rev = STRBUF_INIT; - unsigned char sha1[20]; + struct object_id oid; - if (gitmodule_sha1_from_commit(commit_sha1, sha1, &rev)) { - git_config_from_blob_sha1(git_modules_config, rev.buf, - sha1, NULL); + if (gitmodule_oid_from_commit(commit_oid, &oid, &rev)) { + git_config_from_blob_oid(submodule_config, rev.buf, + &oid, NULL); } strbuf_release(&rev); } @@ -293,7 +293,7 @@ int is_submodule_active(struct repository *repo, const char *path) const struct string_list *sl; const struct submodule *module; - module = submodule_from_cache(repo, null_sha1, path); + module = submodule_from_cache(repo, &null_oid, path); /* early return if there isn't a path->module mapping */ if (!module) @@ -738,7 +738,7 @@ const struct submodule *submodule_from_ce(const struct cache_entry *ce) if (!should_update_submodules()) return NULL; - return submodule_from_path(null_sha1, ce->name); + return submodule_from_path(&null_oid, ce->name); } static struct oid_array *submodule_commits(struct string_list *submodules, @@ -1166,9 +1166,9 @@ static int get_next_submodule(struct child_process *cp, if (!S_ISGITLINK(ce->ce_mode)) continue; - submodule = submodule_from_path(null_sha1, ce->name); + submodule = submodule_from_path(&null_oid, ce->name); if (!submodule) - submodule = submodule_from_name(null_sha1, ce->name); + submodule = submodule_from_name(&null_oid, ce->name); default_argv = "yes"; if (spf->command_line_option == RECURSE_SUBMODULES_DEFAULT) { @@ -1544,7 +1544,7 @@ int submodule_move_head(const char *path, if (old && !is_submodule_populated_gently(path, error_code_ptr)) return 0; - sub = submodule_from_path(null_sha1, path); + sub = submodule_from_path(&null_oid, path); if (!sub) die("BUG: could not get submodule information for '%s'", path); @@ -1826,7 +1826,7 @@ static void relocate_single_git_dir_into_superproject(const char *prefix, real_old_git_dir = real_pathdup(old_git_dir, 1); - sub = submodule_from_path(null_sha1, path); + sub = submodule_from_path(&null_oid, path); if (!sub) die(_("could not lookup name for submodule '%s'"), path); @@ -1882,7 +1882,7 @@ void absorb_git_dir_into_superproject(const char *prefix, * superproject did not rewrite the git file links yet, * fix it now. */ - sub = submodule_from_path(null_sha1, path); + sub = submodule_from_path(&null_oid, path); if (!sub) die(_("could not lookup name for submodule '%s'"), path); connect_work_tree_and_git_dir(path, @@ -2025,7 +2025,7 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule) } if (!is_git_directory(buf->buf)) { gitmodules_config(); - sub = submodule_from_path(null_sha1, submodule); + sub = submodule_from_path(&null_oid, submodule); if (!sub) { ret = -1; goto cleanup; |