Skip to content

Commit 1e6771e

Browse files
Martin Ågrengitster
authored andcommitted
object-name.c: rename from sha1-name.c
Generalize the last remnants of "sha" and "sha1" in this file and rename it to reflect that we're not just able to handle SHA-1 these days. We need to update one test to check for an updated error string. Signed-off-by: Martin Ågren <[email protected]> Reviewed-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 71ca53e commit 1e6771e

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,7 @@ LIB_OBJS += notes-cache.o
937937
LIB_OBJS += notes-merge.o
938938
LIB_OBJS += notes-utils.o
939939
LIB_OBJS += notes.o
940+
LIB_OBJS += object-name.o
940941
LIB_OBJS += object.o
941942
LIB_OBJS += oid-array.o
942943
LIB_OBJS += oidmap.o
@@ -995,7 +996,6 @@ LIB_OBJS += server-info.o
995996
LIB_OBJS += setup.o
996997
LIB_OBJS += sha1-file.o
997998
LIB_OBJS += sha1-lookup.o
998-
LIB_OBJS += sha1-name.o
999999
LIB_OBJS += shallow.o
10001000
LIB_OBJS += sideband.o
10011001
LIB_OBJS += sigchain.o

list-objects-filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* in the traversal (until we mark it SEEN). This is a way to
2222
* let us silently de-dup calls to show() in the caller. This
2323
* is subtly different from the "revision.h:SHOWN" and the
24-
* "sha1-name.c:ONELINE_SEEN" bits. And also different from
24+
* "object-name.c:ONELINE_SEEN" bits. And also different from
2525
* the non-de-dup usage in pack-bitmap.c
2626
*/
2727
#define FILTER_SHOWN_BUT_REVISIT (1<<21)

sha1-name.c renamed to object-name.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static void update_candidates(struct disambiguate_state *ds, const struct object
8585
/* otherwise, current can be discarded and candidate is still good */
8686
}
8787

88-
static int match_sha(unsigned, const unsigned char *, const unsigned char *);
88+
static int match_hash(unsigned, const unsigned char *, const unsigned char *);
8989

9090
static void find_short_object_filename(struct disambiguate_state *ds)
9191
{
@@ -102,15 +102,15 @@ static void find_short_object_filename(struct disambiguate_state *ds)
102102
while (!ds->ambiguous && pos < loose_objects->nr) {
103103
const struct object_id *oid;
104104
oid = loose_objects->oid + pos;
105-
if (!match_sha(ds->len, ds->bin_pfx.hash, oid->hash))
105+
if (!match_hash(ds->len, ds->bin_pfx.hash, oid->hash))
106106
break;
107107
update_candidates(ds, oid);
108108
pos++;
109109
}
110110
}
111111
}
112112

113-
static int match_sha(unsigned len, const unsigned char *a, const unsigned char *b)
113+
static int match_hash(unsigned len, const unsigned char *a, const unsigned char *b)
114114
{
115115
do {
116116
if (*a != *b)
@@ -145,7 +145,7 @@ static void unique_in_midx(struct multi_pack_index *m,
145145
for (i = first; i < num && !ds->ambiguous; i++) {
146146
struct object_id oid;
147147
current = nth_midxed_object_oid(&oid, m, i);
148-
if (!match_sha(ds->len, ds->bin_pfx.hash, current->hash))
148+
if (!match_hash(ds->len, ds->bin_pfx.hash, current->hash))
149149
break;
150150
update_candidates(ds, current);
151151
}
@@ -173,7 +173,7 @@ static void unique_in_pack(struct packed_git *p,
173173
for (i = first; i < num && !ds->ambiguous; i++) {
174174
struct object_id oid;
175175
nth_packed_object_id(&oid, p, i);
176-
if (!match_sha(ds->len, ds->bin_pfx.hash, oid.hash))
176+
if (!match_hash(ds->len, ds->bin_pfx.hash, oid.hash))
177177
break;
178178
update_candidates(ds, &oid);
179179
}
@@ -483,7 +483,7 @@ static enum get_oid_result get_short_oid(struct repository *r,
483483
if (!quietly && (status == SHORT_NAME_AMBIGUOUS)) {
484484
struct oid_array collect = OID_ARRAY_INIT;
485485

486-
error(_("short SHA1 %s is ambiguous"), ds.hex_pfx);
486+
error(_("short object ID %s is ambiguous"), ds.hex_pfx);
487487

488488
/*
489489
* We may still have ambiguity if we simply saw a series of
@@ -1811,7 +1811,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
18111811
if (!ret)
18121812
return ret;
18131813
/*
1814-
* sha1:path --> object name of path in ent sha1
1814+
* tree:path --> object name of path in tree
18151815
* :path -> object name of absolute path in index
18161816
* :./path -> object name of path relative to cwd in index
18171817
* :[0-3]:path -> object name of path in index at stage
@@ -1949,6 +1949,6 @@ enum get_oid_result get_oid_with_context(struct repository *repo,
19491949
struct object_context *oc)
19501950
{
19511951
if (flags & GET_OID_FOLLOW_SYMLINKS && flags & GET_OID_ONLY_TO_DIE)
1952-
BUG("incompatible flags for get_sha1_with_context");
1952+
BUG("incompatible flags for get_oid_with_context");
19531953
return get_oid_with_context_1(repo, str, flags, NULL, oid, oc);
19541954
}

t/t1512-rev-parse-disambiguation.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test_expect_success 'blob and tree' '
4848

4949
test_expect_success 'warn ambiguity when no candidate matches type hint' '
5050
test_must_fail git rev-parse --verify 000000000^{commit} 2>actual &&
51-
test_i18ngrep "short SHA1 000000000 is ambiguous" actual
51+
test_i18ngrep "short object ID 000000000 is ambiguous" actual
5252
'
5353

5454
test_expect_success 'disambiguate tree-ish' '

0 commit comments

Comments
 (0)