<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/t/lib-submodule-update.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-05-11T03:45:18Z</updated>
<entry>
<title>submodule tests: use symbolic-ref --short to discover branch name</title>
<updated>2021-05-11T03:45:18Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-05-10T14:19:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ba7d318504a4f69e2b3ce664d6a3f2c413f5bf61'/>
<id>urn:sha1:ba7d318504a4f69e2b3ce664d6a3f2c413f5bf61</id>
<content type='text'>
Change a use of $GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME added in
704fed9ea22 (tests: start moving to a different default main branch
name, 2020-10-23) to simply discover the initial branch name of a
repository set up in this function with "symbolic-ref --short".

That's something done in another test in 704fed9ea22, so doing it like
this seems like an omission, or rather an overly eager
search/replacement instead of fixing the test logic.

There are only three uses of the GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
variable in the test suite, this gets rid of one of those.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>stash: remove unnecessary process forking</title>
<updated>2020-12-01T22:39:04Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2020-12-01T22:25:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b34ab4a43ba68dd4bba66d765368a37d99890ab2'/>
<id>urn:sha1:b34ab4a43ba68dd4bba66d765368a37d99890ab2</id>
<content type='text'>
When stash was converted from shell to a builtin, it merely
transliterated the forking of various git commands from shell to a C
program that would fork the same commands.  Some of those were converted
over to actual library calls, but much of the pipeline-of-commands
design still remains.  Fix some of this by replacing the portion
corresponding to

    git diff-index --cached --name-only --diff-filter=A $CTREE &gt;"$a"
    git read-tree --reset $CTREE
    git update-index --add --stdin &lt;"$a"
    rm -f "$a"

into a library function that does the same thing.  (The read-tree
--reset was already partially converted over to a library call, but as
an independent piece.)  Note here that this came after a merge operation
was performed.  The merge machinery always stages anything that cleanly
merges, and the above code only runs if there are no conflicts.  Its
purpose is to make it so that when there are no conflicts, all the
changes from the stash are unstaged.  However, that causes brand new
files from the stash to become untracked, so the code above first saves
those files off and then re-adds them afterwards.

We replace the whole series of commands with a simple function that will
unstage files that are not newly added.  This doesn't fix any bugs in
the usage of these commands, it simply matches the existing behavior but
makes it into a single atomic operation that we can then operate on as a
whole.  A subsequent commit will take advantage of this to fix issues
with these commands in sparse-checkouts.

This conversion incidentally fixes t3906.1, because the separate
update-index process would die with the following error messages:
    error: uninitialized_sub: is a directory - add files inside instead
    fatal: Unable to process path uninitialized_sub
The unstaging of the directory as a submodule meant it was no longer
tracked, and thus as an uninitialized directory it could not be added
back using `git update-index --add`, thus resulting in this error and
early abort.  Most of the submodule tests in 3906 continue to fail after
this change, this change was just enough to push the first of those
tests to success.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tests: start moving to a different default main branch name</title>
<updated>2020-10-23T15:57:40Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2020-10-23T14:00:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=704fed9ea22230929639c9e5fca122045f84311d'/>
<id>urn:sha1:704fed9ea22230929639c9e5fca122045f84311d</id>
<content type='text'>
To allow for an incremental conversion to a new default main branch
name, let's introduce `GIT_TEST_DEFAULT_MAIN_BRANCH_NAME`. This
environment variable can be set at the top of each converted test
script, overriding the default main branch name to use when initializing
new repositories (or cloning empty repositories).

Note: the `GIT_TEST_DEFAULT_MAIN_BRANCH_NAME` is _not_ intended to be
used manually; many tests require a specific main branch name and cannot
simply work with another one. This `GIT_TEST_*` variable is meant purely
for the transitional period while the entire test suite is converted to
use `main` as the initial branch name by default.

We also introduce the `PREPARE_FOR_MAIN_BRANCH` prereq that determines
whether the default main branch name is `main`, and adjust a couple of
test functions to use it. This prereq will be used to temporarily
disable a couple test cases to allow for adjusting the test script
incrementally. Once an entire test is adjusted, we will adjust the test
so that it is run with `GIT_TEST_DEFAULT_MAIN_BRANCH_NAME=main`.

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>t: remove test_oid_init in tests</title>
<updated>2020-07-30T16:16:49Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2020-07-29T23:14:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e023ff0691ca207d421a0e75ea23c132ada9142a'/>
<id>urn:sha1:e023ff0691ca207d421a0e75ea23c132ada9142a</id>
<content type='text'>
Now that we call test_oid_init in the setup for all test scripts,
there's no point in calling it individually.  Remove all of the places
where we've done so to help keep tests tidy.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Reviewed-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'dl/test-must-fail-fixes-5'</title>
<updated>2020-07-07T05:09:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-07-07T05:09:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=efafdca42162843e90cefdeefd8e6c244cee91f5'/>
<id>urn:sha1:efafdca42162843e90cefdeefd8e6c244cee91f5</id>
<content type='text'>
The effort to avoid using test_must_fail on non-git command continues.

