- Update to version 0.8.1+git.1746484874.96c7a111: * docs: update install, contrib, and usage documentation (#1222) * fix: resolve the remote URI using url.*.insteadOf (#1394) * build(deps): bump the go_modules group across 1 directory with 3 updates (#1376) * chore: gofmt simplify gitlab/export_test.go (#1392) * fix: checkout repo before setting up go environment (#1390) * feat: bump to go v1.24.2 (#1389) * chore: update golang.org/x/net (#1379) * fix: use -0700 when formatting time (#1388) * fix: use correct url for gitlab PATs (#1384) * refactor: remove depdendency on pnpm for auto-label action (#1383) * feat: add action: auto-label (#1380) * feat: remove lifecycle/frozen (#1377) * build(deps): bump the npm_and_yarn group across 1 directory with 12 updates (#1378) * feat: support new exclusion label: lifecycle/pinned (#1375) * fix: refactor how gitlab title changes are detected (#1370) * revert: "Create Dependabot config file" (#1374) * refactor: rename //:git-bug.go to //:main.go (#1373) * build(deps): bump github.com/vektah/gqlparser/v2 from 2.5.16 to 2.5.25 (#1361) * fix: set GitLastTag to an empty string when git-describe errors (#1355) * chore: update go-git to v5@masterupdate_mods (#1284) * refactor: Directly swap two variables to optimize code (#1272) * Update README.md Matrix link to new room (#1275) - Remove upstreamed patch: - CVE-2025-22869-bump-go-crypto-ssh.patch OBS-URL: https://build.opensuse.org/request/show/1275060 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/git-bug?expand=0&rev=10
107 lines
3.3 KiB
Diff
107 lines
3.3 KiB
Diff
From 65cfe2b3fff11d34b5ffc9f7e5d24aefb505497f Mon Sep 17 00:00:00 2001
|
|
From: William Ahern <william@25thandClement.com>
|
|
Date: Thu, 27 Jul 2023 22:06:45 -0700
|
|
Subject: [PATCH] pull, push: try reading git-bug.remote config value before
|
|
defaulting to 'origin' when no explicit REMOTE argument
|
|
|
|
---
|
|
commands/pull.go | 16 +++++++++++-----
|
|
commands/push.go | 16 +++++++++++-----
|
|
repository/config.go | 11 +++++++++++
|
|
3 files changed, 33 insertions(+), 10 deletions(-)
|
|
|
|
Index: git-bug-0.8.1+git.1746484874.96c7a111/commands/pull.go
|
|
===================================================================
|
|
--- git-bug-0.8.1+git.1746484874.96c7a111.orig/commands/pull.go 2025-05-06 00:41:14.000000000 +0200
|
|
+++ git-bug-0.8.1+git.1746484874.96c7a111/commands/pull.go 2025-05-06 12:25:33.320505683 +0200
|
|
@@ -8,6 +8,7 @@
|
|
"github.com/git-bug/git-bug/commands/completion"
|
|
"github.com/git-bug/git-bug/commands/execenv"
|
|
"github.com/git-bug/git-bug/entity"
|
|
+ "github.com/git-bug/git-bug/repository"
|
|
)
|
|
|
|
func newPullCommand(env *execenv.Env) *cobra.Command {
|
|
@@ -25,13 +26,18 @@
|
|
}
|
|
|
|
func runPull(env *execenv.Env, args []string) error {
|
|
- if len(args) > 1 {
|
|
+ var remote string
|
|
+ switch {
|
|
+ case len(args) > 1:
|
|
return errors.New("Only pulling from one remote at a time is supported")
|
|
- }
|
|
-
|
|
- remote := "origin"
|
|
- if len(args) == 1 {
|
|
+ case len(args) == 1:
|
|
remote = args[0]
|
|
+ default:
|
|
+ v, err := repository.GetDefaultString("git-bug.remote", env.Repo.AnyConfig(), "origin")
|
|
+ if err != nil {
|
|
+ return err
|
|
+ }
|
|
+ remote = v
|
|
}
|
|
|
|
env.Out.Println("Fetching remote ...")
|
|
Index: git-bug-0.8.1+git.1746484874.96c7a111/commands/push.go
|
|
===================================================================
|
|
--- git-bug-0.8.1+git.1746484874.96c7a111.orig/commands/push.go 2025-05-06 00:41:14.000000000 +0200
|
|
+++ git-bug-0.8.1+git.1746484874.96c7a111/commands/push.go 2025-05-06 12:25:33.320753379 +0200
|
|
@@ -7,6 +7,7 @@
|
|
|
|
"github.com/git-bug/git-bug/commands/completion"
|
|
"github.com/git-bug/git-bug/commands/execenv"
|
|
+ "github.com/git-bug/git-bug/repository"
|
|
)
|
|
|
|
func newPushCommand(env *execenv.Env) *cobra.Command {
|
|
@@ -24,13 +25,18 @@
|
|
}
|
|
|
|
func runPush(env *execenv.Env, args []string) error {
|
|
- if len(args) > 1 {
|
|
+ var remote string
|
|
+ switch {
|
|
+ case len(args) > 1:
|
|
return errors.New("Only pushing to one remote at a time is supported")
|
|
- }
|
|
-
|
|
- remote := "origin"
|
|
- if len(args) == 1 {
|
|
+ case len(args) == 1:
|
|
remote = args[0]
|
|
+ default:
|
|
+ v, err := repository.GetDefaultString("git-bug.remote", env.Repo.AnyConfig(), "origin")
|
|
+ if err != nil {
|
|
+ return err
|
|
+ }
|
|
+ remote = v
|
|
}
|
|
|
|
stdout, err := env.Backend.Push(remote)
|
|
Index: git-bug-0.8.1+git.1746484874.96c7a111/repository/config.go
|
|
===================================================================
|
|
--- git-bug-0.8.1+git.1746484874.96c7a111.orig/repository/config.go 2025-05-06 00:41:14.000000000 +0200
|
|
+++ git-bug-0.8.1+git.1746484874.96c7a111/repository/config.go 2025-05-06 12:25:33.320922899 +0200
|
|
@@ -60,6 +60,17 @@
|
|
RemoveAll(keyPrefix string) error
|
|
}
|
|
|
|
+func GetDefaultString(key string, cfg ConfigRead, def string) (string, error) {
|
|
+ val, err := cfg.ReadString(key)
|
|
+ if err == nil {
|
|
+ return val, nil
|
|
+ } else if errors.Is(err, ErrNoConfigEntry) {
|
|
+ return def, nil
|
|
+ } else {
|
|
+ return "", err
|
|
+ }
|
|
+}
|
|
+
|
|
func ParseTimestamp(s string) (time.Time, error) {
|
|
timestamp, err := strconv.Atoi(s)
|
|
if err != nil {
|