]> arthur.barton.de Git - bup.git/blobdiff - t/test-get
git: remove unused _git_capture()
[bup.git] / t / test-get
index 9d3381ee26d56e4bee5b5d61df085210390f6fdc..7f5c7d0e326c0243f49e4d89b20e7dfdc50430e2 100755 (executable)
@@ -18,6 +18,7 @@ script_home = abspath(dirname(sys.argv[0] or '.'))
 sys.path[:0] = [abspath(script_home + '/../lib'), abspath(script_home + '/..')]
 
 from bup import compat
+from bup.helpers import merge_dict, unlink
 from buptest import ex, exo, test_tempdir
 from wvtest import wvcheck, wvfail, wvmsg, wvpass, wvpasseq, wvpassne, wvstart
 
@@ -83,32 +84,32 @@ def validate_blob(src_id, dest_id):
 
 def validate_tree(src_id, dest_id):
 
-    def set_committer_date():
-        environ['GIT_COMMITTER_DATE'] = "2014-01-01 01:01"
-
     rmrf('restore-src')
     rmrf('restore-dest')
     mkdir('restore-src')
     mkdir('restore-dest')
     
+    commit_env = merge_dict(environ, {'GIT_COMMITTER_DATE': '2014-01-01 01:01'})
+
     # Create a commit so the archive contents will have matching timestamps.
     src_c = exo(('git', '--git-dir', 'get-src',
                  'commit-tree', '-m', 'foo', src_id),
-                preexec_fn=set_committer_date).out.strip()
+                env=commit_env).out.strip()
     dest_c = exo(('git', '--git-dir', 'get-dest',
                   'commit-tree', '-m', 'foo', dest_id),
-                 preexec_fn=set_committer_date).out.strip()
+                 env=commit_env).out.strip()
     exr = verify_rcz('git --git-dir get-src archive %s | tar xvf - -C restore-src'
                      % quote(src_c),
                      shell=True)
     if exr.rc != 0: return False
-    ex('cd restore-src && ls --full-time -aR .', shell=True)
     exr = verify_rcz('git --git-dir get-dest archive %s | tar xvf - -C restore-dest'
                      % quote(dest_c),
                      shell=True)
     if exr.rc != 0: return False
     
     # git archive doesn't include an entry for ./.
+    unlink('restore-src/pax_global_header')
+    unlink('restore-dest/pax_global_header')
     ex(('touch', '-r', 'restore-src', 'restore-dest'))
     verify_trees_match('restore-src/', 'restore-dest/')
     rmrf('restore-src')
@@ -238,6 +239,8 @@ def _run_get(disposition, method, what):
         cmd = get_cmd + (method, src, dest)
     result = exo(cmd, check=False, stderr=PIPE)
     get_cases_tested += 1
+    fsck = ex((bup_cmd, '-d', 'get-dest', 'fsck'), check=False)
+    wvpasseq(0, fsck.rc)
     return result
 
 def run_get(disposition, method, what=None, given=None):
@@ -861,7 +864,7 @@ def create_get_src():
     exr = exo((bup_cmd, '-d', 'get-src', 'ls', 'src'))
     save_0 = exr.out.splitlines()[0]
     ex(('git', '--git-dir', 'get-src', 'branch', 'src-0', 'src'))
-    ex(('cp', '-a', 'src', 'src-0'))
+    ex(('cp', '-RPp', 'src', 'src-0'))
     
     rmrf('src')
     mkdir('src')
@@ -877,10 +880,10 @@ def create_get_src():
     exr = exo((bup_cmd, '-d', 'get-src', 'ls', 'src'))
     save_1 = exr.out.splitlines()[1]
     ex(('git', '--git-dir', 'get-src', 'branch', 'src-1', 'src'))
-    ex(('cp', '-a', 'src', 'src-1'))
+    ex(('cp', '-RPp', 'src', 'src-1'))
     
     # Make a copy the current state of src so we'll have an ancestor.
-    ex(('cp', '-a',
+    ex(('cp', '-RPp',
          'get-src/refs/heads/src', 'get-src/refs/heads/src-ancestor'))
 
     with open('src/tiny-file', 'a') as f: f.write('xyzzy')