threads / discuss / 18244

Remove leading/trailing whitespace from commit messages when importing from Subversion?

Subject: Remove leading/trailing whitespace from commit messages when importing from Subversion?

## tl;dr

3 messages between Mar 10, 2009 and Mar 10, 2009.

replies: 2people: 2as markdown or json

Mike Swanson· Mar 10, 2009, 03:14 UTC · lore

I was wondering if it's possible to removing leading and trailing whitespace (tabs, newlines, spaces) from commit messages when importing from Subversion via git-svn.

I've got a repository with tens of thousands of commits, and not all of the messages are entered... sanely. I need to know whether it is possible to clean these up when transfering the repository to Git.

Thanks.
Marcel M. Cary· Mar 10, 2009, 05:38 UTC · re: Mike Swanson · lore

Re: Remove leading/trailing whitespace from commit messages when importing from Subversion?

Mike Swanson wrote:
Show 7 quoted lines
> I was wondering if it's possible to removing leading and trailing
> whitespace (tabs, newlines, spaces) from commit messages when importing
> from Subversion via git-svn.
> 
> I've got a repository with tens of thousands of commits, and not all of
> the messages are entered... sanely.  I need to know whether it is
> possible to clean these up when transfering the repository to Git.
Try "git filter-branch --msg-filter your-filter-command".
Marcel
Mike Swanson· Mar 10, 2009, 06:15 UTC · re: Marcel M. Cary · lore

Re: Remove leading/trailing whitespace from commit messages when importing from Subversion?

Marcel M. Cary wrote:
> Try "git filter-branch --msg-filter your-filter-command".
>
> Marcel
>   
Thank you, after-the-fact works fine too.  :)

If anyone else searches the archives and wonders how I did it, this sed command is it: sed -e "s/^[ \t]*//;s/[ \t]*$//;/^$/d"

Unix rules!

← back to recent threads