|
4 | 4 | # This module is part of GitPython and is released under
|
5 | 5 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php
|
6 | 6 |
|
7 |
| -from git.exc import ( |
8 |
| - InvalidGitRepositoryError, |
9 |
| - NoSuchPathError, |
10 |
| - GitCommandError |
11 |
| -) |
12 |
| -from git.cmd import ( |
13 |
| - Git, |
14 |
| - handle_process_output |
15 |
| -) |
16 |
| -from git.refs import ( |
17 |
| - HEAD, |
18 |
| - Head, |
19 |
| - Reference, |
20 |
| - TagReference, |
21 |
| -) |
22 |
| -from git.objects import ( |
23 |
| - Submodule, |
24 |
| - RootModule, |
25 |
| - Commit |
26 |
| -) |
27 |
| -from git.util import ( |
28 |
| - Actor, |
29 |
| - finalize_process |
30 |
| -) |
31 |
| -from git.index import IndexFile |
32 |
| -from git.config import GitConfigParser |
33 |
| -from git.remote import ( |
34 |
| - Remote, |
35 |
| - add_progress, |
36 |
| - to_progress_instance |
37 |
| -) |
38 |
| - |
39 |
| -from git.db import GitCmdObjectDB |
| 7 | +from collections import namedtuple |
| 8 | +import logging |
| 9 | +import os |
| 10 | +import re |
| 11 | +import sys |
40 | 12 |
|
41 | 13 | from gitdb.util import (
|
42 | 14 | join,
|
43 | 15 | isfile,
|
44 | 16 | hex_to_bin
|
45 | 17 | )
|
46 | 18 |
|
47 |
| -from .fun import ( |
48 |
| - rev_parse, |
49 |
| - is_git_dir, |
50 |
| - find_git_dir, |
51 |
| - touch, |
| 19 | +from git.cmd import ( |
| 20 | + Git, |
| 21 | + handle_process_output |
52 | 22 | )
|
53 | 23 | from git.compat import (
|
54 | 24 | text_type,
|
|
58 | 28 | range,
|
59 | 29 | is_win,
|
60 | 30 | )
|
| 31 | +from git.config import GitConfigParser |
| 32 | +from git.db import GitCmdObjectDB |
| 33 | +from git.exc import InvalidGitRepositoryError, NoSuchPathError, GitCommandError |
| 34 | +from git.index import IndexFile |
| 35 | +from git.objects import Submodule, RootModule, Commit |
| 36 | +from git.refs import HEAD, Head, Reference, TagReference |
| 37 | +from git.remote import Remote, add_progress, to_progress_instance |
| 38 | +from git.util import Actor, finalize_process |
| 39 | + |
| 40 | +from .fun import rev_parse, is_git_dir, find_git_dir, touch |
61 | 41 |
|
62 |
| -import os |
63 |
| -import sys |
64 |
| -import re |
65 |
| -import logging |
66 |
| -from collections import namedtuple |
67 | 42 |
|
68 | 43 | log = logging.getLogger(__name__)
|
69 | 44 |
|
@@ -875,12 +850,22 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):
|
875 | 850 | progress = to_progress_instance(progress)
|
876 | 851 |
|
877 | 852 | odbt = kwargs.pop('odbt', odb_default_type)
|
878 |
| - proc = git.clone(url, path, with_extended_output=True, as_process=True, |
| 853 | + |
| 854 | + ## A bug win cygwin's Git, when `--bare` |
| 855 | + # it prepends the basename of the `url` into the `path:: |
| 856 | + # git clone --bare /cygwin/a/foo.git C:\\Work |
| 857 | + # becomes:: |
| 858 | + # git clone --bare /cygwin/a/foo.git /cygwin/a/C:\\Work |
| 859 | + # |
| 860 | + clone_path = (Git.polish_url(path) |
| 861 | + if Git.is_cygwin() and 'bare' in kwargs |
| 862 | + else path) |
| 863 | + proc = git.clone(Git.polish_url(url), clone_path, with_extended_output=True, as_process=True, |
879 | 864 | v=True, **add_progress(kwargs, git, progress))
|
880 | 865 | if progress:
|
881 | 866 | handle_process_output(proc, None, progress.new_message_handler(), finalize_process)
|
882 | 867 | else:
|
883 |
| - (stdout, stderr) = proc.communicate() # FIXME: Will block of outputs are big! |
| 868 | + (stdout, stderr) = proc.communicate() # FIXME: Will block if outputs are big! |
884 | 869 | log.debug("Cmd(%s)'s unused stdout: %s", getattr(proc, 'args', ''), stdout)
|
885 | 870 | finalize_process(proc, stderr=stderr)
|
886 | 871 |
|
|
0 commit comments