From: Junio C Hamano Date: Wed, 12 Mar 2008 04:40:47 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.5.5-rc0~26 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b81a7b58875e07d7e82aafced1de9834ba1ef94a?hp=-c Merge branch 'maint' * maint: git-svn: fix find-rev error message when missing arg t0021: tr portability fix for Solaris launch_editor(): allow spaces in the filename git rebase --abort: always restore the right commit --- b81a7b58875e07d7e82aafced1de9834ba1ef94a diff --combined builtin-tag.c index 28c36fdcd1,9a59caf70d..8dd959fe1c --- a/builtin-tag.c +++ b/builtin-tag.c @@@ -50,12 -50,15 +50,15 @@@ void launch_editor(const char *path, st size_t len = strlen(editor); int i = 0; const char *args[6]; + struct strbuf arg0; + strbuf_init(&arg0, 0); if (strcspn(editor, "$ \t'") != len) { /* there are specials */ + strbuf_addf(&arg0, "%s \"$@\"", editor); args[i++] = "sh"; args[i++] = "-c"; - args[i++] = "$0 \"$@\""; + args[i++] = arg0.buf; } args[i++] = editor; args[i++] = path; @@@ -63,6 -66,7 +66,7 @@@ if (run_command_v_opt_cd_env(args, 0, NULL, env)) die("There was a problem with the editor %s.", editor); + strbuf_release(&arg0); } if (!buffer) @@@ -226,17 -230,19 +230,17 @@@ static int do_sign(struct strbuf *buffe if (write_in_full(gpg.in, buffer->buf, buffer->len) != buffer->len) { close(gpg.in); + close(gpg.out); finish_command(&gpg); return error("gpg did not accept the tag data"); } close(gpg.in); - gpg.close_in = 0; len = strbuf_read(buffer, gpg.out, 1024); + close(gpg.out); if (finish_command(&gpg) || !len || len < 0) return error("gpg failed to sign the tag"); - if (len < 0) - return error("could not read the entire signature from gpg."); - return 0; } diff --combined git-svn.perl index 1195569529,38e1d5944d..d8b38c9a47 --- a/git-svn.perl +++ b/git-svn.perl @@@ -186,9 -186,6 +186,9 @@@ my %cmd = "Show info about the latest SVN revision on the current branch", { 'url' => \$_url, } ], + 'blame' => [ \&Git::SVN::Log::cmd_blame, + "Show what revision and author last modified each line of a file", + {} ], ); my $cmd; @@@ -522,7 -519,8 +522,8 @@@ sub cmd_dcommit } sub cmd_find_rev { - my $revision_or_hash = shift; + my $revision_or_hash = shift or die "SVN or git revision required ", + "as a command-line argument\n"; my $result; if ($revision_or_hash =~ /^r\d+$/) { my $head = shift; @@@ -1250,8 -1248,7 +1251,8 @@@ use File::Path qw/mkpath/ use File::Copy qw/copy/; use IPC::Open3; -my $_repack_nr; +my ($_gc_nr, $_gc_period); + # properties that we do not log: my %SKIP_PROP; BEGIN { @@@ -1412,10 -1409,9 +1413,10 @@@ sub read_all_remotes } sub init_vars { - $_repack = 1000 unless (defined $_repack && $_repack > 0); - $_repack_nr = $_repack; - $_repack_flags ||= '-d'; + $_gc_nr = $_gc_period = 1000; + if (defined $_repack || defined $_repack_flags) { + warn "Repack options are obsolete; they have no effect.\n"; + } } sub verify_remotes_sanity { @@@ -2106,10 -2102,6 +2107,10 @@@ sub restore_commit_header_env } } +sub gc { + command_noisy('gc', '--auto'); +}; + sub do_git_commit { my ($self, $log_entry) = @_; my $lr = $self->last_rev; @@@ -2163,9 -2155,12 +2164,9 @@@ 0, $self->svm_uuid); } print " = $commit ($self->{ref_id})\n"; - if ($_repack && (--$_repack_nr == 0)) { - $_repack_nr = $_repack; - # repack doesn't use any arguments with spaces in them, does it? - print "Running git repack $_repack_flags ...\n"; - command_noisy('repack', split(/\s+/, $_repack_flags)); - print "Done repacking\n"; + if (--$_gc_nr == 0) { + $_gc_nr = $_gc_period; + gc(); } return $commit; } @@@ -2237,12 -2232,7 +2238,12 @@@ sub find_parent_branch # just grow a tail if we're not unique enough :x $ref_id .= '-' while find_ref($ref_id); print STDERR "Initializing parent: $ref_id\n"; - $gs = Git::SVN->init($new_url, '', $ref_id, $ref_id, 1); + my ($u, $p) = ($new_url, ''); + if ($u =~ s#^\Q$url\E(/|$)##) { + $p = $u; + $u = $url; + } + $gs = Git::SVN->init($u, $p, $self->{repo_id}, $ref_id, 1); } my ($r0, $parent) = $gs->find_rev_before($r, 1); if (!defined $r0 || !defined $parent) { @@@ -4000,7 -3990,6 +4001,7 @@@ sub gs_fetch_loop_common $max += $inc; $max = $head if ($max > $head); } + Git::SVN::gc(); } sub match_globs { @@@ -4457,24 -4446,6 +4458,24 @@@ out print commit_log_separator unless $incremental || $oneline; } +sub cmd_blame { + my $path = shift; + + config_pager(); + run_pager(); + + my ($fh, $ctx) = command_output_pipe('blame', @_, $path); + while (my $line = <$fh>) { + if ($line =~ /^\^?([[:xdigit:]]+)\s/) { + my (undef, $rev, undef) = ::cmt_metadata($1); + $rev = sprintf('%-10s', $rev); + $line =~ s/^\^?[[:xdigit:]]+(\s)/$rev$1/; + } + print $line; + } + command_close_pipe($fh, $ctx); +} + package Git::SVN::Migration; # these version numbers do NOT correspond to actual version numbers # of git nor git-svn. They are just relative.