[HN Gopher] The shortest pull request ever
       ___________________________________________________________________
        
       The shortest pull request ever
        
       Author : julienpalard
       Score  : 102 points
       Date   : 2022-10-05 21:09 UTC (1 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | christiangenco wrote:
       | 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.
        
         | donatj wrote:
         | Interesting. You could presumably also swap out characters for
         | homoglyphs at random.
        
         | mr337 wrote:
         | Wow, this is pretty nifty and I would, nor would the program
         | authors thing of that use case :D
        
         | frabjoused wrote:
         | The original creator of the first zero width space had to be
         | evil.
        
           | throwaway290 wrote:
           | It has uses in typesetting, e.g. for allowing a word to be
           | broken.
        
         | benj111 wrote:
         | Somewhere someone is adding long lines of BOMs just so if
         | someone else adds long lines of BOMs it gets flagged as
         | plagiarism.
         | 
         | I hope it returns the copied string.
         | 
         | String "" is plagiarised
        
       | djha-skin wrote:
       | > If we drop those markers (1110 and 10 in front of bytes) and
       | keep the remaining bits we're left with 1111111011111111, which
       | evaluates to 65279, which is in hexadecimal0xfeff. Yes, you
       | recognize it, it's a BOM. Because yes a BOM is just a ZERO WIDTH
       | NO-BREAK SPACE, isn't it beautiful?
       | 
       | Byte Order Marks have stolen hours and days of my life. Anyone
       | suffering the pain of developing on a windows box can relate.
       | Windows puts BOMs by default in the front of every file. Thus
       | windows programs silently ignore it, but then linux machines run
       | the program and choke on the BOM. You have to specifically ask
       | the editor if the BOM is even there, it doesn't show up in the
       | editor by default. I have specific lines in my .vimrc[1] that
       | prevent BOMs from ruining my day/week, but they still pop up
       | often. I often joke there will be a byte order mark on my
       | tombstone, along with avahi daemon.
       | 
       | 1: https://git.sr.ht/~djha-skin/dotfiles/tree/main/item/dot-
       | con...
        
         | ddalcino wrote:
         | > Byte Order Marks have stolen hours and days of my life.
         | 
         | Me too, to some degree. I have discovered them in a Ruby code
         | base at work, in the middle of a line of code (copy pasted),
         | where the Ruby interpreter thinks they are undeclared
         | identifiers. When the code runs, it throws an exception every
         | time that complains of "Undeclared identifier `'".
         | 
         | The dad-joke of it is that "You gotta sweep for BOMs before
         | they blow up your code."
        
         | TillE wrote:
         | I've dealt with two elusive bugs which were ultimately caused
         | by Windows stupidly using UTF-8 with BOM by default. Python
         | requires you to take extra steps to decode that garbage, and
         | some C++ libraries can't handle it at all.
         | 
         | I'm sure there were good reasons that BOM sounded like the
         | right idea at Microsoft, but everyone else just used straight
         | UTF-8 and it was fine.
        
         | AceJohnny2 wrote:
         | > _along with avahi daemon_
         | 
         | Tell us more!
        
       | verandaguy wrote:
       | 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.
        
         | AceJohnny2 wrote:
         | Working in embedded, I've seen commits that changed a single
         | _bit_ with pages and pages of background explanation :D
        
         | dixie_land wrote:
         | I think file mode changes (eg 0644 -> 0755 to fix a script not
         | running) could be smaller
        
         | mjochim wrote:
         | Depends on whether you consider `git commit --allow-empty` a
         | weird quirk ... I guess it would be reasonable to do so ;).
        
           | mywittyname wrote:
           | 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.
        
             | maxfurman wrote:
             | I see `--allow-empty` in git tutorials all the time, to
             | demonstrate the concept of a commit. I'm not sure when
             | you'd reach for it in a real repo though
        
             | dixie_land wrote:
             | git commit --allow-empty -m "trigger CI job"
        
               | aflag wrote:
               | Nice. I used to just add a BOM at the beginning of a
               | random line to accomplish that.
        
               | sodality2 wrote:
               | I think this post is a good reason not to do that ;)
        
             | ezekg wrote:
             | 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
        
             | gh02t wrote:
             | 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."
        
             | bryanlarsen wrote:
             | 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.
        
             | ok_dad wrote:
             | For those of us who start projects often, but never finish
             | them:                   git commit --allow-empty -m
             | "Initial commit."
        
         | layer8 wrote:
         | Given that a BOM is three bytes, I don't really agree that it's
         | the shortest. How about replacing a CRLF by LF? That one is
         | invisible in many contexts as well.
        
         | silverwind wrote:
         | `git commit --allow-empty -m 'empty commit'` will do.
        
           | capableweb wrote:
           | 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.
        
           | rlayton2 wrote:
           | Rejected, please don't commit code in a broken state.
        
             | JasonFruit wrote:
             | You can't commit code from New Jersey?
        
       | donatj wrote:
       | Over the years I've submitted a decent number of pull requests
       | just removing execute bits from files that shouldn't be
       | executable.
       | 
       | They always end up +0-0 - see:
       | 
       | https://github.com/ICanBoogie/Inflector/pull/38
        
       ___________________________________________________________________
       (page generated 2022-10-05 23:01 UTC)