diff options
| author | Neeraj Singh <neerajsi@microsoft.com> | 2022-04-04 22:20:15 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-04-06 13:13:26 -0700 |
| commit | fb2d0db502240231cde9584d2a908ae186a2ae06 (patch) | |
| tree | 270328180ba07793e8c55418f63f3ff14976e0ab /t/test-lib-functions.sh | |
| parent | core.fsync: use batch mode and sync loose objects by default on Windows (diff) | |
| download | git-fb2d0db502240231cde9584d2a908ae186a2ae06.tar.gz git-fb2d0db502240231cde9584d2a908ae186a2ae06.zip | |
test-lib-functions: add parsing helpers for ls-files and ls-tree
Several tests use awk to parse OIDs from the output of 'git ls-files
--stage' and 'git ls-tree'. Introduce helpers to centralize these uses
of awk.
Update t5317-pack-objects-filter-objects.sh to use the new ls-files
helper so that it has some usages to review. Other updates are left for
the future.
Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib-functions.sh')
| -rw-r--r-- | t/test-lib-functions.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 0f439c99d6..d9d16796c4 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1706,6 +1706,16 @@ test_oid_to_path () { echo "${1%$basename}/$basename" } +# Parse oids from git ls-files --staged output +test_parse_ls_files_stage_oids () { + awk '{print $2}' - +} + +# Parse oids from git ls-tree output +test_parse_ls_tree_oids () { + awk '{print $3}' - +} + # Choose a port number based on the test script's number and store it in # the given variable name, unless that variable already contains a number. test_set_port () { |
