<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/t/t4060-diff-submodule-option-diff-format.sh, branch v2.36.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.36.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.36.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-08-31T17:11:48Z</updated>
<entry>
<title>diff --submodule=diff: do not fail on ever-initialied deleted submodules</title>
<updated>2021-08-31T17:11:48Z</updated>
<author>
<name>David Turner</name>
<email>dturner@twosigma.com</email>
</author>
<published>2021-08-31T13:12:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f1c0368da4d64f394e4c099cb3c232671040d725'/>
<id>urn:sha1:f1c0368da4d64f394e4c099cb3c232671040d725</id>
<content type='text'>
If you have ever initialized a submodule, open_submodule will open it.
If you then delete the submodule's worktree directory (but don't
remove it from .gitmodules), git diff --submodule=diff would error out
as it attempted to chdir into the now-deleted working tree directory.

This only matters if the submodules git dir is absorbed.  If not, then
we no longer have anywhere to run the diff.  But that case does not
trigger this error, because in that case, open_submodule fails, so we
don't resolve a left commit, so we exit early, which is the only thing
we could do.

If absorbed, then we can run the diff from the submodule's absorbed
git dir (.git/modules/sm2).  In practice, that's a bit more
complicated, because `git diff` expects to be run from inside a
working directory, not a git dir.  So it looks in the config for
core.worktree, and does chdir("../../../sm2"), which is the very dir
that we're trying to avoid visiting because it's been deleted.  We
work around this by setting GIT_WORK_TREE (and GIT_DIR) to ".".  It is
little weird to set GIT_WORK_TREE to something that is not a working
tree just to avoid an unnecessary chdir, but it works.

Signed-off-by: David Turner &lt;dturner@twosigma.com
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t4060: remove unused variable</title>
<updated>2021-07-26T22:35:54Z</updated>
<author>
<name>David Turner</name>
<email>dturner@twosigma.com</email>
</author>
<published>2021-07-26T18:33:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4577d26dc0aaae3bb35c8906db96ba043716f3f7'/>
<id>urn:sha1:4577d26dc0aaae3bb35c8906db96ba043716f3f7</id>
<content type='text'>
Signed-off-by: David Turner &lt;dturner@twosigma.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff: do not show submodule with untracked files as "-dirty"</title>
<updated>2020-12-08T22:27:35Z</updated>
<author>
<name>Sangeeta Jain</name>
<email>sangunb09@gmail.com</email>
</author>
<published>2020-11-10T08:39:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8ef93124645f89c45c9ec3edd3b268b38154061a'/>
<id>urn:sha1:8ef93124645f89c45c9ec3edd3b268b38154061a</id>
<content type='text'>
Git diff reports a submodule directory as -dirty even when there are
only untracked files in the submodule directory. This is inconsistent
with what `git describe --dirty` says when run in the submodule
directory in that state.

Make `--ignore-submodules=untracked` the default for `git diff` when
there is no configuration variable or command line option, so that the
command would not give '-dirty' suffix to a submodule whose working
tree has untracked files, to make it consistent with `git
describe --dirty` that is run in the submodule working tree.

And also make `--ignore-submodules=none` the default for `git status`
so that the user doesn't end up deleting a submodule that has
uncommitted (untracked) files.

Signed-off-by: Sangeeta Jain &lt;sangunb09@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t4060: make test work with SHA-256</title>
<updated>2020-02-07T19:07:30Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2020-02-07T00:52:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=417e45e5e38f824f65259f1c67d3a40b3597e12a'/>
<id>urn:sha1:417e45e5e38f824f65259f1c67d3a40b3597e12a</id>
<content type='text'>
In this test, there are two main types of object IDs we see in the
diffs: the ones for the submodules, which we care about, and the ones
for the individual files, which are unrelated to what we're testing.
Much of the test already computes the former, so extend the rest of the
test to do so as well.  Add a diff comparison function that normalizes
the differences in the latter, since they're not explicitly what we're
testing.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sg/test-must-be-empty'</title>
<updated>2018-08-27T21:33:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-08-27T21:33:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=986c5181071ce3aac42d0aaeb7bd691a1a0bdf4a'/>
<id>urn:sha1:986c5181071ce3aac42d0aaeb7bd691a1a0bdf4a</id>
<content type='text'>
Test fixes.

* sg/test-must-be-empty:
  tests: use 'test_must_be_empty' instead of 'test_cmp &lt;empty&gt; &lt;out&gt;'
  tests: use 'test_must_be_empty' instead of 'test_cmp /dev/null &lt;out&gt;'
  tests: use 'test_must_be_empty' instead of 'test ! -s'
  tests: use 'test_must_be_empty' instead of '! test -s'
