This is an archive of the discontinued Mercurial Phabricator instance.

patch: handle filenames with trailing spaces
ClosedPublic

Authored by spectral on Jan 12 2021, 1:33 PM.

Details

Summary

I have no idea if this is *actually* supported by the patch file format, but at
least when reading from a patch file created by running hg shelve, it is
written out such that there's a trailing space after the second (b) filename.
When we read the patch file, we remove the space before parsing the filenames,
so it doesn't end up matching the other sources of what files are in the shelve.

We observed this internally due to a wrapper around unshelve that called into
patch.changedfiles, but hg patch is able to reproduce the issue as well, so
I've included both tests.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

spectral created this revision.Jan 12 2021, 1:33 PM
martinvonz accepted this revision.Jan 12 2021, 1:53 PM
martinvonz added a subscriber: martinvonz.

I have no idea if this is *actually* supported by the patch file format,

At least Git seems to preserve the filename even if it has a trailing space.

This patch looks good to me. I'll just give others a chance to comment before I queue.

This revision is now accepted and ready to land.Jan 12 2021, 1:53 PM
This revision was automatically updated to reflect the committed changes.