Commit graph

12 commits

Author SHA1 Message Date
Brice Waegeneire
715b38815f
git authenticate: Create Git hooks directory.
* guix/scripts/git/authenticate.scm (install-hooks): Create Git hooks
directory if necessary.

Change-Id: Icb9b0674d42af78fe03a3c820369f8324db960b4
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-06-30 14:30:40 +02:00
Ludovic Courtès
99f85246e1
git authenticate: Do nothing when invoked from the keyring branch.
Fixes <https://issues.guix.gnu.org/78283>.

* guix/scripts/git/authenticate.scm (guix-git-authenticate): Call
‘current-branch’ and do nothing if it returns the keyring branch.

Reported-by: Vagrant Cascadian <vagrant@debian.org>
Change-Id: I66c2a3f4babf68ac1df0913db6bc708ac0c7968e
2025-06-22 23:45:36 +02:00
Ludovic Courtès
0ec5cab132
git authenticate: Gracefully handle passing an annotated tag to ‘--end’.
Partly fixes <https://issues.guix.gnu.org/74583>.

Previously, passing an annotated tag to ‘--end’, as can happen when
‘guix git authenticate’ is invoked by the pre-push hook when pushing
tags, would lead to an error:

  guix git: error: Git error: the requested type does not match the type in the ODB

* guix/scripts/git/authenticate.scm (ensure-commit-id): New procedure.
(guix-git-authenticate): Use it.
* tests/guix-git-authenticate.sh: Test with $v1_2_0_annotated_tag.

Change-Id: I22e8eb665609522c80c1f0dcb9e77a46c23c0c3c
2025-06-22 23:45:36 +02:00
Ludovic Courtès
56eb949f3b
git authenticate: Upgrade pre-push hook with a fixed version.
Partly fixes <https://issues.guix.gnu.org/74583>.

* guix/scripts/git/authenticate.scm (%pre-push-hook): New variable.
(install-hooks): Use it.
(broken-pre-push-hook?, maybe-upgrade-hooks): New procedures.
(guix-git-authenticate): Call ‘maybe-upgrade-hooks’ when ‘configured?’
returns true.

Change-Id: I39d34ab66ffe0f34170c0f562e9f97f2f69c9fdc
2025-06-22 23:45:36 +02:00
Ludovic Courtès
55b38ddefc
git authenticate: Remove support for Guile-Git < 0.7.0.
Guile-Git 0.7.0 was released in May 2024.

* guix/scripts/git/authenticate.scm (record-configuration): Remove
‘module-defined?’ condition for Guile-Git < 0.7.0.
(install-hooks): Likewise.

Change-Id: I27af82068b989d6a18ff1a66453e0a8d397ed380
2025-06-22 23:45:32 +02:00
Ludovic Courtès
8d1d98a3aa
git authenticate: Install pre-push and post-checkout hooks.
* guix/scripts/git/authenticate.scm (install-hooks): New procedure.
(guix-git-authenticate): Use it.
* doc/guix.texi (Invoking guix git authenticate): Document it.

Change-Id: I4464a33193186e85b476a12740e54412bd58429c
2024-05-01 17:26:19 +02:00
Ludovic Courtès
1a5041a502
git authenticate: Print something upon success.
Until now the command would be silent and exit with 0.

* guix/scripts/git/authenticate.scm (guix-git-authenticate): Print
something upon success.

Change-Id: I08d086c35df6ac74ee847df0479660293c68987d
2024-05-01 17:26:19 +02:00
Ludovic Courtès
88573dd928
git authenticate: Discover the repository.
This allows one to run ‘guix git authenticate’ from a sub-directory of
the checkout.

* guix/scripts/git/authenticate.scm (%default-options): Remove
‘directory’ key.
(guix-git-authenticate): Use ‘repository-discover’ when ‘directory’
option is missing.

Change-Id: Ifada00d559254971ed7eeb8c0a8d4ae74ff3defc
2024-05-01 17:26:18 +02:00
Ludovic Courtès
7b4bf4ee88
git authenticate: Record introduction and keyring in ‘.git/config’.
* guix/scripts/git/authenticate.scm (%default-options): Remove
‘keyring-reference’.
(config-value, configured-introduction, configured-keyring-reference)
(configured?, record-configuration, current-branch): New procedures.
(guix-git-authenticate)[missing-arguments]: New procedure.
Use ‘configured-introduction’ when zero arguments are given.
Use ‘configured-keyring-reference’ when ‘-k’ is not passed.  Add call to
‘record-configuration’.
* doc/guix.texi (Invoking guix git authenticate): Document it.

Change-Id: I66e111a83f50407b52da71662629947f83a78bbc
2024-05-01 17:26:18 +02:00
Ludovic Courtès
b7931e6f5d
git authenticate: Document ‘--end’.
* guix/scripts/git/authenticate.scm (show-help): Document ‘--end’.
* doc/guix.texi (Invoking guix git authenticate): Likewise.

Reported-by: Tomas Volf <~@wolfsden.cz>
Change-Id: Ia646203ce2f721487de547c76b9488754c70db66
2024-03-19 17:02:14 +01:00
Ludovic Courtès
5bd5bb5f6c
git authenticate: Gracefully handle invalid fingerprints.
Previously the command would crash when passed an invalid fingerprint on
the command line.

* guix/scripts/git/authenticate.scm (guix-git-authenticate)
[openpgp-fingerprint*]: New procedure.
Use it instead of ‘openpgp-fingerprint’.

Change-Id: I99e0549781382f36a684a84449b603e00b53778d
2024-02-12 12:03:52 +01:00
Ludovic Courtès
a98712785e
Add 'guix git authenticate'.
* guix/scripts/git.scm, guix/scripts/git/authenticate.scm,
tests/guix-git-authenticate.sh: New files.
* Makefile.am (MODULES): Add the *.scm files.
(SH_TESTS): Add 'tests/guix-git-authenticate.sh'.
* doc/guix.texi (Channels)[Specifying Channel Authorizations]: Mention
'guix git authenticate'.
(Invoking guix git authenticate): New node.
* po/guix/POTFILES.in: Add 'guix/scripts/git.scm' and
'guix/scripts/git/authenticate.scm'.
2020-07-11 12:33:01 +02:00