chiark / gitweb /
Make "stg refresh" subdirectory safe
authorKarl Hasselström <kha@treskal.com>
Sun, 7 Oct 2007 22:14:11 +0000 (00:14 +0200)
committerKarl Hasselström <kha@treskal.com>
Sun, 7 Oct 2007 22:14:11 +0000 (00:14 +0200)
Make "stg refresh" 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 refresh subroutine should instead be safe to
run from a subdirectory. However, refreshing from a subdirectory
currently only refreshes changes that are in the index, and not
changes in the working directory, and that has to be fixed.

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

index b283892762d2860e63d7a88171e72e9da9476c57..f032375fce6381a891f9695a743bb029fea54eea 100644 (file)
@@ -37,7 +37,7 @@ options. The '--force' option is useful when a commit object was
 created with a different tool but the changes need to be included in
 the current patch."""
 
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
 options = [make_option('-f', '--force',
                        help = 'force the refresh even if HEAD and '\
                        'top differ',
index d1c7168197fe4e7f2ffa90fbbe9d6218edf029a7..bdd27c5740ed9839ab7409d8d1dc2fe969536690 100755 (executable)
@@ -15,7 +15,7 @@ test_expect_success 'Refresh from a subdirectory' '
     [ "$(stg status)" = "" ]
 '
 
-test_expect_failure 'Refresh again' '
+test_expect_success 'Refresh again' '
     echo foo2 >> foo.txt &&
     echo bar2 >> bar/bar.txt &&
     cd bar &&