16 ms·
Shit – An implementation of Git using POSIX shell
- kick 7y agoThis was done in the span of a few hours, and was committed to sr.ht using itself. Drew even livestreamed the whole thing, but I don't think he's uploaded it to a PeerTube instance yet.
- orf 7y agoWhere was it livestreamed?
- kwk1 7y agohttps://live.drewdevault.com/ https://live.drewdevault.com/
- kick 7y agoHe has a subdomain on his site that he uses for it: https://live.drewdevault.com/ https://live.drewdevault.com/
- danShumway 7y agoYou're not the right person to ask about this, but if Drew is around I would love to hear high-level details about what how this setup works and what the average monthly cost is. I can see that it's open source[0], and I'm very tempted to copy it. I'm already in the midst of migrating all of my video hosting to peertube, but I don't have a solution I'm confident in for livestreaming other than Twitch -- especially because when in the rare instances where I do stream coding sessions they can go up to 5 or 6 hours, at which point archiving and storing that video starts to look a lot more costly. [0]: https://git.sr.ht/~sircmpwn/live.drewdevault.com/tree https://git.sr.ht/~sircmpwn/live.drewdevault.com/tree
- ddevault 7y agoI don't use it very often. I just threw it up on a Linode with minimal effort so I could have a working live streaming setup. You'll note from the readme: >This is the website for my self-hosted livestreaming platform (aka bag of hacks dumped into a server). PeerTube is nice in theory but in practice it's been really really unreliable for me.
- alpb 7y agoWhy not simply stream to somewhere live Twitch/YouTube and have them serve the recording offline later on?
- ddevault 7y agoI try to avoid proprietary services.
- munificent 7y agoYou know, YouTube is pretty easy. I bet someone could implement it in an afternoon and a dozen lines of shell script...
- squarefoot 7y agoNever tried yet for hosting content, however I've read good things about Lbry. https://lbry.com/faq https://lbry.com/faq
- proc0 7y agoThat's already a lot given the expectations set by the name.
- chungy 7y agoImpressive! Though very lacking on any kind of instructional use. "init" is easy enough to figure out, but there's no "add" step. Shame :)
- ddevault 7y agoSorry, I wasn't expecting this to HN before I had written some porcelain commands. I pushed an updated README that explains how to write commits with this.
- mar77i 7y agohttps://wyag.thb.lt/ https://wyag.thb.lt/ If you want to hop the same train, I saw this long ago...
- downerending 7y agoAmusing, but less than the title suggests (no porcelain, no reliability properties, no error checking, etc). Still, fun stuff.
- jaytaylor 7y agoInteresting terminology, I'd never heard of porcelain in the context of git. In case there are others like me, this will save some clicking: https://stackoverflow.com/q/6976473/293064 https://stackoverflow.com/q/6976473/293064
- Izkata 7y agoAnd then there's random stuff like "git status --porcelain", an easily-parsed version of "git status"
- Sean1708 7y agoAm I reading that correctly? A porcelain command is one that's not supposed to be used in scripts, but the --porcelain flag is for when you do want to use things in scripts?
- IshKebab 7y agoWhy would you expect reliability and error checking in a shell implementation of git? It's clearly a mad bit of fun.
- downerending 7y agoI wouldn't necessarily expect it in a "mad bit of fun", and I'm implicitly noting that that's what this is. I completely require it in shell scripts in general. Good checking of errors is really a fundamental requirement of professional programming.
- ReverseCold 7y agoI initially thought it was "SourceHut gIT" not "SHell gIT" I don't mean any offense by that - sourcehut is fine - just what popped into my head.
- billconan 7y agoare there any other implementations in other languages? (preferably c++). I use libgit2, but the code is a bit difficult to read and hack. I know there is a ruby book implementing from scratch. I want to understand the git internals.
- kbumsik 7y agoLet's rewrite everything in JavaScript: https://github.com/isomorphic-git/isomorphic-git https://github.com/isomorphic-git/isomorphic-git
- K0SM0S 7y agoWhat a strange way to spell Rust: https://news.ycombinator.com/item?id=19540845 https://news.ycombinator.com/item?id=19540845 (to GP: lots of links related to reimplementing git in there)
- woodrowbarlow 7y ago"write yourself a git" is an online book that walks you through implementing git in python. https://wyag.thb.lt/ https://wyag.thb.lt/
- mroche 7y agoThe WYAG book many have referenced is pretty good. Haven’t gotten through it yet, but I’m looking to do a Go implementation. I also want create my own SCM if I have the brainpower for it to test some new workflow ideas.
- russellendicott 7y agoPlease do. The one package I've used was missing features like "commit all files" last time I used it a year ago. https://github.com/src-d/go-git https://github.com/src-d/go-git
- emmelaich 7y agoI know of two, one in pure Ocaml and one pure Go. https://github.com/mirage/ocaml-git https://github.com/mirage/ocaml-git https://github.com/src-d/go-git https://github.com/src-d/go-git
- Koshkin 7y agoIsn't this how Git was originally done?
- chrchr 7y agoYou might be thinking of a different DVCS called Arch, which was initially implemented as a set of shell scripts: https://en.wikipedia.org/wiki/GNU_arch https://en.wikipedia.org/wiki/GNU_arch
- cesarb 7y agoNo, git was originally done in C: https://git.kernel.org/pub/scm/git/git.git/commit/?id=e83c5163316f89bfbde7d9ab23ca2e25604af290 https://git.kernel.org/pub/scm/git/git.git/commit/?id=e83c51...
- raphlinus 7y agoIt's slightly more complicated than that. The `git` command line itself was done in shell. Initially, `git foo` just ran `git-foo-script`, and then those were also written in shell. But the actual sha1 and packfile stuff was always in C from the beginning. Source: https://git.kernel.org/pub/scm/git/git.git/commit/git?h=v0.99&id=e764b8e8b3c50b131be825532ba26fa346d6586e https://git.kernel.org/pub/scm/git/git.git/commit/git?h=v0.9...
- ac42 7y agoI wasn't aware of the plumbing / porcelain metaphor in git until now. It's fantastic to what lengths some of us go for a good pun :-)
- J5892 7y agoThis is great, but I already use "shit" as an alias for "fuck".
- etxm 7y agoI’m just here to support the four people that have a sense of humor on HN.
- J5892 7y agoTo be fair, humor (on its own) is often detrimental to HN discussions. At least as top level comments. But for a toy project like this, it seemed appropriate.
- gumby 7y agoYour home life must be quite unusual.
- sjwright 7y agoIf there's anything you don't want to confuse, it's your shit and your fuck. Keep them separate, people. Keep them separate.
- h2odragon 7y agoThe world is big enough for everyone's kinks; I'll keep mine off yours and you return the favor tx
- sjwright 7y agoYou can have whatever kinks you want, but you can't escape the germ theory of disease.
- deleted 7y ago[deleted]
- prutschman 7y ago
- ddevault 7y agoHiya HN. I was ranting on Mastodon earlier today because I feel like people learn git the wrong way - from the outside in, instead of the inside out. I reasoned that git internals are pretty simple and easy to understand, and that the supposedly obtuse interface makes a lot more sense when you approach it with an understanding of the fundamentals in hand. I said that the internals were so simple that you could implement a workable version of git using only shell scripts inside of an afternoon. So I wrapped up what I was working on and set out to prove it. Five hours later, it had turned into less of a simple explanation of "look how simple these primitives are, we can create them with only a dozen lines of shell scripting!" and more into "oh fuck, I didn't realize that the git index is a binary file format". Then it became a personal challenge to try and make it work anyway, despite POSIX shell scripts clearly being totally unsuitable for manipulating that kind of data. Anyway, this is awful, don't use it for anything, don't read the code, don't look at it, just don't.
- viraptor 7y ago> I feel like people learn git the wrong way Why do you think it's the wrong way? I sit somewhere in between and think that some people want to know the details and learning from inside is a good idea. But some other people want to simply be users and for the tool to get out of their way - and that's also good. So if the docs or the UX make either way hard or less effective, that's on the docs or the UX to improve.
- _bxg1 7y ago10/10 on wordplay
- steelframe 7y agoIt's cute, but it negatively impacts my ability to effectively advocate for the tool in my workplace.
- pmarreck 7y agoI feel like the name was conceived before the tool in this case. Also, hilarious.
- noypi3 7y agothat means i can put shit on my busybox.
- awkward 7y agoSo if this is the git internals, shit is what goes inside the porcelain plumbing?
- iamEAP 7y agoI once landed a job as a web developer in a marketing department where IT was gatekeeping production hard. Although all the code was in git (the real git), deployment involved a magical shell script someone in IT had written ages ago. Only after a bunch of rocky, outage-causing deployments did we have the sense to start digging into this magic script. It turned out it was just a bad, thousands of lines long re-implementation of git using perl and mysql that captured and stored diffs and rsync'd them to production. ...And this was well into the era of CI/CD and infrastructure automation tools. Eventually, the company brought in new IT leadership that put an end to that kind of nonsense, which freed us in marketing to buy purpose-built PaaS for our needs. Obviously do this kind of crazy stuff as you please on the side. But at work, build only what uniquely adds value to your company. For most, dev tools are probably pretty low on that list.
- angry_octet 7y agoI really disagree, a small amount of customisation of tools can reap significant productivity gains. I think your anecdote is really just an example of bad management, not bad tooling. Could easily be that some management doofus had prohibited git from being installed on the 'production' system.
- peterwwillis 7y agoI think the problem is the idea of 'tooling'. A table saw by itself is mostly useless. With a fence and a miter gauge, it becomes useful. With a push block, stop block, subfence, outfeed table, infeed table, featherboard, crosscut sled, tenon jig, and dado set, it is the single most useful tool in a woodshop. Keep in mind it is still one tool and all those accessories are not "tooling", they are accessories to a single tool that increase what you can do with it. The tool always works the same way, and anyone can use it with any of those accessories in any woodshop in the world. In effect it becomes a new, larger solution, made up of many features that extend the utility of the tool. That's not really what we have. Mostly what we have are jigs. A jig isn't an outfeed table or a crosscut sled. It's a hack for a particular job. If you need to make one specific cut 300 times, you nail together some scrap wood, dial in the miter gauge, angle the saw blade, and make your cuts. And the jig is scrap once again. But in the heady new world of "DevOps engineering", the jig is now "tooling", and we pat ourselves on the back that we were able to nail some scrap wood together and claim it created business value. Of course, it's not a shitty jig like in the bad old days of shell scripts ("ha ha! remember when we were productive with this simple code that was portable and not gigantic or complicated? how foolish!"), because instead of making it out of scrap wood, we now make it out of scrap steel with a MIG welder. We're advanced now. And I'll go further. The fact that most woodworkers make their own tablesaw extensions is illustrative of the problem: craftspeople like having fun with their toys. Is there value and experience and dollar savings you get out of making your own crosscut sled? Sure! But it'll also take you 1-2 days of buying parts, measuring, cutting, gluing, clamping, drying, aligning, and finishing. Any business with any sense should have paid $100 to just buy a complete crosscut sled made of aluminum with a good design that will last forever. But they are too dumb to notice they're spending an inordinate amount of time and money on craftspeople making jigs. I wish the ghost of W. Edwards Deming would rise from the grave and call us what we are: bullshit artists.
- quotemstr 7y agoI don't think anybody should be targeting plain POSIX shell anymore. There are much richer shells available almost everywhere.
- m0zg 7y agoUnfortunately "rt" TLD is not a thing. Otherwise it'd be worthwhile to register sh.rt as an alternate domain for sr.ht.
- m3kw9 7y agoTry and market this shit
- megavolcano 7y agowasn't the original version of git mostly entirely shell scripts?
- srathi 7y agoThis is essentially adding a blob inside .git/objects by taking a sha1 hash of the data after appending a header "blog <length>\00<data>". Then the first two characters of the hash are created as a directory and the remaining 38 acts as the file name inside which the zlib compressed data is stored. Nice project for learning the git internals.
- harry8 7y ago"Shellgrit" which I've heard used to recover from starting to say "shit" in circumstances where that isn't appropriate. Better name and contraction of "shell git" ? Or maybe this is not something in common usage. Dunno.
- deleted 7y ago[deleted]
- bigyanshr 7y agoWhat's wrong with people nowadays? Couldn't they come with a better name ?
- pushpop 7y agoI think the name is genius (baring in mind it is a personal project and not intended for production use).
- cannam 7y agoGit is already an insulting term where I come from - I remember one of our children, years ago when they were young, looking at my screen and saying "why are you typing git ??" in a shocked sort of tone. They're much less concerned about their language now. I don't mean to overstate the case - it's not a swearword or the sort of thing you'd really censor, just a playground term for a mean person. All the same it's an ugly word and (however irrationally) this is one of the reasons I prefer Mercurial to this day.
- krallja 7y agoMercurial is also an insult. Both projects were started in response to a mercurial git’s actions.
- bigyanshr 7y agoI don't care about the negative/down votes, but this is literally shit. Imagine the communication: * Here in our project we use shit, and it's very good. * do "shit pull" / "shit pop" * Sorry, I don't have shit in my machine. But, again, english is a funny language.
- singingfish 7y agoThere are two hard problems in computer science: 1. Cache invalidation. 2. Naming things 3. Off by one errors. This person has #2 nailed down, hard.
- daniel-dev 7y agoi like the name so that's why i read it
- deleted 7y ago[deleted]
- mkirch 7y agoIt seems that the logical next step after the birth of this monstrosity would be to create the next best platform: ShitHub
- rrrrreee 7y agoits shit