sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_name
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Apr 16, 2019 at 16:33 UTC
e270f42c4d26fca591ca89ea8ee08ff17a72c1b5
3 files changed
+11
-6
cache.h
+3
-1
@@ -1387,7 +1387,9 @@ extern int get_oid_committish(const char *str, struct object_id *oid);
1387
extern int get_oid_tree(const char *str, struct object_id *oid);
1388
extern int get_oid_treeish(const char *str, struct object_id *oid);
1389
extern int get_oid_blob(const char *str, struct object_id *oid);
1390
-extern void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);
1390
+void maybe_die_on_misspelt_object_name(struct repository *repo,
1391
+ const char *name,
1392
+ const char *prefix);
1393
extern enum get_oid_result get_oid_with_context(struct repository *repo, const char *str,
1394
unsigned flags, struct object_id *oid,
1395
struct object_context *oc);
setup.c
+4
-3
@@ -164,7 +164,8 @@ int check_filename(const char *prefix, const char *arg)
164
die_errno(_("failed to stat '%s'"), arg);
165
}
166
167
-static void NORETURN die_verify_filename(const char *prefix,
167
+static void NORETURN die_verify_filename(struct repository *r,
168
+ const char *prefix,
169
const char *arg,
170
int diagnose_misspelt_rev)
171
{
@@ -179,7 +180,7 @@ static void NORETURN die_verify_filename(const char *prefix,
180
* let maybe_die_on_misspelt_object_name() even trigger.
181
*/
182
if (!(arg[0] == ':' && !isalnum(arg[1])))
182
- maybe_die_on_misspelt_object_name(arg, prefix);
183
+ maybe_die_on_misspelt_object_name(r, arg, prefix);
184
185
/* ... or fall back the most general message. */
186
die(_("ambiguous argument '%s': unknown revision or path not in the working tree.\n"
@@ -234,7 +235,7 @@ void verify_filename(const char *prefix,
235
die(_("option '%s' must come before non-option arguments"), arg);
236
if (looks_like_pathspec(arg) || check_filename(prefix, arg))
237
return;
237
- die_verify_filename(prefix, arg, diagnose_misspelt_rev);
238
+ die_verify_filename(the_repository, prefix, arg, diagnose_misspelt_rev);
239
}
240
241
/*
sha1-name.c
+4
-2
@@ -1885,11 +1885,13 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
1885
* exist in 'HEAD'" when given "HEAD:doc", or it may return in which case
1886
* you have a chance to diagnose the error further.
1887
*/
1888
-void maybe_die_on_misspelt_object_name(const char *name, const char *prefix)
1888
+void maybe_die_on_misspelt_object_name(struct repository *r,
1889
+ const char *name,
1890
+ const char *prefix)
1891
{
1892
struct object_context oc;
1893
struct object_id oid;
1892
- get_oid_with_context_1(the_repository, name, GET_OID_ONLY_TO_DIE,
1894
+ get_oid_with_context_1(r, name, GET_OID_ONLY_TO_DIE,
1895
prefix, &oid, &oc);
1896
}
1897