diff options
author | Russell Belfer <rb@github.com> | 2012-12-20 03:06:40 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-01-05 03:47:42 +0400 |
commit | a6a82e1a59065f6d5eaf4748708c92326048a99f (patch) | |
tree | 335d00d20987c2d2dd3f1a1b91217fcb41a32e1b /tests-clar/stash | |
parent | 8fe713ccf7bf8c6330fdda7f0c733e7f3ab29d3f (diff) |
Improve error propagation in stash
Stash was sometimes obscuring the actual error code, replacing it
with a -1 when there was more descriptive value. This updates
stash to preserve the original error code more reliably along
with a variety of other error handling tweaks.
I believe this is an improvement, but arguably, preserving the
underlying error code may result in values that are harder to
interpret by the caller who does not understand the internals.
Discussion is welcome!
Diffstat (limited to 'tests-clar/stash')
-rw-r--r-- | tests-clar/stash/drop.c | 7 | ||||
-rw-r--r-- | tests-clar/stash/foreach.c | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/tests-clar/stash/drop.c b/tests-clar/stash/drop.c index c146e90ec..2af95c737 100644 --- a/tests-clar/stash/drop.c +++ b/tests-clar/stash/drop.c @@ -36,15 +36,22 @@ static void push_three_states(void) cl_git_pass(git_repository_index(&index, repo)); cl_git_pass(git_index_add_from_workdir(index, "zero.txt")); commit_staged_files(&oid, index, signature); + cl_assert(git_path_exists("stash/zero.txt")); cl_git_mkfile("stash/one.txt", "content\n"); cl_git_pass(git_stash_save(&oid, repo, signature, "First", GIT_STASH_INCLUDE_UNTRACKED)); + cl_assert(!git_path_exists("stash/one.txt")); + cl_assert(git_path_exists("stash/zero.txt")); cl_git_mkfile("stash/two.txt", "content\n"); cl_git_pass(git_stash_save(&oid, repo, signature, "Second", GIT_STASH_INCLUDE_UNTRACKED)); + cl_assert(!git_path_exists("stash/two.txt")); + cl_assert(git_path_exists("stash/zero.txt")); cl_git_mkfile("stash/three.txt", "content\n"); cl_git_pass(git_stash_save(&oid, repo, signature, "Third", GIT_STASH_INCLUDE_UNTRACKED)); + cl_assert(!git_path_exists("stash/three.txt")); + cl_assert(git_path_exists("stash/zero.txt")); git_index_free(index); } diff --git a/tests-clar/stash/foreach.c b/tests-clar/stash/foreach.c index c7d59a3a1..f1983625f 100644 --- a/tests-clar/stash/foreach.c +++ b/tests-clar/stash/foreach.c @@ -38,10 +38,10 @@ void test_stash_foreach__cleanup(void) } static int callback_cb( - size_t index, - const char* message, - const git_oid *stash_oid, - void *payload) + size_t index, + const char* message, + const git_oid *stash_oid, + void *payload) { struct callback_data *data = (struct callback_data *)payload; |