Skip to content

Commit e270f42

Browse files
pcloudsgitster
authored andcommitted
sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_name
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d9b8b8f commit e270f42

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

cache.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,9 @@ extern int get_oid_committish(const char *str, struct object_id *oid);
13871387
extern int get_oid_tree(const char *str, struct object_id *oid);
13881388
extern int get_oid_treeish(const char *str, struct object_id *oid);
13891389
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);
13911393
extern enum get_oid_result get_oid_with_context(struct repository *repo, const char *str,
13921394
unsigned flags, struct object_id *oid,
13931395
struct object_context *oc);

setup.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ int check_filename(const char *prefix, const char *arg)
164164
die_errno(_("failed to stat '%s'"), arg);
165165
}
166166

167-
static void NORETURN die_verify_filename(const char *prefix,
167+
static void NORETURN die_verify_filename(struct repository *r,
168+
const char *prefix,
168169
const char *arg,
169170
int diagnose_misspelt_rev)
170171
{
@@ -179,7 +180,7 @@ static void NORETURN die_verify_filename(const char *prefix,
179180
* let maybe_die_on_misspelt_object_name() even trigger.
180181
*/
181182
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);
183184

184185
/* ... or fall back the most general message. */
185186
die(_("ambiguous argument '%s': unknown revision or path not in the working tree.\n"
@@ -234,7 +235,7 @@ void verify_filename(const char *prefix,
234235
die(_("option '%s' must come before non-option arguments"), arg);
235236
if (looks_like_pathspec(arg) || check_filename(prefix, arg))
236237
return;
237-
die_verify_filename(prefix, arg, diagnose_misspelt_rev);
238+
die_verify_filename(the_repository, prefix, arg, diagnose_misspelt_rev);
238239
}
239240

240241
/*

sha1-name.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,11 +1885,13 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
18851885
* exist in 'HEAD'" when given "HEAD:doc", or it may return in which case
18861886
* you have a chance to diagnose the error further.
18871887
*/
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)
18891891
{
18901892
struct object_context oc;
18911893
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,
18931895
prefix, &oid, &oc);
18941896
}
18951897

0 commit comments

Comments
 (0)