Page MenuHomePhabricator

Correctly parse `git status --porcelain=2` output with filenames with spaces
ClosedPublic

Authored by alexmv on Apr 20 2018, 1:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 25, 10:55 AM
Unknown Object (File)
Thu, Dec 19, 7:39 PM
Unknown Object (File)
Sat, Dec 14, 6:57 PM
Unknown Object (File)
Sat, Dec 14, 12:37 AM
Unknown Object (File)
Mon, Dec 9, 8:07 AM
Unknown Object (File)
Sat, Dec 7, 7:06 AM
Unknown Object (File)
Thu, Dec 5, 11:45 AM
Unknown Object (File)
Thu, Dec 5, 12:50 AM
Subscribers

Details

Summary

Filenames are last in git status --porcelain=2 lines; they
are not escaped in any way, despite the fields being
whitespace-delimited. explode thus happily chops apart filenames
with spaces in them, causing later git operations to operate only on
the filename up to the first space.

Split the lines into the right number of elements -- in all cases,
this is one more than the index we're using, since filenames come last.

Test Plan

Altering a file with a space in its path, and running arc diff -a.

Added tests.

Diff Detail

Repository
rARC Arcanist
Branch
up-whitespace (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 20193
Build 27403: Run Core Tests
Build 27402: arc lint + arc unit