зеркало из https://github.com/microsoft/git.git
merge-recursive: add some defensive coding to was_dirty()
It took this developer quite a good while to understand why the current code cannot get a `NULL` returned by `index_file_exists()`. To un-confuse readers (and future-proof the code), let's just be safe and check before we dereference the returned pointer.
This commit is contained in:
Родитель
92aa3dedc2
Коммит
24877a61d8
|
@ -877,7 +877,7 @@ static int was_dirty(struct merge_options *opt, const char *path)
|
|||
|
||||
ce = index_file_exists(opt->priv->unpack_opts.src_index,
|
||||
path, strlen(path), ignore_case);
|
||||
return verify_uptodate(ce, &opt->priv->unpack_opts) != 0;
|
||||
return !ce || verify_uptodate(ce, &opt->priv->unpack_opts) != 0;
|
||||
}
|
||||
|
||||
static int make_room_for_path(struct merge_options *opt, const char *path)
|
||||
|
|
Загрузка…
Ссылка в новой задаче