Commit 6c52614
committed
csum-file: introduce sha1file_checkpoint
It is useful to be able to rewind a check-summed file to a certain
previous state after writing data into it using sha1write() API. The
fast-import command does this after streaming a blob data to the packfile
being generated and then noticing that the same blob has already been
written, and it does this with a private code truncate_pack() that is
commented as "Yes, this is a layering violation".
Introduce two API functions, sha1file_checkpoint(), that allows the caller
to save a state of a sha1file, and then later revert it to the saved state.
Use it to reimplement truncate_pack().
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 0e99053 commit 6c52614
3 files changed
+37
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
161 | 181 | | |
162 | 182 | | |
163 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
20 | 29 | | |
21 | 30 | | |
22 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1143 | 1143 | | |
1144 | 1144 | | |
1145 | 1145 | | |
1146 | | - | |
| 1146 | + | |
1147 | 1147 | | |
1148 | | - | |
1149 | | - | |
| 1148 | + | |
1150 | 1149 | | |
1151 | | - | |
1152 | | - | |
1153 | | - | |
1154 | | - | |
1155 | | - | |
1156 | | - | |
| 1150 | + | |
1157 | 1151 | | |
1158 | 1152 | | |
1159 | 1153 | | |
| |||
1166 | 1160 | | |
1167 | 1161 | | |
1168 | 1162 | | |
1169 | | - | |
1170 | 1163 | | |
| 1164 | + | |
1171 | 1165 | | |
1172 | 1166 | | |
1173 | 1167 | | |
1174 | 1168 | | |
1175 | 1169 | | |
1176 | 1170 | | |
1177 | 1171 | | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
| 1172 | + | |
| 1173 | + | |
1183 | 1174 | | |
1184 | 1175 | | |
1185 | 1176 | | |
| |||
1245 | 1236 | | |
1246 | 1237 | | |
1247 | 1238 | | |
1248 | | - | |
| 1239 | + | |
1249 | 1240 | | |
1250 | 1241 | | |
1251 | 1242 | | |
1252 | 1243 | | |
1253 | 1244 | | |
1254 | 1245 | | |
1255 | | - | |
| 1246 | + | |
1256 | 1247 | | |
1257 | 1248 | | |
1258 | 1249 | | |
| |||
0 commit comments