chiark / gitweb /
Make "stg push" subdirectory safe
authorKarl Hasselström <kha@treskal.com>
Sun, 7 Oct 2007 18:56:05 +0000 (20:56 +0200)
committerKarl Hasselström <kha@treskal.com>
Sun, 7 Oct 2007 22:14:11 +0000 (00:14 +0200)
Make "stg push" subdirectory safe by letting it internally cd up to
the top of the worktree. This is possibly not the best long-term fix;
one could argue that the push subroutine should instead be safe to run
from a subdirectory. However, pushing from a subdirectory currently
erases the parts of a patch that doesn't touch that subdirectory, and
that has to be fixed.

Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/commands/push.py
t/t1205-push-subdir.sh

index b91bc5e23536ab54d27917e590529659931d5df5..4d5de26feded214bce142cfbad886ad19e087525 100644 (file)
@@ -39,7 +39,7 @@ command run.
 The command also notifies when the patch becomes empty (fully merged
 upstream) or is modified (three-way merged) by the 'push' operation."""
 
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
 options = [make_option('-a', '--all',
                        help = 'push all the unapplied patches',
                        action = 'store_true'),
index 6502c2007938cf0cf4201be2a2ce10d50abcab14..f9a84f6182808ad487d46e7eb1a808bcd7e35033 100755 (executable)
@@ -27,7 +27,7 @@ test_expect_success 'Fast-forward push from a subdir' '
     [ "$(echo $(cat foo/y.txt))" = "y0 y1 y2" ]
 '
 
-test_expect_failure 'Modifying push from a subdir' '
+test_expect_success 'Modifying push from a subdir' '
     stg pop &&
     [ "$(echo $(cat x.txt))" = "x0 x1" ] &&
     [ "$(echo $(cat foo/y.txt))" = "y0 y1" ] &&
@@ -42,7 +42,7 @@ test_expect_failure 'Modifying push from a subdir' '
     [ "$(echo $(cat foo/y.txt))" = "y0 y1 y2" ]
 '
 
-test_expect_failure 'Conflicting push from subdir' '
+test_expect_success 'Conflicting push from subdir' '
     stg pop p1 p2 &&
     [ "$(echo $(cat x.txt))" = "x0" ] &&
     [ "$(echo $(cat foo/y.txt))" = "y0" ] &&