4 ms·
This is so true. Torvalds wrote git in shell. You can do great things. Provided... a) agreed, RTFM, (man bash is not long) b) you dont try to do things shell
by teknopaul 4y ago
This is so true.
Torvalds wrote git in shell.
You can do great things.
Provided...
a) agreed, RTFM, (man bash is not long)
b) you dont try to do things shells shouldn't do.
c) for things you shouldn't do, you write a clean stable cli interface in some other language.
Often you can do c) in bash temporarily and port only if/when it gets complicated.
(That's what git did)
- masklinn 4y ago> Torvalds wrote git in shell. Did he? Because that’s definitely not what the initial revision of git that’s in the repo shows. It has 1kloc of C, a readme, and a makefile. I struggle to think how you’d even get to the wonky tree format if you used the shell as your implementation language. The first shell scripts landed a few weeks later, in 839a7a06f35bf8cd563a41d6db97f453ab108129 and were convenience wrappers to facilitate interacting with contributors (a wrapper around `merge` to merge a single file, a trivial wrapper around `fsck-cache` to prune, and finally a somewhat more involved original `git pull` which used `rsync` to retrieve all of the remote’s object store then would merge its HEAD with yours). The next two scripts were literally called “example scripts” in their commit messages, and respectively for creating a signed tag and applying a patch.
- rbonvall 4y agoIf I remember correctly, git was originally distributed as several small programs like git-checkout, git-reset, etc., some written in C and others in shell.
- rascul 4y agoThe first commit of the git command that I found was a shell script. It called other scripts which used the C stuff behind the scenes. https://git.kernel.org/pub/scm/git/git.git/commit/git?id=e764b8e8b3c50b131be825532ba26fa346d6586e https://git.kernel.org/pub/scm/git/git.git/commit/git?id=e76...
- masklinn 4y agoThat’s not “git was originally written in shell” by any honest interpretation of the term.
- theamk 4y agohere is "git commit" in shell: https://git.kernel.org/pub/scm/git/git.git/tree/git-commit-script?id=e764b8e8b3c50b131be825532ba26fa346d6586e https://git.kernel.org/pub/scm/git/git.git/tree/git-commit-s... here is "git status", with all its formatting glory: https://git.kernel.org/pub/scm/git/git.git/tree/git-status-script?id=e764b8e8b3c50b131be825532ba26fa346d6586e https://git.kernel.org/pub/scm/git/git.git/tree/git-status-s... but yes, I would not call it "git was written in shell". But some of its significant pieces were.
- rascul 4y agoIt's pretty much the only interpretation I can come up with that results in git being written in shell. I do think it's a bit of a stretch though.
- tylersmith 4y agoAnd in only 3 lines of code!
- H4ZB7 4y ago> man bash is not long it's literally longer than reading the Go spec and even after reading it several times i still can't code bash