Live data from Hacker News

Git git git git git

caiustheory.com

141–150 of 244 posts

Re: Git git git git git

#141
post #82

Earlier quoted context omitted.

In the context of software it seems like the word has pretty broadly adopted the meaning of "side-effect free". It's even made it to Wikipedia: https://en.wikipedia.org/wiki/Idempotence#Computer_science_m... One notable example: Stripe's "idempotency keys": https://stripe.com/blog/idempotency

I understand 'idempotent' not as 'having no side effects' but as 'having the same side effects whether performed one or many times'. This is side-effect free: echo hello This is side-effectful, but idempotent: echo hello >world This is side-effectful and not idempotent: echo hello >>world

Mathematical idempotency depends heavily on the function's domain. It's not too challenging to construct a non-idempotent function that has an idempotent restriction. So depending on what your domain of interest some operations may be idempotent or not.

In the hello world example, I guess we are considering 'echo' as the function. If then if we consider stdout and echo's args to be the same, echo will be idempotent.

However, stdout and command args are pretty different things on any system I know. If we care about things like command line history, then clearly 'echo hello world' is not idempotent.

Re: Git git git git git

#142

The danger of this is if you accidentally write 'git git something' into a shell script and it works on your machine, then you commit the script to a repo and it doesn't work for anyone else. I suppose this is a problem with any alias.

One way around that issue is to prefix commands you intend to share with backslash:

    $ \gstatus
    gstatus: command not found
vs

    $ gstatus
    git status stuff
The backslash just disables alias expansion. This works on all shells I'm aware of. It won't help with other portability concerns like actual missing commands though, of course.

Re: Git git git git git

#145
post #63

Earlier quoted context omitted.

Not this, but I do fairly often think assume I'm in vim when I'm not. `alias :q="echo NOT IN VIM!!!"`

My favorite one of these is typing ctrl-w (cut in emacs) in a browser tab as I am editing a bunch of text in a text box.

Well, cutting is called killing in Emacs...

Re: Git git git git git

#146
post #124

Earlier quoted context omitted.

iTerm gives you a warning if it thinks you just pasted in something malicious

I think it gives warning when you paste something ends with a `\n`.

I think my zsh does something to detect copy paste (and not execute the command till I press enter), or it could be iTerm, no idea.

Re: Git git git git git

#147
post #63

>I quite often type git then go away and come back, then type a full git status after it. Does anyone else actually do this besides OP. I've never heard of this problem until now.

Not this, but I do fairly often think assume I'm in vim when I'm not. `alias :q="echo NOT IN VIM!!!"`

I really do that a lot so I aliased 'q' to exit in shell.

Re: Git git git git git

#148

>I quite often type git then go away and come back, then type a full git status after it. Does anyone else actually do this besides OP. I've never heard of this problem until now.

The one I do is `git clone ` then paste in the repository URL from bitbucket, and end up with `git clone git clone https://....` I don't think that can be solved here though.

CTRL-u CTRL-v

Re: Git git git git git

#149

>I quite often type git then go away and come back, then type a full git status after it. Does anyone else actually do this besides OP. I've never heard of this problem until now.

I do. And I also write "vim vim thefile.txt" and stuff like that. Finally I've written a small shell function that corrects "gi tpull" to "git pull", because that happens at least once a day.

I just alias 'pull' to git pull, it's much nicer. Also 'push' and a few of the other most common ones.

Re: Git git git git git

#150
post #63

Earlier quoted context omitted.

Not this, but I do fairly often think assume I'm in vim when I'm not. `alias :q="echo NOT IN VIM!!!"`

My favorite one of these is typing ctrl-w (cut in emacs) in a browser tab as I am editing a bunch of text in a text box.

Heh, for me ctrl-w means "extend selection to enclosing expression", which leads to the same issue in browsers.
Post reply on HN