feat: add random time jitter to the day

This commit is contained in:
Himadri Bhattacharjee
2025-09-10 10:42:29 +05:30
parent 004a530068
commit 0da5267360
2 changed files with 4 additions and 1 deletions

View File

@@ -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

View File

@@ -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()