matched_pathspec, NULL);
}
+static void diff_delta__flag_known_size(git_diff_file *file)
+{
+ /*
+ * If we don't know the ID, that can only come from the workdir
+ * iterator, which means we *do* know the file size. This is a
+ * leaky abstraction, but alas. Otherwise, we test against the
+ * empty blob id.
+ */
+ if (file->size ||
+ !(file->flags & GIT_DIFF_FLAG_VALID_ID) ||
+ git_oid_equal(&file->id, &git_oid__empty_blob_sha1))
+ file->flags |= GIT_DIFF_FLAG_VALID_SIZE;
+}
+
+static void diff_delta__flag_known_sizes(git_diff_delta *delta)
+{
+ diff_delta__flag_known_size(&delta->old_file);
+ diff_delta__flag_known_size(&delta->new_file);
+}
+
static int diff_delta__from_one(
git_diff_generated *diff,
git_delta_t status,
if (has_old || !git_oid_is_zero(&delta->new_file.id))
delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
+ diff_delta__flag_known_sizes(delta);
+
return diff_insert_delta(diff, delta, matched_pathspec);
}
delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
}
+ diff_delta__flag_known_sizes(delta);
+
return diff_insert_delta(diff, delta, matched_pathspec);
}
const git_oid *update_match)
{
git_diff_generated *diff;
- git_buf full_path = GIT_BUF_INIT;
+ git_str full_path = GIT_STR_INIT;
git_index_entry entry = *src;
git_filter_list *fl = NULL;
int error = 0;
diff->base.perf.stat_calls++;
if (p_stat(full_path.ptr, &st) < 0) {
- error = git_path_set_error(errno, entry.path, "stat");
- git_buf_dispose(&full_path);
+ error = git_fs_path_set_error(errno, entry.path, "stat");
+ git_str_dispose(&full_path);
return error;
}
}
}
- git_buf_dispose(&full_path);
+ git_str_dispose(&full_path);
return error;
}
/* do not advance into directories that contain a .git file */
if (recurse_into_dir && !contains_oitem) {
- git_buf *full = NULL;
+ git_str *full = NULL;
if (git_iterator_current_workdir_path(&full, info->new_iter) < 0)
return -1;
- if (full && git_path_contains(full, DOT_GIT)) {
+ if (full && git_fs_path_contains(full, DOT_GIT)) {
/* TODO: warning if not a valid git repository */
recurse_into_dir = false;
}