]> git.madduck.net Git - code/myrepos.git/blobdiff - mr

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

After checkout, run fixups chdired to the just checked out directory.
[code/myrepos.git] / mr
diff --git a/mr b/mr
index 7147061b2019a93d5e889c3b40ffa6f87d24c17a..8408c61d5407d56301f081e000b01bf02d0a547f 100755 (executable)
--- a/mr
+++ b/mr
@@ -684,6 +684,7 @@ sub fulldir {
 sub action {
        my ($action, $dir, $topdir, $subdir, $force_checkout) = @_;
        my $fulldir=fulldir($topdir, $subdir);
+       my $checkout_dir;
 
        $ENV{MR_CONFIG}=$configfiles{$topdir};
        my $is_checkout=($action eq 'checkout');
@@ -725,6 +726,7 @@ sub action {
        }
 
        if ($is_checkout) {
+               $checkout_dir=$dir;
                if (! $force_checkout) {
                        if (-d $dir) {
                                print "mr $action: $dir already exists, skipping checkout\n" if $verbose;
@@ -828,7 +830,13 @@ sub action {
                        my $ret=hook("post_$action", $topdir, $subdir);
                        return $ret if $ret != OK;
                        
-                       if (($is_checkout || $is_update)) {
+                       if ($is_checkout || $is_update) {
+                               if ($is_checkout && ! $no_chdir) {
+                                       if (! chdir($checkout_dir)) {
+                                               print STDERR "mr $action: failed to chdir to $checkout_dir: $!\n";
+                                               return FAILED;
+                                       }
+                               }
                                my $ret=hook("fixups", $topdir, $subdir);
                                return $ret if $ret != OK;
                        }