git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nico@cam.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Kastrup <dak@gnu.org>, git@vger.kernel.org
Subject: Re: [PATCH] Make "git reset" a builtin. (incomplete)
Date: Wed, 22 Aug 2007 21:15:24 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.0.999.0708222033040.16727@xanadu.home> (raw)
In-Reply-To: <alpine.LFD.0.999.0708221149440.30176@woody.linux-foundation.org>


[ I'm branching off from here and not from later posts on purpose ... ]

On Wed, 22 Aug 2007, Linus Torvalds wrote:

> "git reset" is a command, not a scripting language. We can still script 
> git as much as we want, but the fewer dependencies we have on anything 
> external, the better off we are.
> 
> I don't understand why people consider scripting languages (whether shell, 
> perl, or anything else) "better" than C if there is an alternative. Once 
> the C work has been done (and if you require C _anyway_ for other reasons, 
> like git does), doing it in C is simply superior.

Absolutely no argument with that.  Considering that "git reset" is a 
command, the language used to implement it is just that: an 
_implementation_ "detail".  Especially if the C conversion has already 
been done.

> 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'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?

> I also dispute your "easy to do". Quite often, shell (or any scripting 
> language) is actually much *more* complicated than C. Yes, the C code may 
> be more lines (in this case, the shell script is 106 lines, and the C code 
> was 216 lines), but from a maintenance standpoint, C has had *much* fewer 
> problems than the shell script stuff has ever had!

Let's not talk strictly about this very case.  Like we agreed above, the 
C conversion has been done so there is no downside really not to move on 
with the C version.  Same for other core commands if/when they get 
converted.

That would still be nice, though, if we could have a unified scripting 
language for Git, that didn't have any nasty external dependency either.  
If only so Git could be self sufficient on any platform it is ported to 
for its test suite, and also for extra functionality that users would 
end up sharing across the whole user base and not only on platform where 
bash comes installed by default.

And there might be some cases where using that same scripting language 
for permanently implementing actual command could simply make sense once 
it can be safely depended upon.

> So scripting languages are often good for *prototyping*, and a lot of 
> people like scripting languages for that reason. But once something is 
> already prototyped, and if somebody then rewrites it in C, all the 
> advantages of a scripting language have already disappeared!
> 
> So yes, we could just make the shell/etc from busybox _be_ the scripting 
> language, but the fact is, that is *more* C code than just making the 
> commands C code in the first place, and while a lot of the effort is 
> already done for us, "busybox under windows" is actually likely to be more 
> of a maintenance problem than "native git commands under windows" are.

Possibly.  Again that depends how much we need from it.  We don't need 
_that_ much from a shell and the bad portability issues can certainly be 
avoided altogether simply by ripping out problematic functionality.  
Such shell doesn't even have to be POSIX compliant or whatever.

> So if we have the choice, and somebody has written a git command in native 
> C code, I think we should *always* take it. Just because it means that 
> _eventually_ we can drop shell entirely, even if it would be a git 
> internal busybox shell.

It could be taken the other way around too: If we have the choice, and 
somebody has ported a subset of busybox to Windows tailored for Git 
plumbing usage, then we _could_ stop worrying so much about shell 
portability right there and redirect our efforts toward other things.


Nicolas

  parent reply	other threads:[~2007-08-23  1:15 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-22 12:48 [PATCH] Make "git reset" a builtin. (incomplete) Carlos Rica
2007-08-22 13:00 ` David Kastrup
2007-08-22 13:37   ` Andreas Ericsson
2007-08-22 14:29     ` David Kastrup
2007-08-22 14:49       ` Mike Hommey
2007-08-22 15:02         ` Chris Shoemaker
2007-08-22 15:41           ` David Kastrup
2007-08-22 16:07       ` Nicolas Pitre
2007-08-22 16:51         ` Johannes Schindelin
2007-08-22 17:17           ` David Kastrup
2007-08-22 19:05             ` Linus Torvalds
2007-08-22 19:36               ` David Kastrup
2007-08-22 19:58                 ` Linus Torvalds
2007-08-22 22:25                   ` David Kastrup
2007-08-22 23:10                     ` Linus Torvalds
2007-08-22 23:39                       ` David Kastrup
2007-08-23  1:30                         ` Linus Torvalds
2007-08-23  0:24                     ` Wincent Colaiuta
2007-08-23  1:15               ` Nicolas Pitre [this message]
2007-08-23  1:40                 ` Jon Smirl
2007-08-23  3:23                 ` Linus Torvalds
2007-08-23  4:21                   ` Junio C Hamano
2007-08-23  9:15                   ` Johannes Schindelin
2007-08-22 21:34             ` Reece Dunn
2007-08-23  9:10               ` Johannes Schindelin
2007-08-23 10:20                 ` Theodore Tso
2007-08-23 10:31                   ` Johannes Schindelin
2007-08-23 10:55                   ` David Tweed
2007-08-23 11:24                     ` Theodore Tso
2007-08-23 11:35                       ` Johannes Schindelin
2007-08-23 16:30                       ` Jon Smirl
2007-08-23 11:25                     ` Reece Dunn
2007-08-23 20:26             ` Alex Riesen
2007-08-23 21:14               ` David Kastrup
2007-08-23 21:33                 ` Alex Riesen
2007-08-23 22:05                   ` David Kastrup
2007-08-22 17:21           ` Nicolas Pitre
2007-08-23  9:55             ` Johannes Schindelin
2007-08-23 15:19               ` Nicolas Pitre
2007-08-22 21:19           ` Reece Dunn
2007-08-23  9:05             ` Johannes Schindelin
2007-08-23 18:40             ` Robin Rosenberg
2007-08-23  2:05       ` Nguyen Thai Ngoc Duy
2007-08-22 13:42   ` Matthieu Moy
2007-08-22 22:28     ` David Kastrup
2007-08-22 14:27   ` Andy Parkins
2007-08-22 14:57 ` Johannes Sixt
2007-08-22 16:20 ` Alex Riesen
2007-08-23 11:14 ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.0.999.0708222033040.16727@xanadu.home \
    --to=nico@cam.org \
    --cc=dak@gnu.org \
    --cc=git@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).