diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-05-10 22:04:40 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-05-10 22:05:20 +0200 |
commit | c083f3d0b853e723d0d4b00ff2f1ec5f65f05cba (patch) | |
tree | 37623b60ff831bb2b0aa48f72f59b5276a79bb2f /test/git/test_index.py | |
parent | 837c32ba7ff2a3aa566a3b8e1330e3db0b4841d8 (diff) | |
download | gitpython-c083f3d0b853e723d0d4b00ff2f1ec5f65f05cba.tar.gz |
index.add: added index path rewrite functionality, which allows to store a different path in the index than the actual one on disk ( from which the object will be created )
Fixed bug the way newlines were handled, which hopefully fixes occasional hangs as well. It works fine with git 1.7.1
Most of the changes are due to the tab-space conversion - its weird once more as I thought it was all in spaces before ... .
Diffstat (limited to 'test/git/test_index.py')
-rw-r--r-- | test/git/test_index.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/git/test_index.py b/test/git/test_index.py index 9eed5678..95f2b519 100644 --- a/test/git/test_index.py +++ b/test/git/test_index.py @@ -527,3 +527,33 @@ class TestIndex(TestBase): # dir into dir rval = index.move(['doc', 'test']) assert_mv_rval(rval) + + + # TEST PATH REWRITING + ###################### + count = [0] + def rewriter(entry): + rval = str(count[0]) + count[0] += 1 + return rval + # END rewriter + + def make_paths(): + # two existing ones, one new one + yield 'CHANGES' + yield 'ez_setup.py' + yield index.entries[index.get_entries_key('README', 0)] + yield index.entries[index.get_entries_key('.gitignore', 0)] + + for fid in range(3): + fname = 'newfile%i' % fid + open(fname, 'wb').write("abcd") + yield Blob(rw_repo, Blob.NULL_HEX_SHA, 0100644, fname) + # END for each new file + # END path producer + paths = list(make_paths()) + index.add(paths, path_rewriter=rewriter) + + for filenum in range(len(paths)): + assert index.get_entries_key(str(filenum), 0) in index.entries + |