Make git_dir a path relative to work_tree in setup_work_tree()
[gitweb.git] / git-svn.perl
index 3a6eb1cb9da752a3a6fa35d781cade9c886e03b9..a54979dc51f0fc392b357da9071b6ea19aac4798 100755 (executable)
@@ -177,6 +177,7 @@ BEGIN
                          'strategy|s=s' => \$_strategy,
                          'local|l' => \$_local,
                          'fetch-all|all' => \$_fetch_all,
+                         'dry-run|n' => \$_dry_run,
                          %fc_opts } ],
        'commit-diff' => [ \&cmd_commit_diff,
                           'Commit a diff between two trees',
@@ -557,6 +558,11 @@ sub cmd_rebase {
                die "Unable to determine upstream SVN information from ",
                    "working tree history\n";
        }
+       if ($_dry_run) {
+               print "Remote Branch: " . $gs->refname . "\n";
+               print "SVN URL: " . $url . "\n";
+               return;
+       }
        if (command(qw/diff-index HEAD --/)) {
                print STDERR "Cannot rebase with uncommited changes:\n";
                command_noisy('status');
@@ -745,7 +751,7 @@ sub cmd_commit_diff {
        my $usage = "Usage: $0 commit-diff -r<revision> ".
                    "<tree-ish> <tree-ish> [<URL>]";
        fatal($usage) if (!defined $ta || !defined $tb);
-       my $svn_path;
+       my $svn_path = '';
        if (!defined $url) {
                my $gs = eval { Git::SVN->new };
                if (!$gs) {
@@ -769,7 +775,6 @@ sub cmd_commit_diff {
                $_message ||= get_commit_entry($tb)->{log};
        }
        my $ra ||= Git::SVN::Ra->new($url);
-       $svn_path ||= $ra->{svn_path};
        my $r = $_revision;
        if ($r eq 'HEAD') {
                $r = $ra->get_latest_revnum;
@@ -1018,6 +1023,7 @@ sub get_commit_entry {
                my $in_msg = 0;
                my $author;
                my $saw_from = 0;
+               my $msgbuf = "";
                while (<$msg_fh>) {
                        if (!$in_msg) {
                                $in_msg = 1 if (/^\s*$/);
@@ -1030,14 +1036,15 @@ sub get_commit_entry {
                                if (/^From:/ || /^Signed-off-by:/) {
                                        $saw_from = 1;
                                }
-                               print $log_fh $_ or croak $!;
+                               $msgbuf .= $_;
                        }
                }
+               $msgbuf =~ s/\s+$//s;
                if ($Git::SVN::_add_author_from && defined($author)
                    && !$saw_from) {
-                       print $log_fh "\nFrom: $author\n"
-                             or croak $!;
+                       $msgbuf .= "\n\nFrom: $author";
                }
+               print $log_fh $msgbuf or croak $!;
                command_close_pipe($msg_fh, $ctx);
        }
        close $log_fh or croak $!;
@@ -1918,7 +1925,7 @@ sub prop_walk {
 
        foreach (sort keys %$dirent) {
                next if $dirent->{$_}->{kind} != $SVN::Node::dir;
-               $self->prop_walk($p . $_, $rev, $sub);
+               $self->prop_walk($self->{path} . $p . $_, $rev, $sub);
        }
 }