git-shuffle 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +7 -0
- data/bin/git-shuffle +53 -0
- data/lib/version.rb +5 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f192e95725812cdb18c5d6c3089c33325a977d23
|
4
|
+
data.tar.gz: 308208c30f79d4d4b152244e1459fd1318c870b8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 38decbc5ce0ccd4486935aa431fe6021f3c60663084bcbc88ae6e6b089a6df5b838592c632681c5b950769d4446a78ac0f6758f73fe683b5d128859385d57f00
|
7
|
+
data.tar.gz: bb1fb3657cca4798e1ef5c4ee54f369c2fb325a005f1b409b1ab66554b9400a3a78bd3f132b6b1286ff27c59a734502e952223757fb9e896300d7e89c1dfc72b
|
data/README.md
ADDED
data/bin/git-shuffle
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'timerizer'
|
4
|
+
require 'time'
|
5
|
+
require 'optparse'
|
6
|
+
|
7
|
+
options = {}
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = "Usage: ruby date-shuffle.rb [options]"
|
10
|
+
|
11
|
+
opts.on("-p path", "--path=path", "Path to the target respository") do |path|
|
12
|
+
puts path
|
13
|
+
options[:path] = path
|
14
|
+
end
|
15
|
+
end.parse!
|
16
|
+
|
17
|
+
|
18
|
+
if options[:path] == nil
|
19
|
+
puts 'Using current directory...'
|
20
|
+
options[:path] = Dir.pwd
|
21
|
+
end
|
22
|
+
|
23
|
+
Dir.chdir options[:path]
|
24
|
+
|
25
|
+
count = %x(git log --pretty=format:"%H" | wc -w)
|
26
|
+
count = count.to_i
|
27
|
+
# puts "there are #{count} commits in total"
|
28
|
+
|
29
|
+
days_offset = []
|
30
|
+
(1..365).to_a.sample(count).each do |num|
|
31
|
+
days_offset << num
|
32
|
+
end
|
33
|
+
|
34
|
+
days_offset.sort!
|
35
|
+
|
36
|
+
i = 0
|
37
|
+
|
38
|
+
days_offset.each do |offset|
|
39
|
+
i += 1
|
40
|
+
|
41
|
+
commit = %x(git log -#{i} --pretty=format:"%H" | tail -1)
|
42
|
+
|
43
|
+
# Sat, 14 Dec 2015 12:40:00 +0000
|
44
|
+
date = offset.days.ago
|
45
|
+
puts "[#{i}/#{count}] Set commit #{commit} to #{offset} days ago: #{date}"
|
46
|
+
|
47
|
+
new_time = Time.new(date.year, date.month, date.day, (8..23).to_a.sample, (0..59).to_a.sample, (0..59).to_a.sample, "+02:00")
|
48
|
+
command = <<-FOO
|
49
|
+
git filter-branch -f --env-filter "if test \\$GIT_COMMIT = \'#{commit}\' ; then export GIT_AUTHOR_DATE='#{new_time.to_s}'; export GIT_COMMITTER_DATE='#{new_time.to_s}'; fi && rm -fr '.git/refs/original/'"
|
50
|
+
FOO
|
51
|
+
# puts command
|
52
|
+
system(command)
|
53
|
+
end
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git-shuffle
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Han
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-09-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: timerizer
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: A CLI tool to shuffle the commit date of your git repository
|
28
|
+
email: hex0cter@gmail.com
|
29
|
+
executables:
|
30
|
+
- git-shuffle
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- README.md
|
35
|
+
- bin/git-shuffle
|
36
|
+
- lib/version.rb
|
37
|
+
homepage: http://rubygems.org/gems/git-shuffle
|
38
|
+
licenses:
|
39
|
+
- MIT
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.2'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 2.5.1
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Shuffle the git commit date
|
61
|
+
test_files: []
|