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

Re: Something wrong with pickaxe?

From
Junio C Hamano <junkio@cox.net>
Date
Jan 19, 2006, 02:46 UTC
Message-ID
<7vwtgxlysf.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0601181541150.3240@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
> Me, I find the pickaxe semantics so non-intuitive that I never use it 
> (that said, the counting begaviour is better than what it _used_ to be, 
> which, if I recall correctly, was just "it existed before, doesn't exist 
> now").

You are so polite to say "non-intuitive" when you mean "useless".

I use pickaxe primarily when I want to find out what commit made the code into the current shape.

For example, after I start debugging or code change, if I suspect the first "if (!nr_match) return;" is bogus in filter_refs() of fetch-pack.c, before declaring that code is bogus and start butchering it, I run something like this:

$ git whatchanged -p -S'static void filter_refs(struct ref **refs, int nr_match, char **match)
{
	struct ref *prev, *current, *next;
	if (!nr_match)
		return;
' master -- fetch-pack.c

to find the commit that made the function to look like so, hoping to find the reason _why_ it is that way is explained in the log message for that commit. If the commit log is not enough, then next thing I do is to see its commit/author date and go back to the mailing list logs to see discussion around that timeframe.

For this use pattern, even counting behaviour we added later is redundant, since "did not have it that way but now it does" is the only thing that matters.

"What commits changed the lines that use this symbol over time" is not a question I ask pickaxe. When I ask a question about an individual symbol, such as "get_remote_heads", I often use "git grep", to learn what other existing users of the function would be affected in the current code if I changed that function, or to learn how other functions in the current code uses that symbol, but for that kind of research, historical usage of that symbol does not interest me.

Having said all of the above, I agree a different kind of pickaxe that gives you "if you were to run diff -u between these two blobs, the resulting patch would contain this text" might also be useful, and I am very open to have such an additional diffcore module next to pickaxe (IOW, not a replacement).

But it might not be as easy to use as the current pickaxe if the question I want to ask is "who made it into this shape".

Previous: Andreas EricssonNext: Linus Torvalds
Message 7 of 9 in “Something wrong with pickaxe?”
  1. Johannes SchindelinJan 18, 2006
  2. Linus TorvaldsJan 18, 2006
  3. Junio C HamanoJan 19, 2006
  4. Andreas EricssonJan 19, 2006
  5. Junio C HamanoJan 19, 2006
  6. Andreas EricssonJan 19, 2006
  7. Junio C HamanoJan 19, 2006
  8. Linus TorvaldsJan 19, 2006
  9. Junio C HamanoJan 19, 2006

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.