Parsing diff --git lines
- From
- Simon Fraser <smfr@mac.com>
- Date
- Mar 9, 2008, 01:48 UTC
- Message-ID
- <F4D3B820-CCF4-4212-BF32-700EFD448143@mac.com>
I'm working on a GUI for git, and I'd like to be able to provide some diff navigation tools. That requires that I can find the file chunks in a diff, and parse out the file names.
However, I don't see a reliable way to identify the two files from a "diff --git" line. Here's a (deliberately pathological) example:
diff --git a/a / b/file with spaces.txt b/a / b/file with spaces.txt In this case, the repository contains directories called "a " and " b" and the file names have spaces in. What would make this possible would be either to always quote file paths containing spaces, or use a character other than a space (e.g. a \t) between the two file names. Thanks Simon