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

Re: Error converting from 1.4.4.1 to 1.5.0?

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Feb 14, 2007, 23:03 UTC
Message-ID
<Pine.LNX.4.64.0702141447290.20368@woody.linux-foundation.org>
In-Reply-To
<17875.33204.413186.355557@lisa.zopyra.com>
On Wed, 14 Feb 2007, Bill Lear wrote:
Show 6 quoted lines
>
> WAAAAAIAMINIT ... I think I see it:
> 
> % perl -pi -e 's/.*\$Id.*//sx' $(xgrep -l '[$]Id')
> 
> Could I have corrupted the pack file?  I'll bet $50 I did:
Heh.

I'm relieved git is off the hook, although I think we should still look at that SIGSEGV. We might well have some situation where we react badly do a corrupt pack (most likely, by having one of the object parsing routines return NULL, and then we follow that NULL pointer rather than saying "bad object").

> % [yet another clone]
> % xgrep -l '[$]Id'
> ./.git/objects/pack/pack-23d1a9af78b4b78d1f3750cf70f83cb91a20ba64.pack

This is just one reason I don't ever use 'find' on my source tree. I long ago used to do

	find . -name '*.c' | xargs grep ...

etc, but especially with git I have almost totally stopped using "xargs grep" entirely - to the point where I actually end up importing tar-files into new git archives just because I'm so used to "git grep".

So I would suggest that in order to avoid this in the future, you teach your fingers to say "git grep" instead of "xgrep"., which I assume is just some local alias of yours for "find .. | xargs grep"?

"git grep" really works wonderfully well, and you could have just done
	perl -pi -e 's/.*\$Id.*//sx' $(git grep -l '[$]Id')
instead.

("git grep" is much nicer than "xargs grep" in many other ways too. You can ask it to limit itself to a certain pattern of filenames etc by doing

	git grep -l '[$]Id' -- 'net/*.[ch]'

as long as you realize that the name pattern for git grep considers '*' to act like '**' does for some shells - ie it globs against '/'too, so the above will find any C and header files under the net/ directory, however deep they are.. And you can ask it to grep in just a certain revision etc too).

Once you get used to "git grep", I bet you'll forget all about "xgrep", and won't have to worry about going into the .git/ directory by mistake any more.

There are other tricks you can do, but they are somewhat inconvenient. They range from making ".git" a symlink to somewhere else (to stop "find" from following it), and in your case, since you apparently already have an "xgrep" alias for this, you could just teach your "find" thing to do something like what we do in the kernel Makefile:

	RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o
and then we use
	find . $(RCS_FIND_IGNORE) ...

which knows to ignore ".git" directories along with all the other SCCS/CVS/SVN/BK/etc directories.

		Linus
Previous: Linus TorvaldsNext: Uwe Kleine-König
Message 30 of 39 in “Error converting from 1.4.4.1 to 1.5.0?”
  1. Bill LearFeb 14, 2007
  2. Bill LearFeb 14, 2007
  3. Junio C HamanoFeb 14, 2007
  4. Bill LearFeb 14, 2007
  5. Junio C HamanoFeb 14, 2007
  6. Bill LearFeb 14, 2007
  7. Bill LearFeb 14, 2007
  8. Linus TorvaldsFeb 14, 2007
  9. Bill LearFeb 14, 2007
  10. Junio C HamanoFeb 14, 2007
  11. Junio C HamanoFeb 14, 2007
  12. Johannes SchindelinFeb 14, 2007
  13. Junio C HamanoFeb 14, 2007
  14. Johannes SchindelinFeb 14, 2007
  15. Jakub NarebskiFeb 15, 2007
  16. Olivier GalibertFeb 15, 2007
  17. Johannes SchindelinFeb 15, 2007
  18. Johannes SchindelinFeb 14, 2007
  19. Nicolas PitreFeb 14, 2007
  20. Bill LearFeb 14, 2007
  21. OT: data destruction classics (was: Re: Error converting from 1.4.4.1 to 1.5.0?)Simon 'corecode' Schubert, Feb 15, 2007
  22. Shawn O. PearceFeb 15, 2007
  23. Linus TorvaldsFeb 15, 2007
  24. Johannes SchindelinFeb 15, 2007
  25. Michael K. EdwardsFeb 15, 2007
  26. Bill LearFeb 15, 2007
  27. Andy ParkinsFeb 15, 2007
  28. Mark WoodingFeb 15, 2007
  29. Linus TorvaldsFeb 14, 2007
  30. Linus TorvaldsFeb 14, 2007
  31. Uwe Kleine-KönigFeb 15, 2007
  32. Junio C HamanoFeb 14, 2007
  33. Bill LearFeb 14, 2007
  34. Nicolas PitreFeb 14, 2007
  35. Junio C HamanoFeb 14, 2007
  36. Linus TorvaldsFeb 14, 2007
  37. Linus TorvaldsFeb 14, 2007
  38. Bill LearFeb 14, 2007
  39. Linus TorvaldsFeb 14, 2007

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.