<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/t/t5317-pack-objects-filter-objects.sh, branch v2.35.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.35.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.35.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-12-13T18:29:48Z</updated>
<entry>
<title>t5000-t5999: detect and signal failure within loop</title>
<updated>2021-12-13T18:29:48Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2021-12-09T05:11:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d0fd993137cf41be66b54628f124b6651eea0bd2'/>
<id>urn:sha1:d0fd993137cf41be66b54628f124b6651eea0bd2</id>
<content type='text'>
Failures within `for` and `while` loops can go unnoticed if not detected
and signaled manually since the loop itself does not abort when a
contained command fails, nor will a failure necessarily be detected when
the loop finishes since the loop returns the exit code of the last
command it ran on the final iteration, which may not be the command
which failed. Therefore, detect and signal failures manually within
loops using the idiom `|| return 1` (or `|| exit 1` within subshells).

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tests: fix broken &amp;&amp;-chains in compound statements</title>
<updated>2021-12-13T18:29:48Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2021-12-09T05:11:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=74d2f5695dab4454097b2d1693f7206e8328724a'/>
<id>urn:sha1:74d2f5695dab4454097b2d1693f7206e8328724a</id>
<content type='text'>
The top-level &amp;&amp;-chain checker built into t/test-lib.sh causes tests to
magically exit with code 117 if the &amp;&amp;-chain is broken. However, it has
the shortcoming that the magic does not work within `{...}` groups,
`(...)` subshells, `$(...)` substitutions, or within bodies of compound
statements, such as `if`, `for`, `while`, `case`, etc. `chainlint.sed`
partly fills in the gap by catching broken &amp;&amp;-chains in `(...)`
subshells, but bugs can still lurk behind broken &amp;&amp;-chains in the other
cases.

Fix broken &amp;&amp;-chains in compound statements in order to reduce the
number of possible lurking bugs.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t5[0-4]*: adjust the references to the default branch name "main"</title>
<updated>2020-11-19T23:44:18Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2020-11-18T23:44:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=966b4be2765a9bd80febfd4660a1fa9e6408d143'/>
<id>urn:sha1:966b4be2765a9bd80febfd4660a1fa9e6408d143</id>
<content type='text'>
Carefully excluding t5310, which is developed independently of the
current patch series at the time of writing, we now use `main` as
default branch in t5[0-4]*. This trick was performed via

	$ (cd t &amp;&amp;
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t5[0-4]*.sh &amp;&amp;
	   git checkout HEAD -- t5310\*)

This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main`
for those tests.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tests: mark tests relying on the current default for `init.defaultBranch`</title>
<updated>2020-11-19T23:44:17Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2020-11-18T23:44:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=334afbc76fbd4a8d850946a2b450ba036365b554'/>
<id>urn:sha1:334afbc76fbd4a8d850946a2b450ba036365b554</id>
<content type='text'>
In addition to the manual adjustment to let the `linux-gcc` CI job run
the test suite with `master` and then with `main`, this patch makes sure
that GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME is set in all test scripts
that currently rely on the initial branch name being `master by default.

To determine which test scripts to mark up, the first step was to
force-set the default branch name to `master` in

- all test scripts that contain the keyword `master`,

- t4211, which expects `t/t4211/history.export` with a hard-coded ref to
  initialize the default branch,

- t5560 because it sources `t/t556x_common` which uses `master`,

- t8002 and t8012 because both source `t/annotate-tests.sh` which also
  uses `master`)

This trick was performed by this command:

	$ sed -i '/^ *\. \.\/\(test-lib\|lib-\(bash\|cvs\|git-svn\)\|gitweb-lib\)\.sh$/i\
	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\
	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\
	' $(git grep -l master t/t[0-9]*.sh) \
	t/t4211*.sh t/t5560*.sh t/t8002*.sh t/t8012*.sh

