File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed
Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -196,28 +196,29 @@ int git_futils_readbuffer_updated(
196196
197197 p_close (fd );
198198
199- if ((error = git_hash_buf (& checksum_new , buf .ptr , buf .size )) < 0 ) {
200- git_buf_free (& buf );
201- return error ;
202- }
199+ if (checksum ) {
200+ if ((error = git_hash_buf (& checksum_new , buf .ptr , buf .size )) < 0 ) {
201+ git_buf_free (& buf );
202+ return error ;
203+ }
203204
204- /*
205- * If we were given a checksum, we only want to use it if it's different
206- */
207- if (checksum && !git_oid__cmp (checksum , & checksum_new )) {
208- git_buf_free (& buf );
209- if (updated )
210- * updated = 0 ;
205+ /*
206+ * If we were given a checksum, we only want to use it if it's different
207+ */
208+ if (!git_oid__cmp (checksum , & checksum_new )) {
209+ git_buf_free (& buf );
210+ if (updated )
211+ * updated = 0 ;
211212
212- return 0 ;
213+ return 0 ;
214+ }
215+
216+ git_oid_cpy (checksum , & checksum_new );
213217 }
214218
215219 /*
216220 * If we're here, the file did change, or the user didn't have an old version
217221 */
218- if (checksum )
219- git_oid_cpy (checksum , & checksum_new );
220-
221222 if (updated != NULL )
222223 * updated = 1 ;
223224
You can’t perform that action at this time.
0 commit comments