Subject: [PATCH v5] gnu: Add git-issue.

From: [email-masked]
Date: Mon, 29 May 2023 16:35:42 +0200

From: phodina <[email-masked]>

* gnu/packages/version-control.scm (git-issue): New variable.

Co-authored-by: Jelle Licht <[email-masked]>

---

Changes in v5:
- Update to latest commit of upstream
- Use gexp-style inputs
- Pass custom #:test-target instead of replacing check phase
- Use search-input-file where possible
- Autoload shellcheck to prevent module import cycle
- Use user-installed git, instead of hardcoding reference

 gnu/packages/version-control.scm | 68 ++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 1db0931ac3..4eff59e516 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -42,6 +42,7 @@
 ;;; Copyright © 2021 Julien Lepiller <[email-masked]>
 ;;; Copyright © 2021 Guillaume Le Vaillant <[email-masked]>
 ;;; Copyright © 2021 jgart <[email-masked]>
+;;; Copyright © 2021 Petr Hodina <[email-masked]>
 ;;; Copyright © 2021 Foo Chuan Wei <[email-masked]>
 ;;; Copyright © 2022 Jai Vetrivelan <[email-masked]>
 ;;; Copyright © 2022 Maxime Devos <[email-masked]>
@@ -140,6 +141,8 @@ (define-module (gnu packages version-control)
   #:use-module (gnu packages textutils)
   #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
+  ;; Using autoload to avoid a cycle.
+  #:autoload   (gnu packages haskell-apps) (shellcheck)
   #:use-module (gnu packages)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
@@ -1365,6 +1368,71 @@ (define-public git-flow
 lot easier.")
     (license license:bsd-2)))
 
+(define-public git-issue
+  (let ((commit "4d2bc4173bf803d74bf2ae54f892bd08754f1b48")
+        (revision "1"))
+    (package
+      (name "git-issue")
+      (version (git-version "0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri
+                 (git-reference
+                  (url "https://github.com/dspinellis/git-issue")
+                  (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0jmx8wjvvxkd3y5im2h96d13dnbpds66djf96b6s23jwfbr7dlsz"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:make-flags #~(list (string-append "PREFIX=" #$output))
+        #:test-target "test"
+        #:phases
+        #~(modify-phases %standard-phases
+           (delete 'configure)
+           (delete 'build)
+           (add-before 'check 'setup-env
+             (lambda* (#:key inputs native-inputs #:allow-other-keys)
+               (setenv "HOME" (getenv "TMPDIR"))
+               (invoke "git" "config" "--global" "user.email" "test")
+               (invoke "git" "config" "--global" "user.name" "Test")
+               (substitute* "test.sh"
+                 (("! git diff") "false")
+                 (("#!/bin/sh")
+                  (string-append
+                   "#!"
+                   (search-input-file (or native-inputs inputs) "/bin/sh"))))
+               (substitute* "Makefile"
+                 (("shellcheck -x")
+                  "shellcheck --exclude=SC2001,SC2294,SC3043,SC3003 -x"))))
+           (add-after 'install 'patch-paths
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let ((path (map
+                            (lambda (program)
+                              (dirname
+                               (search-input-file inputs
+                                                  (string-append "/bin/" program))))
+                            '("jq" "curl" "grep" "cat" "find"))))
+                 (wrap-program (search-input-file outputs "bin/git-issue")
+                   `("PATH" prefix ,path))))))))
+      (native-inputs (list shellcheck git-minimal bash-minimal util-linux))
+      (inputs (list bash-minimal
+                    coreutils
+                    curl
+                    findutils
+                    grep
+                    jq
+                    sed))
+      (synopsis
+       "Git-based decentralized issue management")
+      (description "Git-issue provide a minimalist decentralized issue
+management system based on Git, offering (optional) bidirectional
+integration with GitHub and GitLab issue management.")
+      (home-page "https://github.com/dspinellis/git-issue")
+      (license license:gpl3+))))
+
 (define-public stgit
   (package
     (name "stgit")

base-commit: cf78f5b54975679df97c3015a541114d8278f417
-- 
2.40.1