From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Derrick Stolee <stolee@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Derrick Stolee <dstolee@microsoft.com>,
git@vger.kernel.org
Subject: Re: [PATCH 3/3] commit-graph: error out on invalid commit oids in 'write --stdin-commits'
Date: Mon, 5 Aug 2019 19:57:04 +0200 [thread overview]
Message-ID: <20190805175704.GC20404@szeder.dev> (raw)
In-Reply-To: <ecdd6c01-5ee2-6869-4eb3-1eb45f4c335c@gmail.com>
On Mon, Aug 05, 2019 at 09:57:19AM -0400, Derrick Stolee wrote:
> On 8/5/2019 4:02 AM, SZEDER Gábor wrote:
> > While 'git commit-graph write --stdin-commits' expects commit object
> > ids as input, it accepts and silently skips over any invalid commit
> > object ids, and still exits with success:
> >
> > # nonsense
> > $ echo not-a-commit-oid | git commit-graph write --stdin-commits
> > $ echo $?
> > 0
> > # sometimes I forgot that refs are not good...
> > $ echo HEAD | git commit-graph write --stdin-commits
> > $ echo $?
> > 0
> > # valid tree OID, but not a commit OID
> > $ git rev-parse HEAD^{tree} | git commit-graph write --stdin-commits
> > $ echo $?
> > 0
> > $ ls -l .git/objects/info/commit-graph
> > ls: cannot access '.git/objects/info/commit-graph': No such file or directory
> >
> > Check that all input records are indeed valid commit object ids and
> > return with error otherwise, the same way '--stdin-packs' handles
> > invalid input; see e103f7276f (commit-graph: return with errors during
> > write, 2019-06-12).
>
> Consistency is good. We should definitely make these modes match.
I was also wondering whether it would be worth accepting refs as well,
either as DWIMery or only when a '--revs' option is given (similar to
'git pack-objects --revs'). Dunno, I'm a bit hesitant about always
accepting refs as a DWIMery, this is plumbing after all. And I don't
really care whether I correct my bogus command by replacing 'echo'
with 'git rev-parse' or by adding a '--revs' argument; the important
thing is that the command should tell me that I gave it junk. And
that would be a new feature, while this patch is a bugfix IMO.
> > Note that it should only return with error when encountering an
> > invalid commit object id coming from standard input. However,
> > '--reachable' uses the same code path to process object ids pointed to
> > by all refs, and that includes tag object ids as well, which should
> > still be skipped over. Therefore add a new flag to 'enum
> > commit_graph_write_flags' and a corresponding field to 'struct
> > write_commit_graph_context', so we can differentiate between those two
> > cases.
>
> Thank you for the care here.
Well, to be honest, I wasn't careful... :) but running the test suite
with GIT_TEST_COMMIT_GRAPH=1 resulted in about a dozen failed test
scripts that traced back to this.
next prev parent reply other threads:[~2019-08-05 17:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-05 8:02 [PATCH 0/3] commit-graph: error out on invalid commit oids in 'write --stdin-commits' SZEDER Gábor
2019-08-05 8:02 ` [PATCH 1/3] t5318-commit-graph: use 'test_expect_code' SZEDER Gábor
2019-08-05 8:02 ` [PATCH 2/3] commit-graph: turn a group of write-related macro flags into an enum SZEDER Gábor
2019-08-05 8:02 ` [PATCH 3/3] commit-graph: error out on invalid commit oids in 'write --stdin-commits' SZEDER Gábor
2019-08-05 13:57 ` Derrick Stolee
2019-08-05 17:57 ` SZEDER Gábor [this message]
2020-04-03 18:30 ` Jeff King
2020-04-03 18:49 ` Taylor Blau
2020-04-03 19:38 ` SZEDER Gábor
2020-04-03 19:51 ` Jeff King
2020-04-03 20:40 ` SZEDER Gábor
2020-04-03 23:10 ` Jeff King
2020-04-13 19:39 ` Taylor Blau
2020-04-13 21:25 ` Jeff King
2020-04-14 2:04 ` Taylor Blau
2020-04-03 19:55 ` Taylor Blau
2020-04-03 19:47 ` Junio C Hamano
2020-04-03 19:57 ` Taylor Blau
2019-08-05 10:14 ` [PATCH 0/3] " SZEDER Gábor
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=20190805175704.GC20404@szeder.dev \
--to=szeder.dev@gmail.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=stolee@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.