Skip to content

Commit 249c8f4

Browse files
committed
sha1_name.c: get rid of get_sha1_with_mode()
There are only two callers, and they will benefit from being able to pass disambiguation hints to underlying get_sha1_with_context() API once it happens. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8c135ea commit 249c8f4

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

cache.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,6 @@ struct object_context {
812812
};
813813

814814
extern int get_sha1(const char *str, unsigned char *sha1);
815-
extern int get_sha1_with_mode(const char *str, unsigned char *sha1, unsigned *mode);
816815
extern void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);
817816
extern int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc);
818817

revision.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs,
10971097
int flags,
10981098
int cant_be_filename)
10991099
{
1100-
unsigned mode;
1100+
struct object_context oc;
11011101
char *dotdot;
11021102
struct object *object;
11031103
unsigned char sha1[20];
@@ -1180,13 +1180,13 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs,
11801180
local_flags = UNINTERESTING;
11811181
arg++;
11821182
}
1183-
if (get_sha1_with_mode(arg, sha1, &mode))
1183+
if (get_sha1_with_context(arg, sha1, &oc))
11841184
return revs->ignore_missing ? 0 : -1;
11851185
if (!cant_be_filename)
11861186
verify_non_filename(revs->prefix, arg);
11871187
object = get_reference(revs, arg, sha1, flags ^ local_flags);
11881188
add_rev_cmdline(revs, object, arg_, REV_CMD_REV, flags ^ local_flags);
1189-
add_pending_object_with_mode(revs, object, arg, mode);
1189+
add_pending_object_with_mode(revs, object, arg, oc.mode);
11901190
return 0;
11911191
}
11921192

@@ -1794,11 +1794,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
17941794
if (revs->def && !revs->pending.nr && !got_rev_arg) {
17951795
unsigned char sha1[20];
17961796
struct object *object;
1797-
unsigned mode;
1798-
if (get_sha1_with_mode(revs->def, sha1, &mode))
1797+
struct object_context oc;
1798+
if (get_sha1_with_context(revs->def, sha1, &oc))
17991799
die("bad default revision '%s'", revs->def);
18001800
object = get_reference(revs, revs->def, sha1, 0);
1801-
add_pending_object_with_mode(revs, object, revs->def, mode);
1801+
add_pending_object_with_mode(revs, object, revs->def, oc.mode);
18021802
}
18031803

18041804
/* Did the user ask for any diff output? Run the diff! */

sha1_name.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,14 +1139,6 @@ void maybe_die_on_misspelt_object_name(const char *name, const char *prefix)
11391139
get_sha1_with_context_1(name, sha1, &oc, 1, prefix);
11401140
}
11411141

1142-
int get_sha1_with_mode(const char *str, unsigned char *sha1, unsigned *mode)
1143-
{
1144-
struct object_context oc;
1145-
int ret = get_sha1_with_context_1(str, sha1, &oc, 0, NULL);
1146-
*mode = oc.mode;
1147-
return ret;
1148-
}
1149-
11501142
int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc)
11511143
{
11521144
return get_sha1_with_context_1(str, sha1, orc, 0, NULL);

0 commit comments

Comments
 (0)