From 00000004d5af255411908403dfe78b202b7ea71b Mon Sep 17 00:00:00 2001 From: Kevin Wallace Date: Mon, 23 Feb 2015 07:39:48 -0800 Subject: [PATCH] Use commit/author dates relative to the commit, not Now() This makes gitbrute convenient to use on a series of commits after rebasing. Otherwise, date information for those commits is completely destroyed. --- gitbrute.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/gitbrute.go b/gitbrute.go index ce6e18c..31e6c5e 100644 --- a/gitbrute.go +++ b/gitbrute.go @@ -29,7 +29,6 @@ import ( "runtime" "strconv" "strings" - "time" ) var ( @@ -38,11 +37,6 @@ var ( cpu = flag.Int("cpus", runtime.NumCPU(), "Number of CPUs to use. Defaults to number of processors.") ) -var ( - start = time.Now() - startUnix = start.Unix() -) - func main() { flag.Parse() runtime.GOMAXPROCS(*cpu) @@ -112,8 +106,8 @@ func bruteForce(obj []byte, winner chan<- solution, possibilities <-chan try, do case <-done: return default: - ad := date{startUnix - int64(t.authorBehind), authorDate.tz} - cd := date{startUnix - int64(t.commitBehind), commitDate.tz} + ad := date{authorDate.n - int64(t.authorBehind), authorDate.tz} + cd := date{commitDate.n - int64(t.commitBehind), commitDate.tz} strconv.AppendInt(blob[:adatei], ad.n, 10) strconv.AppendInt(blob[:cdatei], cd.n, 10) s1.Reset()