From 56442f2c8fd35a5f243cb22914ca013299bfa619 Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Mon, 21 Jan 2008 01:00:48 +0100 Subject: [PATCH] Do not process the same commit more than once. * svn-merge2git.sh (doit): Save the list of commit already processed in a temporary file and check against this file that the commit we're about to process is a new one. (top level): Properly quote and adjust the code in the `trap 0'. Signed-off-by: Benoit Sigoure --- svn-merge2git.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/svn-merge2git.sh b/svn-merge2git.sh index 15c5330..458f8fa 100755 --- a/svn-merge2git.sh +++ b/svn-merge2git.sh @@ -352,6 +352,10 @@ doit() rv=$? test $rv -eq 0 || fatal "git rev-list failed and returned $rv" while read commit; do + # Check that we didn't already process this commit. + grep -F "$commit" "$tmp_done" >/dev/null && continue + echo "$commit" >>"$tmp_done" || fatal "could not write to $tmp_done" + case $opt_exclude in #( *" $commit "*) skipped="$skipped $commit" @@ -417,8 +421,9 @@ doit() test -d "$TMPDIR" || fatal "TMPDIR='$TMPDIR' is not a directory" test -w "$TMPDIR" || fatal "TMPDIR='$TMPDIR' is not writable" tmp_buf=`mktemp "$TMPDIR/$me.XXXXXX"` +tmp_done=`mktemp "$TMPDIR/$me.done.XXXXXX"` # Clean up temp file upon exit. -trap "exit_status=$?; rm -f $tmp_buf; exit \$exit_status" 0 +trap "exit_status=\$?; rm -f '$tmp_buf' '$tmp_done'; exit \$exit_status" 0 # Parse the options passed to the script. # Initialize the defaults -- 2.11.4.GIT