<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/t/t7510-signed-commit.sh, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-07-29T15:07:42Z</updated>
<entry>
<title>t7510: use $PWD instead of $(pwd) inside PATH</title>
<updated>2025-07-29T15:07:42Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2025-07-25T05:13:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c26ecaf069080c6f9f98925530394a5b4c53e325'/>
<id>urn:sha1:c26ecaf069080c6f9f98925530394a5b4c53e325</id>
<content type='text'>
On Windows, $(pwd) will give us a Windows-style path like "D:/foo".
Putting that into $PATH confuses anybody parsing that variable, since
colon is a separator character in $PATH. Instead, we should use the
Unix-style value we get from $PWD ("/d/foo").

This is similar to the cases fixed by 71dd50472d (t0021, t5615: use $PWD
instead of $(pwd) in PATH-like shell variables, 2016-11-11).

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>t7510: add test cases for non-absolute gpg program</title>
<updated>2025-07-22T20:28:58Z</updated>
<author>
<name>Jonas Brandstötter</name>
<email>jonas.brandstoetter@gmx.at</email>
</author>
<published>2025-07-22T19:09:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=26ef8872f1ccb095ef7d263edac1e844d6516bfd'/>
<id>urn:sha1:26ef8872f1ccb095ef7d263edac1e844d6516bfd</id>
<content type='text'>
These cases cover scenarios where `gpg.program` is set as a program in
`$PATH` or as a path relative to the user's home directory.

Signed-off-by: Jonas Brandstötter &lt;jonas.brandstoetter@gmx.at&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>builtin/verify-commit: stop using `the_repository`</title>
<updated>2025-03-08T00:52:01Z</updated>
<author>
<name>Usman Akinyemi</name>
<email>usmanakinyemi202@gmail.com</email>
</author>
<published>2025-03-07T23:35:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=db58d5a351031ec51817c1a6566ec5672ba17138'/>
<id>urn:sha1:db58d5a351031ec51817c1a6566ec5672ba17138</id>
<content type='text'>
Remove the_repository global variable in favor of the repository
argument that gets passed in "builtin/verify-commit.c".

When `-h` is passed to the command outside a Git repository, the
`run_builtin()` will call the `cmd_verify_commit()` function with `repo`
set to NULL and then early in the function, `parse_options()` call will
give the options help and exit.

Pass the repository available in the calling context to `verify_commit()`
to remove it's dependency on the global `the_repository` variable.

Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Usman Akinyemi &lt;usmanakinyemi202@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t: remove TEST_PASSES_SANITIZE_LEAK annotations</title>
<updated>2024-11-20T23:23:48Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-11-20T13:39:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fc1ddf42af6742fae7e770cae20e30d7902014c0'/>
<id>urn:sha1:fc1ddf42af6742fae7e770cae20e30d7902014c0</id>
<content type='text'>
Now that the default value for TEST_PASSES_SANITIZE_LEAK is `true` there
is no longer a need to have that variable declared in all of our tests.
Drop it.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pretty: clear signature check</title>
<updated>2024-11-05T06:37:53Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-11-05T06:17:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0b20a28811390ad8a1f7e22928018e5241738446'/>
<id>urn:sha1:0b20a28811390ad8a1f7e22928018e5241738446</id>
<content type='text'>
The signature check in the formatting context is never getting released.
Fix this to plug the resulting memory leak.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t/lib-gpg: introduce new prereq GPG2</title>
<updated>2023-06-06T00:32:12Z</updated>
<author>
<name>Kousik Sanagavarapu</name>
<email>five231003@gmail.com</email>
</author>
<published>2023-06-04T18:22:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2f36339fa8622ee1cba957e8d0ef15719c697de3'/>
<id>urn:sha1:2f36339fa8622ee1cba957e8d0ef15719c697de3</id>
<content type='text'>
GnuPG v2.0.0 released in 2006, which according to its release notes

	https://gnupg.org/download/release_notes.html

is the "First stable version of GnuPG integrating OpenPGP and S/MIME".

Use this version or its successors for tests that will fail for
versions less than v2.0.0 because of the difference in the output on
stderr between the versions (v2.* vs v0.* or v2.* vs v1.*). Skip if
the GPG version detected is less than v2.0.0.

Do not, however, remove the existing prereq GPG yet since a lot of tests
still work with the prereq GPG (that is even with versions v0.* or v1.*)
and some systems still use these versions.

