{"thread":{"id":"7200","subject":"[PATCH 0/2] Fixes for recent stgit issues","startedAt":"2007-03-11T21:44:06Z","lastAt":"2007-03-11T21:44:17Z","messageCount":3,"participants":["Yann Dirson"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"36870","messageId":"20070311214133.3142.11407.stgit@gandelf.nowhere.earth","threadId":"7200","inReplyTo":null,"subject":"[PATCH 0/2] Fixes for recent stgit issues","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-03-11T21:44:06Z","receivedAt":"2007-03-11T21:44:06Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"The initial \"stg cp\" implementation was known to be inconsistent wrt\nclobbering, this makes the unsafe case safe.  Also, a copy of the\npolicy=fetch-rebase testsuite crept as a fake policy=rebase one, so\nhere is a real one.\n\n-- \nYann Dirson    <ydirson@altern.org> |\nDebian-related: <dirson@debian.org> |   Support Debian GNU/Linux:\n                                    |  Freedom, Power, Stability, Gratis\n     http://ydirson.free.fr/        | Check <http://www.debian.org/>\n"},{"id":"36871","messageId":"20070311214412.3142.58190.stgit@gandelf.nowhere.earth","threadId":"7200","inReplyTo":"20070311214133.3142.11407.stgit@gandelf.nowhere.earth","subject":"[PATCH 1/2] Make 'stg cp' 2nd form safe.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-03-11T21:44:12Z","receivedAt":"2007-03-11T21:44:12Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"\n\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n Documentation/stg-cp.txt |    9 +++++----\n stgit/git.py             |    9 +++++++++\n 2 files changed, 14 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/stg-cp.txt b/Documentation/stg-cp.txt\nindex f499309..723d811 100644\n--- a/Documentation/stg-cp.txt\n+++ b/Documentation/stg-cp.txt\n@@ -35,10 +35,11 @@ file not known to Git will not be copied.\n CAVEATS\n -------\n \n-The first form doesn't allow yet to overwrite an existing file\n-(whether it could be recovered from Git or not), and the second form\n-does not check before overwriting any file, possibly leading to loss\n-of non-committed modifications.\n+This command does not allow yet to overwrite an existing file (whether\n+it could be recovered from Git or not).  Further more, when copying a\n+directory, the second form does not allow to proceed if a directory by\n+that name already exists inside the target, even when no file inside\n+that directory would be overwritten.\n \n FUTURE OPTIONS\n --------------\ndiff --git a/stgit/git.py b/stgit/git.py\nindex 9129c92..f6d6b43 100644\n--- a/stgit/git.py\n+++ b/stgit/git.py\n@@ -464,6 +464,15 @@ def copy(filespecs, target):\n     if os.path.isdir(target):\n         # target is a directory: copy each entry on the command line,\n         # with the same name, into the target\n+        target = target.rstrip('/')\n+        \n+        # first, check that none of the children of the target\n+        # matching the command line aleady exist\n+        for filespec in filespecs:\n+            entry = target+ '/' + os.path.basename(filespec.rstrip('/'))\n+            if os.path.exists(entry):\n+                raise GitException, 'Target \"%s\" already exists' % entry\n+        \n         for filespec in filespecs:\n             filespec = filespec.rstrip('/')\n             basename = '/' + os.path.basename(filespec)\n"},{"id":"36872","messageId":"20070311214417.3142.16353.stgit@gandelf.nowhere.earth","threadId":"7200","inReplyTo":"20070311214133.3142.11407.stgit@gandelf.nowhere.earth","subject":"[PATCH 2/2] Fixed t2102-pull-policy-rebase to really test 'rebase' policy.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-03-11T21:44:17Z","receivedAt":"2007-03-11T21:44:17Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"\n\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n t/t2102-pull-policy-rebase.sh |   79 ++++++++++++++++++-----------------------\n 1 files changed, 35 insertions(+), 44 deletions(-)\n\ndiff --git a/t/t2102-pull-policy-rebase.sh b/t/t2102-pull-policy-rebase.sh\nindex e1398a3..41f8168 100755\n--- a/t/t2102-pull-policy-rebase.sh\n+++ b/t/t2102-pull-policy-rebase.sh\n@@ -3,70 +3,61 @@\n # Copyright (c) 2007 Yann Dirson\n #\n \n-test_description='Excercise pull-policy \"fetch-rebase\".'\n+test_description='Excercise pull-policy \"rebase\".'\n \n . ./test-lib.sh\n \n-# don't need this repo, but better not drop it, see t1100\n-#rm -rf .git\n-\n-# Need a repo to clone\n-test_create_repo upstream\n-\n-test_expect_success \\\n-    'Setup upstream repo, clone it, and add patches to the clone' \\\n-    '\n-    (cd upstream && stg init) &&\n-    stg clone upstream clone &&\n-    (cd clone &&\n-     git repo-config branch.master.stgit.pull-policy fetch-rebase &&\n-     git repo-config --list &&\n-     stg new c1 -m c1 &&\n-     echo a > file && stg add file && stg refresh\n-    )\n-    '\n-\n test_expect_success \\\n-    'Add non-rewinding commit upstream and pull it from clone' \\\n+    'Fork stack off parent branch, and add patches to the stack' \\\n     '\n-    (cd upstream && stg new u1 -m u1 &&\n-     echo a > file2 && stg add file2 && stg refresh) &&\n-    (cd clone && stg pull) &&\n-    test -e clone/file2\n+    stg init &\n+    git branch -m master parent &&\n+    stg branch --create stack &&\n+    git repo-config branch.stack.stgit.pull-policy rebase &&\n+    git repo-config --list &&\n+    stg new c1 -m c1 &&\n+    echo a > file && stg add file && stg refresh\n     '\n \n-# note: with pre-1.5 Git the clone is not automatically recorded\n-# as rewinding, and thus heads/origin is not moved, but the stack\n-# is still correctly rebased\n test_expect_success \\\n-    'Rewind/rewrite upstream commit and pull it from clone' \\\n+    'Add non-rewinding commit in parent and pull the stack' \\\n     '\n-    (cd upstream && echo b >> file2 && stg refresh) &&\n-    (cd clone && stg pull) &&\n-    test `wc -l <clone/file2` = 2\n+    stg branch parent && stg new u1 -m u1 &&\n+    echo b > file2 && stg add file2 && stg refresh &&\n+    stg branch stack && stg pull &&\n+    test -e file2\n     '\n \n-# this one ensures the guard against commits does not unduly trigger\n test_expect_success \\\n-    'Rewind/rewrite upstream commit and fetch it from clone before pulling' \\\n+    'Rewind/rewrite commit in parent and pull the stack' \\\n     '\n-    (cd upstream && echo c >> file2 && stg refresh) &&\n-    (cd clone && git fetch && stg pull) &&\n-    test `wc -l <clone/file2` = 3\n+    stg branch parent && echo b >> file2 && stg refresh &&\n+    stg branch stack && stg pull &&\n+    test `wc -l <file2` = 2\n     '\n \n # this one exercises the guard against commits\n # (use a new file to avoid mistaking a conflict for a success)\n test_expect_success \\\n-    'New upstream commit and commit a patch in clone' \\\n+    'New commit in parent and commit a patch in stack' \\\n     '\n-    (cd upstream && stg new u2 -m u2 &&\n-     echo a > file3 && stg add file3 && stg refresh) &&\n-    (cd clone && stg commit && stg new c2 -m c2 &&\n-     echo a >> file && stg refresh)\n+    stg branch parent && stg new u2 -m u2 &&\n+     echo c > file3 && stg add file3 && stg refresh &&\n+    stg branch stack && stg commit && stg new c2 -m c2 &&\n+     echo a >> file && stg refresh\n     '\n test_expect_failure \\\n-    'Try to  and commit a patch in clone' \\\n-    '(cd clone && stg pull)'\n+    'Try to pull/rebase now that stack base has moved' \\\n+    'stg pull'\n+\n+test_expect_success \\\n+    'Force the pull/rebase, but do not push yet' \\\n+    'stg pull --force --nopush'\n+test_expect_failure \\\n+    '...check we lost the committed patch' \\\n+    'test -e file'\n+test_expect_failure \\\n+    '...and check we get a conflict while pushing' \\\n+    'stg push'\n \n test_done\n"}]}