| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1081,7 +1081,7 @@ void git_indexer_free(git_indexer *idx) | |||
| 1081 | 1081 | ||
| 1082 | 1082 | git_vector_free_deep(&idx->objects); | |
| 1083 | 1083 | ||
| 1084 | - if (idx->pack && idx->pack->idx_cache) { | ||
| 1084 | + if (idx->pack->idx_cache) { | ||
| 1085 | 1085 | struct git_pack_entry *pentry; | |
| 1086 | 1086 | kh_foreach_value( | |
| 1087 | 1087 | idx->pack->idx_cache, pentry, { git__free(pentry); }); | |
@@ -1091,17 +1091,10 @@ void git_indexer_free(git_indexer *idx) | |||
| 1091 | 1091 | ||
| 1092 | 1092 | git_vector_free_deep(&idx->deltas); | |
| 1093 | 1093 | ||
| 1094 | - /* Try to delete the temporary file in case it was not committed. */ | ||
| 1095 | - git_mwindow_free_all(&idx->pack->mwf); | ||
| 1096 | - | ||
| 1097 | - /* We need to close the descriptor here so Windows doesn't choke on unlink */ | ||
| 1098 | - if (idx->pack->mwf.fd != -1) | ||
| 1099 | - p_close(idx->pack->mwf.fd); | ||
| 1100 | - | ||
| 1101 | - if (!idx->pack_committed) | ||
| 1102 | - p_unlink(idx->pack->pack_name); | ||
| 1103 | - | ||
| 1104 | 1094 | if (!git_mutex_lock(&git__mwindow_mutex)) { | |
| 1095 | + if (!idx->pack_committed) | ||
| 1096 | + git_packfile_close(idx->pack, true); | ||
| 1097 | + | ||
| 1105 | 1098 | git_packfile_free(idx->pack); | |
| 1106 | 1099 | git_mutex_unlock(&git__mwindow_mutex); | |
| 1107 | 1100 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -991,17 +991,26 @@ git_off_t get_delta_base( | |||
| 991 | 991 | * | |
| 992 | 992 | ***********************************************************/ | |
| 993 | 993 | ||
| 994 | + void git_packfile_close(struct git_pack_file *p, bool unlink_packfile) | ||
| 995 | + { | ||
| 996 | + if (p->mwf.fd >= 0) { | ||
| 997 | + git_mwindow_free_all_locked(&p->mwf); | ||
| 998 | + p_close(p->mwf.fd); | ||
| 999 | + p->mwf.fd = -1; | ||
| 1000 | + } | ||
| 1001 | + | ||
| 1002 | + if (unlink_packfile) | ||
| 1003 | + p_unlink(p->pack_name); | ||
| 1004 | + } | ||
| 1005 | + | ||
| 994 | 1006 | void git_packfile_free(struct git_pack_file *p) | |
| 995 | 1007 | { | |
| 996 | 1008 | if (!p) | |
| 997 | 1009 | return; | |
| 998 | 1010 | ||
| 999 | 1011 | cache_free(&p->bases); | |
| 1000 | 1012 | ||
| 1001 | - if (p->mwf.fd >= 0) { | ||
| 1002 | - git_mwindow_free_all_locked(&p->mwf); | ||
| 1003 | - p_close(p->mwf.fd); | ||
| 1004 | - } | ||
| 1013 | + git_packfile_close(p, false); | ||
| 1005 | 1014 | ||
| 1006 | 1015 | pack_index_free(p); | |
| 1007 | 1016 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -149,6 +149,7 @@ git_off_t get_delta_base(struct git_pack_file *p, git_mwindow **w_curs, | |||
| 149 | 149 | git_off_t *curpos, git_otype type, | |
| 150 | 150 | git_off_t delta_obj_offset); | |
| 151 | 151 | ||
| 152 | + void git_packfile_close(struct git_pack_file *p, bool unlink_packfile); | ||
| 152 | 153 | void git_packfile_free(struct git_pack_file *p); | |
| 153 | 154 | int git_packfile_alloc(struct git_pack_file **pack_out, const char *path); | |
| 154 | 155 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments