From 2299c463794f214b750ecc33e24779243ddc5aff Mon Sep 17 00:00:00 2001 Message-Id: <2299c463794f214b750ecc33e24779243ddc5aff.1715194972.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 8 Oct 2007 00:14:11 +0200 Subject: [PATCH] Make "stg refresh" subdirectory safe MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Organization: Straylight/Edgeware From: Karl Hasselström 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 --- stgit/commands/refresh.py | 2 +- t/t2300-refresh-subdir.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stgit/commands/refresh.py b/stgit/commands/refresh.py index b283892..f032375 100644 --- a/stgit/commands/refresh.py +++ b/stgit/commands/refresh.py @@ -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', diff --git a/t/t2300-refresh-subdir.sh b/t/t2300-refresh-subdir.sh index d1c7168..bdd27c5 100755 --- a/t/t2300-refresh-subdir.sh +++ b/t/t2300-refresh-subdir.sh @@ -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 && -- [mdw]