]> git.ipfire.org Git - thirdparty/git.git/commit - pathspec.c
pathspec: add new function to parse file
authorAlexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Tue, 19 Nov 2019 16:48:51 +0000 (16:48 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Nov 2019 04:01:53 +0000 (13:01 +0900)
commit24e4750c969b844536af1d286e7d977c74c078a2
tree0b5be5c3f0873076b4035fb7d4ec67f37f53f160
parentadd97702ed7cc3aa57b15c50b72606eb2f2f8cf5
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>
pathspec.c
pathspec.h