Mentored-by: Christian Couder &lt;christian.couder@gmail.com&gt;
Mentored-by: Hariom Verma &lt;hariom18599@gmail.com&gt;
Signed-off-by: Kousik Sanagavarapu &lt;five231003@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>gpg-interface: set trust level of missing key to "undefined"</title>
<updated>2023-04-19T15:30:54Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2023-04-19T01:29:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7891e465856e539c4a102dadec6dca9ac51c38df'/>
<id>urn:sha1:7891e465856e539c4a102dadec6dca9ac51c38df</id>
<content type='text'>
In check_signature(), we initialize the trust_level field to "-1", with
the idea that if gpg does not return a trust level at all (if there is
no signature, or if the signature is made by an unknown key), we'll
use that value. But this has two problems:

  1. Since the field is an enum, it's up to the compiler to decide what
     underlying storage to use, and it only has to fit the values we've
     declared. So we may not be able to store "-1" at all. And indeed,
     on my system (linux with gcc), the resulting enum is an unsigned
     32-bit value, and -1 becomes 4294967295.

     The difference may seem academic (and you even get "-1" if you pass
     it to printf("%d")), but it means that code like this:

       status |= sigc-&gt;trust_level &lt; configured_min_trust_level;

     does not necessarily behave as expected. This turns out not to be a
     bug in practice, though, because we keep the "-1" only when gpg did
     not report a signature from a known key, in which case the line
     above:

       status |= sigc-&gt;result != 'G';

     would always set status to non-zero anyway. So only a 'G' signature
     with no parsed trust level would cause a problem, which doesn't
     seem likely to trigger (outside of unexpected gpg behavior).

  2. When using the "%GT" format placeholder, we pass the value to
     gpg_trust_level_to_str(), which complains that the value is out of
     range with a BUG(). This behavior was introduced by 803978da49
     (gpg-interface: add function for converting trust level to string,
     2022-07-11). Before that, we just did a switch() on the enum, and
     anything that wasn't matched would end up as the empty string.

     Curiously, solving this by naively doing:

       if (level &lt; 0)
               return "";

     in that function isn't sufficient. Because of (1) above, the
     compiler can (and does in my case) actually remove that conditional
     as dead code!

We can solve both by representing this state as an enum value. We could
do this by adding a new "unknown" value. But this really seems to match
the existing "undefined" level well. GPG describes this as "Not enough
information for calculation".

We have tests in t7510 that trigger this case (verifying a signature
from a key that we don't have, and then checking various %G
placeholders), but they didn't notice the BUG() because we didn't look
at %GT for that case! Let's make sure we check all %G placeholders for
each case in the formatting tests.

The interesting ones here are "show unknown signature with custom
format" and "show lack of signature with custom format", both of which
would BUG() before, and now turn %GT into "undefined". Prior to
803978da49 they would have turned it into the empty string, but I think
saying "undefined" consistently is a reasonable outcome, and probably
makes life easier for anyone parsing the output (and any such parser had
to be ready to see "undefined" already).

The other modified tests produce the same output before and after this
patch, but now we're consistently checking both %G? and %GT in all of
them.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Reported-by: Rolf Eike Beer &lt;eb@emlix.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'js/gpg-errors'</title>
<updated>2023-02-24T19:32:29Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-02-24T19:32:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=38a227b796653d61a21d9b31e44e48dd66f647e0'/>
<id>urn:sha1:38a227b796653d61a21d9b31e44e48dd66f647e0</id>
<content type='text'>
Error messages given upon a signature verification failure used to
discard the errors from underlying gpg program, which has been
corrected.

* js/gpg-errors:
  gpg: do show gpg's error message upon failure
  t7510: add a test case that does not need gpg
</content>
</entry>
<entry>
<title>gpg: do show gpg's error message upon failure</title>
<updated>2023-02-15T16:55:24Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2023-02-15T05:58:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ad6b320756d8d9150291c696a02c86d1c2f0f4b2'/>
<id>urn:sha1:ad6b320756d8d9150291c696a02c86d1c2f0f4b2</id>
<content type='text'>
There are few things more frustrating when signing a commit fails than
reading a terse "error: gpg failed to sign the data" message followed by
the unsurprising "fatal: failed to write commit object" message.

In many cases where signing a commit or tag fails, `gpg` actually said
something helpful, on its stderr, and Git even consumed that, but then
keeps mum about it.

Teach Git to stop withholding that rather important information.

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>t7510: add a test case that does not need gpg</title>
<updated>2023-02-15T16:55:22Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2023-02-15T05:58:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8300d15d5ecea1e41b2b1d381238ccaaec501dd4'/>
<id>urn:sha1:8300d15d5ecea1e41b2b1d381238ccaaec501dd4</id>
<content type='text'>
This test case not only increases test coverage in setups without
working gpg, but also prepares for verifying that the error message of
`gpg.program` is shown upon failure.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
