File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2174,11 +2174,14 @@ int lock_packed_refs(int flags)
2174
2174
{
2175
2175
struct packed_ref_cache * packed_ref_cache ;
2176
2176
2177
- /* Discard the old cache because it might be invalid: */
2178
- clear_packed_ref_cache (& ref_cache );
2179
2177
if (hold_lock_file_for_update (& packlock , git_path ("packed-refs" ), flags ) < 0 )
2180
2178
return -1 ;
2181
- /* Read the current packed-refs while holding the lock: */
2179
+ /*
2180
+ * Get the current packed-refs while holding the lock. If the
2181
+ * packed-refs file has been modified since we last read it,
2182
+ * this will automatically invalidate the cache and re-read
2183
+ * the packed-refs file.
2184
+ */
2182
2185
packed_ref_cache = get_packed_ref_cache (& ref_cache );
2183
2186
packed_ref_cache -> lock = & packlock ;
2184
2187
/* Increment the reference count to prevent it from being freed: */
You can’t perform that action at this time.
0 commit comments