Skip to content

Instantly share code, notes, and snippets.

@gogomako
gogomako / gitdiff-svnpatch.sh
Last active June 1, 2016 06:17 — forked from neosergio/gitdiff-svnpatch.sh
Converts git diff to svn patch format and acceptable for reviewboard 2.0.23
TAB=$'\t'
#get svn revision from manually input
SVN_DIFF_REV=$1
git diff --no-prefix --ignore-space-at-eol | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" -e "/^---/s/$/${TAB}(revision ${SVN_DIFF_REV})/" | awk '{if($1!="+++") print ; else print $1" "$2"\t(working copy)"}' | sed -e "/\/dev\/null/s/[0-9]*)$/0)/" > changes.patch