After that, careful, manual inspection revealed that some of the test
scripts containing the needle `master` do not actually rely on a
specific default branch name: either they mention `master` only in a
comment, or they initialize that branch specificially, or they do not
actually refer to the current default branch. Therefore, the
aforementioned modification was undone in those test scripts thusly:

	$ git checkout HEAD -- \
		t/t0027-auto-crlf.sh t/t0060-path-utils.sh \
		t/t1011-read-tree-sparse-checkout.sh \
		t/t1305-config-include.sh t/t1309-early-config.sh \
		t/t1402-check-ref-format.sh t/t1450-fsck.sh \
		t/t2024-checkout-dwim.sh \
		t/t2106-update-index-assume-unchanged.sh \
		t/t3040-subprojects-basic.sh t/t3301-notes.sh \
		t/t3308-notes-merge.sh t/t3423-rebase-reword.sh \
		t/t3436-rebase-more-options.sh \
		t/t4015-diff-whitespace.sh t/t4257-am-interactive.sh \
		t/t5323-pack-redundant.sh t/t5401-update-hooks.sh \
		t/t5511-refspec.sh t/t5526-fetch-submodules.sh \
		t/t5529-push-errors.sh t/t5530-upload-pack-error.sh \
		t/t5548-push-porcelain.sh \
		t/t5552-skipping-fetch-negotiator.sh \
		t/t5572-pull-submodule.sh t/t5608-clone-2gb.sh \
		t/t5614-clone-submodules-shallow.sh \
		t/t7508-status.sh t/t7606-merge-custom.sh \
		t/t9302-fast-import-unpack-limit.sh

We excluded one set of test scripts in these commands, though: the range
of `git p4` tests. The reason? `git p4` stores the (foreign) remote
branch in the branch called `p4/master`, which is obviously not the
default branch. Manual analysis revealed that only five of these tests
actually require a specific default branch name to pass; They were
modified thusly:

	$ sed -i '/^ *\. \.\/lib-git-p4\.sh$/i\
	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\
	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\
	' t/t980[0167]*.sh t/t9811*.sh

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t5317: use ! grep to check for no matching lines</title>
<updated>2019-11-29T21:20:15Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2019-11-27T19:53:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a29b2429e583794c27d9527e105b1ce7500e8062'/>
<id>urn:sha1:a29b2429e583794c27d9527e105b1ce7500e8062</id>
<content type='text'>
Several times in t5317, we would use `wc -l` to ensure that a grep
result is empty. However, grep already has a way to do that... Its
return code! Use `! grep` in the cases where we are ensuring that there
are no matching lines.

While at it, drop unnecessary invocations of `awk` and `sort` in each
affected test since those commands do not influence the outcome. It's
not clear why that extra work was being done in the first place, and the
code's history doesn't shed any light on the matter since these tests
were simply born this way[1], likely due to copy-paste programming. The
unnecessary work wasn't noticed even when the code was later touched for
various cleanups[2][3].

[1]: 9535ce7337 (pack-objects: add list-objects filtering, 2017-11-21)
[2]: bdbc17e86a (tests: standardize pipe placement, 2018-10-05)
[3]: 61de0ff695 (tests: don't swallow Git errors upstream of pipes, 2018-10-05)

Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Denton Liu &lt;liu.denton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t5317: stop losing return codes of git commands</title>
<updated>2019-11-29T21:20:14Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2019-11-27T19:53:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6c37f3ec1b89f317bd379ce4db307f700ca4acd9'/>
<id>urn:sha1:6c37f3ec1b89f317bd379ce4db307f700ca4acd9</id>
<content type='text'>
Currently, there are two ways where the return codes of git commands are
lost. The first way is when a command is in the upstream of a pipe. In a
pipe, only the return code of the last command is used. Thus, all other
commands will have their return codes masked. Rewrite pipes so that
there are no git commands upstream.

The other way is when a command is in a non-assignment command
substitution. The return code will be lost in favour of the surrounding
command's. Rewrite instances of this such that git commands output to a
file and surrounding commands only call command substitutions with
non-git commands.

Signed-off-by: Denton Liu &lt;liu.denton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>list-objects-filter: disable 'sparse:path' filters</title>
<updated>2019-05-29T18:05:34Z</updated>
<author>
<name>Christian Couder</name>
<email>christian.couder@gmail.com</email>
</author>
<published>2019-05-29T12:44:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e693237e2ba27b6129e8af7f6a794f5c2fbd26f3'/>
<id>urn:sha1:e693237e2ba27b6129e8af7f6a794f5c2fbd26f3</id>
<content type='text'>
If someone wants to use as a filter a sparse file that is in the
repository, something like "--filter=sparse:oid=&lt;ref&gt;:&lt;path&gt;"
already works.

So 'sparse:path' is only interesting if the sparse file is not in
the repository. In this case though the current implementation has
a big security issue, as it makes it possible to ask the server to
read any file, like for example /etc/password, and to explore the
filesystem, as well as individual lines of files.

If someone is interested in using a sparse file that is not in the
repository as a filter, then at the minimum a config option, such
as "uploadpack.sparsePathFilter", should be implemented first to
restrict the directory from which the files specified by
'sparse:path' can be read.

For now though, let's just disable 'sparse:path' filters.

Helped-by: Matthew DeVore &lt;matvore@google.com&gt;
Helped-by: Jeff Hostetler &lt;git@jeffhostetler.com&gt;
Signed-off-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tests (pack-objects): use the full, unabbreviated `--revs` option</title>
<updated>2019-04-02T00:55:00Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2019-03-25T18:14:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=effc2bae642a08ea0cb4a9020cb57632d00ab1a0'/>
<id>urn:sha1:effc2bae642a08ea0cb4a9020cb57632d00ab1a0</id>
<content type='text'>
To use the singular form of a word, when the option wants the plural
form (and quietly expands it because it thinks it was abbreviated), is
an easy mistake to make, and t5317 contains almost two dozen of them.

However, using abbreviated options in tests is a bit fragile, so we will
disallow use of abbreviated options in our test suite.

In preparation for this change, let's fix
`t5317-pack-objects-filter-objects.sh`.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'md/filter-trees'</title>
<updated>2018-10-30T06:43:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-10-30T06:43:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=77d503757d6328703f9571a4432dd83800bc26bb'/>
<id>urn:sha1:77d503757d6328703f9571a4432dd83800bc26bb</id>
<content type='text'>
The "rev-list --filter" feature learned to exclude all trees via
"tree:0" filter.

* md/filter-trees:
  list-objects: support for skipping tree traversal
  filter-trees: code clean-up of tests
  list-objects-filter: implement filter tree:0
  list-objects-filter-options: do not over-strbuf_init
  list-objects-filter: use BUG rather than die
  revision: mark non-user-given objects instead
  rev-list: handle missing tree objects properly
  list-objects: always parse trees gently
  list-objects: refactor to process_tree_contents
  list-objects: store common func args in struct
</content>
</entry>
<entry>
<title>filter-trees: code clean-up of tests</title>
<updated>2018-10-15T03:43:17Z</updated>
<author>
<name>Matthew DeVore</name>
<email>matvore@google.com</email>
</author>
<published>2018-10-12T20:01:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d9e6d0942bb9f9fe9e4cca9670181e5b59074bcb'/>
<id>urn:sha1:d9e6d0942bb9f9fe9e4cca9670181e5b59074bcb</id>
<content type='text'>
A few trivial updates to test to match the current best practices.

 - avoid "grep -q" that strips potentially useful output from tests
   running under "-v".

 - use test_write_lines to prepare multi-line expected output file.

 - reserve use of test_must_fail to "git" commands.

Signed-off-by: Matthew DeVore &lt;matvore@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
