X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=adns.git;a=blobdiff_plain;f=convert;h=a0f4e8fa674d21c486c12682a04ed0d4ef75a0f6;hp=60b19980f597c7607261b4d9a8e85c0eb797eb4b;hb=898afc783a7bd5947405b4fd828a34dfbd9b99a8;hpb=8f100340e2c039fb5a3e18cb955eee8bc2efeb59 diff --git a/convert b/convert index 60b1998..a0f4e8f 100755 --- a/convert +++ b/convert @@ -43,7 +43,7 @@ graftmergein () { local branchname=branch-$desc mkdir -p .git/info local branchtip=`git rev-parse $branchname~0` - local oldparents=`git-log -n1 --pretty=format:%P $mergecommit` + local oldparents=`git log -n1 --pretty=format:%P $mergecommit` cat <>.git/info/grafts $2 $oldparents $branchtip END @@ -73,17 +73,24 @@ tochiark-1998-11-17 fromchiark-1998-11-28 END -git checkout master -scr=cvs-to-git-conversion-script -cp $base/script/convert $scr -git add $scr -git commit -m "$scr: record the script +(set -e + cd $base/script + if [ x"`git diff`" != x ]; then + git checkout master~0 + git commit -a -m autocommit + git tag -f actual + git reset master + git checkout master + else + git tag -f actual + fi) -Record the script we used to convert the CVS repo to git" -git rm $scr -git commit -m "$scr: delete the script +git checkout master +git fetch $base/script actual +git merge -m 'CVS to git conversion -We have in fact done the conversion and don't need the script any more." +Record the scripts etc. we used (and their history) for posterity, +by binding them into the history.' FETCH_HEAD git branch -d origin git tag cvs-to-git-conversion @@ -92,8 +99,19 @@ cat >$tmp/msg-filter <<'FEND' perl -ne ' $out .= $_; END { + if ($out =~ /\*\*\* empty log message/) { + ($out = `git diff $ENV{GIT_COMMIT}^ $ENV{GIT_COMMIT} -- changelog`) + =~ s/\A.*\n\@\@ /\@\@ /s; + } + if ($out !~ /\n.*\n/) { + $out = `fmt <<'\''EOF'\'' +$out +EOF +`; + } if ($out =~ m/^\@\@/s && - $out =~ m/^(?:\+ )?[^\@ ].*\w.*$/m) { + ($out =~ m/^\+(?!u?adns).*\w.*$/m || + $out =~ m/^\-(?!u?adns).*\w.*$/m)) { print $&, "\n\n" or die $!; } print $out or die $!; @@ -102,11 +120,11 @@ perl -ne ' FEND chmod +x $tmp/msg-filter -git-filter-branch --msg-filter $tmp/msg-filter \ - `git-show-ref | awk '{print $2}'` +git filter-branch --msg-filter $tmp/msg-filter \ + `git show-ref | awk '{print $2}'` -git-show-ref | awk '{print $2}' | grep '^refs/original/' \ - | xargs -n1 git-update-ref -d +git show-ref | awk '{print $2}' | grep '^refs/original/' \ + | xargs -n1 git update-ref -d rm -rf $tmp/converted mkdir $tmp/converted