return FALSE;
}
+static gboolean
+sizename_is_delta_candidate (OstreeDeltaContentSizeNames *sizename)
+{
+ /* Don't build candidates for the empty object */
+ if (sizename->size == 0)
+ return FALSE;
+
+ /* Look for known non-delta-able files (currently just compression like xz) */
+ for (guint i = 0; i < sizename->basenames->len; i++)
+ {
+ const char *name = sizename->basenames->pdata[i];
+ /* We could replace this down the line with g_content_type_guess() or so,
+ * but it's not clear to me that's a major win; we'd still need to
+ * maintain a list of compression formats, and this doesn't require
+ * allocation.
+ * NB: We explicitly don't have .gz here in case someone might be
+ * using --rsyncable for that.
+ */
+ const char *dot = strrchr (name, '.');
+ if (!dot)
+ continue;
+ const char *extension = dot+1;
+ /* Don't add .gz here, see above */
+ if (g_str_equal (extension, "xz") || g_str_equal (extension, "bz2"))
+ return FALSE;
+ }
+
+ /* Let's try it */
+ return TRUE;
+}
+
/*
* Build up a map of files with matching basenames and similar size,
* and use it to find apparently similar objects.
&to_sizes,
cancellable, error))
goto out;
-
+
/* Iterate over all newly added objects, find objects which have
* similar basename and sizes.
*
const guint64 max_threshold = to_sizenames->size *
(1.0+similarity_percent_threshold/100.0);
- /* Don't build candidates for the empty object */
- if (to_sizenames->size == 0)
+ if (!sizename_is_delta_candidate (to_sizenames))
continue;
for (fuzzy = 0; fuzzy < 2 && !found; fuzzy++)
for (j = lower; j < upper; j++)
{
OstreeDeltaContentSizeNames *from_sizenames = from_sizes->pdata[j];
-
- /* Don't build candidates for the empty object */
- if (from_sizenames->size == 0)
- {
- continue;
- }
+ if (!sizename_is_delta_candidate (from_sizenames))
+ continue;
if (from_sizenames->size < min_threshold)
{