Thread (3 messages) 3 messages, 2 authors, 2021-01-09

Re: [PATCH v4 1/2] bundle: lost objects when removing duplicate pendings

From: Jiang Xin <hidden>
Date: 2021-01-09 15:10:48

Junio C Hamano [off-list ref] 于2021年1月9日周六 上午10:11写道:
quoted
+# Display the pack data contained in the bundle file, bypassing the
+# header that contains the signature, prerequisites and references.
+convert_bundle_to_pack () {
+     while read x && test -n "$x"
+     do
+             :;
+     done
+     cat
+}
This looks somewhat familiar.  Perhaps extract out necessary helpers
including this one into t/test-bundle-lib or something similar in a
preparatory step before this patch?
Will add a new helper "t/test-bundle-functions.sh". But as how to
include this helper, there are several solutions, which is better?

1. For those scripts which use  these shared functions include this helper like:

        . ./test-lib.sh
        # current directory changed, so add path prefix
        .  "$TEST_DIRECTORY"/test-bundle-functions.sh

2. Include "test-bundle-functions.sh" in "test-lib.sh" like this:

        . "$TEST_DIRECTORY/test-lib-functions.sh"
        . "$TEST_DIRECTORY/test-bundle-functions.sh"

3. Create a "t/test-lib.d/" directory, add add
“test-bundle-functions.sh” inside "t/test-lib.d/" as an extension,
just like chriscool introduced in sharness project.

----8<-----
 # test_perf subshells can have them too
 . "$TEST_DIRECTORY/test-lib-functions.sh"

+if test -d "$TEST_DIRECTORY/test-lib.d"
+then
+       for file in "$TEST_DIRECTORY/test-lib.d/"*.sh
+       do
+               # Ensure glob was not an empty match:
+               test -e "${file}" || break
+
+               if test -n "$debug"
+               then
+                       echo >&5 "test-lib: loading extensions from ${file}"
+               fi
+               . "${file}"
+               if test $? != 0
+               then
+                       echo >&5 "test-lib: Error loading ${file}. Aborting."
+                       exit 1
+               fi
+       done
+fi
+
----->8-----
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help