Back to News
Advertisement
Advertisement

⚡ Community Insights

Discussion Sentiment

80% Positive

Analyzed from 441 words in the discussion.

Trending Topics

#git#pathspec#options#rev#cases#long#something#poorly#cmd#revspec

Discussion (17 Comments)Read Original on HackerNews

metadatabout 1 hour ago
Does anyone know why git broke the long standing convention of "--" early on? Kind of a nightmare for humans to use.

Remembering app-specific one-offs is kind of the worst!

doctobogganabout 1 hour ago
git's data model is incredibly powerful and flexible, but its UX is famously... interesting:

https://stevelosh.com/blog/2013/04/git-koans/

epistasis34 minutes ago
Since it separates out the pathspec, doesn't that match the long standing convention?
p-e-wabout 1 hour ago
When something appears to be poorly designed, then the deeper explanation is often that it’s indeed poorly designed.
js24 minutes ago
[delayed]
epistasis37 minutes ago
Perhaps I'm missing something (it's been a long day), but couldn't "--" be used for both?

    git cmd --options -- rev -- pathspec
would be the fully specified revspec and pathspec

    git cmd --option -- rev --
would be just the revspec, excluding accidental options, without a pathspec

    git cmd --option revspec -- pathspec
and the single "--" would work as it currently does.
gene915 minutes ago
Currently, git log -- a -- prints all commits that affects the files whose name is a or two dashes.
yobertabout 1 hour ago
So I should name my next branch ‘--‘ is what I'm hearing :)
Chinjut10 minutes ago
The "Everything is text, do everything via text" philosophy has its advantages, and also its disadvantages.
bradley1342 minutes ago
As with almost any successful system: more and more special features and edge cases get added. Git has become ridiculously complex.

I wonder: would it not be better to tell users with those edge cases to fix their problems some other way? To take an example from the article: why does someone have a filename beginning with a dash? Maybe don't do that.

zanecodes29 minutes ago
Sometimes you're using git in a context where you don't control the filenames, or where a potential attacker could influence or fully control them, at which point edge cases like this can easily turn into exploits.

I also chafe whenever I run into artificial restrictions on things like characters in names of things, because there's no good reason for them besides the laziness of developers or the limitations and inertia of existing systems that might be used under the hood, like DNS for instance.

_blkabout 1 hour ago
> git log --end-of-options "$rev" -- "$path",

Argh, that's when I wished for object oriented shells. Powershell sure isn't perfect but objects encoding their own meaning really helps differentiate those cases (but it may not always help the user if types aren't clear to the reader)

eruabout 1 hour ago
I don't think you need object orientation for that. Haskell and Rust solve these problems also just fine, without any OOP in sight.
_blk22 minutes ago
Hmm, not sure I understand. How are those shell based?

I agree that rust and haskell are not your typical OO (or not OO at all in a traditional sense) I guess my poorly worded claim was less focused on the OO nature of psh than on the typization (which both of these also do) - if you knew what type $rev and $path are, it's easier to distinguish intent, whether objects or not.

ButlerianJihadabout 1 hour ago
https://m.xkcd.com/1597/

By the way, something munched the article title. An emdash is incorrect command-line usage. It’s supposed to be a double hyphen.

wafflemaker40 minutes ago
From the title I've learned that git uses an em-dash instead of double dash as options delimiter. Thanks for pointing out that the title was wrong -- I've never had a need to use -- with git, so didn't know that it doesn't work.
ButlerianJihad25 minutes ago
I'm sorry, you've learned what now?