From 9a369d39e13787c376c57713ab8c14e5c0f4bfb8 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Mon, 17 Aug 2015 22:45:31 +0000 Subject: 36209: vcs_info: avoid grep error message when file is missing When running git rebase -m and a conflict occurs, the git-rebase-todo file is not present. This leads to an error from grep every time the shell prompt is printed when vcs_info is enabled. Avoid this message by checking if the file exists before trying to grep it. --- Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Functions') diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index c348da2a7..3fc861eeb 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -210,7 +210,9 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then # remove action git_patches_applied+=("${${(s: :)p}[2,-1]}") done - git_patches_unapplied=(${(f)"$(grep -v '^$' "${patchdir}/git-rebase-todo" | grep -v '^#')"}) + if [[ -f "${patchdir}/git-rebase-todo" ]] ; then + git_patches_unapplied=(${(f)"$(grep -v '^$' "${patchdir}/git-rebase-todo" | grep -v '^#')"}) + fi VCS_INFO_git_handle_patches elif [[ -d "${gitdir}/rebase-apply" ]]; then # Fake patch names for all but current patch -- cgit 1.4.1