From: "Martin Ågren" <martin.agren@gmail.com>
To: git@vger.kernel.org
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>
Subject: [PATCH 1/4] object-name.c: rename from sha1-name.c
Date: Wed, 30 Dec 2020 00:52:57 +0100 [thread overview]
Message-ID: <aac3a3c3e202f790f11089e2c8f814bea9943831.1609282997.git.martin.agren@gmail.com> (raw)
In-Reply-To: <cover.1609282997.git.martin.agren@gmail.com>
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.
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
---
list-objects-filter.c | 2 +-
sha1-name.c => object-name.c | 14 +++++++-------
Makefile | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
rename sha1-name.c => object-name.c (99%)
diff --git a/list-objects-filter.c b/list-objects-filter.c
index 0a3ef3cab3..4ec0041cfb 100644
--- a/list-objects-filter.c
+++ b/list-objects-filter.c
@@ -21,7 +21,7 @@
* in the traversal (until we mark it SEEN). This is a way to
* let us silently de-dup calls to show() in the caller. This
* is subtly different from the "revision.h:SHOWN" and the
- * "sha1-name.c:ONELINE_SEEN" bits. And also different from
+ * "object-name.c:ONELINE_SEEN" bits. And also different from
* the non-de-dup usage in pack-bitmap.c
*/
#define FILTER_SHOWN_BUT_REVISIT (1<<21)
diff --git a/sha1-name.c b/object-name.c
similarity index 99%
rename from sha1-name.c
rename to object-name.c
index 0b23b86ceb..7e58a58777 100644
--- a/sha1-name.c
+++ b/object-name.c
@@ -85,7 +85,7 @@ static void update_candidates(struct disambiguate_state *ds, const struct object
/* otherwise, current can be discarded and candidate is still good */
}
-static int match_sha(unsigned, const unsigned char *, const unsigned char *);
+static int match_hash(unsigned, const unsigned char *, const unsigned char *);
static void find_short_object_filename(struct disambiguate_state *ds)
{
@@ -102,7 +102,7 @@ static void find_short_object_filename(struct disambiguate_state *ds)
while (!ds->ambiguous && pos < loose_objects->nr) {
const struct object_id *oid;
oid = loose_objects->oid + pos;
- if (!match_sha(ds->len, ds->bin_pfx.hash, oid->hash))
+ if (!match_hash(ds->len, ds->bin_pfx.hash, oid->hash))
break;
update_candidates(ds, oid);
pos++;
@@ -110,7 +110,7 @@ static void find_short_object_filename(struct disambiguate_state *ds)
}
}
-static int match_sha(unsigned len, const unsigned char *a, const unsigned char *b)
+static int match_hash(unsigned len, const unsigned char *a, const unsigned char *b)
{
do {
if (*a != *b)
@@ -145,7 +145,7 @@ static void unique_in_midx(struct multi_pack_index *m,
for (i = first; i < num && !ds->ambiguous; i++) {
struct object_id oid;
current = nth_midxed_object_oid(&oid, m, i);
- if (!match_sha(ds->len, ds->bin_pfx.hash, current->hash))
+ if (!match_hash(ds->len, ds->bin_pfx.hash, current->hash))
break;
update_candidates(ds, current);
}
@@ -173,7 +173,7 @@ static void unique_in_pack(struct packed_git *p,
for (i = first; i < num && !ds->ambiguous; i++) {
struct object_id oid;
nth_packed_object_id(&oid, p, i);
- if (!match_sha(ds->len, ds->bin_pfx.hash, oid.hash))
+ if (!match_hash(ds->len, ds->bin_pfx.hash, oid.hash))
break;
update_candidates(ds, &oid);
}
@@ -1811,7 +1811,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
if (!ret)
return ret;
/*
- * sha1:path --> object name of path in ent sha1
+ * tree:path --> object name of path in tree
* :path -> object name of absolute path in index
* :./path -> object name of path relative to cwd in index
* :[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,
struct object_context *oc)
{
if (flags & GET_OID_FOLLOW_SYMLINKS && flags & GET_OID_ONLY_TO_DIE)
- BUG("incompatible flags for get_sha1_with_context");
+ BUG("incompatible flags for get_oid_with_context");
return get_oid_with_context_1(repo, str, flags, NULL, oid, oc);
}
diff --git a/Makefile b/Makefile
index 7b64106930..8bb1163f70 100644
--- a/Makefile
+++ b/Makefile
@@ -937,6 +937,7 @@ LIB_OBJS += notes-cache.o
LIB_OBJS += notes-merge.o
LIB_OBJS += notes-utils.o
LIB_OBJS += notes.o
+LIB_OBJS += object-name.o
LIB_OBJS += object.o
LIB_OBJS += oid-array.o
LIB_OBJS += oidmap.o
@@ -995,7 +996,6 @@ LIB_OBJS += server-info.o
LIB_OBJS += setup.o
LIB_OBJS += sha1-file.o
LIB_OBJS += sha1-lookup.o
-LIB_OBJS += sha1-name.o
LIB_OBJS += shallow.o
LIB_OBJS += sideband.o
LIB_OBJS += sigchain.o
--
2.30.0
next prev parent reply other threads:[~2020-12-29 23:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-29 23:52 [PATCH 0/4] rename "sha1-foo" files Martin Ågren
2020-12-29 23:52 ` Martin Ågren [this message]
2020-12-30 1:19 ` [PATCH 1/4] object-name.c: rename from sha1-name.c Derrick Stolee
2020-12-29 23:52 ` [PATCH 2/4] object-file.c: rename from sha1-file.c Martin Ågren
2020-12-29 23:52 ` [PATCH 3/4] sha1-lookup: rename `sha1_pos()` as `hash_pos()` Martin Ågren
2020-12-30 1:21 ` Derrick Stolee
2020-12-29 23:53 ` [PATCH 4/4] hash-lookup: rename from sha1-lookup Martin Ågren
2020-12-30 1:29 ` [PATCH 0/4] rename "sha1-foo" files Derrick Stolee
2020-12-30 8:01 ` Martin Ågren
2020-12-30 13:35 ` Derrick Stolee
2020-12-30 4:22 ` brian m. carlson
2020-12-30 8:04 ` Martin Ågren
2020-12-31 11:56 ` [PATCH v2 " Martin Ågren
2020-12-31 11:56 ` [PATCH v2 1/4] object-name.c: rename from sha1-name.c Martin Ågren
2020-12-31 11:56 ` [PATCH v2 2/4] object-file.c: rename from sha1-file.c Martin Ågren
2020-12-31 11:56 ` [PATCH v2 3/4] sha1-lookup: rename `sha1_pos()` as `hash_pos()` Martin Ågren
2020-12-31 11:56 ` [PATCH v2 4/4] hash-lookup: rename from sha1-lookup Martin Ågren
2020-12-31 12:47 ` [PATCH v2 0/4] rename "sha1-foo" files Derrick Stolee
2020-12-31 13:36 ` Martin Ågren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aac3a3c3e202f790f11089e2c8f814bea9943831.1609282997.git.martin.agren@gmail.com \
--to=martin.agren@gmail.com \
--cc=git@vger.kernel.org \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).