@@ -180,19 +180,16 @@ def setup_git
180
180
git_dir = '.' + variants . sample
181
181
sha1 , content = build_object ( 'tree' , "40000 #{ git_dir } \0 #{ [ sha1 ] . pack ( 'H*' ) } " )
182
182
@repo_data [ :git ] [ :files ] [ "/objects/#{ get_path ( sha1 ) } " ] = content
183
- # build the supposed commit that dropped this file
184
- # a random user and user name
185
- user = rand_text_alphanumeric ( 3 + rand ( 10 ) ) + ' ' + rand_text_alphanumeric ( 3 + rand ( 10 ) )
186
- user_name = user . downcase . gsub ( /\s +/ , '_' )
187
- # random company
188
- company = ( rand_text_alphanumeric ( 3 + rand ( 10 ) ) + '.' + %w( com net org ) . sample ) . downcase
189
- # random commit and author time stamps
183
+ # build the supposed commit that dropped this file, which has a random user/company
184
+ email = Rex ::Text . rand_mail_address
185
+ first , last , company = email . scan ( /([^\. ]+)\. ([^\. ]+)@(.*)$/ ) . flatten
186
+ full_name = "#{ first . capitalize } #{ last . capitalize } "
190
187
tstamp = Time . now . to_i
191
188
author_time = rand ( tstamp )
192
189
commit_time = rand ( author_time )
193
190
tz_off = rand ( 10 )
194
- commit = "author #{ user } <#{ user_name } @ #{ company } > #{ author_time } -0#{ tz_off } 00\n " \
195
- "committer #{ user } <#{ user_name } @ #{ company } > #{ commit_time } -0#{ tz_off } 00\n " \
191
+ commit = "author #{ full_name } <#{ email } > #{ author_time } -0#{ tz_off } 00\n " \
192
+ "committer #{ full_name } <#{ email } > #{ commit_time } -0#{ tz_off } 00\n " \
196
193
"\n " \
197
194
"Initial commit to open git repository for #{ company } !\n "
198
195
if datastore [ 'VERBOSE' ]
@@ -226,7 +223,7 @@ def setup_mercurial
226
223
fake_sha1 = 'e6c39c507d7079cfff4963a01ea3a195b855d814'
227
224
@repo_data [ :mercurial ] [ :files ] [ '?cmd=heads' ] = "#{ fake_sha1 } \n "
228
225
# TODO: properly bundle this using the information in http://mercurial.selenic.com/wiki/BundleFormat
229
- @repo_data [ :mercurial ] [ :files ] [ "?cmd=getbundle&common=#{ '0' * 40 } &heads=#{ fake_sha1 } " ] = Zlib ::Deflate . deflate ( "HG10UNfoofoofoo" )
226
+ @repo_data [ :mercurial ] [ :files ] [ "?cmd=getbundle&common=#{ '0' * 40 } &heads=#{ fake_sha1 } " ] = Zlib ::Deflate . deflate ( "HG10UNfoofoofoo" )
230
227
231
228
# TODO: finish building the fake repository
232
229
end
0 commit comments