| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,10 +29,11 @@ CLI Usage is as follows:: | |||
| 29 | 29 | [-o OUTPUT_DIRECTORY] [-i] [--starred] [--watched] | |
| 30 | 30 | [--all] [--issues] [--issue-comments] [--issue-events] | |
| 31 | 31 | [--pulls] [--pull-comments] [--pull-commits] [--labels] | |
| 32 | - [--hooks] [--milestones] [--repositories] [--wikis] | ||
| 33 | - [--skip-existing] [-L [LANGUAGES [LANGUAGES ...]]] | ||
| 34 | - [-N NAME_REGEX] [-H GITHUB_HOST] [-O] [-R REPOSITORY] | ||
| 35 | - [-P] [-F] [--prefer-ssh] [-v] | ||
| 32 | + [--hooks] [--milestones] [--repositories] [--bare] | ||
| 33 | + [--wikis] [--skip-existing] | ||
| 34 | + [-L [LANGUAGES [LANGUAGES ...]]] [-N NAME_REGEX] | ||
| 35 | + [-H GITHUB_HOST] [-O] [-R REPOSITORY] [-P] [-F] | ||
| 36 | + [--prefer-ssh] [-v] | ||
| 36 | 37 | USER | |
| 37 | 38 | ||
| 38 | 39 | Backup a github account | |
@@ -66,6 +67,7 @@ CLI Usage is as follows:: | |||
| 66 | 67 | authenticated) | |
| 67 | 68 | --milestones include milestones in backup | |
| 68 | 69 | --repositories include repository clone in backup | |
| 70 | + --bare clone bare repositories | ||
| 69 | 71 | --wikis include wiki clone in backup | |
| 70 | 72 | --skip-existing skip project if a backup directory exists | |
| 71 | 73 | -L [LANGUAGES [LANGUAGES ...]], --languages [LANGUAGES [LANGUAGES ...]] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -204,6 +204,10 @@ def parse_args(): | |||
| 204 | 204 | action='store_true', | |
| 205 | 205 | dest='include_repository', | |
| 206 | 206 | help='include repository clone in backup') | |
| 207 | + parser.add_argument('--bare', | ||
| 208 | + action='store_true', | ||
| 209 | + dest='bare_clone', | ||
| 210 | + help='clone bare repositories') | ||
| 207 | 211 | parser.add_argument('--wikis', | |
| 208 | 212 | action='store_true', | |
| 209 | 213 | dest='include_wiki', | |
@@ -508,14 +512,16 @@ def backup_repositories(args, output_directory, repositories): | |||
| 508 | 512 | fetch_repository(repository['name'], | |
| 509 | 513 | repo_url, | |
| 510 | 514 | repo_dir, | |
| 511 | - skip_existing=args.skip_existing) | ||
| 515 | + skip_existing=args.skip_existing, | ||
| 516 | + bare_clone=args.bare_clone) | ||
| 512 | 517 | ||
| 513 | 518 | download_wiki = (args.include_wiki or args.include_everything) | |
| 514 | 519 | if repository['has_wiki'] and download_wiki: | |
| 515 | 520 | fetch_repository(repository['name'], | |
| 516 | 521 | repo_url.replace('.git', '.wiki.git'), | |
| 517 | 522 | os.path.join(repo_cwd, 'wiki'), | |
| 518 | - skip_existing=args.skip_existing) | ||
| 523 | + skip_existing=args.skip_existing, | ||
| 524 | + bare_clone=args.bare_clone) | ||
| 519 | 525 | ||
| 520 | 526 | if args.include_issues or args.include_everything: | |
| 521 | 527 | backup_issues(args, repo_cwd, repository, repos_template) | |
@@ -695,7 +701,7 @@ def backup_hooks(args, repo_cwd, repository, repos_template): | |||
| 695 | 701 | log_info("Unable to read hooks, skipping") | |
| 696 | 702 | ||
| 697 | 703 | ||
| 698 | - def fetch_repository(name, remote_url, local_dir, skip_existing=False): | ||
| 704 | + def fetch_repository(name, remote_url, local_dir, skip_existing=False, bare_clone=False): | ||
| 699 | 705 | clone_exists = os.path.exists(os.path.join(local_dir, '.git')) | |
| 700 | 706 | ||
| 701 | 707 | if clone_exists and skip_existing: | |
@@ -723,7 +729,10 @@ def fetch_repository(name, remote_url, local_dir, skip_existing=False): | |||
| 723 | 729 | log_info('Cloning {0} repository from {1} to {2}'.format(name, | |
| 724 | 730 | masked_remote_url, | |
| 725 | 731 | local_dir)) | |
| 726 | - git_command = ['git', 'clone', remote_url, local_dir] | ||
| 732 | + if bare_clone: | ||
| 733 | + git_command = ['git', 'clone', '--bare', remote_url, local_dir] | ||
| 734 | + else: | ||
| 735 | + git_command = ['git', 'clone', remote_url, local_dir] | ||
| 727 | 736 | logging_subprocess(git_command, None) | |
| 728 | 737 | ||
| 729 | 738 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments