File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -1100,22 +1100,27 @@ static int packed_write(refdb_fs_backend *backend)
11001100static int packed_delete (refdb_fs_backend * backend , const char * ref_name )
11011101{
11021102 size_t pack_pos ;
1103- int error ;
1103+ int error , found = 0 ;
11041104
11051105 if ((error = packed_reload (backend )) < 0 )
11061106 goto cleanup ;
11071107
1108- /* If a packed reference exists, remove it from the packfile and repack */
11091108 if ((error = git_sortedcache_wlock (backend -> refcache )) < 0 )
11101109 goto cleanup ;
11111110
1112- if (!(error = git_sortedcache_lookup_index (
1113- & pack_pos , backend -> refcache , ref_name )))
1111+ /* If a packed reference exists, remove it from the packfile and repack if necessary */
1112+ error = git_sortedcache_lookup_index (& pack_pos , backend -> refcache , ref_name );
1113+ if (error == 0 ) {
11141114 error = git_sortedcache_remove (backend -> refcache , pack_pos );
1115+ found = 1 ;
1116+ }
1117+ if (error == GIT_ENOTFOUND )
1118+ error = 0 ;
11151119
11161120 git_sortedcache_wunlock (backend -> refcache );
11171121
1118- error = packed_write (backend );
1122+ if (found )
1123+ error = packed_write (backend );
11191124
11201125cleanup :
11211126 return error ;
You can’t perform that action at this time.
0 commit comments