pathspec: add new function to parse file
This will be used to support the new option '--pathspec-from-file' in `git add`, `git-commit`, `git reset` etc. Note also that we specifically handle CR/LF line endings to support Windows better. To simplify code, file is first parsed into `argv_array`. This allows to avoid refactoring `parse_pathspec()`. I considered adding `nul_term_line` to `flags` instead, but decided that it doesn't fit there. The new code is mostly taken from `cmd_update_index()` and `split_mail_conv()`. Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
add97702ed
commit
24e4750c96
10
pathspec.h
10
pathspec.h
@ -85,6 +85,16 @@ void parse_pathspec(struct pathspec *pathspec,
|
||||
unsigned flags,
|
||||
const char *prefix,
|
||||
const char **args);
|
||||
/*
|
||||
* Same as parse_pathspec() but uses file as input.
|
||||
* When 'file' is exactly "-" it uses 'stdin' instead.
|
||||
*/
|
||||
void parse_pathspec_file(struct pathspec *pathspec,
|
||||
unsigned magic_mask,
|
||||
unsigned flags,
|
||||
const char *prefix,
|
||||
const char *file,
|
||||
int nul_term_line);
|
||||
void copy_pathspec(struct pathspec *dst, const struct pathspec *src);
|
||||
void clear_pathspec(struct pathspec *);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user