by teknopaul · 3y ago · 0 comments
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)
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.
https://git.kernel.org/pub/scm/git/git.git/commit/git?id=e76...
here is "git status", with all its formatting glory: 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.
it's literally longer than reading the Go spec and even after reading it several times i still can't code bash