git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Han-Wen Nienhuys <hanwenn@gmail.com>
Subject: Re: What's cooking (draft for #4's issue this month)
Date: Wed, 14 Apr 2021 11:43:16 +0200	[thread overview]
Message-ID: <YHa5NE3tj/R5kF8N@ncase> (raw)
In-Reply-To: <xmqqmtu1zn3o.fsf@gitster.g>

[-- Attachment #1: Type: text/plain, Size: 4540 bytes --]

On Tue, Apr 13, 2021 at 06:11:39PM -0700, Junio C Hamano wrote:
> On 'seen' there are many topics that have not seen adequately
> reviews; some tests are broken near its tip (I think they pass the
> selftests by themselves).
> 
>     0e76df05ca Merge branch 'ps/rev-list-object-type-filter' into seen
>     956fbceb2e ### breaks 6112 6113
>     c007303ad4 Merge branch 'bc/hash-transition-interop-part-1' into seen
>     4813f16161 ### breaks 0031

Test breakage for the rev-list filter series has been a bad interaction
of d8883ed540 (object.c: stop supporting len == -1 in
type_from_string_gently(), 2021-03-28) and
ps/rev-list-object-type-filter. The following patch fixes this, which
I'll include in my next reroll of this series.

diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
index 19e128ef11..33c7718a7a 100644
--- a/list-objects-filter-options.c
+++ b/list-objects-filter-options.c
@@ -100,7 +100,7 @@ static int gently_parse_list_objects_filter(
 		return 1;

 	} else if (skip_prefix(arg, "object:type=", &v0)) {
-		int type = type_from_string_gently(v0, -1);
+		int type = type_from_string_gently(v0, strlen(v0));
 		if (type < 0) {
 			strbuf_addstr(errbuf, _("expected 'object:type=<type>'"));
 			return 1;


The other breakages I see are caused by hn/reftable, where all tests in
t0031-reftables.sh cause segfaults. The root cause seems to be that
reading refs via the reftable backend doesn't initialize the `algo`
field of the OID, which is fixed via the following patch.

diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
index 130fd90e45..35fb7dd0a2 100644
--- a/refs/reftable-backend.c
+++ b/refs/reftable-backend.c
@@ -251,10 +251,10 @@ static int reftable_ref_iterator_advance(struct ref_iterator *ref_iterator)
 		ri->base.flags = 0;
 		switch (ri->ref.value_type) {
 		case REFTABLE_REF_VAL1:
-			hashcpy(ri->oid.hash, ri->ref.value.val1);
+			oidread(&ri->oid, ri->ref.value.val1);
 			break;
 		case REFTABLE_REF_VAL2:
-			hashcpy(ri->oid.hash, ri->ref.value.val2.value);
+			oidread(&ri->oid, ri->ref.value.val2.value);
 			break;
 		case REFTABLE_REF_SYMREF: {
 			int out_flags = 0;
@@ -299,7 +299,7 @@ static int reftable_ref_iterator_peel(struct ref_iterator *ref_iterator,
 	struct git_reftable_iterator *ri =
 		(struct git_reftable_iterator *)ref_iterator;
 	if (ri->ref.value_type == REFTABLE_REF_VAL2) {
-		hashcpy(peeled->hash, ri->ref.value.val2.target_value);
+		oidread(peeled, ri->ref.value.val2.target_value);
 		return 0;
 	}

@@ -977,7 +977,7 @@ git_reftable_reflog_ref_iterator_advance(struct ref_iterator *ref_iterator)

 		free(ri->last_name);
 		ri->last_name = xstrdup(ri->log.refname);
-		hashcpy(ri->oid.hash, ri->log.update.new_hash);
+		oidread(&ri->oid, ri->log.update.new_hash);
 		return ITER_OK;
 	}
 }
@@ -1090,8 +1090,8 @@ static int git_reftable_for_each_reflog_ent_newest_first(
 			break;
 		}

-		hashcpy(old_oid.hash, log.update.old_hash);
-		hashcpy(new_oid.hash, log.update.new_hash);
+		oidread(&old_oid, log.update.old_hash);
+		oidread(&new_oid, log.update.new_hash);

 		full_committer = fmt_ident(log.update.name, log.update.email,
 					   WANT_COMMITTER_IDENT,
@@ -1157,8 +1157,8 @@ static int git_reftable_for_each_reflog_ent_oldest_first(
 		struct object_id new_oid;
 		const char *full_committer = "";

-		hashcpy(old_oid.hash, log->update.old_hash);
-		hashcpy(new_oid.hash, log->update.new_hash);
+		oidread(&old_oid, log->update.old_hash);
+		oidread(&new_oid, log->update.new_hash);

 		full_committer = fmt_ident(log->update.name, log->update.email,
 					   WANT_COMMITTER_IDENT, NULL,
@@ -1330,8 +1330,8 @@ git_reftable_reflog_expire(struct ref_store *ref_store, const char *refname,
 		if (err > 0 || strcmp(log.refname, refname)) {
 			break;
 		}
-		hashcpy(ooid.hash, log.update.old_hash);
-		hashcpy(noid.hash, log.update.new_hash);
+		oidread(&ooid, log.update.old_hash);
+		oidread(&noid, log.update.new_hash);

 		if (should_prune_fn(&ooid, &noid, log.update.email,
 				    (timestamp_t)log.update.time,
@@ -1410,7 +1410,7 @@ static int git_reftable_read_raw_ref(struct ref_store *ref_store,
 		strbuf_addstr(referent, ref.value.symref);
 		*type |= REF_ISSYMREF;
 	} else if (reftable_ref_record_val1(&ref) != NULL) {
-		hashcpy(oid->hash, reftable_ref_record_val1(&ref));
+		oidread(oid, reftable_ref_record_val1(&ref));
 	} else {
 		*type |= REF_ISBROKEN;
 		errno = EINVAL;


Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-04-14  9:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14  1:11 What's cooking (draft for #4's issue this month) Junio C Hamano
2021-04-14  9:43 ` Patrick Steinhardt [this message]
2021-04-14 21:20   ` Junio C Hamano
2021-04-14 21:53     ` Junio C Hamano
2021-04-15  9:37       ` Jeff King
2021-04-15 18:02         ` Junio C Hamano
2021-04-14 21:31   ` Junio C Hamano
2021-04-14 23:22 ` Junio C Hamano
2021-04-14 23:26   ` Junio C Hamano
2021-04-15  0:34   ` brian m. carlson
2021-04-15  6:37     ` Junio C Hamano
2021-04-19  2:10       ` brian m. carlson
2021-04-19 23:14         ` Junio C Hamano
2021-04-15 12:58   ` Han-Wen Nienhuys

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHa5NE3tj/R5kF8N@ncase \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hanwenn@gmail.com \
    /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.
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 NNTP newsgroup(s).