diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/diff/binary.c | 1 | ||||
| -rw-r--r-- | tests/diff/workdir.c | 1 | ||||
| -rw-r--r-- | tests/stash/apply.c | 34 |
3 files changed, 34 insertions, 2 deletions
diff --git a/tests/diff/binary.c b/tests/diff/binary.c index 3a5716800..5298e9ebb 100644 --- a/tests/diff/binary.c +++ b/tests/diff/binary.c @@ -278,7 +278,6 @@ void test_diff_binary__empty_for_no_diff(void) git_tree *tree; git_diff *diff; git_buf actual = GIT_BUF_INIT; - const char *expected = ""; opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY; opts.id_abbrev = GIT_OID_HEXSZ; diff --git a/tests/diff/workdir.c b/tests/diff/workdir.c index 34bad48b3..8a23f53ae 100644 --- a/tests/diff/workdir.c +++ b/tests/diff/workdir.c @@ -1791,7 +1791,6 @@ void test_diff_workdir__only_writes_index_when_necessary(void) git_index *index; git_diff_options opts = GIT_DIFF_OPTIONS_INIT; git_diff *diff = NULL; - git_diff_perfdata perf = GIT_DIFF_PERFDATA_INIT; git_reference *head; git_object *head_object; git_oid initial, first, second; diff --git a/tests/stash/apply.c b/tests/stash/apply.c index 901667df3..1056ce7eb 100644 --- a/tests/stash/apply.c +++ b/tests/stash/apply.c @@ -413,3 +413,37 @@ void test_stash_apply__progress_cb_can_abort(void) cl_git_fail_with(-44, git_stash_apply(repo, 0, &opts)); } + +void test_stash_apply__uses_reflog_like_indices_1(void) +{ + git_oid oid; + + cl_git_mkfile("stash/untracked", "untracked\n"); + cl_git_pass(git_stash_save(&oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED)); + assert_status(repo, "untracked", GIT_ENOTFOUND); + + // stash@{1} is the oldest (first) stash we made + cl_git_pass(git_stash_apply(repo, 1, NULL)); + cl_assert_equal_i(git_index_has_conflicts(repo_index), 0); + assert_status(repo, "what", GIT_STATUS_WT_MODIFIED); + assert_status(repo, "how", GIT_STATUS_CURRENT); + assert_status(repo, "who", GIT_STATUS_WT_MODIFIED); + assert_status(repo, "when", GIT_STATUS_WT_NEW); + assert_status(repo, "why", GIT_STATUS_INDEX_NEW); + assert_status(repo, "where", GIT_STATUS_INDEX_NEW); +} + +void test_stash_apply__uses_reflog_like_indices_2(void) +{ + git_oid oid; + + cl_git_mkfile("stash/untracked", "untracked\n"); + cl_git_pass(git_stash_save(&oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED)); + assert_status(repo, "untracked", GIT_ENOTFOUND); + + // stash@{0} is the newest stash we made immediately above + cl_git_pass(git_stash_apply(repo, 0, NULL)); + + cl_assert_equal_i(git_index_has_conflicts(repo_index), 0); + assert_status(repo, "untracked", GIT_STATUS_WT_NEW); +} |
