this post was submitted on 20 Feb 2024
212 points (97.7% liked)

Programmer Humor

32710 readers
674 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
all 24 comments
sorted by: hot top controversial new old
[–] NegativeLookBehind 91 points 10 months ago* (last edited 10 months ago) (5 children)
[–] gibzag 47 points 10 months ago (2 children)
[–] [email protected] 19 points 10 months ago
[–] [email protected] 10 points 10 months ago
[–] [email protected] 21 points 10 months ago
[–] ignotum 9 points 10 months ago

shit fetch --all

[–] victorz 9 points 10 months ago

shit restore

[–] [email protected] 2 points 10 months ago (1 children)
[–] NegativeLookBehind 3 points 10 months ago
[–] [email protected] 88 points 10 months ago* (last edited 10 months ago)

How to use

  1. Don't

Lol

[–] [email protected] 21 points 10 months ago

shit cherry-pick

[–] [email protected] 21 points 10 months ago (1 children)

Most advanced Linux developer's naming skill on full display

[–] random9 1 points 10 months ago

Too many vowels, real commandline utilities get shortened to 3, ideally 2 letters. Why use more when not all 2 letter combinations have yet been exhausted? Literally unusable, smh.

[–] JustUseMint 4 points 10 months ago (1 children)

Someone explain why git in a posix shell is awful pls I don't get it

[–] FooBarrington 14 points 10 months ago (1 children)

It's not necessarily awful by itself (though this is not a production-ready implementation). shit is the name of the project, Shell Git.

[–] JustUseMint 10 points 10 months ago (1 children)

My comment was not in reference to the name.

" Why the fuck would you use this

Status

Enough plumbing commands are written to make this write the initial commit with itself, which is how the initial commit was written. Huzzah.

How to use

Don't" 

While humorous, I'm asking why you wouldn't want to. What makes it so ridiculous so I can find it funny

[–] [email protected] 8 points 10 months ago* (last edited 10 months ago) (1 children)

Bash scripts are rarely the best choice for large, complicated, programs or for software that requires complex data structures. (Git is very much in both categories)

In bash there are so many ways to accidentally shoot yourself in the foot that it's absurd. That can lead to bizarre seeming behavior, which may break your script, or even lead to a security vulnerability.

There are things that make it a bit more manageable, like "[[]]" instead of "[]", but a frustrating number of such things are bash specific and this is written for the subset that is POSIX shell, meaning you don't even get those token niceties.

Where you generally "want" to use POSIX sh is for relatively simple scripts where the same file needs to run on Linux with bash, Linux with only BusyBox sh, OSX with zfs (and an outdated version of bash which will never be updated because Apple refuses to ship any GPLv3 software in MacOS).

This is not that, and so one would expect that:

  1. The developer of this git implementation has poor / foolish judgement.

  2. Shit will be buggy

  3. Shit will be insecure

  4. Shit will be a PITA to try to troubleshoot or fix

  5. And shit will be slow, because bash is slow and this isn't a job that you can just hand off all of the heavy lifting to grep / sed / awk*, because the data structures don't lend themselves to that.

* You could write the entire program in awk, and maybe even end up with something almost as fast as a python implementation done in ⅒ the time, but that would be terrible in other ways.

[–] [email protected] 6 points 10 months ago (1 children)
[–] [email protected] 3 points 10 months ago

I should have guessed.

Thank you 🤣

[–] [email protected] 3 points 10 months ago

The blame command becomes of uttermost importance

[–] [email protected] 1 points 10 months ago

Waiting for shell darcs, sharcs

[–] [email protected] -1 points 10 months ago (1 children)

Is this on HN? If not, someone neeeeds to post it!!!!!!