Live data from Hacker News

Git git git git git

caiustheory.com

101–110 of 244 posts

Re: Git git git git git

#101
post #85

Earlier quoted context omitted.

Interestingly, in this case the non-idempotent option is less safe.

Non-idempotent options are always unsafe; safe operations are a subset of idempotent operations. (I suspect you meant “safe” in a different sense, but I couldn't resist.)

> safe operations are a subset of idempotent operations

Definitely not. 'Safe' means too many things in different contexts to make sweeping statements like that.

Here's one i came across recently. You are interacting with a stock exchange. You have sent an order to buy 100 shares of Twitter stock at some price, and it is now resting on the order book, waiting for orders to sell at that price. You see that the character limit on tweets is being increased, and decide that you don't want to buy 100 shares, but only 90, so you send a message to modify your order. At the same time, two other people, who have also seen the news, decide to dump their holdings of 90 shares each by sending sell orders at the price you are bidding. Their messages arrive just before and after yours. What happens?

If the message to reduce your order is a nasty non-idempotent one which says "reduce my order by 10", then:

1. First seller's order to sell 90 matches your order to buy 100; you buy 90, and your order is reduced to one to buy 10

2. Your modify message reduces your order of 10 to 0

3. Second seller's order to sell 90 arrives, but has nothing to match with

You have successfully bought 90 shares, well done.

If the message to reduce your order is a nice safe idempotent one which says "change my order to 90", then:

1. First seller's order to sell 90 matches your order to buy 100; you buy 90, and your order is reduced to one to buy 10

2. Your modify message increases your order of 10 to 90

3. Second seller's order to sell 90 matches your order to buy 90; you buy 90, and your order is reduced to 0

You have bought 180 shares. Oh dear.

This is not hypothetical. More than one new exchange has launched with a protocol where orders are modified to a target amount, rather than by a target delta, and changed it some time later, after their users got themselves in a pickle.

You can do a bit better by making the modify message a compare-and-set, so it only changes the quantity to 90 if it is currently 100. In that situation, the modify will fail, and the second order will sell you 10 shares. That's still not as good as the non-idempotent message.

> (I suspect you meant “safe” in a different sense, but I couldn't resist.)

The moral of this story is that computer scientists should not be allowed to use the word "safe"!

Re: Git git git git git

#103
Well... If you have this problem (I really don't), then you probably have it with more than just git, and the proposed workaround would be "a local solution to a global problem".

Re: Git git git git git

#104
While the cleverness is admirable, there comes a point in your life when you realize you really do always want your own errors to fail loudly and immediately.

Re: Git git git git git

#105

While the cleverness is admirable, there comes a point in your life when you realize you really do always want your own errors to fail loudly and immediately.

That is true given automatic error correction can backfire, I don't see how git git -> git autocorrect can backfire.

Re: Git git git git git

#106

While the cleverness is admirable, there comes a point in your life when you realize you really do always want your own errors to fail loudly and immediately.

That is true given automatic error correction can backfire, I don't see how git git -> git autocorrect can backfire.

The backfires you can see ahead of time are never the problem, are they? :)

Re: Git git git git git

#107
post #101

Earlier quoted context omitted.

Non-idempotent options are always unsafe; safe operations are a subset of idempotent operations. (I suspect you meant “safe” in a different sense, but I couldn't resist.)

> safe operations are a subset of idempotent operations Definitely not. 'Safe' means too many things in different contexts to make sweeping statements like that. Here's one i came across recently. You are interacting with a stock exchange. You have sent an order to buy 100 shares of Twitter stock at some price, and it is now resting on the order book, waiting for orders to sell at that price. You see that the charact…

> > safe operations are a subset of idempotent operations

> Definitely not. 'Safe' means too many things in different contexts to make sweeping statements like that.

The intended reference (which I hoped would be recognized generally in this audience) was to he definition of “safe” and “idempotent” in HTTP (see section 4.2 of RFC 7231.)

(In your example, neither operation is “safe” in the HTTP sense; all state-modifying operations are unsafe.)

Re: Git git git git git

#108

Earlier quoted context omitted.

I always typed rebnoot, so I patched Netbsd to allow rebnoot. Then I patched it still so it would say, "Rebnooting". Fun times.

Can't tell if serious...

It’s probably just a shell script or an alias

Re: Git git git git git

#109
I never had the problem mentioned in the article, but for misspelled commands I trust git autocorrect:

git config --global help.autocorrect 1

It will run the correct misspelled command after 100ms. For example git stauts will be corrected automatically to git status http://schacon.github.io/git/git-config.html

Re: Git git git git git

#110

Why type out `git status`? I use `gst`, and lots of other great aliases provided by the [oh-my-zsh git plugin]( https://github.com/robbyrussell/oh-my-zsh/blob/master/plugin... )

For me, it's because `gst` will only work on my machine. I like feeling at home on any system, so I'm loathe to depend heavily on aliases and configuration. One of the things I like about git git is that it appears to improve my experience without significantly affecting my habits.
Post reply on HN