aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md9
-rw-r--r--bridge/github/import.go22
-rw-r--r--bridge/gitlab/config.go3
-rw-r--r--commands/ls.go28
4 files changed, 48 insertions, 14 deletions
diff --git a/README.md b/README.md
index 200b2033..8c51d6d5 100644
--- a/README.md
+++ b/README.md
@@ -48,6 +48,15 @@ That's all !
</details>
+<details><summary>Windows packages</summary>
+
+* [Scoop](https://github.com/ScoopInstaller/Main/blob/master/bucket/git-bug.json)
+ ```
+ scoop install git-bug
+ ```
+
+</details>
+
<details><summary>Linux packages</summary>
* [Archlinux (AUR)](https://aur.archlinux.org/packages/?K=git-bug)
diff --git a/bridge/github/import.go b/bridge/github/import.go
index a41083d2..1db67469 100644
--- a/bridge/github/import.go
+++ b/bridge/github/import.go
@@ -184,7 +184,7 @@ func (gi *githubImporter) ensureIssue(ctx context.Context, repo *cache.RepoCache
// resolve bug
b, err := repo.ResolveBugMatcher(func(excerpt *cache.BugExcerpt) bool {
- return excerpt.CreateMetadata[core.MetaKeyOrigin] == target &&
+ return excerpt.CreateMetadata[metaKeyGithubUrl] == issue.Url.String() &&
excerpt.CreateMetadata[metaKeyGithubId] == parseId(issue.Id)
})
if err == nil {
@@ -195,12 +195,11 @@ func (gi *githubImporter) ensureIssue(ctx context.Context, repo *cache.RepoCache
}
// At Github there exist issues with seemingly empty titles. An example is
- // https://github.com/NixOS/nixpkgs/issues/72730 .
- // The title provided by the GraphQL API actually consists of a space followed by a
- // zero width space (U+200B). This title would cause the NewBugRaw() function to
- // return an error: empty title.
- title := string(issue.Title)
- if title == " \u200b" { // U+200B == zero width space
+ // https://github.com/NixOS/nixpkgs/issues/72730 (here the title is actually
+ // a zero width space U+200B).
+ // Set title to some non-empty string, since git-bug does not accept empty titles.
+ title := text.CleanupOneLine(string(issue.Title))
+ if text.Empty(title) {
title = EmptyTitlePlaceholder
}
@@ -375,12 +374,11 @@ func (gi *githubImporter) ensureTimelineItem(ctx context.Context, repo *cache.Re
}
// At Github there exist issues with seemingly empty titles. An example is
- // https://github.com/NixOS/nixpkgs/issues/72730 .
- // The title provided by the GraphQL API actually consists of a space followed
- // by a zero width space (U+200B). This title would cause the NewBugRaw()
- // function to return an error: empty title.
+ // https://github.com/NixOS/nixpkgs/issues/72730 (here the title is actually
+ // a zero width space U+200B).
+ // Set title to some non-empty string, since git-bug does not accept empty titles.
title := text.CleanupOneLine(string(item.RenamedTitleEvent.CurrentTitle))
- if title == " \u200b" { // U+200B == zero width space
+ if text.Empty(title) {
title = EmptyTitlePlaceholder
}
diff --git a/bridge/gitlab/config.go b/bridge/gitlab/config.go
index 3496b4a3..4a714d09 100644
--- a/bridge/gitlab/config.go
+++ b/bridge/gitlab/config.go
@@ -3,7 +3,6 @@ package gitlab
import (
"fmt"
"net/url"
- "path"
"regexp"
"strconv"
"strings"
@@ -195,7 +194,7 @@ func promptTokenOptions(repo repository.RepoKeyring, login, baseUrl string) (aut
}
func promptToken(baseUrl string) (*auth.Token, error) {
- fmt.Printf("You can generate a new token by visiting %s.\n", path.Join(baseUrl, "profile/personal_access_tokens"))
+ fmt.Printf("You can generate a new token by visiting %s.\n", strings.TrimSuffix(baseUrl, "/")+"/-/profile/personal_access_tokens")
fmt.Println("Choose 'Create personal access token' and set the necessary access scope for your repository.")
fmt.Println()
fmt.Println("'api' access scope: to be able to make api calls")
diff --git a/commands/ls.go b/commands/ls.go
index 9134d752..db4145d0 100644
--- a/commands/ls.go
+++ b/commands/ls.go
@@ -133,6 +133,8 @@ func runLs(env *Env, opts lsOptions, args []string) error {
return lsPlainFormatter(env, bugExcerpt)
case "json":
return lsJsonFormatter(env, bugExcerpt)
+ case "compact":
+ return lsCompactFormatter(env, bugExcerpt)
case "default":
return lsDefaultFormatter(env, bugExcerpt)
default:
@@ -203,6 +205,32 @@ func lsJsonFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error {
return nil
}
+func lsCompactFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error {
+ for _, b := range bugExcerpts {
+ author, err := env.backend.ResolveIdentityExcerpt(b.AuthorId)
+ if err != nil {
+ return err
+ }
+
+ var labelsTxt strings.Builder
+ for _, l := range b.Labels {
+ lc256 := l.Color().Term256()
+ labelsTxt.WriteString(lc256.Escape())
+ labelsTxt.WriteString("◼")
+ labelsTxt.WriteString(lc256.Unescape())
+ }
+
+ env.out.Printf("%s %s %s %s %s\n",
+ colors.Cyan(b.Id.Human()),
+ colors.Yellow(b.Status),
+ text.LeftPadMaxLine(strings.TrimSpace(b.Title), 40, 0),
+ text.LeftPadMaxLine(labelsTxt.String(), 5, 0),
+ colors.Magenta(text.TruncateMax(author.DisplayName(), 15)),
+ )
+ }
+ return nil
+}
+
func lsDefaultFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error {
for _, b := range bugExcerpts {
author, err := env.backend.ResolveIdentityExcerpt(b.AuthorId)