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

Alex Vandiver <alexmv@dropbox.com> 编辑于 Apr 20 2018, 8:52 AM 。

简介

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

详情

提交
Alex Vandiver <alexmv@dropbox.com>Apr 20 2018, 10:17 AM
父级
rARC73f5afd44110: Remove "very large change" warning from Arcanist
分支
未知
标签
未知
参考
HEAD, master