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

Re: [PATCH] Make "git reset" a builtin. (incomplete)

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Aug 23, 2007, 03:23 UTC
Message-ID
<alpine.LFD.0.999.0708222006110.30176@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.0.999.0708222033040.16727@xanadu.home>
On Wed, 22 Aug 2007, Nicolas Pitre wrote:
Show 9 quoted lines
> 
> > We ended up writing our own versions (or merging other peoples code) for 
> > things like appying patches, generating diffs, three-way merging etc, 
> > because not having external dependencies is *so* much more maintainable 
> > and portable that it's not even funny.
> 
> Indeed. And this is the very same reason why Git should _also_ acquire a 
> script interpreter of its own if we want to continue bragging about 
> Git's easy scriptability.

I suspect that most people who want scriptability want it within the confines of whatever environment they run in.

For example, I swear by git's scriptability, but I do so not because I think it would be a good idea to script _within_ git using some magic language, but because I think we made good design decisions that makes it easy to integrate git with the kinds of scripts I write every day.

But the kinds of scriping *I* do has nothing to do with the kinds of scripting other people necessarily do. I use shell pipelines, and quite frankly, any "internal" scripting inside of git is totally uninteresting to me, exactly because I'm used to the generic UNIX tools, and I find it damn interesting to do things like

	git log -p --since=6.months | cut -c1 | sort | uniq -c

and use that as a really cheesy way to see how many lines have gotten added/removed in the patches in the last 6 months.

(Yeah, I get some other characters than just "+/-" too, I don't care, the part I care about is:

	 749754 -
	  96945 @
	1030104 +

ie about a hundred thousand hunks, with an average of 7.5 lines deleted per hunk, and 10 lines added)

See? Sure, some kind of internal git scripting language could do things like this too, but that defeats the point: it's that git is useful *within* a UNIX scripting environment, not that it makes its own.

There are enough scripting languages out there. It's wonderful if git can be used with then, rather than having to make up another language that you have to learn.

And yes, I agree with people who say that LUA is probably the best choice if people really want a scripting language, but would I actually use LUA for something like the above? No. I think that people who look for scriptability usually prefer the kind of scriptability that git already has, namely that it fits into their *existing* setup.

> > I'd love for every single shell-script in git core to be written in C, so 
> > that we can drop the dependency on shell *entirely*.
> 
> What about the test suite?

The test suite is indeed special. But I think that's a "build requiement", and if we require something like shell for *building*, that's different from requiring normal users to have it.

If somebody wants to re-code the test-suite in some other scripting engine, that would be fine by me. I'd hope you can automate it, though: that is a *lot* of lines of shell.

			Linus
Previous: Jon SmirlNext: Junio C Hamano
Message 21 of 49 in “Make "git reset" a builtin. (incomplete)”
  1. Make "git reset" a builtin. (incomplete)Carlos Rica, Aug 22, 2007
  2. David KastrupAug 22, 2007
  3. Andreas EricssonAug 22, 2007
  4. David KastrupAug 22, 2007
  5. Mike HommeyAug 22, 2007
  6. Chris ShoemakerAug 22, 2007
  7. David KastrupAug 22, 2007
  8. Nicolas PitreAug 22, 2007
  9. Johannes SchindelinAug 22, 2007
  10. David KastrupAug 22, 2007
  11. Linus TorvaldsAug 22, 2007
  12. David KastrupAug 22, 2007
  13. Linus TorvaldsAug 22, 2007
  14. David KastrupAug 22, 2007
  15. Linus TorvaldsAug 22, 2007
  16. David KastrupAug 22, 2007
  17. Linus TorvaldsAug 23, 2007
  18. Wincent ColaiutaAug 23, 2007
  19. Nicolas PitreAug 23, 2007
  20. Jon SmirlAug 23, 2007
  21. Linus TorvaldsAug 23, 2007
  22. Junio C HamanoAug 23, 2007
  23. Johannes SchindelinAug 23, 2007
  24. Reece DunnAug 22, 2007
  25. Johannes SchindelinAug 23, 2007
  26. Theodore TsoAug 23, 2007
  27. Johannes SchindelinAug 23, 2007
  28. David TweedAug 23, 2007
  29. Theodore TsoAug 23, 2007
  30. Johannes SchindelinAug 23, 2007
  31. Jon SmirlAug 23, 2007
  32. Reece DunnAug 23, 2007
  33. Alex RiesenAug 23, 2007
  34. David KastrupAug 23, 2007
  35. Alex RiesenAug 23, 2007
  36. David KastrupAug 23, 2007
  37. Nicolas PitreAug 22, 2007
  38. Johannes SchindelinAug 23, 2007
  39. Nicolas PitreAug 23, 2007
  40. Reece DunnAug 22, 2007
  41. Johannes SchindelinAug 23, 2007
  42. Robin RosenbergAug 23, 2007
  43. Nguyen Thai Ngoc DuyAug 23, 2007
  44. Matthieu MoyAug 22, 2007
  45. David KastrupAug 22, 2007
  46. Andy ParkinsAug 22, 2007
  47. Johannes SixtAug 22, 2007
  48. Alex RiesenAug 22, 2007
  49. Johannes SchindelinAug 23, 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.