summaryrefslogtreecommitdiff
path: root/guix/git.scm
AgeCommit message (Collapse)Author
2026-01-13git: Guard against git submodules lacking a path.Maxim Cournoyer
* guix/git.scm (update-submodules) <directory>: Remove extraneous "/" in file name. Only recurse when the directory exists. Fixes: #5579 Change-Id: Ica5e5de196bd1a3d5a0a41c34162c68c0855298d
2025-09-25git: Fix update cached checkout when not a symref.Simon Tournier
Follow up of 66463356ce5868d3551ea7014acb34543972a5d8. * guix/git.scm (update-cached-checkout)[symref?]: New procedure. [ref->refspecs]: New procedure. Use them. Change-Id: Ia2cb7db45222d59d61a2349bec277fd06456844b Signed-off-by: Ludovic Courtès <ludo@gnu.org> Modified-by: Ludovic Courtès <ludo@gnu.org>
2025-09-23guix: update-cached-checkout: Fix fetching remote for branches, commits and ↵Rutherther
tags. Follow up of 66463356ce5868d3551ea7014acb34543972a5d8. Because of the mentioned change, update-cached-checkout doesn't update the checkout for branches, commits or tags. This means `guix pull` with %default-channels no longer pulls newer versions. `forward-update-check` no longer fetches the commit to check relations for, leading to an error that reference is not available. * guix/git.scm (update-cached-checkout): Fetch remote even if symref-list is empty. Change-Id: Ia6bb1c669065cf19a6dd16c2a403e8590bc07613
2025-09-23git: Create/update remote references locally when needed.Romain GARBAGE
This allows ‘update-cached-checkout’ to fetch symbolic references such as those created by the AGit workflow with Forgejo instances. * guix/git.scm (update-cached-checkout): Create/update remote references locally. Change-Id: Ice761d09eebc4f1275381a4eefbdd679d9b95127 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-06-16git: Move ‘core.autocrlf’ settings.Simon Tournier
Follow up of b5e567bb2b277f89af493ba8cd0799fdb368a184. * guix/git.scm (clone*): Move ‘core.autocrlf’ settings from here... (update-cached-checkout): ...to here. Change-Id: I0f91d348376f9953cfbc497148596b738705818b Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-05-18git: Remove code for Guile-Git < 0.10.0.Ludovic Courtès
* guix/git.scm (commit-relation, commit-descendant?): Remove code for Guile-Git < 0.10.0. (set-git-timeouts): Remove code for Guile-Git < 0.9.0. (report-git-error): Remove code for ancient Guile-Git. Change-Id: Ie597151ce4c1e5ea006e2783fcc510caed3f566c
2025-04-25git: Add support for symbolic references.Romain GARBAGE
The #:refspecs argument was added in Guile-Git 0.10.0. * guix/git.scm (update-cached-checkout): Define ‘symref-list’. Pass it as #:refspecs to ‘remote-fetch’. Change-Id: Ib7874e2a30f97e51fdfdc2231a3bc5a3b45a177d Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-04-23git: Remove compatibility shim for Guile-Git <= 0.5.2.Ludovic Courtès
Guile-Git 0.5.2 was released in July 2021. * guix/git.scm (GITERR_HTTP): Remove. Change-Id: I05b2ee36f786bd83ca91c8989912f83f6dde59c0
2025-04-23git: Use ‘graph-descendant?’ from Guile-Git >= 0.10.0 when available.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/66268>. Fixes a bug whereby ‘commit-relation’ and ‘commit-descendant?’ would provide an incorrect result when two distinct <commit> objects would exist for the same commit, which happens when the commit’s metadata is beyond 4 KiB at least as of libgit2 1.8/1.9. This, in turn, would lead ‘guix pull’ & co. to wrongfully report an attempt to downgrade and pull to an unrelated commit. * guix/git.scm (commit-relation): When (git graph) is available, rewrite in terms of ‘graph-descendant?’. (commit-descendant?): Likewise. Change-Id: Ie52b188a8dfa90c95a73387c3ab2fdd04d2bf3e9 Reported-by: Tomas Volf <~@wolfsden.cz>
2025-04-14git: Override the user’s ‘core.autocrlf’ settings.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/77214>. Fixes a bug whereby setting ‘core.autocrlf’ to ‘true’ in ~/.gitconfig would lead ‘guix pull’ & co. to obtain non-bit-identical files, including possibly syntactically-invalid Scheme files. * guix/git.scm (clone*): Set ‘core.autocrlf’ to ‘input’. Reported-by: Jodi Jodingtonstinski <jodijodingtondev@gmail.com> Change-Id: I11fb20813a9fc1e14828ca8ebf5092c4b1181e5c
2025-02-24git: Really enable timeouts when supported by Guile-Git.Ludovic Courtès
This is a followup to 8bd013011ddde259c0dd0334847ce31a63263962. Previously, the call to ‘defined?’ would look for those bindings in (current-module), where chances were that they would be missing; consequently timeouts were never enabled. This fixes that. * guix/git.scm (set-git-timeouts)[defined?]: New procedure. Change-Id: Ia14a351fd6d508f760992d7bb68d2f4bb61f8468
2024-12-25git: Allow X.509 certificate verification to be disabled.Ludovic Courtès
* guix/git.scm (make-default-fetch-options): Add #:verify-certificate? and honor it. Define ‘warn-for-invalid-certificate’. (clone*): Add #:verify-certificate? and pass it on. (clone/swh-fallback): Likewise. (update-cached-checkout): Likewise. (latest-repository-commit): Likewise. Change-Id: Ibf535a4a8d2a7e0c4026a896da9d4ab72e85401a
2024-12-25git: Remove Guile-Git < 0.4.0 compatibility fallback.Ludovic Courtès
Guile-Git 0.4.0 was released in October 2020. * guix/git.scm (make-default-fetch-options): Remove ‘wrong-number-of-args’ fallback. Change-Id: I5ebcb7212fd96241ea5defc4127e9880a6dd9667
2024-10-22git: Add server connection and read timeouts.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/71818>. * guix/git.scm (set-git-timeouts): New procedure. (update-cached-checkout): Add #:connection-timeout and #:read-timeout. Call ‘set-git-timeouts’. Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Change-Id: Ibbd4fc6104ce66afed880b3975c129abbc2ab755
2024-07-18git: Remove untracked files from cached checkouts.Ludovic Courtès
Cached checkouts could end up with stale untracked files, for example because the checkout was interrupted. As a result, when this happens for the Guix checkout, users would not get substitutes for ‘guix pull’. * guix/git.scm (delete-untracked-files): New procedure. (switch-to-ref): Use it. * tests/git.scm ("update-cached-checkout, untracked files removed"): New test. Co-authored-by: Ricardo Wurmus <rekado@elephly.net> Change-Id: Iccbe644ade396ad27a037db7e0ef1c2a68ef91ce
2024-04-15Autoload (gcrypt hash).Ludovic Courtès
* guix/derivations.scm: Autoload (guix utils) and (gcrypt hash). * guix/git.scm, guix/store.scm: Autoload (gcrypt hash). Change-Id: I6145231d41c61f2d8c36e28f29e91074910bdd15
2024-04-15Autoload (guix build syscalls).Ludovic Courtès
* guix/discovery.scm, guix/git.scm, guix/nar.scm, guix/scripts.scm, guix/scripts/build.scm: Autoload (guix build syscalls). * guix/packages.scm: Autoload (guix build utils). Change-Id: Ia7703b5f46e55fbfadff63b13c35bfe097ce2220
2024-04-15git: Add ‘tag->commit’ and use it in (guix channels).Ludovic Courtès
* guix/git.scm (tag->commit): New procedure, taken from… (resolve-reference): … here. Use it in the ‘tag’ case. * guix/channels.scm (resolve-channel-news-entry-tag): Use ‘tag->commit’ instead of custom code. Change-Id: I46ea387345dc1b695ce0702991a52d0cde29e2f0
2024-04-15channels: Move ‘commit-short-id’ to (guix git).Ludovic Courtès
* guix/channels.scm (commit-short-id): Move to… * guix/git.scm (commit-short-id): … here. Change-Id: If4b34b1d82b1aa5068d157f26e57e8aecc967061
2024-04-15git: Add ‘repository-info’ and use it in (guix channels).Ludovic Courtès
* guix/git.scm (repository-info): New procedure. * guix/channels.scm (repository->guix-channel): Use it instead of local code. Change-Id: I74c758c73a22e16031571ca4271cc9cab0492f6e
2023-11-22git: Shell out to ‘git gc’ when necessary.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/65720>. This fixes a bug whereby libgit2-managed checkouts would keep growing as we fetch. * guix/git.scm (packs-in-git-repository, maybe-run-git-gc): New procedures. (update-cached-checkout): Use it.
2023-11-11guix: Properly compute progress bar width.Julien Lepiller
* guix/progress.scm (progress-reporter/bar): Take font width into account to compute progress bar width. * guix/git.scm (show-progress): Take font width into account to compute progress bar width. Change-Id: I946e447c1ea7c6eb4ff805400280f39e8f1a7c02
2023-09-25git: Restore 'false-if-git-not-found' in 'reference-available?'.Simon Tournier
* guix/git/scm (reference-available?): Add 'false-if-git-not-found' for the case 'commit.
2023-09-22git: Avoid touching the network unless needed in 'reference-available?'.Simon Tournier
Follow-up of 756e336fa008c2469b4a7317ad5c641ed48f25d6 fixing the issue. * guix/git/scm (reference-available?): Address case by case to determine whether the reference exists in the local Git checkout.
2023-09-05git: Fix typo in reference-available? comment.Maxim Cournoyer
* guix/git.scm (reference-available?): Fix typo.
2023-09-05Revert "guix: git: Avoid touching the network unless needed in ↵Maxim Cournoyer
'reference-available?'." This reverts commit a789dd58656d5f7f1b8edf790d77753fc71670af, which broke e.g.: guix time-machine -C <(echo %default-channels) -- describe Add an explanatory comment as suggested. Reported-by: Ludovic Courtès <ludo@gnu.org>
2023-08-29guix: git: Avoid touching the network unless needed in 'reference-available?'.Simon Tournier
* guix/git/scm (reference-available?): Use the resolve-reference procedure to determine whether the reference exists in the local Git checkout. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2023-08-16git: Clarify commit relation reference in doc.Maxim Cournoyer
* guix/git.scm (update-cached-checkout): Clarify that it is the relation of STARTING-COMMIT that is returned, relative to the new commit, not the other way around.
2023-03-13guix: Strip #:use-module lists.Ludovic Courtès
This was obtained by setting up this environment: guix shell -D guix --with-input=guile@3.0.9=guile-next \ --with-commit=guile-next=e2ed33ef0445c867fe56c247054aa67e834861f2 -- make -j5 then adding 'unused-module' to (@@ (guix build compiler) %warnings), building, and checking all the "unused module" warnings and removing those that were definitely unused.
2023-02-19git: Make better use of the better progress bar.Tobias Geerinckx-Rice
Commit 189525412e3d803f3f77e15ec4a62aaa57f65a2d introduced ‘high-resolution’ Unicode progress bars, but these require more granular calls to reach their full potential. * guix/git.scm (show-progress): Derive the number of PROGRESS-BAR updates from its maximum resolution, rather than hard-coding 100.
2023-02-19git: Factor out INDEXER-PROGRESS-TOTAL-OBJECTS access.Tobias Geerinckx-Rice
* guix/git.scm (show-progress): Reuse the result of the first call.
2022-10-17git: 'update-cached-checkout' returns the commit ID when given a tag.Ludovic Courtès
Previously, starting with commit efa578ecaece67366b4b0e2266de7c2faaa4ae54, 'update-cached-checkout' would return the OID of the annotated tag the tag points to. With this change it returns the OID of the commit object in all cases. * guix/git.scm (resolve-reference): In the 'tag' case, call 'tag-target-id' and 'tag-lookup' when OID designates an annotated tag. * tests/git.scm ("update-cached-checkout, tag"): New test.
2022-10-15git: 'update-cached-checkout' recognizes truncated commit IDs.Ludovic Courtès
Fixes a regression introduced in 602527ab9778165ca9a8f9cb62036038b5354688 that broke 'tests/guix-build-branch.sh'. * guix/git.scm (resolve-reference): Revert change from 602527ab9778165ca9a8f9cb62036038b5354688.
2022-10-11git: Factorize 'commit-id?' predicate.Ludovic Courtès
* guix/git.scm (commit-id?): New procedure, copied from (guix swh). (resolve-reference): Use it instead of inline code. * guix/inferior.scm (channel-full-commit): Likewise.
2022-02-14git: Add 'commit-descendant?'.Ludovic Courtès
* guix/git.scm (commit-descendant?): New procedure. * tests/git.scm ("commit-descendant?"): New test.
2022-01-06upstream: Support updating and fetching 'git-fetch' origins.Sarah Morgensen
Updaters need to be modified to return 'git-reference' objects. This patch modifies the 'generic-git' and 'minetest' updater, but others might need to be modified as well. * guix/git.scm (git-reference->git-checkout): New procedure. * guix/upstream.scm (package-update/git-fetch): New procedure. (<upstream-source>)[urls]: Document it can be a 'git-reference'. (%method-updates): Add 'git-fetch' mapping. (update-package-source): Support 'git-reference' sources. (upstream-source-compiler/url-fetch): Split off from ... (upstream-source-compiler): ... this, and call ... (upstream-source-compiler/git-fetch): ... this new procedure if the URL field contains a 'git-reference'. * guix/import/git.scm (latest-git-tag-version): Always return two values and document that the tag is returned as well. (latest-git-release)[urls]: Use the 'git-reference' instead of the repository URL. * guix/import/minetest.scm (latest-minetest-release)[urls]: Don't wrap the 'git-reference' in a list. * tests/minetest.scm (upstream-source->sexp): Adjust to new convention. Co-authored-by: Maxime Devos <maximedevos@telenet.be> Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-18git: 'reference-available?' recognizes 'tag-or-commit'.Ludovic Courtès
* guix/git.scm (reference-available?): Handle 'tag-or-commit' with a 40-digit hex string.
2021-09-18git: 'update-cached-checkout' can fall back to SWH when cloning.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/44187>. Reported by zimoun <zimon.toutoune@gmail.com>. * guix/git.scm (GITERR_HTTP): New variable. (clone-from-swh, clone/swh-fallback): New procedures. (update-cached-checkout): Use 'clone/swh-fallback' instead of 'clone*'.
2021-09-18import: Add 'generic-git' updater.Xinglu Chen
* guix/git.scm (ls-remote-refs): New procedure. * tests/git.scm ("remote-refs" "remote-refs: only tags"): New tests. * guix/import/git.scm: New file. * doc/guix.texi (Invoking guix refresh): Document it. * tests/import-git.scm: New test file. * Makefile.am (MODULES, SCM_TESTS): Register the new files. Co-authored-by: Sarah Morgensen <iskarian@mgsn.dev> Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-08transformations: Git tags and 'git describe' style IDs are used as version.Marius Bakke
* guix/transformations.scm (commit->version-string): New procedure. Use git tags and 'git describe' style identifiers directly. (transform-package-source-commit): Adjust accordingly. * tests/transformations.scm ("options->transformation, with-commit, version transformation"): New test. * doc/guix.texi (Package Transformation Options): Mention the 'git describe' style.
2021-09-08git: 'resolve-reference' handles 'git describe'-style commit IDs.Marius Bakke
* guix/git.scm (resolve-reference): Rewrite tag-or-commit case to recognize 'git describe' style identifiers and resolve them as commits. * doc/guix.texi (origin Reference): Mention it.
2021-06-12git: Update the mtime of the just-updated checkout.Ludovic Courtès
Reported by zimoun <zimon.toutoune@gmail.com>. Previously, the mtime of CACHE-DIRECTORY may or may not have been updated after a pull. Thus, 'maybe-remove-expired-cache-entries' could potentially delete CACHE-DIRECTORY right before it's returned. * guix/git.scm (update-cached-checkout): Call 'utime' on CACHE-DIRECTORY.
2021-04-14git: Honor proxy settings when fetching submodules.Ludovic Courtès
Fixes <https://bugs.gnu.org/44593>. * guix/git.scm (update-submodules): Add #:fetch-options and honor it. (update-cached-checkout): Pass #:fetch-options to 'update-submodules'. * doc/guix.texi (Requirements): Adjust comment about Guile-Git.
2021-04-10git: Update cached checkout to the remote HEAD by default.Kyle Meyer
Fixes <https://bugs.gnu.org/45187>. Reported by Ricardo Wurmus <rekado@elephly.net>. update-cached-checkout hard codes "master" as the default branch, leading to a failure when the clone doesn't have a "master" branch. Instead use the remote HEAD symref as an indicator of what the primary branch is. * guix/git.scm (resolve-reference): Support resolving symrefs. (update-cached-checkout, latest-repository-commit): Change the default for REF to the empty list and translate it to the remote HEAD symref. (<git-checkout>): Change branch field's default to #f. (git-checkout-compiler): When branch and commit fields are both #f, call latest-repository-commit* with the empty list as the ref. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-02git: Remove unused variables.Ludovic Courtès
This is a followup to 298f9d29d6c26e408a90d08d147d926aa6f81ab3, which left those variables despite being unnecessary. * guix/git.scm (clone*, update-cached-checkout): Remove unused 'auth-method' variable.
2021-01-13git: Periodically delete least-recently-used cached checkouts.Ludovic Courtès
This ensures ~/.cache/guix/checkouts is periodically cleaned up. * guix/git.scm (cached-checkout-expiration) (%checkout-cache-cleanup-period): New variables. (delete-checkout): New procedure. (update-cached-checkout)[cache-entries]: New procedure. Add call to 'maybe-remove-expired-cache-entries'. * guix/cache.scm (file-expiration-time): Add optional 'timestamp' parameter and honor it.
2020-12-04git: 'reference-available?' handles short commit IDs.Ludovic Courtès
Reported by Simon Tournier on #guix. Until now 'reference-available?' would always return #f when passed a short commit ID. * guix/git.scm (reference-available?): Call 'object-lookup-prefix' when COMMIT is shorter than 40 characters.
2020-10-22git: Support HTTP and HTTPS proxies.Ludovic Courtès
This allows 'guix pull' and similar to fetch code over a proxy. * guix/git.scm (make-default-fetch-options): Pass #:proxy-url.
2020-10-22git: Display a progress bar while fetching a repo.Ludovic Courtès
Fixes <https://bugs.gnu.org/39260>. This uses the API of the yet-to-be-released Guile-Git 0.4.0. Using an older version is still possible, but progress report is disabled. * guix/git.scm (show-progress, make-default-fetch-options): New procedures. (clone*, update-cached-checkout): Use it instead of 'make-fetch-options'.
2020-10-22git: Require Guile-Git 0.3.0 or later.Ludovic Courtès
* guix/git.scm (auth-supported?): Remove. (clone*): Inline code that was dependent on AUTH-SUPPORTED?. (update-cached-checkout): Likewise. (resolve-reference): Remove check for 'object-lookup-prefix' and use it unconditionally. (load-git-submodules): Remove. (update-submodules): Use 'repository-submodules', 'submodule-lookup', etc. unconditionally. (update-cached-checkout): Use 'repository-close!' unconditionally. * m4/guix.m4 (GUIX_CHECK_GUILE_GIT): New macro. * configure.ac: Use it and error out when it fails. * doc/guix.texi (Requirements): Bump to Guile-Git 0.3.0.