</content>
</entry>
<entry>
<title>tests: use 'test_must_be_empty' instead of 'test_cmp &lt;empty&gt; &lt;out&gt;'</title>
<updated>2018-08-21T18:48:36Z</updated>
<author>
<name>SZEDER Gábor</name>
<email>szeder.dev@gmail.com</email>
</author>
<published>2018-08-19T21:57:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1c5e94f459a0b7c23ef7e855441a65afdc4effab'/>
<id>urn:sha1:1c5e94f459a0b7c23ef7e855441a65afdc4effab</id>
<content type='text'>
Using 'test_must_be_empty' is shorter and more idiomatic than

  &gt;empty &amp;&amp;
  test_cmp empty out

as it saves the creation of an empty file.  Furthermore, sometimes the
expected empty file doesn't have such a descriptive name like 'empty',
and its creation is far away from the place where it's finally used
for comparison (e.g. in 't7600-merge.sh', where two expected empty
files are created in the 'setup' test, but are used only about 500
lines later).

These cases were found by instrumenting 'test_cmp' to error out the
test script when it's used to compare empty files, and then converted
manually.

Note that even after this patch there still remain a lot of cases
where we use 'test_cmp' to check empty files:

  - Sometimes the expected output is not hard-coded in the test, but
    'test_cmp' is used to ensure that two similar git commands produce
    the same output, and that output happens to be empty, e.g. the
    test 'submodule update --merge  - ignores --merge  for new
    submodules' in 't7406-submodule-update.sh'.

  - Repetitive common tasks, including preparing the expected results
    and running 'test_cmp', are often extracted into a helper
    function, and some of this helper's callsites expect no output.

  - For the same reason as above, the whole 'test_expect_success'
    block is within a helper function, e.g. in 't3070-wildmatch.sh'.

  - Or 'test_cmp' is invoked in a loop, e.g. the test 'cvs update
    (-p)' in 't9400-git-cvsserver-server.sh'.

Signed-off-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tests: use 'test_must_be_empty' instead of '! test -s'</title>
<updated>2018-08-21T18:48:29Z</updated>
<author>
<name>SZEDER Gábor</name>
<email>szeder.dev@gmail.com</email>
</author>
<published>2018-08-19T21:57:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ec10b018e76b3f4f40db96a24202c6b8c056bd0f'/>
<id>urn:sha1:ec10b018e76b3f4f40db96a24202c6b8c056bd0f</id>
<content type='text'>
Using 'test_must_be_empty' is preferable to '! test -s', because it
gives a helpful error message if the given file is unexpectedly not
empty, while the latter remains completely silent.  Furthermore, it
also catches cases when the given file unexpectedly does not exist at
all.

This patch was basically created by:

  sed -i -e 's/! test -s/test_must_be_empty/' t[0-9]*.sh

with the following notable exceptions:

  - The '! test -s' check in '.gitmodules ignore=dirty suppresses
    submodules with untracked content' in 't7508-status.sh' is left
    as-is, because it's bogus and, therefore, it's subject of a
    dedicated patch.

  - The '! test -s' checks in 't9131-git-svn-empty-symlink.sh' and
    't9135-git-svn-moved-branch-empty-file.sh' are immediately
    preceeded by a 'test -f' to ensure that the files exist in the
    first place.  'test_must_be_empty' ensures that as well, so those
    'test -f' commands are removed as well.

Signed-off-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t4000-t4999: fix broken &amp;&amp;-chains</title>
<updated>2018-07-16T21:38:47Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2018-07-02T00:24:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f957f03b60163ffdc346cce44a67b0347a51190b'/>
<id>urn:sha1:f957f03b60163ffdc346cce44a67b0347a51190b</id>
<content type='text'>
Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t: move "git add submodule" into test blocks</title>
<updated>2017-06-15T16:10:47Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-06-14T10:58:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=17f2f88c9c9e0015cba6d962dc6d9e2329ddf713'/>
<id>urn:sha1:17f2f88c9c9e0015cba6d962dc6d9e2329ddf713</id>
<content type='text'>
Some submodule tests do some setup outside of a test_expect
block. This is bad because we won't actually check the
outcome of those commands. But it's doubly so because "git
add submodule" now produces a warning to stderr, which is
not suppressed by the test scripts in non-verbose mode.

This patch does the minimal to fix the annoying warnings.
All three of these scripts could use more cleanup of related
setup.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/diff-submodule-diff-inline'</title>
<updated>2017-05-29T03:34:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-05-29T03:34:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a531ecf399a5d2ddb97dbd79bbcdad2dd93e7268'/>
<id>urn:sha1:a531ecf399a5d2ddb97dbd79bbcdad2dd93e7268</id>
<content type='text'>
"git diff --submodule=diff" now recurses into nested submodules.

* jk/diff-submodule-diff-inline:
  diff: recurse into nested submodules for inline diff
</content>
</entry>
</feed>
