Billy Keyes
cf2f946a66
Implement traditional file header parsing
...
While I think this works, this is mostly for completeness. I (and I
expect most other users, if any) intend to use this with git patches.
2019-03-21 22:47:52 -07:00
Billy Keyes
412e7a39b1
Add more tests for git file header parsing
...
Also fix a bug with EOF handling in the parsing function and make sure
the test does not ignore unexpected errors.
2019-03-20 22:20:21 -07:00
Billy Keyes
b8b0c25c1e
Move file header functions to a new file
2019-03-19 22:00:11 -07:00
Billy Keyes
cbd3915448
Add final tests for git header parsing functions
...
This gets 100% test coverage for the functions involved in parsing
Git-style file headers. Whether that actually makes it correct remains
to be seen.
2019-03-19 21:50:50 -07:00
Billy Keyes
a1f92fec30
Fix and test old/new file name verification
2019-03-18 23:05:15 -07:00
Billy Keyes
6daf604b25
Add tests for git header data parsing
...
Fix parseGitHeaderIndex to allow abbreviated OIDs and add a note about
this to the README. The behavior might change again later, based on some
experimentation with Git.
2019-03-17 21:38:14 -07:00
Billy Keyes
3f641b393f
Add tests and fix bugs with name parsing
...
Also convert all table tests to use maps instead of structs with name
fields and standardize other field names.
2019-03-17 20:21:58 -07:00
Billy Keyes
ea5b8bceea
Finish parsing filenames from Git headers
...
Adds "default" name handling, error checks for missing names, and prefix
and double-slash stripping.
2019-03-17 15:34:03 -07:00
Billy Keyes
303b32d463
Add "header" to header parsing function names
2019-03-17 14:04:43 -07:00
Billy Keyes
c928ba2827
Implement index header line parsing
2019-03-16 22:42:14 -07:00
Billy Keyes
3cca171e73
Refactor git header parser to use function array
...
This is slightly more code, but I think is a bit cleaner, especially for
functions that set or could set multiple values, like the currently
unimplemented index parsing. It also removes the string manipulation as
a side-effect of case match thing, which was weird.
2019-03-16 18:29:21 -07:00
Billy Keyes
4f50b85d06
Implement file name parsing for git headers
...
Also change how error handling works for similarity score parsing.
2019-03-16 17:46:05 -07:00
Billy Keyes
2a2f704b96
Add incomplete git header parsing functions
...
I believe the structure is correct, but there are a lot of details to
fill in - translating the C string parsing logic into Go is not always
straightforward.
2019-03-14 23:09:41 -07:00
Billy Keyes
bca8d0806e
Detach parseFragmentHeader from parser struct
...
This operates on a single line and doesn't need any parser state.
2019-03-14 21:55:06 -07:00
Billy Keyes
4ddf1d962d
Implement fragment header parsing
...
Use a regexp for simplicity, unlike the direct parsing in Git.
2019-03-13 23:04:01 -07:00
Billy Keyes
d8a0cc90d1
Implement ParseNextFileHeader
...
This follows the structure and logic of find_header() in git/apply.c.
Calls to helper functions are currently stubbed.
2019-03-12 22:41:20 -07:00
Billy Keyes
42914c81df
Create parser skeleton and utilities
2019-03-10 21:48:59 -07:00