[StGit PATCH 5/5] Make "stg refresh" subdirectory safe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>

---

 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 &&

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux