Re: [PATCH] git-cget: prints elements of C code in the git repository
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Mar 24, 2009, 12:05 UTC
- Message-ID
- <alpine.DEB.1.00.0903241257430.7493@intel-tinevez-2-302>
- In-Reply-To
- <49C8B159.2040600@gmail.com>
Hi,
Disclaimer: if you are offended by constructive criticism, or likely to answer with insults to the comments I offer, please stop reading this mail now (and please do not answer my mail, either). :-)
Still with me? Good. Nice to meet you.
Just for the record: responding to a patch is my strongest way of saying that I appreciate your work.
On Tue, 24 Mar 2009, Roel Kluin wrote:
Show 5 quoted lines
> Maybe something like this is useful? > ------------------------------>8-------------8<--------------------------------- > Add git-cget.sh: prints elements of C code in the git repository. > > Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
I really like what this tries to do.
But there are some problems:
- the name is not expressive enough,
- the commit message is severely lacking (I had to apply it and run it to find out what problem it tries to solve),
- it still uses dashed git commands,
- it might be better to put it into contrib/, otherwise it needs documentation with examples, and tests,
- it misdetects functions: trying
$ ./git-cget -f get_sha1.*
shows this, amongst others:
-- snip --
// vi sha1_name.c +59
return get_sha1_hex(hex, sha1) == 0;
return found;
}static int match_sha(unsigned len, const unsigned char *a, const unsigned
char *b)
{
do {
if (*a != *b)
return 0;
a++;
b++;
len -= 2;
} while (len > 1);
if (len)
if ((*a ^ *b) & 0xf0)
return 0;
return 1;
}
-- snap --- maybe it would be nicer to integrate this into git grep itself? Maybe by allowing multi-line matches and default patterns, or pattern templates?
Ciao, Dscho