diff options
author | Russell Belfer <rb@github.com> | 2014-04-02 23:07:27 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-04-23 02:23:43 +0400 |
commit | 24d17de255caa57b01c0c758e6fc81aad493806e (patch) | |
tree | 5d4831849777583e4cd2d6b46ac6a7a532fa468b /tests/stash/save.c | |
parent | a32d684f866e7710fd139d69ad5d1a8d0ae527c4 (diff) |
Make stash and checkout ignore contained repos
To emulate git, stash should not remove untracked git repositories
inside the parent repo, and checkout's REMOVE_UNTRACKED should
also skip over these items.
`git stash` actually prints a warning message for these items.
That should be possible with a checkout notify callback if you
wanted to, although it would require a bit of extra logic as things
are at the moment.
Diffstat (limited to 'tests/stash/save.c')
-rw-r--r-- | tests/stash/save.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/stash/save.c b/tests/stash/save.c index f06c1fb71..5165eeadf 100644 --- a/tests/stash/save.c +++ b/tests/stash/save.c @@ -342,7 +342,7 @@ void test_stash_save__can_stage_normal_then_stage_untracked(void) void test_stash_save__including_untracked_without_any_untracked_file_creates_an_empty_tree(void) { - cl_git_pass(p_unlink("stash/when")); + cl_must_pass(p_unlink("stash/when")); assert_status(repo, "what", GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_MODIFIED); assert_status(repo, "how", GIT_STATUS_INDEX_MODIFIED); @@ -354,3 +354,18 @@ void test_stash_save__including_untracked_without_any_untracked_file_creates_an_ assert_object_oid("stash^3^{tree}", EMPTY_TREE, GIT_OBJ_TREE); } + +void test_stash_save__skip_submodules(void) +{ + git_repository *untracked_repo; + cl_git_pass(git_repository_init(&untracked_repo, "stash/untracked_repo", false)); + cl_git_mkfile("stash/untracked_repo/content", "stuff"); + git_repository_free(untracked_repo); + + assert_status(repo, "untracked_repo/", GIT_STATUS_WT_NEW); + + cl_git_pass(git_stash_save( + &stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED)); + + assert_status(repo, "untracked_repo/", GIT_STATUS_WT_NEW); +} |