Changeset - 078136fd83fb
[Not reviewed]
default
0 2 0
domruf - 10 years ago 2016-04-11 22:36:52
dominikruf@gmail.com
tests: fix Git on Windows sometimes failing on ' or ` in file:/// URLs

Some Git versions will fail when cloning a repository like:

git clone file:///path/to/strange-file-'`foobar myclone

Since '` (and some other characters) are filtered anyway (in
lib.utils.repo_name_slug) I think this test doesn't need to test those
characters.
2 files changed with 5 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/compare.py
Show inline comments
 
@@ -127,12 +127,13 @@ class CompareController(BaseRepoControll
 
                other_changesets = [other_repo.get_changeset(rev) for rev in reversed(revs)]
 
                if other_changesets:
 
                    ancestor = other_changesets[0].parents[0].raw_id
 
                else:
 
                    # no changesets from other repo, ancestor is the other_rev
 
                    ancestor = other_rev
 

	
 
                # dulwich 0.9.9 doesn't have a Repo.close() so we have to mess with internals:
 
                gitrepo.object_store.close()
 
                gitrepo_remote.object_store.close()
 

	
 
            else:
 
                so, se = org_repo.run_git_command(
kallithea/tests/vcs/test_git.py
Show inline comments
 
@@ -43,22 +43,24 @@ class GitRepositoryTest(unittest.TestCas
 
            clone_fail_repo = GitRepository(get_new_dir('injection-repo'), create=True)
 
            clone_fail_repo.clone(repo_inject_path, update_after_clone=True,)
 

	
 
        # Verify correct quoting of evil characters that should work on posix file systems
 
        if sys.platform == 'win32':
 
            # windows does not allow '"' in dir names
 
            tricky_path = get_new_dir("tricky-path-repo-$'`")
 
            # and some versions of the git client don't like ` and '
 
            tricky_path = get_new_dir("tricky-path-repo-$")
 
        else:
 
            tricky_path = get_new_dir("tricky-path-repo-$'\"`")
 
        successfully_cloned = GitRepository(tricky_path, src_url=TEST_GIT_REPO, update_after_clone=True, create=True)
 
        # Repo should have been created
 
        self.assertFalse(successfully_cloned._repo.bare)
 

	
 
        if sys.platform == 'win32':
 
            # windows does not allow '"' in dir names
 
            tricky_path_2 = get_new_dir("tricky-path-2-repo-$'`")
 
            # and some versions of the git client don't like ` and '
 
            tricky_path_2 = get_new_dir("tricky-path-2-repo-$")
 
        else:
 
            tricky_path_2 = get_new_dir("tricky-path-2-repo-$'\"`")
 
        successfully_cloned2 = GitRepository(tricky_path_2, src_url=tricky_path, bare=True, create=True)
 
        # Repo should have been created and thus used correct quoting for clone
 
        self.assertTrue(successfully_cloned2._repo.bare)
 

	
0 comments (0 inline, 0 general)