aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2024-07-21 02:15:35 +0700
committerShulhan <m.shulhan@gmail.com>2026-04-09 22:20:06 +0700
commit99962d5770bded6aa8fac22d4c74103b5f832d6d (patch)
tree3c942b439ab8075aa00df49b7419842c589f0374
parent55cca39997e216656d703840268b9ff8676b0672 (diff)
downloadgo-x-review-99962d5770bded6aa8fac22d4c74103b5f832d6d.tar.xz
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
-rw-r--r--git-codereview/change-id.go11
-rw-r--r--git-codereview/review.go3
2 files changed, 14 insertions, 0 deletions
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":