Subject: [bug#49581] [PATCH v3] gnu: Add git-issues.

From: Sarah Morgensen <[email-masked]>
Date: Wed, 22 Sep 2021 15:14:53 -0700

Hello Petr,

Thanks for your updated patch.  This looks like a great tool.  After
making the changes below, I gave it a try, and I might use it myself
when I can't use fossil!

I was unable to apply your patch with `git am'; I had to guess which
commit it was based on and manually apply it.  In the future, please
configure your git to include the base commit with

  git config --local format.useautobase whenAble

or use the `--base' command line option:

  git format-patch --base=a916d50566

phodina <[email-masked]> writes:

> * gnu/packages/version-control.scm (git-issues): New variable.
>
> diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
> index 7c1dbe8b26..cff1190094 100644
> --- a/gnu/packages/version-control.scm
> +++ b/gnu/packages/version-control.scm
> @@ -39,6 +39,7 @@
>  ;;; Copyright © 2021 LibreMiami <[email-masked]>
>  ;;; Copyright © 2021 Xinglu Chen <[email-masked]>
>  ;;; Copyright © 2021 François J. <[email-masked]>
> +;;; Copyright © 2021 Petr Hodina <[email-masked]>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -1267,6 +1268,36 @@ subcommands helps automate some parts of the flow to make working with it a
>  lot easier.")
>      (license license:bsd-2)))
>
> +(define-public git-issues

The name should be "git-issue" since that's the name of the project and
the command.

> +  (let ((commit "67aacad35888b4c51e2d7be35c86fef137874f12")
> +        (revision "1"))
> +    (package
> +      (name "git-issues")
> +      (version commit)
> +      (source (origin
> +                (method git-fetch)
> +                (uri
> +                 (git-reference
> +                  (url "https://github.com/dspinellis/git-issue")
> +                  (commit version)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                  "1z6dpwbikmiq5acpbji4kvmxqc2jw995rfk5703k5mvp5ps9a29q"))))
> +      (build-system gnu-build-system)
> +      (arguments
> +       '(#:tests? #f

Please add a comment explaining why tests are disabled.  For example, I
attempted to run the tests and found that they must be run in a git
repository, and that a global user.name and user.email must be
configured.

> +         #:make-flags (list (string-append "PREFIX="(assoc-ref %outputs "out")))

Please add a space after "PREFIX=" and wrap the line.

> +         #:phases (modify-phases %standard-phases
> +                    (delete 'configure)
> +                    (delete 'build))))
> +      (synopsis "Git-based decentralized issue management")
> +      (description "Git-issues provide a minimalist decentralized issue
> +management system based on Git, offering (optional) bidirectional integration
> +with GitHub and GitLab issue management.")

This is a bit short.  How about:

--8<---------------cut here---------------start------------->8---
      (description "@command{git-issue} provides a minimalist decentralized
issue management system based on Git, offering (optional) bidirectional
integration with GitHub and GitLab issue management.  Issues are stored as
simple text files, so no special tools are required to access your data, and
issues are changed and shared through Git, so no special infrastructure is
necessary to manage your data.")
--8<---------------cut here---------------end--------------->8---

> +      (home-page "https://github.com/dspinellis/git-issue")
> +      (license license:gpl3+))))
> +
>  (define-public stgit
>    (package
>      (name "stgit")
> --
> 2.32.0

Additionally, it looks like git-issue depends on several tools: cat,
curl, grep, git, find, jq, and sed, at least.  These should probably be
included in inputs and substituted in the script, perhaps with:

--8<---------------cut here---------------start------------->8---
(add-before 'install 'patch-paths
  (lambda* (#:key inputs #:allow-other-keys)
    (define (input-file input file)
      (string-append (assoc-ref inputs input) "/" file))

    (substitute* '("git-issue.sh"
                   "lib/git-issue/import-export.sh"
                   "scripts/replacerefs.sh")
      (("\\bcat\\b") (input-file "coreutils" "bin/cat"))
      (("\\bcurl\\b") (input-file "curl" "bin/curl"))
      (("\\bdate\\b") (input-file "coreutils" "bin/date"))
      (("\\bgit\\b") (input-file "git-minimal" "bin/git"))
      (("\\bgrep\\b") (input-file "grep" "bin/grep"))
      (("\\bfind\\b") (input-file "findutils" "bin/find"))
      (("\\bjq\\b") (input-file "jq" "bin/jq"))
      (("\\bsed\\b") (input-file "sed" "bin/sed"))
      ;; Substitute back any usage examples.
      (("((usage|Example): )/gnu/store/[^/]+/bin/(\\w+)"
        all start exec)
       (string-append start exec)))))
--8<---------------cut here---------------end--------------->8---

I may have missed a few utilities, though.

Thank you!

--
Sarah