git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/4] blame: validate and peel the object names on the ignore list

From
BRBarret Rhoden <brho@google.com>
Date
Sep 28, 2020, 13:26 UTC
Message-ID
<32370477-c6e4-5378-fedc-c86b9ddf96bd@google.com>
In-Reply-To
<xmqqtuvkii1j.fsf@gitster.c.googlers.com>
Hi -
On 9/26/20 1:06 PM, Junio C Hamano wrote:
Show 17 quoted lines
> René Scharfe <l.s.r@web.de> writes:
> 
>> When I request "Don't eat any glue!", perfectly human responses could be
>> "But I don't have any glue!" or "It doesn't even taste that good.", but
>> I'd expect a computer program to act I bit more logical and just don't
>> do it, without talking back.  Maybe that's just me.
>>
>> (I had been bitten by a totally different software adding such a check,
>> which made it complain about my long catch-all ignore list, and I had to
>> craft and maintain a specific "clean" list for each deployment --
>> perhaps I'm still bitter about that.)
> 
> A user who says "ignore v2.3", sees that the commit pointed at by
> that release tag is not ignored, comes here to complain, and is told
> to write v2.3^0 instead, would not be happy.  It is a mistake easy
> to catch to help users, so I am more for than against that part of
> the change.
That sounds like a nice change.
> I am completely neutral about "you told me to ignore
> this, but as far as I can tell it does not even exist---did you
> screw up when you prepared the list of stuff to ignore?" part.  I do
> not mind seeing it removed.

Part of my reasoning for "fail if you can't find it" was that it was highly likely to be a user error. Especially because it will fail for a short hash from a file. If you do have a list of commits to ignore (.git-blame-ignore-revs), that list is probably under version control in the same git repo, so it should change as you change branches.

But all in all, I'm fine with skipping unknown objects. Or for warning or having a git-config option, like we do for a couple other aspects of blame-ignore, since one size doesn't fit all.

Show 12 quoted lines
>>> +		if (kind == OBJ_COMMIT) {
>>> +			oidcpy(oid_ret, &oid);
>>
>> At that point we know it's an object, but cast it up to the most generic
>> class we have -- an object ID.  We could have set an object flag to mark
>> it ignored instead, which would be trivial to check later.  On the other
>> hand it probably wouldn't make much of a difference -- hashmaps are
>> pretty fast, and blame has lots of things to do beyond ignoring commits.
> 
> Quite honestly, I am not interested in the "blame --ignore" feature
> itself.  It is good that you CC'ed Barret so that such an
> improvement suggestion would be heard by the right party ;-).

Any performance improvement would be welcome. I haven't looked at the code in a while, but I don't recall any reasons why this wouldn't work.

Show 12 quoted lines
> 
>>> @@ -815,10 +836,12 @@ static void build_ignorelist(struct blame_scoreboard *sb,
>>>   		if (!strcmp(i->string, ""))
>>>   			oidset_clear(&sb->ignore_list);
>>
>> This preexisting feature is curious.  It's even documented ('An empty
>> file name, "", will clear the list of revs from previously processed
>> files.') and covered by t8013.6.  Why would we need such magic in
>> addition to the standard negation (--no-ignore-revs-file) for clearing
>> the list?  The latter counters blame.ignoreRevsFile as well. *puzzled*
> 
> I shared the puzzlement when I saw it, but ditto.

I don't recall exactly. Someone on the list might have wanted to both counter the blame.ignoreRevsFile and specify another file. Or maybe they just wanted to counter the ignoreRevsFile, and I didn't know that --no- would already do that. I'm certainly not wed to it.

Thanks,
Barret
Show 23 quoted lines
>>> +void oidset_parse_file_carefully(struct oidset *set, const char *path,
>>> +				 oidset_parse_tweak_fn fn, void *cbdata)
>>>   {
>>>   	FILE *fp;
>>>   	struct strbuf sb = STRBUF_INIT;
>>> @@ -66,7 +72,8 @@ void oidset_parse_file(struct oidset *set, const char *path)
>>>   		if (!sb.len)
>>>   			continue;
>>>
>>> -		if (parse_oid_hex(sb.buf, &oid, &p) || *p != '\0')
>>> +		if (parse_oid_hex(sb.buf, &oid, &p) || *p != '\0' ||
>>> +		    (fn && fn(&oid, cbdata)))
>>
>> OK, so this turns the basic all-I-know-is-hashes oidset loader into a
>> flexible higher-order map function.  Fun, but wise?  Can't make up my
>> mind.
> 
> Fun and probably useful.  It is a different matter if it is wise to
> use it to (1) peel tags to commits and (2) fail on an nonexistent
> object.  My take on them is (1) is probably true, and (2) is Meh ;-)
> 
> Thanks.
> 
Previous: Junio C HamanoNext: René Scharfe
Message 8 of 13 in “Clean-up around get_x_ish()”
  1. 0/4 Clean-up around get_x_ish()Junio C Hamano, Sep 25, 2020
  2. 4/4 sequencer: stop abbreviating stopped-sha fileJunio C Hamano, Sep 25, 2020
  3. 3/4 t1506: rev-parse A..B and A...BJunio C Hamano, Sep 25, 2020
  4. 2/4 blame: validate and peel the object names on the ignore listJunio C Hamano, Sep 25, 2020
  5. René ScharfeSep 26, 2020
  6. Junio C HamanoSep 26, 2020
  7. Junio C HamanoSep 26, 2020
  8. Barret RhodenSep 28, 2020
  9. René ScharfeOct 11, 2020
  10. Junio C HamanoOct 12, 2020
  11. Barret RhodenOct 12, 2020
  12. René ScharfeOct 13, 2020
  13. 1/4 t8013: minimum preparatory clean-upJunio C Hamano, Sep 25, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.