• hinoka@chromium.org's avatar
    Don't have checkout.py's git apply_patch fail when files don't match · dc6a1d03
    hinoka@chromium.org authored
    The contract for apply_patch is that it applies a patch on top of something, and
    it either all applies cleanly or it fails.  The something that is applied on can
    be as clean or dirty without having apply_patch judge.  The particular failure
    condition was that we want to patch DEPS first (into the index), do some stuff,
    then apply another patch on top of that.  Apply_patch was failing because it
    saw that there was a DEPS in the index already when it wasn't expecting one.
    
    A fix that could've also worked is to run git diff --staged before applying the
    patch, then subtract that list from found_files, but it still gets tricky then
    because what if you want to apply an independent patch on top of
    an already patched index?  
    
    Because apply_patch shouldn't need to be in the business of
    keeping track of what the state of everything is like before and
    after a patch (That's up to the patch application), the better thing would be to remove the assert
    alltogether, and rely on "git apply" to complain if something doesn't apply.
    
    BUG=370503
    TBR=iannucci
    
    Review URL: https://codereview.chromium.org/280023004
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@269526 0039d316-1c4b-4281-b951-d872f2087c98
    dc6a1d03
checkout.py 30.3 KB