From 3698c8977b2be9bb8285d87181cbf4e3dfa8aef8 Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Sat, 5 Dec 2009 02:47:33 +0000 Subject: [PATCH] Restore the __kdesvn-build-remote alias to make git checkout work while I investigate the kernel.org git user guide on how to do what I want better. In this case the alias is always created so there shouldn't be missing alias errors though. svn path=/trunk/KDE/kdesdk/scripts/kdesvn-build; revision=1058743 --- kdesvn-build | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/kdesvn-build b/kdesvn-build index 1aec9cf..33ea580 100755 --- a/kdesvn-build +++ b/kdesvn-build @@ -269,6 +269,12 @@ use constant { ERROR => 5, }; +use constant { + # We use a named remote to make some git commands work that don't accept the + # full path. + GIT_REMOTE_ALIAS => '__kdesvn-build-remote', +}; + { # Separate package for namespacing. package IPC; @@ -1918,7 +1924,7 @@ sub git_clone_module p_chdir($srcdir); $result = log_command($module, 'git-remote-setup', - ['git', 'remote', 'add', '__kdesvn-build-remote', $git_repo]); + ['git', 'remote', 'add', GIT_REMOTE_ALIAS, $git_repo]); } return ($result == 0); @@ -1959,39 +1965,39 @@ sub git_update_module p_chdir($srcdir); + # Ensure any existing remote is removed and recreated + # Don't log it, we don't need the output + safe_system('git', 'remote', 'rm', GIT_REMOTE_ALIAS); + + $result = log_command($module, 'git-remote-setup', + ['git', 'remote', 'add', GIT_REMOTE_ALIAS, $cur_repo]); + if ($result != 0) { + return 0; + } + if ($old_repo and ($cur_repo ne $old_repo)) { note " y[b[*] y[$module]'s selected repository has changed:"; note " y[b[*] from\t$old_repo"; note " y[b[*] to\t$cur_repo,"; note " y[b[*] Attempting to perform the switch"; - # Ensure any existing remote is removed and recreated - # Don't log it, we don't need the output - safe_system(qw(git remote rm __kdesvn-build-remote)); - - my $result = log_command($module, 'git-remote-setup', - ['git', 'remote', 'add', '__kdesvn-build-remote', $cur_repo]); - if ($result != 0) { - return 0; - } - # Update what we think is the current repository on-disk. set_persistent_option($module, 'git-cloned-repository', $cur_repo); } # Download updated objects - if (0 != log_command($module, 'git-fetch', ['git', 'fetch', $cur_repo])) { + if (0 != log_command($module, 'git-fetch', ['git', 'fetch', GIT_REMOTE_ALIAS])) { return 0; } # If the user doesn't already have this branch, check it out. if (not git_has_branch($branch)) { $result = log_command($module, 'git-checkout-branch', - ['git', 'checkout', '-b', $branch, "$cur_repo/$branch"]); + ['git', 'checkout', '-b', $branch, GIT_REMOTE_ALIAS . "/$branch"]); } else { $result = log_command($module, 'git-checkout-update', - ['git', 'checkout', $branch]); + ['git', 'checkout', GIT_REMOTE_ALIAS . "/$branch"]); } return $result == 0;