I am using git svn to access a SVN server. I am trying to write a script that converts and copy all SVN tags into git tags.
I found this: http://gitready.com/advanced/2009/02/16/convert-git-svn-tag-branches-to-real-tags.html
And this: https://stackoverflow.com/a/3357357/882697
To create that:
git for-each-ref refs/remotes/origin/tags | cut -d / -f 5- |
while read ref
do
msg=`git log --format=%B -n 1 origin/tags/"$ref"`
echo $msg
done
The git log
command works well in the mingw bash (from git install).
But when launching the script from the same mingw bash, the line endings are stripped.
I tried to added \r
:
msg=`echo $msg | sed 's/\n/\r\n/'`
But it doesn't work either...
Could someone help me please? Thanks!
Try at least putting double-quotes:
echo "${msg}"
(see "how do I preserve newlines in a quoted string in bash?")
That will avoid echo interpreting the output of $msg
content (doing field splitting or pathname expansion).