From 99962d5770bded6aa8fac22d4c74103b5f832d6d Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sun, 21 Jul 2024 02:15:35 +0700 Subject: git-codereview: add command to generate Change-Id The codereview commands only works when the git repository remote name is "origin" and on certain URLs. If we execute "codereview change", on repository where "origin" is not pointed to specific URL, the "Change-Id" will generated. This changes is quick solution to manually generate the Change-Id (and add it manually to commit message) until we figure out how to implement commands with different remote name. Change-Id: Ieb155c2f7e097a6a0ec8130698b1c0709a57be0a --- git-codereview/change-id.go | 11 +++++++++++ git-codereview/review.go | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 git-codereview/change-id.go diff --git a/git-codereview/change-id.go b/git-codereview/change-id.go new file mode 100644 index 0000000..dd2dee0 --- /dev/null +++ b/git-codereview/change-id.go @@ -0,0 +1,11 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "fmt" + +func cmdChangeId(args []string) { + fmt.Printf("Change-Id: I%x\n", randomBytes()) +} diff --git a/git-codereview/review.go b/git-codereview/review.go index ad0632a..940b6dc 100644 --- a/git-codereview/review.go +++ b/git-codereview/review.go @@ -65,6 +65,7 @@ Available commands: branchpoint change [name] change NNNN[/PP] + change-id gofmt [-l] help hooks @@ -106,6 +107,8 @@ func main() { cmd = cmdBranchpoint case "change": cmd = cmdChange + case "change-id": + cmd = cmdChangeId case "gofmt": cmd = cmdGofmt case "hook-invoke": -- cgit v1.3