git-svn: un-break "git svn rebase" when log.abbrevCommit=true
PATCH 1/1 git-svn: un-break "git svn rebase" when log.abbrevCommit=true
Change git-svn to parse --no-abbrev-commit --no-decorate to git-log since it's trying to parse the log output, and the parsing will fail completely if log.abbrevCommit is set to true in the configuration, also set --no-decorate so we won't fail if we're processing a commit that has a tag pointing to it.
Without this patch the code will fail to parse a SHA1, and then just spew a bunch of "Use of uninitialized value $hash in string eq" warnings at "if ($c && $c eq $hash) { ..." and never do anything useful.
A real fix would be to make git-svn not use any porcelain utilities, but just work around it for now.
--- git-svn.perl | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
git-svn.perl +2 -1
@@ -1879,7 +1879,8 @@ sub cmt_sha2rev_batch { sub working_head_info { my ($head, $refs) = @_; my @args = qw/log --no-color --no-decorate --first-parent - --pretty=medium/; + --pretty=medium --no-abbrev-commit --no-decorate/; + my ($fh, $ctx) = command_output_pipe(@args, $head); my $hash; my %max;
Signature · 1 line
1.7.8.3
git-svn.perl sub cmt_sha2rev_batch { · line 1883
Quoted 9 lines · Ævar Arnfjörð Bjarmason
git-svn.perl +2
-1@@ -1879,7 +1879,8 @@ sub cmt_sha2rev_batch { sub working_head_info { my ($head, $refs) = @_; my @args = qw/log --no-color --no-decorate --first-parent - --pretty=medium/; + --pretty=medium --no-abbrev-commit --no-decorate/; +
Oh, dear. Wouldn't
my @args = qw/rev-list --first-parent --pretty=medium/;
be simpler and more robust as a quick fix?
Of course something that takes plain rev-list --first-parent output and pipes it through to cat-file --batch might be more intuitive, but rev-list --pretty should at least work. ;-)
Quoted 14 lines · Jonathan Nieder
Quoted 9 lines · Ævar Arnfjörð Bjarmason
git-svn.perl +0
-0@@ -1879,7 +1879,8 @@ sub cmt_sha2rev_batch { sub working_head_info { my ($head, $refs) = @_;my @args = qw/log --no-color --no-decorate --first-parent
- --pretty=medium/;
+ --pretty=medium --no-abbrev-commit --no-decorate/; +Oh, dear. Wouldn't
Quoted 7 lines
my @args = qw/rev-list --first-parent --pretty=medium/;
be simpler and more robust as a quick fix?
Of course something that takes plain rev-list --first-parent output and pipes it through to cat-file --batch might be more intuitive, but rev-list --pretty should at least work. ;-)
That sounds like a better fix. I forgot that rev-list could emulate git-log like that.
Quoted 1 line · Ævar Arnfjörð Bjarmason
Change git-svn to parse --no-abbrev-commit --no-decorate to git-log
Did you mean _pass_ --no-abbrev-commit here?
Signature · 1 line
-Dan
Quoted 4 lines · Dan Johnson
Quoted 1 line · Ævar Arnfjörð Bjarmason
Change git-svn to parse --no-abbrev-commit --no-decorate to git-log
Did you mean _pass_ --no-abbrev-commit here?
Yup.
I'l submit another patch fixing this and using rev-list.
PATCH v2 1/2 git-svn: remove redundant porcelain option to rev-list
Change an invocation of git-rev-list(1) to not use --no-color, git-rev-list(1) will always ignore that option and the --color option, so there's no need to pass it.
--- git-svn.perl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
git-svn.perl +1 -1
@@ -3920,7 +3920,7 @@ sub rebuild { my ($base_rev, $head) = ($partial ? $self->rev_map_max_norebuild(1) : (undef, undef)); my ($log, $ctx) = - command_output_pipe(qw/rev-list --pretty=raw --no-color --reverse/, + command_output_pipe(qw/rev-list --pretty=raw --reverse/, ($head ? "$head.." : "") . $self->refname, '--'); my $metadata_url = $self->metadata_url;
Signature · 1 line
1.7.9
PATCH v2 2/2 git-svn: un-break "git svn rebase" when log.abbrevCommit=true
Change git-svn to use git-rev-list(1) instead of git-log(1) since the latter is porcelain that'll cause "git svn rebase" to fail completely if log.abbrevCommit is set to true in the configuration.
Without this patch the code will fail to parse a SHA1, and then just spew a bunch of "Use of uninitialized value $hash in string eq" warnings at "if ($c && $c eq $hash) { ..." and never do anything useful.
--- git-svn.perl | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
git-svn.perl +1 -2
@@ -1878,8 +1878,7 @@ sub cmt_sha2rev_batch { sub working_head_info { my ($head, $refs) = @_; - my @args = qw/log --no-color --no-decorate --first-parent - --pretty=medium/; + my @args = qw/rev-list --first-parent --pretty=medium/; my ($fh, $ctx) = command_output_pipe(@args, $head); my $hash; my %max;
Signature · 1 line
1.7.9
Quoted 3 lines · Ævar Arnfjörð Bjarmason
Change git-svn to use git-rev-list(1) instead of git-log(1) since the latter is porcelain that'll cause "git svn rebase" to fail completely if log.abbrevCommit is set to true in the configuration.
[...]
git-svn.perl sub cmt_sha2rev_batch { · line 1881
Quoted 9 lines
git-svn.perl +1
-2@@ -1878,8 +1878,7 @@ sub cmt_sha2rev_batch { sub working_head_info { my ($head, $refs) = @_; - my @args = qw/log --no-color --no-decorate --first-parent - --pretty=medium/; + my @args = qw/rev-list --first-parent --pretty=medium/;
Thanks! The other caller to "git log" in this script uses --pretty=raw and should be safe.
Re: [PATCH v2 1/2] git-svn: remove redundant porcelain option to rev-list
In reply to Ævar Arnfjörð BjarmasonQuoted 5 lines · Ævar Arnfjörð Bjarmason
Change an invocation of git-rev-list(1) to not use --no-color, git-rev-list(1) will always ignore that option and the --color option, so there's no need to pass it.
Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>
Thanks, will push this series.