diff options
author | Neeraj Singh <neerajsi@microsoft.com> | 2022-04-05 08:20:15 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-04-06 23:13:26 +0300 |
commit | fb2d0db502240231cde9584d2a908ae186a2ae06 (patch) | |
tree | 270328180ba07793e8c55418f63f3ff14976e0ab /t/test-lib-functions.sh | |
parent | 8a94d833497f3b8232684271c80a7da56f930939 (diff) |
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 () { |