| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 87ae425 commit 96d003c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -210,13 +210,14 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False): | |||
| 210 | 210 | If None, the repository is assumed to exist, and the url of the first | |
| 211 | 211 | remote is taken instead. This is useful if you want to make an existing | |
| 212 | 212 | repository a submodule of anotherone. | |
| 213 | - :param branch: branch at which the submodule should (later) be checked out. | ||
| 213 | + :param branch: name of branch at which the submodule should (later) be checked out. | ||
| 214 | 214 | The given branch must exist in the remote repository, and will be checked | |
| 215 | 215 | out locally as a tracking branch. | |
| 216 | 216 | It will only be written into the configuration if it not None, which is | |
| 217 | 217 | when the checked out branch will be the one the remote HEAD pointed to. | |
| 218 | 218 | The result you get in these situation is somewhat fuzzy, and it is recommended | |
| 219 | - to specify at least 'master' here | ||
| 219 | + to specify at least 'master' here. | ||
| 220 | + Examples are 'master' or 'feature/new' | ||
| 220 | 221 | :param no_checkout: if True, and if the repository has to be cloned manually, | |
| 221 | 222 | no checkout will be performed | |
| 222 | 223 | :return: The newly created submodule instance | |
@@ -252,7 +253,8 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False): | |||
| 252 | 253 | # END handle exceptions | |
| 253 | 254 | # END handle existing | |
| 254 | 255 | ||
| 255 | - br = git.Head.to_full_path(str(branch) or cls.k_head_default) | ||
| 256 | + # fake-repo - we only need the functionality on the branch instance | ||
| 257 | + br = git.Head(repo, git.Head.to_full_path(str(branch) or cls.k_head_default)) | ||
| 256 | 258 | has_module = sm.module_exists() | |
| 257 | 259 | branch_is_default = branch is None | |
| 258 | 260 | if has_module and url is not None: | |
@@ -276,7 +278,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False): | |||
| 276 | 278 | # clone new repo | |
| 277 | 279 | kwargs = {'n' : no_checkout} | |
| 278 | 280 | if not branch_is_default: | |
| 279 | - kwargs['b'] = br | ||
| 281 | + kwargs['b'] = br.name | ||
| 280 | 282 | # END setup checkout-branch | |
| 281 | 283 | mrepo = git.Repo.clone_from(url, path, **kwargs) | |
| 282 | 284 | # END verify url | |
@@ -290,8 +292,8 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False): | |||
| 290 | 292 | sm._url = url | |
| 291 | 293 | if not branch_is_default: | |
| 292 | 294 | # store full path | |
| 293 | - writer.set_value(cls.k_head_option, br) | ||
| 294 | - sm._branch_path = br | ||
| 295 | + writer.set_value(cls.k_head_option, br.path) | ||
| 296 | + sm._branch_path = br.path | ||
| 295 | 297 | # END handle path | |
| 296 | 298 | del(writer) | |
| 297 | 299 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments