pr-490/SyntevoAlex/#0207_pathspec_from_file_2-v2
tagged this
16 Dec 15:48
This topic continues the effort to support `--pathspec-from-file` in various commands [1][2]. It also includes some refactorings that I developed while working on it - previously submitted separately [3][4] which was probably a mistake. Anatomy of the branch: checkout, restore: support the --pathspec-from-file option Extends `--pathspec-from-file` to `git checkout/restore`. t2024: cover more cases Some new tests for cases that I deemed worthy while working on `parse_branchname_arg()` refactoring. parse_branchname_arg(): refactor the decision making parse_branchname_arg(): update code comments parse_branchname_arg(): introduce expect_commit_only parse_branchname_arg(): easier to understand variables These patches prepare for `|| opts->pathspec_from_file` addition in `git checkout/restore` patch. Without this refactoring, I found it pretty hard to modify the old code. checkout: die() on ambiguous tracking branches parse_branchname_arg(): extract part as new function Initially I was trying to remove some inconsistency standing in the way of `git checkout/restore` patch. Later I figured that this change is worthy on its own: it prevents some pretty surprising behavior of git. doc: restore: synchronize <pathspec> description doc: checkout: synchronize <pathspec> description doc: checkout: fix broken text reference doc: checkout: remove duplicate synopsis Some polishing of docs in preparation for `git checkout/restore` patch. add: support the --pathspec-from-file option cmd_add: prepare for next patch Extends `--pathspec-from-file` to `git add`. commit: forbid --pathspec-from-file --all t7107, t7526: directly test parse_pathspec_file() Some polishing of merged topic [1]. CC'ing people who shown interest in any of the previous topics, thanks for your reviews! [1] https://public-inbox.org/git/pull.445.git.1572895605.gitgitgadget@gmail.com/ [2] https://public-inbox.org/git/20191204203911.237056-1-emilyshaffer@google.com/ [3] https://public-inbox.org/git/pull.477.git.1574848137.gitgitgadget@gmail.com/ [4] https://public-inbox.org/git/pull.479.git.1574969538.gitgitgadget@gmail.com/ Changes since V1: ---------------- @Junio please note that V1 was already substantially different from what you merged into `next`. 1) Added tests for error scenarios related to --pathspec-from-file. 2) Restored tests for --pathspec-file-nul: they are valuable for every command, because they verify that specific commands handle the commandline option correctly. 3) Dropped old tests for `git restore` that I forgot to delete when I made commit `t7107, t7526: directly test parse_pathspec_file()`. Alexandr Miloslavskiy (18): t7107, t7526: directly test parse_pathspec_file() t7526: add tests for error conditions t7107: add tests for error conditions commit: forbid --pathspec-from-file --all cmd_add: prepare for next patch add: support the --pathspec-from-file option doc: checkout: remove duplicate synopsis doc: checkout: fix broken text reference doc: checkout: synchronize <pathspec> description doc: restore: synchronize <pathspec> description parse_branchname_arg(): extract part as new function checkout: die() on ambiguous tracking branches parse_branchname_arg(): easier to understand variables parse_branchname_arg(): introduce expect_commit_only parse_branchname_arg(): update code comments parse_branchname_arg(): refactor the decision making t2024: cover more cases checkout, restore: support the --pathspec-from-file option Documentation/git-add.txt | 16 +- Documentation/git-checkout.txt | 50 +++-- Documentation/git-restore.txt | 26 ++- Makefile | 1 + builtin/add.c | 60 ++++-- builtin/checkout.c | 279 ++++++++++++++-------------- builtin/commit.c | 3 + t/helper/test-parse-pathspec-file.c | 34 ++++ t/helper/test-tool.c | 1 + t/helper/test-tool.h | 1 + t/t0067-parse_pathspec_file.sh | 89 +++++++++ t/t2024-checkout-dwim.sh | 55 +++++- t/t2026-checkout-pathspec-file.sh | 90 +++++++++ t/t2072-restore-pathspec-file.sh | 91 +++++++++ t/t3704-add-pathspec-file.sh | 86 +++++++++ t/t7107-reset-pathspec-file.sh | 98 ++-------- t/t7526-commit-pathspec-file.sh | 83 +++------ t/t9902-completion.sh | 2 + 18 files changed, 743 insertions(+), 322 deletions(-) create mode 100644 t/helper/test-parse-pathspec-file.c create mode 100755 t/t0067-parse_pathspec_file.sh create mode 100755 t/t2026-checkout-pathspec-file.sh create mode 100755 t/t2072-restore-pathspec-file.sh create mode 100755 t/t3704-add-pathspec-file.sh base-commit: ad05a3d8e5a6a06443836b5e40434262d992889a Submitted-As: https://lore.kernel.org/git/pull.490.v2.git.1576511287.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.490.git.1576161385.gitgitgadget@gmail.com
Assets 2
-
2019-12-16T15:48:07Z -
2019-12-16T15:48:07Z -