@@ -2481,7 +2481,8 @@ def get_source_tarball_from_git(filename, targetdir, git_config):
24812481 if recursive :
24822482 clone_cmd .append ('--recursive' )
24832483 else :
2484- clone_cmd .append ('--no-checkout' ) # We do that manually below
2484+ # checkout is done separately below for specific commits
2485+ clone_cmd .append ('--no-checkout' )
24852486
24862487 clone_cmd .append ('%s/%s.git' % (url , repo_name ))
24872488
@@ -2496,6 +2497,7 @@ def get_source_tarball_from_git(filename, targetdir, git_config):
24962497 checkout_cmd .extend (['&&' , 'git' , 'submodule' , 'update' , '--init' , '--recursive' ])
24972498
24982499 run .run_cmd (' ' .join (checkout_cmd ), log_all = True , simple = True , regexp = False , path = repo_name )
2500+
24992501 elif not build_option ('extended_dry_run' ):
25002502 # If we wanted to get a tag make sure we actually got a tag and not a branch with the same name
25012503 # This doesn't make sense in dry-run mode as we don't have anything to check
@@ -2507,10 +2509,13 @@ def get_source_tarball_from_git(filename, targetdir, git_config):
25072509 ' with the same name. You might want to alert the maintainers of %s about that issue.' ,
25082510 tag , url , repo_name , repo_name )
25092511 cmds = []
2512+
25102513 if not keep_git_dir :
2511- # Make the repo unshallow, same as git fetch --unshallow in git 1.8.3+
2512- # The first fetch seemingly does nothing, no idea why.
2514+ # make the repo unshallow first;
2515+ # this is equivalent with 'git fetch -unshallow' in Git 1.8.3+
2516+ # (first fetch seems to do nothing, unclear why)
25132517 cmds .append ('git fetch --depth=2147483647 && git fetch --depth=2147483647' )
2518+
25142519 cmds .append ('git checkout refs/tags/' + tag )
25152520 # Clean all untracked files, e.g. from left-over submodules
25162521 cmds .append ('git clean --force -d -x' )
0 commit comments