X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=t%2Ftest-get;h=7f5c7d0e326c0243f49e4d89b20e7dfdc50430e2;hb=6b6559e405d264d4127211b935b21a3dda93ad93;hp=7590c776b82378efcab4f44100d4b81cb1babe84;hpb=fea31d9a8673bac8f7e046662b4549391e2b93e7;p=bup.git diff --git a/t/test-get b/t/test-get index 7590c77..7f5c7d0 100755 --- a/t/test-get +++ b/t/test-get @@ -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,21 +84,20 @@ 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) @@ -108,6 +108,8 @@ def validate_tree(src_id, dest_id): 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')