Live data from Hacker News

The shortest pull request ever

github.com

11–20 of 55 posts

Re: The shortest pull request ever

#11
post #5

Earlier quoted context omitted.

Depends on whether you consider `git commit --allow-empty` a weird quirk ... I guess it would be reasonable to do so ;).

What's the purpose of this? I can think of ways to use/abuse it, but there has to be a specific reason that it was added as a feature to git.

git commit --allow-empty -m "trigger CI job"

Re: The shortest pull request ever

#12
post #5

Earlier quoted context omitted.

Depends on whether you consider `git commit --allow-empty` a weird quirk ... I guess it would be reasonable to do so ;).

What's the purpose of this? I can think of ways to use/abuse it, but there has to be a specific reason that it was added as a feature to git.

I use it to trigger CI/CD. And for example, when upgrading Heroku's dyno stack, when is applied on next deployment.

    heroku stack:set heroku-22
    git commit -m 'upgrade to heroku-22 stack' --allow-empty
    git push heroku master

Re: The shortest pull request ever

#13

Earlier quoted context omitted.

What's the purpose of this? I can think of ways to use/abuse it, but there has to be a specific reason that it was added as a feature to git.

git commit --allow-empty -m "trigger CI job"

Nice. I used to just add a BOM at the beginning of a random line to accomplish that.

Re: The shortest pull request ever

#14
My high school english classes would upload any papers students wrote to a site that would check for plagiarism. I figured out that if I inserted random zero-width no-break spaces in the middle of words my plagiarism score would drop to zero.

Presumably the plagiarism system was just looking for exact matches of long substrings.

Re: The shortest pull request ever

#15
post #5

Earlier quoted context omitted.

Depends on whether you consider `git commit --allow-empty` a weird quirk ... I guess it would be reasonable to do so ;).

What's the purpose of this? I can think of ways to use/abuse it, but there has to be a specific reason that it was added as a feature to git.

Maybe so you can make an empty initial commit and push it to a remote like Github as a placeholder? Or a lazy way to trigger a CI job when you're gonna squash and cleanup later.

I guess conceptually you could use it to represent "I started from nothing."

Re: The shortest pull request ever

#16

My high school english classes would upload any papers students wrote to a site that would check for plagiarism. I figured out that if I inserted random zero-width no-break spaces in the middle of words my plagiarism score would drop to zero. Presumably the plagiarism system was just looking for exact matches of long substrings.

Interesting. You could presumably also swap out characters for homoglyphs at random.

Re: The shortest pull request ever

#17

My high school english classes would upload any papers students wrote to a site that would check for plagiarism. I figured out that if I inserted random zero-width no-break spaces in the middle of words my plagiarism score would drop to zero. Presumably the plagiarism system was just looking for exact matches of long substrings.

Wow, this is pretty nifty and I would, nor would the program authors thing of that use case :D

Re: The shortest pull request ever

#18
post #5

Earlier quoted context omitted.

Depends on whether you consider `git commit --allow-empty` a weird quirk ... I guess it would be reasonable to do so ;).

What's the purpose of this? I can think of ways to use/abuse it, but there has to be a specific reason that it was added as a feature to git.

I've found it useful when interactively rebasing a series of commits to make a nice PR. The code moved to a different commit, but I didn't want to lose the message.

Re: The shortest pull request ever

#19

I mean, it's the shortest _possible_ pull request (since I don't think you can make a git diff of zero bytes, barring some weird quirk), but also probably has the highest PR description : PR diff length ratio of any PR I've seen.

`git commit --allow-empty -m 'empty commit'` will do.

That won't show up in diffs though, while this one does show up albeit it's VERY hard to spot the actual difference, as the different is a space with zero width.

Re: The shortest pull request ever

#20

I mean, it's the shortest _possible_ pull request (since I don't think you can make a git diff of zero bytes, barring some weird quirk), but also probably has the highest PR description : PR diff length ratio of any PR I've seen.

`git commit --allow-empty -m 'empty commit'` will do.

Rejected, please don't commit code in a broken state.
Post reply on HN