{"thread":{"id":"6118","subject":"[PATCH 2/2] git-svn: dcommit should diff against the current HEAD after committing","startedAt":"2006-12-27T00:27:37Z","lastAt":"2006-12-27T00:27:38Z","messageCount":2,"participants":["Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"30321","messageId":"1167179258485-git-send-email-normalperson@yhbt.net","threadId":"6118","inReplyTo":null,"subject":"[PATCH 1/2] git-svn: quiet down tests and fix some unportable shell constructs","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-12-27T00:27:37Z","receivedAt":"2006-12-27T00:27:37Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"The latest changes to git-commit have made it more verbose; and\nI was running the setup of the tests outside of the test_expect_*,\nso errors in those were not caught.  Now we move them to where\nthey can be eval'ed and have their output trapped.\n\nexport var=value has been removed\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n t/t9100-git-svn-basic.sh |  258 +++++++++++++++++++++++-----------------------\n 1 files changed, 127 insertions(+), 131 deletions(-)\n\ndiff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh\nindex 0edf19e..c22fe47 100755\n--- a/t/t9100-git-svn-basic.sh\n+++ b/t/t9100-git-svn-basic.sh\n@@ -19,180 +19,176 @@ esac\n \n echo 'define NO_SVN_TESTS to skip git-svn tests'\n \n-mkdir import\n-cd import\n-\n-echo foo > foo\n-if test -z \"$NO_SYMLINK\"\n-then\n-\tln -s foo foo.link\n-fi\n-mkdir -p dir/a/b/c/d/e\n-echo 'deep dir' > dir/a/b/c/d/e/file\n-mkdir -p bar\n-echo 'zzz' > bar/zzz\n-echo '#!/bin/sh' > exec.sh\n-chmod +x exec.sh\n-svn import -m 'import for git-svn' . \"$svnrepo\" >/dev/null\n-\n-cd ..\n-rm -rf import\n-\n test_expect_success \\\n-    'initialize git-svn' \\\n-    \"git-svn init $svnrepo\"\n+    'initialize git-svn' \"\n+\tmkdir import &&\n+\tcd import &&\n+\techo foo > foo &&\n+\tif test -z '$NO_SYMLINK'\n+\tthen\n+\t\tln -s foo foo.link\n+\tfi\n+\tmkdir -p dir/a/b/c/d/e &&\n+\techo 'deep dir' > dir/a/b/c/d/e/file &&\n+\tmkdir bar &&\n+\techo 'zzz' > bar/zzz &&\n+\techo '#!/bin/sh' > exec.sh &&\n+\tchmod +x exec.sh &&\n+\tsvn import -m 'import for git-svn' . $svnrepo >/dev/null &&\n+\tcd .. &&\n+\trm -rf import &&\n+\tgit-svn init $svnrepo\"\n \n test_expect_success \\\n     'import an SVN revision into git' \\\n     'git-svn fetch'\n \n-test_expect_success \"checkout from svn\" \"svn co $svnrepo $SVN_TREE\"\n+test_expect_success \"checkout from svn\" \"svn co $svnrepo '$SVN_TREE'\"\n \n name='try a deep --rmdir with a commit'\n-git checkout -f -b mybranch remotes/git-svn\n-mv dir/a/b/c/d/e/file dir/file\n-cp dir/file file\n-git update-index --add --remove dir/a/b/c/d/e/file dir/file file\n-git commit -m \"$name\"\n-\n-test_expect_success \"$name\" \\\n-    \"git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch &&\n-     svn up $SVN_TREE &&\n-     test -d $SVN_TREE/dir && test ! -d $SVN_TREE/dir/a\"\n+test_expect_success \"$name\" \"\n+\tgit checkout -f -b mybranch remotes/git-svn &&\n+\tmv dir/a/b/c/d/e/file dir/file &&\n+\tcp dir/file file &&\n+\tgit update-index --add --remove dir/a/b/c/d/e/file dir/file file &&\n+\tgit commit -m '$name' &&\n+\tgit-svn set-tree --find-copies-harder --rmdir \\\n+\t\tremotes/git-svn..mybranch &&\n+\tsvn up '$SVN_TREE' &&\n+\ttest -d '$SVN_TREE'/dir && test ! -d '$SVN_TREE'/dir/a\"\n \n \n name='detect node change from file to directory #1'\n-mkdir dir/new_file\n-mv dir/file dir/new_file/file\n-mv dir/new_file dir/file\n-git update-index --remove dir/file\n-git update-index --add dir/file/file\n-git commit -m \"$name\"\n-\n-test_expect_failure \"$name\" \\\n-    'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch' \\\n-    || true\n+test_expect_failure \"$name\" \"\n+\tmkdir dir/new_file &&\n+\tmv dir/file dir/new_file/file &&\n+\tmv dir/new_file dir/file &&\n+\tgit update-index --remove dir/file &&\n+\tgit update-index --add dir/file/file &&\n+\tgit commit -m '$name'  &&\n+\tgit-svn set-tree --find-copies-harder --rmdir \\\n+\t\tremotes/git-svn..mybranch\" || true\n \n \n name='detect node change from directory to file #1'\n-rm -rf dir $GIT_DIR/index\n-git checkout -f -b mybranch2 remotes/git-svn\n-mv bar/zzz zzz\n-rm -rf bar\n-mv zzz bar\n-git update-index --remove -- bar/zzz\n-git update-index --add -- bar\n-git commit -m \"$name\"\n-\n-test_expect_failure \"$name\" \\\n-    'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch2' \\\n-    || true\n+test_expect_failure \"$name\" \"\n+\trm -rf dir '$GIT_DIR'/index &&\n+\tgit checkout -f -b mybranch2 remotes/git-svn &&\n+\tmv bar/zzz zzz &&\n+\trm -rf bar &&\n+\tmv zzz bar &&\n+\tgit update-index --remove -- bar/zzz &&\n+\tgit update-index --add -- bar &&\n+\tgit commit -m '$name' &&\n+\tgit-svn set-tree --find-copies-harder --rmdir \\\n+\t\tremotes/git-svn..mybranch2\" || true\n \n \n name='detect node change from file to directory #2'\n-rm -f $GIT_DIR/index\n-git checkout -f -b mybranch3 remotes/git-svn\n-rm bar/zzz\n-git-update-index --remove bar/zzz\n-mkdir bar/zzz\n-echo yyy > bar/zzz/yyy\n-git-update-index --add bar/zzz/yyy\n-git commit -m \"$name\"\n-\n-test_expect_failure \"$name\" \\\n-    'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch3' \\\n-    || true\n+test_expect_failure \"$name\" \"\n+\trm -f '$GIT_DIR'/index &&\n+\tgit checkout -f -b mybranch3 remotes/git-svn &&\n+\trm bar/zzz &&\n+\tgit-update-index --remove bar/zzz &&\n+\tmkdir bar/zzz &&\n+\techo yyy > bar/zzz/yyy &&\n+\tgit-update-index --add bar/zzz/yyy &&\n+\tgit commit -m '$name' &&\n+\tgit-svn set-tree --find-copies-harder --rmdir \\\n+\t\tremotes/git-svn..mybranch3\" || true\n \n \n name='detect node change from directory to file #2'\n-rm -f $GIT_DIR/index\n-git checkout -f -b mybranch4 remotes/git-svn\n-rm -rf dir\n-git update-index --remove -- dir/file\n-touch dir\n-echo asdf > dir\n-git update-index --add -- dir\n-git commit -m \"$name\"\n-\n-test_expect_failure \"$name\" \\\n-    'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch4' \\\n-    || true\n+test_expect_failure \"$name\" \"\n+\trm -f '$GIT_DIR'/index &&\n+\tgit checkout -f -b mybranch4 remotes/git-svn &&\n+\trm -rf dir &&\n+\tgit update-index --remove -- dir/file &&\n+\ttouch dir &&\n+\techo asdf > dir &&\n+\tgit update-index --add -- dir &&\n+\tgit commit -m '$name' &&\n+\tgit-svn set-tree --find-copies-harder --rmdir \\\n+\t\tremotes/git-svn..mybranch4\" || true\n \n \n name='remove executable bit from a file'\n-rm -f $GIT_DIR/index\n-git checkout -f -b mybranch5 remotes/git-svn\n-chmod -x exec.sh\n-git update-index exec.sh\n-git commit -m \"$name\"\n-\n-test_expect_success \"$name\" \\\n-    \"git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&\n-     svn up $SVN_TREE &&\n-     test ! -x $SVN_TREE/exec.sh\"\n+test_expect_success \"$name\" \"\n+\trm -f '$GIT_DIR'/index &&\n+\tgit checkout -f -b mybranch5 remotes/git-svn &&\n+\tchmod -x exec.sh &&\n+\tgit update-index exec.sh &&\n+\tgit commit -m '$name' &&\n+\tgit-svn set-tree --find-copies-harder --rmdir \\\n+\t\tremotes/git-svn..mybranch5 &&\n+\tsvn up '$SVN_TREE' &&\n+\ttest ! -x '$SVN_TREE'/exec.sh\"\n \n \n name='add executable bit back file'\n-chmod +x exec.sh\n-git update-index exec.sh\n-git commit -m \"$name\"\n-\n-test_expect_success \"$name\" \\\n-    \"git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&\n-     svn up $SVN_TREE &&\n-     test -x $SVN_TREE/exec.sh\"\n-\n+test_expect_success \"$name\" \"\n+\tchmod +x exec.sh &&\n+\tgit update-index exec.sh &&\n+\tgit commit -m '$name' &&\n+\tgit-svn set-tree --find-copies-harder --rmdir \\\n+\t\tremotes/git-svn..mybranch5 &&\n+\tsvn up '$SVN_TREE' &&\n+\ttest -x '$SVN_TREE'/exec.sh\"\n \n \n if test -z \"$NO_SYMLINK\"\n then\n \tname='executable file becomes a symlink to bar/zzz (file)'\n-\trm exec.sh\n-\tln -s bar/zzz exec.sh\n-\tgit update-index exec.sh\n-\tgit commit -m \"$name\"\n \n-\ttest_expect_success \"$name\" \\\n-\t    \"git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&\n-\t     svn up $SVN_TREE &&\n-\t     test -L $SVN_TREE/exec.sh\"\n+\ttest_expect_success \"$name\" \"\n+\t\trm exec.sh &&\n+\t\tln -s bar/zzz exec.sh &&\n+\t\tgit update-index exec.sh &&\n+\t\tgit commit -m '$name' &&\n+\t\tgit-svn set-tree --find-copies-harder --rmdir \\\n+\t\t\tremotes/git-svn..mybranch5 &&\n+\t\tsvn up '$SVN_TREE' &&\n+\t\ttest -L '$SVN_TREE'/exec.sh\"\n \n \tname='new symlink is added to a file that was also just made executable'\n-\tchmod +x bar/zzz\n-\tln -s bar/zzz exec-2.sh\n-\tgit update-index --add bar/zzz exec-2.sh\n-\tgit commit -m \"$name\"\n \n-\ttest_expect_success \"$name\" \\\n-\t    \"git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&\n-\t     svn up $SVN_TREE &&\n-\t     test -x $SVN_TREE/bar/zzz &&\n-\t     test -L $SVN_TREE/exec-2.sh\"\n+\ttest_expect_success \"$name\" \"\n+\t\tchmod +x bar/zzz &&\n+\t\tln -s bar/zzz exec-2.sh &&\n+\t\tgit update-index --add bar/zzz exec-2.sh &&\n+\t\tgit commit -m '$name' &&\n+\t\tgit-svn set-tree --find-copies-harder --rmdir \\\n+\t\t\tremotes/git-svn..mybranch5 &&\n+\t\tsvn up '$SVN_TREE' &&\n+\t\ttest -x '$SVN_TREE'/bar/zzz &&\n+\t\ttest -L '$SVN_TREE'/exec-2.sh\"\n \n \tname='modify a symlink to become a file'\n-\techo git help > help || true\n-\trm exec-2.sh\n-\tcp help exec-2.sh\n-\tgit update-index exec-2.sh\n-\tgit commit -m \"$name\"\n-\n-\ttest_expect_success \"$name\" \\\n-\t    \"git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&\n-\t     svn up $SVN_TREE &&\n-\t     test -f $SVN_TREE/exec-2.sh &&\n-\t     test ! -L $SVN_TREE/exec-2.sh &&\n-\t     diff -u help $SVN_TREE/exec-2.sh\"\n+\ttest_expect_success \"$name\" \"\n+\t\techo git help > help || true &&\n+\t\trm exec-2.sh &&\n+\t\tcp help exec-2.sh &&\n+\t\tgit update-index exec-2.sh &&\n+\t\tgit commit -m '$name' &&\n+\t\tgit-svn set-tree --find-copies-harder --rmdir \\\n+\t\t\tremotes/git-svn..mybranch5 &&\n+\t\tsvn up '$SVN_TREE' &&\n+\t\ttest -f '$SVN_TREE'/exec-2.sh &&\n+\t\ttest ! -L '$SVN_TREE'/exec-2.sh &&\n+\t\tdiff -u help $SVN_TREE/exec-2.sh\"\n fi\n \n \n if test \"$have_utf8\" = t\n then\n \tname=\"commit with UTF-8 message: locale: $GIT_SVN_LC_ALL\"\n-\techo '# hello' >> exec-2.sh\n-\tgit update-index exec-2.sh\n-\tgit commit -m 'Ã©Ã¯â'\n-\texport LC_ALL=\"$GIT_SVN_LC_ALL\"\n-\ttest_expect_success \"$name\" \"git-svn set-tree HEAD\"\n+\tLC_ALL=\"$GIT_SVN_LC_ALL\"\n+\texport LC_ALL\n+\ttest_expect_success \"$name\" \"\n+\t\techo '# hello' >> exec-2.sh &&\n+\t\tgit update-index exec-2.sh &&\n+\t\tgit commit -m 'Ã©Ã¯â' &&\n+\t\tgit-svn set-tree HEAD\"\n \tunset LC_ALL\n else\n \techo \"UTF-8 locale not set, test skipped ($GIT_SVN_LC_ALL)\"\n-- \n1.4.4.3.gd4ada\n"},{"id":"30320","messageId":"11671792603888-git-send-email-normalperson@yhbt.net","threadId":"6118","inReplyTo":"1167179258485-git-send-email-normalperson@yhbt.net","subject":"[PATCH 2/2] git-svn: dcommit should diff against the current HEAD after committing","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-12-27T00:27:38Z","receivedAt":"2006-12-27T00:27:38Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"This is a followup to dd31da2fdc199132c9fd42023aea5b33672d73cc.\nRegardless of whether we commit an alternate head, we always\ndiff-tree based on the current HEAD, and rebase against our\nremote reference as necessary.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 4288a05..c2cdceb 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -512,15 +512,15 @@ sub dcommit {\n \t}\n \treturn if $_dry_run;\n \tfetch();\n-\tmy @diff = command('diff-tree', $head, $gs, '--');\n+\tmy @diff = command('diff-tree', 'HEAD', $gs, '--');\n \tmy @finish;\n \tif (@diff) {\n \t\t@finish = qw/rebase/;\n \t\tpush @finish, qw/--merge/ if $_merge;\n \t\tpush @finish, \"--strategy=$_strategy\" if $_strategy;\n-\t\tprint STDERR \"W: $head and $gs differ, using @finish:\\n\", @diff;\n+\t\tprint STDERR \"W: HEAD and $gs differ, using @finish:\\n\", @diff;\n \t} else {\n-\t\tprint \"No changes between current $head and $gs\\n\",\n+\t\tprint \"No changes between current HEAD and $gs\\n\",\n \t\t      \"Resetting to the latest $gs\\n\";\n \t\t@finish = qw/reset --mixed/;\n \t}\n-- \n1.4.4.3.gd4ada\n"}]}