]> git.proxmox.com Git - libgit2.git/commitdiff
Addressed review feedback
authorlhchavez <lhchavez@lhchavez.com>
Sat, 14 Jan 2017 16:37:00 +0000 (16:37 +0000)
committerlhchavez <lhchavez@lhchavez.com>
Sat, 14 Jan 2017 16:37:00 +0000 (16:37 +0000)
src/indexer.c
tests/pack/indexer.c

index 93153621a2fd7940c89720687bd95e738c0b95c4..3d1c81c86a102eb403cc3cb1b253280302b8c882 100644 (file)
@@ -151,11 +151,11 @@ cleanup:
        if (fd != -1)
                p_close(fd);
 
-       if (git_buf_is_allocated(&tmp_path))
-               (void)p_unlink(git_buf_cstr(&tmp_path));
+       if (git_buf_len(&tmp_path) > 0)
+               p_unlink(git_buf_cstr(&tmp_path));
 
        if (idx->pack != NULL)
-               (void)p_unlink(idx->pack->pack_name);
+               p_unlink(idx->pack->pack_name);
 
        git_buf_free(&path);
        git_buf_free(&tmp_path);
@@ -1094,10 +1094,10 @@ void git_indexer_free(git_indexer *idx)
        git_mwindow_free_all(&idx->pack->mwf);
        /* We need to close the descriptor here so Windows doesn't choke on unlink */
        if (idx->pack->mwf.fd != -1) {
-               (void)p_close(idx->pack->mwf.fd);
+               p_close(idx->pack->mwf.fd);
                idx->pack->mwf.fd = -1;
        }
-       (void)p_unlink(idx->pack->pack_name);
+       p_unlink(idx->pack->pack_name);
 
        if (!git_mutex_lock(&git__mwindow_mutex)) {
                git_packfile_free(idx->pack);
index 2c97246052ec46356761b588eea4d3c35b89617b..1e514b2d65b3a559da296f97bf8f92aa53518111 100644 (file)
@@ -155,11 +155,7 @@ void test_pack_indexer__no_tmp_files(void)
        cl_git_pass(git_buf_sets(&path, clar_sandbox_path()));
        cl_git_pass(find_tmp_file_recurs(&first_tmp_file, &path));
        git_buf_free(&path);
-       if (git_buf_is_allocated(&first_tmp_file)) {
-               git_buf_free(&first_tmp_file);
-               cl_warning("Found a temporary file before running the test");
-               cl_skip();
-       }
+       cl_assert(git_buf_len(&first_tmp_file) == 0);
 
        cl_git_pass(git_indexer_new(&idx, ".", 0, NULL, NULL, NULL));
        git_indexer_free(idx);
@@ -167,9 +163,6 @@ void test_pack_indexer__no_tmp_files(void)
        cl_git_pass(git_buf_sets(&path, clar_sandbox_path()));
        cl_git_pass(find_tmp_file_recurs(&first_tmp_file, &path));
        git_buf_free(&path);
-       if (git_buf_is_allocated(&first_tmp_file)) {
-               cl_warning(git_buf_cstr(&first_tmp_file));
-               git_buf_free(&first_tmp_file);
-               cl_fail("Found a temporary file");
-       }
+       cl_assert(git_buf_len(&first_tmp_file) == 0);
+       git_buf_free(&first_tmp_file);
 }