From 0da52673600c752511f88868458407dc53cd837f Mon Sep 17 00:00:00 2001 From: Himadri Bhattacharjee <107522312+lavafroth@users.noreply.github.com> Date: Wed, 10 Sep 2025 10:42:29 +0530 Subject: [PATCH] feat: add random time jitter to the day --- README.md | 2 +- main.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2425cde..11bd3f3 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,4 @@ go build . ### TODOs - [x] Wipe 4 reflog entries corresponding to the interactive rebase -- [ ] Add jitter to amend timestamp +- [x] Add jitter to amend timestamp diff --git a/main.go b/main.go index 412bfb6..920c80a 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "bytes" "fmt" + "math/rand" "os/exec" "strings" "time" @@ -113,6 +114,8 @@ func (m Model) ChangeDate() { if err != nil { log.Fatalf("failed to parse new date: %v", err) } + timedelta := rand.Int63n(int64(time.Hour * 24)) + parsedDate = parsedDate.Add(time.Duration(timedelta)) dateString := parsedDate.String() rebaseRelativeToHead := m.list.Cursor() + 1 rebaseHash := m.commits[m.list.Cursor()].Hash.String()