Skip to content

Commit b883d37

Browse files
committed
ignore: fix a missing commondir causing failures
As with the preceding commit, the ignore code tries to load code from info/exclude, and we fail to ignore a non-existent file here.
1 parent 82c7a9b commit b883d37

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/ignore.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,13 @@ int git_ignore__for_path(
335335
goto cleanup;
336336
}
337337

338-
if ((error = git_repository_item_path(&infopath,
339-
repo, GIT_REPOSITORY_ITEM_INFO)) < 0)
340-
goto cleanup;
341-
342-
/* load .git/info/exclude */
343-
error = push_ignore_file(
344-
ignores, &ignores->ign_global,
345-
infopath.ptr, GIT_IGNORE_FILE_INREPO);
346-
if (error < 0)
347-
goto cleanup;
338+
/* load .git/info/exclude if possible */
339+
if ((error = git_repository_item_path(&infopath, repo, GIT_REPOSITORY_ITEM_INFO)) < 0 ||
340+
(error = push_ignore_file(ignores, &ignores->ign_global, infopath.ptr, GIT_IGNORE_FILE_INREPO)) < 0) {
341+
if (error != GIT_ENOTFOUND)
342+
goto cleanup;
343+
error = 0;
344+
}
348345

349346
/* load core.excludesfile */
350347
if (git_repository_attr_cache(repo)->cfg_excl_file != NULL)

0 commit comments

Comments
 (0)