arxanas / git-branchless

High-velocity, monorepo-scale workflow for Git
Apache License 2.0
3.43k stars 84 forks source link

fix(status): rudimentary support for filenames with spaces #1127

Closed claytonrcarter closed 9 months ago

claytonrcarter commented 10 months ago

The regex in StatusEntry::try_from() was mistaken parsing status lines for files with spaces in such a way to discard the first word in the path name. This attempts to make that less likely by making the regex more specific, but I don't think it's really unavoidable without completely reworking this part of the code to be less flexible. eg if we parsed each of the 1/2/u statuses separately, then we could be more specific about how many fields we need to match/capture for each option.

I suspect that this issue was already rare, and that this fix will make it even moreso. Given that, I feel like a more robust/complex fix probably isn't warranted. With this fix, files like "r101 project.txt" or "Coffee notes.txt" will work, but "R101 project.txt" or "coffee notes.txt" ("R101" looks like a "change score", and "coffee" is a valid hex value.) (Edit: 🤦 coffee is not a "hex word"; c0ffee is, though.)

The options that come to mind to tighten this up further: