sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_name
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Tue, 16 Apr 2019 09:33:39 +0000 (16:33 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 Apr 2019 09:56:53 +0000 (18:56 +0900)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
setup.c
sha1-name.c
diff --git a/cache.h b/cache.h
index f6e87194d0a2dfd075acdc1386788f14b16990fe..3718b3db8a8c74cb6c4aad6ff6aaf81a7da792f6 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1387,7 +1387,9 @@ extern int get_oid_committish(const char *str, struct object_id *oid);
 extern int get_oid_tree(const char *str, struct object_id *oid);
 extern int get_oid_treeish(const char *str, struct object_id *oid);
 extern int get_oid_blob(const char *str, struct object_id *oid);
-extern void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);
+void maybe_die_on_misspelt_object_name(struct repository *repo,
+                                      const char *name,
+                                      const char *prefix);
 extern enum get_oid_result get_oid_with_context(struct repository *repo, const char *str,
                                unsigned flags, struct object_id *oid,
                                struct object_context *oc);
diff --git a/setup.c b/setup.c
index d0c958c3b2a4a7d4b53970b0e623ed8f6e6a4be4..8dcb4631f7d330a290ab0bb6810f24999f65a1b7 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -164,7 +164,8 @@ int check_filename(const char *prefix, const char *arg)
        die_errno(_("failed to stat '%s'"), arg);
 }
 
-static void NORETURN die_verify_filename(const char *prefix,
+static void NORETURN die_verify_filename(struct repository *r,
+                                        const char *prefix,
                                         const char *arg,
                                         int diagnose_misspelt_rev)
 {
@@ -179,7 +180,7 @@ static void NORETURN die_verify_filename(const char *prefix,
         * let maybe_die_on_misspelt_object_name() even trigger.
         */
        if (!(arg[0] == ':' && !isalnum(arg[1])))
-               maybe_die_on_misspelt_object_name(arg, prefix);
+               maybe_die_on_misspelt_object_name(r, arg, prefix);
 
        /* ... or fall back the most general message. */
        die(_("ambiguous argument '%s': unknown revision or path not in the working tree.\n"
@@ -234,7 +235,7 @@ void verify_filename(const char *prefix,
                die(_("option '%s' must come before non-option arguments"), arg);
        if (looks_like_pathspec(arg) || check_filename(prefix, arg))
                return;
-       die_verify_filename(prefix, arg, diagnose_misspelt_rev);
+       die_verify_filename(the_repository, prefix, arg, diagnose_misspelt_rev);
 }
 
 /*
index 953df0d692d62f8d2ce3bc7d97ecd9b59ce18a19..b94d381befb3810aed89910c00382c95b9267af8 100644 (file)
@@ -1885,11 +1885,13 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
  * exist in 'HEAD'" when given "HEAD:doc", or it may return in which case
  * you have a chance to diagnose the error further.
  */
-void maybe_die_on_misspelt_object_name(const char *name, const char *prefix)
+void maybe_die_on_misspelt_object_name(struct repository *r,
+                                      const char *name,
+                                      const char *prefix)
 {
        struct object_context oc;
        struct object_id oid;
-       get_oid_with_context_1(the_repository, name, GET_OID_ONLY_TO_DIE,
+       get_oid_with_context_1(r, name, GET_OID_ONLY_TO_DIE,
                               prefix, &oid, &oc);
 }