HomePhabricator

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

Description

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

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.

Reviewers: Blessed Reviewers, epriestley

Reviewed By: Blessed Reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D19389

Details

Provenance
alexmvAuthored on Apr 20 2018, 12:52 AM
alexmvPushed on Apr 20 2018, 2:17 AM
Reviewer
Blessed Reviewers
Differential Revision
D19389: Correctly parse `git status --porcelain=2` output with filenames with spaces
Parents
rARC73f5afd44110: Remove "very large change" warning from Arcanist
Branches
Unknown
Tags
Unknown
Build Status
Buildable 20195
Build 27405: Run Core Tests