Commit efded17a authored by Ryan Jackson's avatar Ryan Jackson
Browse files

Fixes for git-cvspush and modified cvsexportcommit

Make git-diff-tree generate more context (8 lines).

Also, keep track of the last commit successfully pushed to CVS and start
there when doing a cvspush if the local repo is up to date.  This should
prevent duplicate commits and allow new commits to be pushed before the
central Git repo is updated from CVS.
parent f9f745ec
......@@ -150,9 +150,9 @@ if ($opt_a) {
close MSG;
if ($parent eq $noparent) {
`git-diff-tree --binary -p --root $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
`git-diff-tree --binary -p -U8 --root $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
} else {
`git-diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
`git-diff-tree --binary -p -U8 $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
## apply non-binary changes
......@@ -29,22 +29,39 @@ elif [ -z "$cvsdir" ]; then
remote_branch_head=`git ls-remote $remote $remote_branch | cut -f1`
git show $remote_branch_head 2>&1 | \
grep "fatal: bad object $remote_branch_head" > /dev/null
if [ $rc -eq 0 ]; then
echo "Your repository is not up-to-date" 1>&2
rm -f "$last_commit_file"
exit 1
if ! mkdir -p "${last_commit_file%/*}"; then
echo "Failed to mkdir" 1>&2
exit 1
if [ -f "$last_commit_file" ]; then
lastcommit=`cat "$last_commit_file"`
commits=`git-cherry $lastcommit refs/heads/$branch | sed -n 's/^+ //p' | wc -l`
if [ $commits -ge 0 ]; then
git cherry $remote_branch_head refs/heads/$branch | sed -n 's/^+ //p' | while read commit; do
# You can use git-cvsexportcommit here, but mine also handles
# the case of a patch already being applied.
# the case of a patch already being applied. It also enforces
# a large amount of context to be generated for each diff.
git-cvsexportcommit.mod -w "$cvsdir" -c -u -p -v -v -v $commit
if [ $rc -ne 0 ]; then
echo "Failed to apply commit $commit. Fix it and retry." 1>&2
exit 1
echo $commit > "$last_commit_file"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment