bir yolu bir senaryo, GIT_EDITOR
ortam değişkeni ve dcommit
--edit
seçeneğini kullanmaktır.
kaydet bir dosyaya aşağıdaki, hadi svnmessage.sh
diyelim: chmod +x svnmessage.sh
:
#!/bin/sh
c=`git rev-parse HEAD`
t=`git cat-file -t $c`
m=`cat "$1"`
if [ "commit" = "$t" ]; then
o=`git cat-file $t $c`
o_a=`echo "$o" | grep '^author '`
o_c=`echo "$o" | grep '^committer '`
author=`echo "$o_a" | sed -e 's/^author \(.*>\).*$/\1/'`
authorts=`echo "$o_a" | sed -e 's/^author .*> \([0-9]\+\) .*$/\1/'`
authordt=`date -d @$authorts +"%Y-%m-%d %H:%M:%S %z"`
committer=`echo "$o_c" | sed -e 's/^committer \(.*>\).*$/\1/'`
committerts=`echo "$o_c" | sed -e 's/^committer .*> \([0-9]\+\) .*$/\1/'`
committerdt=`date -d @$committerts +"%Y-%m-%d %H:%M:%S %z"`
m="$m
-----
Author: $author $authordt
Committer: $committer $committerdt"
fi
echo "$m" > "$1"
komut çalıştırılabilir olduğundan emin olun. Ve çalıştırmak senin
dcommit
gibi:
GIT_EDITOR="/path/to/script/svnmessage.sh" git svn dcommit --edit
--edit
seçenek olacak edit the commit message before committing to SVN
taahhüt mesajı işlemek için GIT_EDITOR
ortam değişkenini kullanarak. Daha fazla bilgi için bkz. git-svn
ve git-var
.
Sen, biraz daha kolay hale getirmek için bir takma ad oluşturabilirsiniz:
git config --global alias.dcommit-edit '!GIT_EDITOR="$HOME/bin/svnmessage.sh" git svn dcommit --edit'
Sonra sadece kullanmak git dcommit-edit
.
komut git-svn.perl
SVN mesaj taahhüt oluşturmak için git cat-file
çıkışını sifonlar nasıl güvenir. Yazar ve gönderen bilgisini çıkarmak için aynı teknik kullanılır. Basit gibi görünebilir taahhüt:
$ git cat-file commit 24aef4f
tree eba872d9caad7246406f310c926427cfc5e73c8d
parent 7dd9de9b5c68b9de1fc3b798edbab2e350ae6eac
author User <[email protected]>54806 -0500
committer User <[email protected]>54806 -0500
foo-27
tipik .git/COMMIT_EDITMSG
bir parametre olarak geçirilen olacak komut; içeriği, SVN taahhüt mesajı için kullanılacak Git taahhüt mesajını içerecektir.
Pek. Eğer "git svn dcommit" ne zaman Bu günlüğü yeniden ilgili. –
Anladım. Yanlış anlamadığım için üzgünüm, git-svn ile hiç deneyimim yok. – takeshin