* dl/test-must-fail-fixes-5:
  lib-submodule-update: pass 'test_must_fail' as an argument
  lib-submodule-update: prepend "git" to $command
  lib-submodule-update: consolidate --recurse-submodules
  lib-submodule-update: add space after function name
</content>
</entry>
<entry>
<title>lib-submodule-update: pass 'test_must_fail' as an argument</title>
<updated>2020-06-24T15:54:18Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2020-06-24T08:50:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5b0ac09fb17656553d85c7e3fbe0583ba3023e5e'/>
<id>urn:sha1:5b0ac09fb17656553d85c7e3fbe0583ba3023e5e</id>
<content type='text'>
When we run a test helper function in test_submodule_switch_common(), we
sometimes specify a whole helper function as the $command. When we do
this, in some test cases, we just mark the whole function with
`test_must_fail`. However, it's possible that the helper function might
fail earlier or later than expected due to an introduced bug. If this
happens, then the test case will still report as passing but it should
really be marked as failing since it didn't actually display the
intended behaviour.

Instead of invoking `test_must_fail $command`, pass the string
"test_must_fail" as the second argument in case where the git command is
expected to fail.

When $command is a helper function, the parent function calling
test_submodule_switch_common() is test_submodule_switch_func(). For all
test_submodule_switch_func() invocations, increase the granularity of
the argument test helper function by prefixing the git invocation which is
meant to fail with the second argument like this:

	$2 git checkout "$1"

In the other cases, test_submodule_switch() and
test_submodule_forced_switch(), instead of passing in the git command
directly, wrap it using the git_test_func() and pass the git arguments
using the global variable $gitcmd. Unfortunately, since closures aren't
a thing in shell scripts, the global variable is necessary. Another
unfortunate result is that the "git_test_func" will used as the test
case name when $command is printed but it's worth it for the cleaner
code.

Finally, as an added bonus, `test_must_fail` will now only run on 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>lib-submodule-update: prepend "git" to $command</title>
<updated>2020-06-12T18:33:40Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2020-06-11T17:41:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=aa06180ac90984204e59ac74bb4e3a4d09037ac2'/>
<id>urn:sha1:aa06180ac90984204e59ac74bb4e3a4d09037ac2</id>
<content type='text'>
Since all invocations of test_submodule_forced_switch() are git
commands, automatically prepend "git" before invoking
test_submodule_switch_common().

Similarly, many invocations of test_submodule_switch() are also git
commands so automatically prepend "git" before invoking
test_submodule_switch_common() as well.

Finally, for invocations of test_submodule_switch() that invoke a custom
function, rename the old function to test_submodule_switch_func().

This is necessary because in a future commit, we will be adding some
logic that needs to distinguish between an invocation of a plain git
comamnd and an invocation of a test helper function.

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>lib-submodule-update: consolidate --recurse-submodules</title>
<updated>2020-04-29T17:36:55Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2020-04-29T12:22:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=add245234820be6cec3f54174d44f738aa1a80f9'/>
<id>urn:sha1:add245234820be6cec3f54174d44f738aa1a80f9</id>
<content type='text'>
Both test_submodule_switch_recursing_with_args() and
test_submodule_forced_switch_recursing_with_args() call the internal
function test_submodule_recursing_with_args_common() with the final
argument of `--recurse-submodules`. Consolidate this duplication by
appending the argument in test_submodule_recursing_with_args_common().

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>lib-submodule-update: add space after function name</title>
<updated>2020-04-29T17:36:55Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2020-04-29T12:22:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=27691ca27e0be0195e30450cc0316c2cc090dfca'/>
<id>urn:sha1:27691ca27e0be0195e30450cc0316c2cc090dfca</id>
<content type='text'>
In the shell scripts in this codebase, the usual style is to include a
space between the function name and the (). Add these missing spaces to
conform to the usual style of the code.

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>Merge branch 'jk/test-cleanup'</title>
<updated>2020-04-22T20:42:44Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-04-22T20:42:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dfe48154b16e35ea01795aa94c7e8686f084e2c3'/>
<id>urn:sha1:dfe48154b16e35ea01795aa94c7e8686f084e2c3</id>
<content type='text'>
Test cleanup.

* jk/test-cleanup:
  t/lib-*.sh: drop executable bit
  t/lib-credential.sh: drop shebang line
</content>
</entry>
</feed>
