File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2174,11 +2174,14 @@ int lock_packed_refs(int flags)
21742174{
21752175 struct packed_ref_cache * packed_ref_cache ;
21762176
2177- /* Discard the old cache because it might be invalid: */
2178- clear_packed_ref_cache (& ref_cache );
21792177 if (hold_lock_file_for_update (& packlock , git_path ("packed-refs" ), flags ) < 0 )
21802178 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+ */
21822185 packed_ref_cache = get_packed_ref_cache (& ref_cache );
21832186 packed_ref_cache -> lock = & packlock ;
21842187 /* Increment the reference count to prevent it from being freed: */
You can’t perform that action at this time.
0 commit comments