Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

holo-files: Support patch files (#5) #42

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Commits on Feb 4, 2018

  1. holo-files/impl.Resource: Pre-compute the disambiguator and entityPath.

    This simplifies the code; as most of the code from the old separate
    Disambiguator() and EntityPath() was identical.
    LukeShu committed Feb 4, 2018
    Configuration menu
    Copy the full SHA
    dc0aebd View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2018

  1. holo-files: Turn Resource into an interface, split the implementation.

    This makes the minimal textual changes to accomplish this (don't move
    things between files, add a bogus `if true {` to avoid indentation
    change, ...), to make rebasing it easier.  The next commit will clean
    that up.
    LukeShu committed Feb 5, 2018
    Configuration menu
    Copy the full SHA
    cf1d60b View commit details
    Browse the repository at this point in the history
  2. holo-files: Split resource.go into multiple files, tidy.

     - shorten rawResource's methods
     - remove the bogus 'if true' from StaticResource.ApplyTo()
    LukeShu committed Feb 5, 2018
    Configuration menu
    Copy the full SHA
    aa26621 View commit details
    Browse the repository at this point in the history
  3. util/dump-to-tree.sh: Correctly handle backslashes in file contents.

    This affects patch files with the "\ No newline at end of file" footer.
    LukeShu committed Feb 5, 2018
    Configuration menu
    Copy the full SHA
    610d23e View commit details
    Browse the repository at this point in the history
  4. doc/holo-files: Refactor wording in anticipation of what is coming.

    Alone, this is probably a bad change.  But, this structure is amenable to
    adding other resource types; which a subsequent commit will do.  I wanted
    these wording changes to be review-able separately from wording for new
    behavior.
    LukeShu committed Feb 5, 2018
    Configuration menu
    Copy the full SHA
    52364c3 View commit details
    Browse the repository at this point in the history
  5. holo-files: Implement .patch files.

    This ended up being a lot more work than I thought it would be... though
    a good chunk of that was slowly realizing all of the ways that I could mess
    up writing patch files (in the tests) by hand.  Apparently, when applying
    `--git` style patches, GNU patch is pretty finicky about the "index" line,
    which I had expected it to basically ignore.
    
    BusyBox patch doesn't implement the `-d` flag, despite it being in POSIX
    for as long as `patch` has (2001; before that patch was standardized in
    XDG/SUS, before that merged with POSIX; but I don't have pre-merge copies
    handy to see if they had the `-d` flag).  So use `cmd.Dir` instead of `-d`.
    
    That doesn't mean that BusyBox patch will pass the tests, just that it will
    work.  It will still fail the tests:
     - The tests check for `--git` style changing of symlinks.  BusyBox patch
       does not support patching symlinks
     - The tests check for `--git` style changing of and file permissions.
       BusyBox patch does not support that
     - The tests expect it to say "patching file FILENAME" when creating a
       file (GNU patch behavior); BusyBox patch says "creating FILENAME".
     - The BusyBox fuzz detector seems to be less forgiving than the GNU one;
       it rejects my with-fuzz test.
    That said, BusyBox patch will still work for users writing ordinary patch
    files.
    
    I will 100% not be surprised of the tests don't pass with BSD patch for
    similar reasons.
    
    This breaks backward compatibility in a very minor way: previously, a
    resource file with the ".patch" suffix was understood to be a verbatim
    file; this changes that, obviously.
    
    The target file is operated on in a temporary directory, and without
    specifying the `-p` flag or the target filename.  This gives the patch the
    freedom to do directory-type operations (change file type).  If the patch
    creates other files, they will be ignored.
    LukeShu committed Feb 5, 2018
    Configuration menu
    Copy the full SHA
    d3c9cba View commit details
    Browse the repository at this point in the history