diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2018-10-25 18:26:41 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2018-10-25 18:26:41 +0300 |
commit | 78bd08c46657c4bb87a9860736940381e381c772 (patch) | |
tree | c3b2f01497d3962e23866356c1e232bf82a5554c | |
parent | d830cbd1595eeabe705abe583c7ae5d2bae5526a (diff) |
Investigate fresheningjv-explore-dedup
-rw-r--r-- | helper.rb | 8 | ||||
-rwxr-xr-x | test-push-alternates | 9 |
2 files changed, 12 insertions, 5 deletions
@@ -14,16 +14,16 @@ end # Note: tricks with the 'dir' argument and File.basename are there only # to make the script output prettier. -def run!(cmd, dir=nil) - abort "failed" unless run(cmd, dir) +def run!(cmd, dir=nil, env={}) + abort "failed" unless run(cmd, dir, env) end -def run(cmd, dir=nil) +def run(cmd, dir=nil, env={}) dir ||= Dir.pwd cmd_s = cmd.join(' ') warn "#{File.basename(dir)}$ #{cmd_s}" start = Time.now - status = system(*cmd, chdir: dir) + status = system(env, *cmd, chdir: dir) delta = Time.now - start warn sprintf("time: %.3fs\n", delta) if delta > 1.0 status diff --git a/test-push-alternates b/test-push-alternates index fb42e822c..94d52a71c 100755 --- a/test-push-alternates +++ b/test-push-alternates @@ -43,8 +43,13 @@ def main run!(%w[find objects -type f -exec ls -l {} ;], child) # Does not look good, no sign of mtime change. How will the pool know the object is used? + # Let's try freshening the commit. + run_pipeline!([%W[git cat-file commit #{commit_id}], %w[git hash-object -t commit -w --stdin]], child) + run!(%w[find objects -type f -exec ls -l {} ;], pool) + run!(%w[find objects -type f -exec ls -l {} ;], child) + # Freshening works! - # Try pushing... + # Different scenario: 'git push' pusher = File.join(TMP_ROOT, 'pusher.git') run!(%W[git clone --quiet --bare #{TEST_REPO} #{pusher}]) @@ -55,6 +60,7 @@ def main obj_name = "objects/#{commit_id[0,2]}/#{commit_id[2, commit_id.size]}" FileUtils.mkdir_p(File.dirname(File.join(pool, obj_name))) run!(%W[cp #{obj_name} #{pool}/#{obj_name}], pusher) + run!(%w[git repack --quiet -k -d -a], pool) backdate_objects(pool) run!(%w[git config advice.objectNameWarning false], pusher) @@ -64,6 +70,7 @@ def main puts "--- looking for: #{commit_id}" run!(%w[find objects -type f -exec ls -l {} ;], pool) run!(%w[find objects -type f -exec ls -l {} ;], child) + run!(%W[git show #{commit_id}], pool) end def new_commit(repo) |