Re: [PATCH] Fix git to be (more) ANSI C99 compliant.

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

 



Rene Scharfe <rene.scharfe@xxxxxxxxxxxxxx> writes:

> Junio C Hamano schrieb:
>> BTW, I think we would probably want to have this patch on top of
>> Rene's patch.  In all instances, the variable "buf" is of type
>> "const char *" and the existing casts do not make sense to me.
>> 
>> diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
>> index 5c8a5f0..39a61b6 100644
>
> Your patch reverts builtin-tar-tree.c to the version which is
> currently both in master and next, which I think is a good
> change.  However, could it be avoided at merge time?

Sorry for attributing those "casts [that] do not make sense to
me" to you -- it is not your code but part of Florian's patch.

I think applying the patch in question on top of Florian's 11172e
would be the most sensible, since that is currently the tip of ff/c99
topic branch whose early parts have been merged to "next" and
the tip to "pu".  When Linus feels as sympathetic as I do, we
can pull the rest of ff/c99 branch to "next" and then eventually
to "master" and the patch will be merged together without
introducing the nonsense casts.

Another possibility is to amend the tip of ff/c99 topic branch,
since it is not merged to "next" yet.  I promised not to rewind
"master" nor "next", but never made promises not to rewind "pu",
so it is a fair game.  I think it is simpler and cleaner, so
that will be what I will do.

> OT: I found the blobs 5c8a5f0 and 39a61b6 by guessing (they are
> builtin-tar-tree.c in pu and master, respectively).  OK, that
> was easy.  But is there a way to reversely look up an object
> without guessing, i.e. find out which commit(s) introduced a
> certain blob?

You could do something like this (totally untested).

Going from the above "diff --git" index line you have object
name abbreviations and pathnames as clues.  To take advantage of
it, you could use "git rev-list pu -- builtin-tar-tree.c"
instead of unlimited list.

$ git rev-list pu |
  git diff-tree -r --stdin --pretty |
  perl -e '
	my @lines = ();
        sub flush_em {
        	my @found = ();
                my @comment = ();
		for my $l (@lines) {
                	if ($l !~ /^:/) {
				push @comment, $l;
				next;
			}
                        for (@ARGV) {
                        	if ($l =~ / $_/) {
                                	push @found, $l;
					last;
				}
                        }
                }
		if (@found) {
			print join("", @comment, @found);
                }
                @lines = ();
	}
        while (<STDIN>) {
        	if (/^commit [0-9a-f]{40}$/) { flush_em(); }
                push @lines, $_;
	}
        flush_em();
  ' 39a61b6 5c8a5f0

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]