Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8139841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:57:41+00:00 2026-06-06T11:57:41+00:00

I’m currently mirroring an existing SVN repository on Github. For the initial clone I

  • 0

I’m currently mirroring an existing SVN repository on Github. For the initial clone I did this:

git svn --authors-prog=fixsvnauthors clone http://closure-compiler.googlecode.com/svn/

To update the repo every hour I do this:

git svn --authors-prog=fixsvnauthors rebase

The fixsvnauthors maps the SVN user names (E-Mail addresses) to Git usernames. My problem is now that this SVN repository seems to have a strange policy for commit messages. Most of them start with an empty line. Github doesn’t like that at all. All commit message summaries are empty which is pretty annoying.

So when there is a nice way to fix the authors during cloning maybe there is also a way to fix commit messages? I simply want to trim the commit messages so they are correctly read by Github. Couldn’t find anything like this in the documentation of git-svn but maybe I missed something. So how can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:57:42+00:00Added an answer on June 6, 2026 at 11:57 am

    I created a Git patch to implement a --messages-prog parameter in git-svn which can be used to specify a program to filter the commit messages while pulling changes from SVN. Works great for me. I sent the patch to the git mailing list but never got any reaction. Well, maybe the patch is useful for someone, so I post it here:

    From: Klaus Reimer <k@ailis.de>
    Date: Sat, 26 May 2012 17:56:42 +0200
    Subject: [PATCH] Implement --messages-prog parameter in git-svn
    
    Some SVN repositories have strange policies for commit messages requiring an
    empty line at the top of the commit message.  When you clone these
    repositories with Git to mirror them on GitHub then no commit message
    summaries are displayed at all at GitHub because they use the first line for
    it (Which is empty).  You always have to open the commit message details
    instead which is pretty annoying.  With the --messages-prog parameter you
    can specify a program which can modify the SVN commit message before
    committing it into the Git repo.  This works like the --authors-prog
    parameter with the only difference that the commit message is piped into the
    specified program instead of being passed to it as a command-line argument.
    
    The same could be achieved by a "trim" feature but specifying a program
    which can modify any aspect of a commit message is much more flexible.
    
    Signed-off-by: Klaus Reimer <k@ailis.de>
    ---
     Documentation/git-svn.txt        |  5 +++++
     git-svn.perl                     | 26 +++++++++++++++++++++++++-
     t/t9147-git-svn-messages-prog.sh | 40 ++++++++++++++++++++++++++++++++++++++++
     3 files changed, 70 insertions(+), 1 deletion(-)
     create mode 100755 t/t9147-git-svn-messages-prog.sh
    
    diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
    index cfe8d2b..7289246 100644
    --- a/Documentation/git-svn.txt
    +++ b/Documentation/git-svn.txt
    @@ -546,6 +546,11 @@ config key: svn.authorsfile
        expected to return a single line of the form "Name <email>",
        which will be treated as if included in the authors file.
    
    +--messages-prog=<filename>::
    +   If this option is specified, each SVN commit message is piped
    +   through the given program. The output of this program is then
    +   used as the new commit message instead.
    +
     -q::
     --quiet::
        Make 'git svn' less verbose. Specify a second time to make it
    diff --git a/git-svn.perl b/git-svn.perl
    index c84842f..514c888 100755
    --- a/git-svn.perl
    +++ b/git-svn.perl
    @@ -6,7 +6,7 @@ use warnings;
     use strict;
     use vars qw/   $AUTHOR $VERSION
            $sha1 $sha1_short $_revision $_repository
    -       $_q $_authors $_authors_prog %users/;
    +       $_q $_authors $_authors_prog $_messages_prog %users/;
     $AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
     $VERSION = '@@GIT_VERSION@@';
    
    @@ -120,6 +120,7 @@ my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
     my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
            'authors-file|A=s' => \$_authors,
            'authors-prog=s' => \$_authors_prog,
    +       'messages-prog=s' => \$_messages_prog,
            'repack:i' => \$Git::SVN::_repack,
            'noMetadata' => \$Git::SVN::_no_metadata,
            'useSvmProps' => \$Git::SVN::_use_svm_props,
    @@ -359,6 +360,9 @@ load_authors() if $_authors;
     if (defined $_authors_prog) {
        $_authors_prog = "'" . File::Spec->rel2abs($_authors_prog) . "'";
     }
    +if (defined $_messages_prog) {
    +   $_messages_prog = "'" . File::Spec->rel2abs($_messages_prog) . "'";
    +}
    
     unless ($cmd =~ /^(?:clone|init|multi-init|commit-diff)$/) {
        Git::SVN::Migration::migration_check();
    @@ -2051,6 +2055,7 @@ use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
     use Carp qw/croak/;
     use File::Path qw/mkpath/;
     use File::Copy qw/copy/;
    +use IPC::Open2;
     use IPC::Open3;
     use Time::Local;
     use Memoize;  # core since 5.8.0, Jul 2002
    @@ -3409,6 +3414,22 @@ sub other_gs {
        $gs
     }
    
    +sub call_messages_prog {
    +   my ($orig_message) = @_;
    +   my ($pid, $in, $out);
    +   
    +   $pid = open2($in, $out, $::_messages_prog)  
    +       or die "$::_messages_prog failed with exit code $?\n";
    +   print $out $orig_message;
    +   close($out);
    +   my ($message) = "";
    +   while (<$in>) {
    +       $message .= $_;
    +   }
    +   close($in);
    +   return $message;    
    +}
    +
     sub call_authors_prog {
        my ($orig_author) = @_;
        $orig_author = command_oneline('rev-parse', '--sq-quote', $orig_author);
    @@ -3809,6 +3830,9 @@ sub make_log_entry {
    
        $log_entry{date} = parse_svn_date($log_entry{date});
        $log_entry{log} .= "\n";
    +   if (defined $::_messages_prog) {
    +       $log_entry{log} = call_messages_prog($log_entry{log});
    +   }
        my $author = $log_entry{author} = check_author($log_entry{author});
        my ($name, $email) = defined $::users{$author} ? @{$::users{$author}}
                                   : ($author, undef);
    diff --git a/t/t9147-git-svn-messages-prog.sh b/t/t9147-git-svn-messages-prog.sh
    new file mode 100755
    index 0000000..ebb42b0
    --- /dev/null
    +++ b/t/t9147-git-svn-messages-prog.sh
    @@ -0,0 +1,40 @@
    +#!/bin/sh
    +
    +test_description='git svn messages prog tests'
    +
    +. ./lib-git-svn.sh
    +
    +cat > svn-messages-prog <<'EOF'
    +#!/bin/sh
    +sed s/foo/bar/g
    +EOF
    +chmod +x svn-messages-prog
    +
    +test_expect_success 'setup svnrepo' '
    +   svn mkdir -m "Unchanged message" "$svnrepo"/a
    +   svn mkdir -m "Changed message: foo" "$svnrepo"/b
    +   '
    +
    +test_expect_success 'import messages with prog' '
    +   git svn clone --messages-prog=./svn-messages-prog \
    +       "$svnrepo" x
    +   '
    +
    +test_expect_success 'imported 2 revisions successfully' '
    +   (
    +       cd x
    +       test "`git rev-list refs/remotes/git-svn | wc -l`" -eq 2
    +   )
    +   '
    +
    +test_expect_success 'messages-prog ran correctly' '
    +   (
    +       cd x
    +       git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
    +         grep "^    Unchanged message" &&
    +       git rev-list -1 --pretty=raw refs/remotes/git-svn~0 | \
    +         grep "^    Changed message: bar"
    +   )
    +   '
    +
    +test_done
    -- 1.7.10.2.605.gbefc5ed.dirty 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am currently running into a problem where an element is coming back from
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.