@@ -944,41 +944,42 @@ static int packed_write(refdb_fs_backend *backend)
944944{
945945 git_sortedcache * refcache = backend -> refcache ;
946946 git_filebuf pack_file = GIT_FILEBUF_INIT ;
947+ int error ;
947948 size_t i ;
948949
949950 /* lock the cache to updates while we do this */
950- if (git_sortedcache_wlock (refcache ) < 0 )
951- return -1 ;
951+ if (( error = git_sortedcache_wlock (refcache ) ) < 0 )
952+ return error ;
952953
953954 /* Open the file! */
954- if (git_filebuf_open (& pack_file , git_sortedcache_path (refcache ), 0 , GIT_PACKEDREFS_FILE_MODE ) < 0 )
955+ if (( error = git_filebuf_open (& pack_file , git_sortedcache_path (refcache ), 0 , GIT_PACKEDREFS_FILE_MODE ) ) < 0 )
955956 goto fail ;
956957
957958 /* Packfiles have a header... apparently
958959 * This is in fact not required, but we might as well print it
959960 * just for kicks */
960- if (git_filebuf_printf (& pack_file , "%s\n" , GIT_PACKEDREFS_HEADER ) < 0 )
961+ if (( error = git_filebuf_printf (& pack_file , "%s\n" , GIT_PACKEDREFS_HEADER ) ) < 0 )
961962 goto fail ;
962963
963964 for (i = 0 ; i < git_sortedcache_entrycount (refcache ); ++ i ) {
964965 struct packref * ref = git_sortedcache_entry (refcache , i );
965966 assert (ref );
966967
967- if (packed_find_peel (backend , ref ) < 0 )
968+ if (( error = packed_find_peel (backend , ref ) ) < 0 )
968969 goto fail ;
969970
970- if (packed_write_ref (ref , & pack_file ) < 0 )
971+ if (( error = packed_write_ref (ref , & pack_file ) ) < 0 )
971972 goto fail ;
972973 }
973974
974975 /* if we've written all the references properly, we can commit
975976 * the packfile to make the changes effective */
976- if (git_filebuf_commit (& pack_file ) < 0 )
977+ if (( error = git_filebuf_commit (& pack_file ) ) < 0 )
977978 goto fail ;
978979
979980 /* when and only when the packfile has been properly written,
980981 * we can go ahead and remove the loose refs */
981- if (packed_remove_loose (backend ) < 0 )
982+ if (( error = packed_remove_loose (backend ) ) < 0 )
982983 goto fail ;
983984
984985 git_sortedcache_updated (refcache );
@@ -991,7 +992,7 @@ static int packed_write(refdb_fs_backend *backend)
991992 git_filebuf_cleanup (& pack_file );
992993 git_sortedcache_wunlock (refcache );
993994
994- return -1 ;
995+ return error ;
995996}
996997
997998static int reflog_append (refdb_fs_backend * backend , const git_reference * ref , const git_oid * old , const git_oid * new , const git_signature * author , const char * message );
0 commit comments