Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit f5b614e

Browse files
committed
Add comments to pack.c
As I was trying to understand the flow of pack.c I added comments as notes to myself. These are helpful enough to be in the source. Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
1 parent 03feb2a commit f5b614e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/pack.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,13 @@ static void prepare_pack(struct packdata *pack)
138138
return;
139139
}
140140

141+
/* read in manifest from file */
141142
pack->end_manifest = manifest_from_file(pack->to, pack->module);
142-
143+
/* wipe any old packs (failed) and re-create pack directory structure */
143144
empty_pack_stage(0, pack->from, pack->to, pack->module);
144-
145+
/* match up old and new manifests */
145146
match_manifests(manifest, pack->end_manifest);
146-
147+
/* link renames together */
147148
link_renames(pack->end_manifest->files, pack->to);
148149
}
149150

@@ -252,6 +253,8 @@ static GList *consolidate_packs_delta_files(GList *files, struct packdata *pack)
252253
file = item->data;
253254
item = g_list_next(item);
254255

256+
/* skip old files, files without a peer, and files that are not
257+
* files, directories, or links */
255258
if ((file->last_change <= pack->from) ||
256259
(!file->peer) ||
257260
(!file->is_file && !file->is_dir && !file->is_link)) {
@@ -261,7 +264,10 @@ static GList *consolidate_packs_delta_files(GList *files, struct packdata *pack)
261264
string_or_die(&from, "%s/%i/delta/%i-%i-%s-%s", staging_dir, file->last_change,
262265
file->peer->last_change, file->last_change, file->peer->hash, file->hash);
263266

267+
/* check for existence */
264268
ret = stat(from, &stat_delta);
269+
/* only add if delta does not already exist and the file is not
270+
* in files */
265271
if (ret && !find_file_in_list(files, file)) {
266272
files = g_list_prepend(files, file);
267273
}

0 commit comments

Comments
 (0)