From 0543294eea74288e6e596a7ee8dbc559797b9e5c Mon Sep 17 00:00:00 2001 From: Oliver Braun Date: Thu, 30 Apr 2026 23:43:25 +0200 Subject: [PATCH 1/2] fix: use committer name and email if set in glabs.yaml --- git/push.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/git/push.go b/git/push.go index 305f7f3..ceddbf4 100644 --- a/git/push.go +++ b/git/push.go @@ -13,6 +13,7 @@ import ( "github.com/logrusorgru/aurora" "github.com/obcode/glabs/v2/config" "github.com/rs/zerolog/log" + "github.com/spf13/viper" "github.com/theckman/yacspin" gitlab "gitlab.com/gitlab-org/api/client-go/v2" ) @@ -133,16 +134,24 @@ func CloneBranch(url, fromBranch string, orphan bool, orphanMessage string) (*gi orphanBranchName := fmt.Sprintf("orphan-%s-%d", fromBranch, time.Now().UnixNano()) orphanRef := plumbing.NewBranchReferenceName(orphanBranchName) + committerName := "glabs" + committerEmail := "glabs-bot@noreply.example.com" + + if viper.IsSet("committer") { + committerName = viper.GetString("committer.name") + committerEmail = viper.GetString("committer.email") + } + now := time.Now() commit := &object.Commit{ Author: object.Signature{ - Name: "glabs", - Email: "noreply@example.com", + Name: committerName, + Email: committerEmail, When: now, }, Committer: object.Signature{ - Name: "glabs", - Email: "noreply@example.com", + Name: committerName, + Email: committerEmail, When: now, }, Message: orphanMessage, From 97f956b1f60fd9b4b094d4c02df32af207023b1f Mon Sep 17 00:00:00 2001 From: Oliver Braun Date: Thu, 30 Apr 2026 23:49:09 +0200 Subject: [PATCH 2/2] docs: add instructions for setting committer name and email in glabs.yaml --- docs/commands.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/commands.md b/docs/commands.md index 9431084..f9c2d1a 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -197,6 +197,14 @@ e.g. glabs push mpd ass1 solution ``` +If you are using `orphan` you might want to set the committer name and email in `~/.glabs.yaml` like so + +``` +committer: + name: Example User + email: user@example.com +``` + ## Filtering students or groups When specifying `[groups...|students...]`, patterns are treated as regular expressions: