зеркало из https://github.com/microsoft/git.git
Merge branch 'maint'
* maint: Add Documentation/cmd-list.made to .gitignore git-svn: fix log command to avoid infinite loop on long commit messages git-svn: dcommit/rebase confused by patches with git-svn-id: lines git-svn: bail out on incorrect command-line options
This commit is contained in:
Коммит
d39d10d7fc
|
@ -2,6 +2,7 @@
|
||||||
*.html
|
*.html
|
||||||
*.1
|
*.1
|
||||||
*.7
|
*.7
|
||||||
|
*.made
|
||||||
howto-index.txt
|
howto-index.txt
|
||||||
doc.dep
|
doc.dep
|
||||||
cmds-*.txt
|
cmds-*.txt
|
||||||
|
|
52
git-svn.perl
52
git-svn.perl
|
@ -363,13 +363,12 @@ sub cmd_dcommit {
|
||||||
my $head = shift;
|
my $head = shift;
|
||||||
$head ||= 'HEAD';
|
$head ||= 'HEAD';
|
||||||
my @refs;
|
my @refs;
|
||||||
my ($url, $rev, $uuid) = working_head_info($head, \@refs);
|
my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
|
||||||
my $c = $refs[-1];
|
unless ($gs) {
|
||||||
unless (defined $url && defined $rev && defined $uuid) {
|
|
||||||
die "Unable to determine upstream SVN information from ",
|
die "Unable to determine upstream SVN information from ",
|
||||||
"$head history\n";
|
"$head history\n";
|
||||||
}
|
}
|
||||||
my $gs = Git::SVN->find_by_url($url);
|
my $c = $refs[-1];
|
||||||
my $last_rev;
|
my $last_rev;
|
||||||
foreach my $d (@refs) {
|
foreach my $d (@refs) {
|
||||||
if (!verify_ref("$d~1")) {
|
if (!verify_ref("$d~1")) {
|
||||||
|
@ -431,16 +430,11 @@ sub cmd_dcommit {
|
||||||
|
|
||||||
sub cmd_rebase {
|
sub cmd_rebase {
|
||||||
command_noisy(qw/update-index --refresh/);
|
command_noisy(qw/update-index --refresh/);
|
||||||
my $url = (working_head_info('HEAD'))[0];
|
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
|
||||||
if (!defined $url) {
|
unless ($gs) {
|
||||||
die "Unable to determine upstream SVN information from ",
|
die "Unable to determine upstream SVN information from ",
|
||||||
"working tree history\n";
|
"working tree history\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $gs = Git::SVN->find_by_url($url);
|
|
||||||
unless ($gs) {
|
|
||||||
die "Unable to determine remote information from URL: $url\n";
|
|
||||||
}
|
|
||||||
if (command(qw/diff-index HEAD --/)) {
|
if (command(qw/diff-index HEAD --/)) {
|
||||||
print STDERR "Cannot rebase with uncommited changes:\n";
|
print STDERR "Cannot rebase with uncommited changes:\n";
|
||||||
command_noisy('status');
|
command_noisy('status');
|
||||||
|
@ -453,8 +447,8 @@ sub cmd_rebase {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cmd_show_ignore {
|
sub cmd_show_ignore {
|
||||||
my $url = (::working_head_info('HEAD'))[0];
|
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
|
||||||
my $gs = Git::SVN->find_by_url($url) || Git::SVN->new;
|
$gs ||= Git::SVN->new;
|
||||||
my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);
|
my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);
|
||||||
$gs->traverse_ignore(\*STDOUT, $gs->{path}, $r);
|
$gs->traverse_ignore(\*STDOUT, $gs->{path}, $r);
|
||||||
}
|
}
|
||||||
|
@ -776,16 +770,23 @@ sub cmt_metadata {
|
||||||
|
|
||||||
sub working_head_info {
|
sub working_head_info {
|
||||||
my ($head, $refs) = @_;
|
my ($head, $refs) = @_;
|
||||||
my ($url, $rev, $uuid);
|
|
||||||
my ($fh, $ctx) = command_output_pipe('rev-list', $head);
|
my ($fh, $ctx) = command_output_pipe('rev-list', $head);
|
||||||
while (<$fh>) {
|
while (<$fh>) {
|
||||||
chomp;
|
chomp;
|
||||||
($url, $rev, $uuid) = cmt_metadata($_);
|
my ($url, $rev, $uuid) = cmt_metadata($_);
|
||||||
last if (defined $url && defined $rev && defined $uuid);
|
if (defined $url && defined $rev) {
|
||||||
|
if (my $gs = Git::SVN->find_by_url($url)) {
|
||||||
|
my $c = $gs->rev_db_get($rev);
|
||||||
|
if ($c && $c eq $_) {
|
||||||
|
close $fh; # break the pipe
|
||||||
|
return ($url, $rev, $uuid, $gs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
unshift @$refs, $_ if $refs;
|
unshift @$refs, $_ if $refs;
|
||||||
}
|
}
|
||||||
close $fh; # break the pipe
|
command_close_pipe($fh, $ctx);
|
||||||
($url, $rev, $uuid);
|
(undef, undef, undef, undef);
|
||||||
}
|
}
|
||||||
|
|
||||||
package Git::SVN;
|
package Git::SVN;
|
||||||
|
@ -3262,12 +3263,19 @@ my $l_fmt;
|
||||||
sub cmt_showable {
|
sub cmt_showable {
|
||||||
my ($c) = @_;
|
my ($c) = @_;
|
||||||
return 1 if defined $c->{r};
|
return 1 if defined $c->{r};
|
||||||
|
|
||||||
|
# big commit message got truncated by the 16k pretty buffer in rev-list
|
||||||
if ($c->{l} && $c->{l}->[-1] eq "...\n" &&
|
if ($c->{l} && $c->{l}->[-1] eq "...\n" &&
|
||||||
$c->{a_raw} =~ /\@([a-f\d\-]+)>$/) {
|
$c->{a_raw} =~ /\@([a-f\d\-]+)>$/) {
|
||||||
|
@{$c->{l}} = ();
|
||||||
my @log = command(qw/cat-file commit/, $c->{c});
|
my @log = command(qw/cat-file commit/, $c->{c});
|
||||||
shift @log while ($log[0] ne "\n");
|
|
||||||
|
# shift off the headers
|
||||||
|
shift @log while ($log[0] ne '');
|
||||||
shift @log;
|
shift @log;
|
||||||
@{$c->{l}} = grep !/^git-svn-id: /, @log;
|
|
||||||
|
# TODO: make $c->{l} not have a trailing newline in the future
|
||||||
|
@{$c->{l}} = map { "$_\n" } grep !/^git-svn-id: /, @log;
|
||||||
|
|
||||||
(undef, $c->{r}, undef) = ::extract_metadata(
|
(undef, $c->{r}, undef) = ::extract_metadata(
|
||||||
(grep(/^git-svn-id: /, @log))[-1]);
|
(grep(/^git-svn-id: /, @log))[-1]);
|
||||||
|
@ -3321,8 +3329,8 @@ sub git_svn_log_cmd {
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $url = (::working_head_info($head))[0];
|
my ($url, $rev, $uuid, $gs) = ::working_head_info($head);
|
||||||
my $gs = Git::SVN->find_by_url($url) || Git::SVN->_new;
|
$gs ||= Git::SVN->_new;
|
||||||
my @cmd = (qw/log --abbrev-commit --pretty=raw --default/,
|
my @cmd = (qw/log --abbrev-commit --pretty=raw --default/,
|
||||||
$gs->refname);
|
$gs->refname);
|
||||||
push @cmd, '-r' unless $non_recursive;
|
push @cmd, '-r' unless $non_recursive;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче