From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1296 invoked by alias); 11 Oct 2015 10:16:52 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36830 Received: (qmail 22195 invoked from network); 11 Oct 2015 10:16:49 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 From: Frank Terbeck To: zsh-workers@zsh.org Subject: [PATCH] vcs_info: Silence an error message with new git versions Date: Sun, 11 Oct 2015 11:54:06 +0200 Message-Id: <1444557246-1233-1-git-send-email-ft@bewatermyfriend.org> X-Mailer: git-send-email 2.1.4 X-Df-Sender: NDMwNDQ0 Mikael informs me on IRC, that in new versions of git (he used 2.6.1) where the "am" subcommand is now a builtin, a file that is used by the git backend of vcs_info (namely .git/rebase-apply/msg-clean) is not available anymore, leading to an annoying error message: VCS_INFO_get_data_git:232: no such file or directory: .git/rebase-apply/msg-clean This patch checks for the availabiliy of the file before using it, and adjusts the value of the dependant values accordingly. --- Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 34 +++++++++++++++-------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 8ecc7c7..dcff616 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -219,18 +219,28 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then patchdir="${gitdir}/rebase-apply" local next="${patchdir}/next" if [[ -f $next ]]; then - local cur=$(< $next) - local p subject - for p in $(seq $(($cur - 1))); do - git_patches_applied+=("$(printf "%04d" $p) ?") - done - subject="${$(< "${patchdir}/msg-clean")[(f)1]}" - if [[ -f "${patchdir}/original-commit" ]]; then - git_patches_applied+=("$(< ${patchdir}/original-commit) $subject") - else - git_patches_applied+=("? $subject") - fi - git_patches_unapplied=($(seq $cur $(< "${patchdir}/last"))) + local cur=$(< $next) + local p subject + for p in $(seq $(($cur - 1))); do + git_patches_applied+=("$(printf "%04d" $p) ?") + done + if [[ -f "${patchdir}/msg-clean" ]]; then + subject="${$(< "${patchdir}/msg-clean")[(f)1]}" + fi + if [[ -f "${patchdir}/original-commit" ]]; then + if [[ -n $subject ]]; then + git_patches_applied+=("$(< ${patchdir}/original-commit) $subject") + else + git_patches_applied+=("$(< ${patchdir}/original-commit)") + fi + else + if [[ -n $subject ]]; then + git_patches_applied+=("? $subject") + else + git_patches_applied+=("?") + fi + fi + git_patches_unapplied=($(seq $cur $(< "${patchdir}/last"))) fi VCS_INFO_git_handle_patches -- 2.1.4