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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi -

On 9/26/20 1:06 PM, Junio C Hamano wrote:
René Scharfe <l.s.r@xxxxxx> 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.

+		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.


@@ -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


+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.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux