Page MenuHomePhabricator

Use "--whitespace nowarn" in `arc patch` to respect trailing whitespace
ClosedPublic

Authored by epriestley on Dec 18 2015, 12:18 AM.
Tags
None
Referenced Files
F18854006: D14816.id35822.diff
Fri, Oct 31, 9:28 PM
F18854002: D14816.id35822.diff
Fri, Oct 31, 9:25 PM
F18797250: D14816.id35822.diff
Fri, Oct 17, 4:51 AM
F18791676: D14816.id35822.diff
Thu, Oct 16, 4:44 PM
F18779266: D14816.diff
Sat, Oct 11, 1:08 PM
F18761639: D14816.diff
Oct 6 2025, 3:29 PM
F18736962: D14816.id35822.diff
Oct 1 2025, 8:26 AM
F17707530: D14816.diff
Jul 16 2025, 3:11 PM
Subscribers
None
Tokens
"Mountain of Wealth" token, awarded by joshuaspence.

Details

Summary

Fixes T10008. Git tries to fix some issues by default (apparently? empirically; not consistent with documentation, I think?), but patches from arc patch are "always" accurate (disregarding other bugs we might have -- basically, they haven't been emailed or copy/pasted or anything like that) so we can just tell it to apply the patch exactly as-is.

Test Plan

Screen Shot 2015-12-17 at 4.16.53 PM.png (138×683 px, 28 KB)

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

icat is this little "invisible cat" (show whitespace, etc) script:

icat
#!/usr/bin/env php
<?php

if ($argc > 1) {
  $args = array_slice($argv, 1);
} else {
  $args = array('php://stdin');
}

foreach ($args as $arg) {
  $data = file_get_contents($arg);
  for ($ii = 0; $ii < strlen($data); $ii++) {
    $s = $data[$ii];
    $n = isset($data[$ii + 1]) ? $data[$ii + 1] : null;
    $c = ord($s);
    if ($c >= 33 && $c <= 127) {
      echo $s;
    } else if ($s == "\r") {
      echo special(' \\r ');
      if ($n !== "\n") {
        echo "\n";
      }
    } else if ($s == "\n") {
      echo special(' \\n ')."\n";
    } else if ($s == "\t") {
      echo special(' \\t ');
    } else if ($s == ' ') {
      echo under(' ');
    } else {
      echo special('\\x'.sprintf('%02x', $c));
    }
  }
  echo "\n";
}

function special($x) {
  return chr(27).'[7m'.$x.chr(27).'[m';
}

function under($x) {
  return chr(27).'[31m'.chr(27).'[4m'.$x.chr(27).'[m'.chr(27).'[39m';
}
chad edited edge metadata.
This revision is now accepted and ready to land.Dec 18 2015, 1:31 AM
joshuaspence edited edge metadata.
joshuaspence awarded a token.
This revision was automatically updated to reflect the committed changes.