From: "Martin Ågren" <martin.agren@gmail.com>
To: git@vger.kernel.org
Cc: "brian m . carlson" <sandals@crustytoothpaste.net>,
Derrick Stolee <dstolee@microsoft.com>
Subject: [PATCH v2 0/4] rename "sha1-foo" files
Date: Thu, 31 Dec 2020 12:56:19 +0100 [thread overview]
Message-ID: <cover.1609415114.git.martin.agren@gmail.com> (raw)
In-Reply-To: <cover.1609282997.git.martin.agren@gmail.com>
Thanks to Derrick and brian for commenting on v1 [1] of my series for
renaming sha1-foo files and generalizing "sha", "sha1" and so on in
them. I realized I hadn't renamed the header guard in hash-lookup.h as I
renamed the file. That made me realize that I had failed to look for
"SHA-1" (capital letters). So this v2 is a bit bigger than v1, but not
by too much, I think. The range-diff is below.
[1] https://lore.kernel.org/git/cover.1609282997.git.martin.agren@gmail.com/
Martin Ågren (4):
object-name.c: rename from sha1-name.c
object-file.c: rename from sha1-file.c
sha1-lookup: rename `sha1_pos()` as `hash_pos()`
hash-lookup: rename from sha1-lookup
t/oid-info/README | 2 +-
t/t1512-rev-parse-disambiguation.sh | 2 +-
sha1-lookup.h => hash-lookup.h | 18 +++++++++---------
bisect.c | 2 +-
builtin/index-pack.c | 2 +-
builtin/name-rev.c | 4 ++--
commit-graph.c | 8 ++++----
commit.c | 4 ++--
sha1-lookup.c => hash-lookup.c | 22 +++++++++++-----------
list-objects-filter.c | 2 +-
midx.c | 2 +-
sha1-file.c => object-file.c | 10 +++++-----
sha1-name.c => object-name.c | 16 ++++++++--------
oid-array.c | 4 ++--
pack-bitmap-write.c | 4 ++--
packfile.c | 2 +-
patch-ids.c | 2 +-
rerere.c | 4 ++--
Makefile | 6 +++---
19 files changed, 58 insertions(+), 58 deletions(-)
rename sha1-lookup.h => hash-lookup.h (68%)
rename sha1-lookup.c => hash-lookup.c (84%)
rename sha1-file.c => object-file.c (99%)
rename sha1-name.c => object-name.c (98%)
Range-diff against v1:
1: aac3a3c3e2 ! 1: 4d69d448a3 object-name.c: rename from sha1-name.c
@@ Commit message
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 <martin.agren@gmail.com>
+ ## t/t1512-rev-parse-disambiguation.sh ##
+@@ t/t1512-rev-parse-disambiguation.sh: test_expect_success 'blob and tree' '
+
+ test_expect_success 'warn ambiguity when no candidate matches type hint' '
+ test_must_fail git rev-parse --verify 000000000^{commit} 2>actual &&
+- test_i18ngrep "short SHA1 000000000 is ambiguous" actual
++ test_i18ngrep "short object ID 000000000 is ambiguous" actual
+ '
+
+ test_expect_success 'disambiguate tree-ish' '
+
## list-objects-filter.c ##
@@
* in the traversal (until we mark it SEEN). This is a way to
@@ object-name.c: static void unique_in_pack(struct packed_git *p,
break;
update_candidates(ds, &oid);
}
+@@ object-name.c: static enum get_oid_result get_short_oid(struct repository *r,
+ if (!quietly && (status == SHORT_NAME_AMBIGUOUS)) {
+ struct oid_array collect = OID_ARRAY_INIT;
+
+- error(_("short SHA1 %s is ambiguous"), ds.hex_pfx);
++ error(_("short object ID %s is ambiguous"), ds.hex_pfx);
+
+ /*
+ * We may still have ambiguity if we simply saw a series of
@@ object-name.c: static enum get_oid_result get_oid_with_context_1(struct repository *repo,
if (!ret)
return ret;
2: 4243886d8a ! 2: 7ab29b868f object-file.c: rename from sha1-file.c
@@ sha1-file.c => object-file.c
* creation etc.
*/
#include "cache.h"
+@@ object-file.c: static int alt_odb_usable(struct raw_object_store *o,
+ * LF separated. Its base points at a statically allocated buffer that
+ * contains "/the/directory/corresponding/to/.git/objects/...", while
+ * its name points just after the slash at the end of ".git/objects/"
+- * in the example above, and has enough space to hold 40-byte hex
+- * SHA1, an extra slash for the first level indirection, and the
+- * terminating NUL.
++ * in the example above, and has enough space to hold all hex characters
++ * of the object ID, an extra slash for the first level indirection, and
++ * the terminating NUL.
+ */
+ static void read_info_alternates(struct repository *r,
+ const char *relative_base,
## Makefile ##
@@ Makefile: LIB_OBJS += notes-cache.o
3: 8d3b123633 = 3: 91617de0ac sha1-lookup: rename `sha1_pos()` as `hash_pos()`
4: afee010474 ! 4: 9df53353dc hash-lookup: rename from sha1-lookup
@@ Commit message
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
## sha1-lookup.h => hash-lookup.h ##
+@@
+-#ifndef SHA1_LOOKUP_H
+-#define SHA1_LOOKUP_H
++#ifndef HASH_LOOKUP_H
++#define HASH_LOOKUP_H
+
+ typedef const unsigned char *hash_access_fn(size_t index, void *table);
+
@@ hash-lookup.h: int hash_pos(const unsigned char *hash,
hash_access_fn fn);
--
2.30.0
next prev parent reply other threads:[~2020-12-31 11:58 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 ` [PATCH 1/4] object-name.c: rename from sha1-name.c Martin Ågren
2020-12-30 1:19 ` 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 ` Martin Ågren [this message]
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=cover.1609415114.git.martin.agren@gmail.com \
--to=martin.agren@gmail.com \
--cc=dstolee@microsoft.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).