@@ -239,6 +239,10 @@ def parse_args(args=None):
239239 action = 'store_true' ,
240240 dest = 'bare_clone' ,
241241 help = 'clone bare repositories' )
242+ parser .add_argument ('--no-prune' ,
243+ action = 'store_true' ,
244+ dest = 'no_prune' ,
245+ help = 'disable prune option for git fetch' )
242246 parser .add_argument ('--lfs' ,
243247 action = 'store_true' ,
244248 dest = 'lfs_clone' ,
@@ -790,7 +794,8 @@ def backup_repositories(args, output_directory, repositories):
790794 repo_dir ,
791795 skip_existing = args .skip_existing ,
792796 bare_clone = args .bare_clone ,
793- lfs_clone = args .lfs_clone )
797+ lfs_clone = args .lfs_clone ,
798+ no_prune = args .no_prune )
794799
795800 if repository .get ('is_gist' ):
796801 # dump gist information to a file as well
@@ -807,8 +812,9 @@ def backup_repositories(args, output_directory, repositories):
807812 os .path .join (repo_cwd , 'wiki' ),
808813 skip_existing = args .skip_existing ,
809814 bare_clone = args .bare_clone ,
810- lfs_clone = args .lfs_clone )
811-
815+ lfs_clone = args .lfs_clone ,
816+ no_prune = args .no_prune
817+ )
812818 if args .include_issues or args .include_everything :
813819 backup_issues (args , repo_cwd , repository , repos_template )
814820
@@ -1053,7 +1059,8 @@ def fetch_repository(name,
10531059 local_dir ,
10541060 skip_existing = False ,
10551061 bare_clone = False ,
1056- lfs_clone = False ):
1062+ lfs_clone = False ,
1063+ no_prune = False ):
10571064 if bare_clone :
10581065 if os .path .exists (local_dir ):
10591066 clone_exists = subprocess .check_output (['git' ,
@@ -1099,6 +1106,8 @@ def fetch_repository(name,
10991106 git_command = ['git' , 'lfs' , 'fetch' , '--all' , '--prune' ]
11001107 else :
11011108 git_command = ['git' , 'fetch' , '--all' , '--force' , '--tags' , '--prune' ]
1109+ if no_prune :
1110+ git_command .pop ()
11021111 logging_subprocess (git_command , None , cwd = local_dir )
11031112 else :
11041113 log_info ('Cloning {0} repository from {1} to {2}' .format (
@@ -1110,6 +1119,8 @@ def fetch_repository(name,
11101119 logging_subprocess (git_command , None )
11111120 if lfs_clone :
11121121 git_command = ['git' , 'lfs' , 'fetch' , '--all' , '--prune' ]
1122+ if no_prune :
1123+ git_command .pop ()
11131124 logging_subprocess (git_command , None , cwd = local_dir )
11141125 else :
11151126 if lfs_clone :
0 commit comments