From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-return-43587-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id e487a299 for ; Tue, 2 Oct 2018 15:21:51 +0000 (UTC) Received: (qmail 10401 invoked by alias); 2 Oct 2018 15:21:09 -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: List-Unsubscribe: X-Seq: 43587 Received: (qmail 2906 invoked by uid 1010); 2 Oct 2018 15:21:09 -0000 X-Qmail-Scanner-Diagnostics: from out3-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.27):SA:0(-2.6/5.0):. Processed in 6.5584 secs); 02 Oct 2018 15:21:09 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=OY+q09Qa1JD3hsOQNSMUjntIes5UetmInpPgMf9bR/8=; b=XwS0PHrR WjozSKJKTzb7yYbyW4mKy9eUnKHkfoti8emMsx14mgdiwRAhEAp7TsUS3uaQkmyo 7zANxMaZqTEe8OMeVymM5zd2dvM3Bh35hCXVjnXS+JDzS2k2Vy/aZZNzg3kOxgb3 9/ixSCIpr8/TP6ybO4yUHAcW2dXth88td2rtzdpImvgzqPJMo+s7i17/a63kfRIK ObDouIN6ZKWPlyANs1jwAr00r9NZvww7hFkg7XD2VdVo3Y4kPjAAGL1uXLu0rDw/ VtiTnmqcvaiJO1HWwFmTksUFzKLIxpTsFO2O/oYS7RqLGhmgaMJ1qdDbGDnKEN3z ZU0o/Eq9k6avhQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=OY+q09Qa1JD3hsOQNSMUjntIes5UetmInpPgMf9bR/8=; b=HgV+En+8 PMDKKzz3i/zxKjnpZW9n8btbpaRrWlJkhi2QzBUHemrunVMxKL35eK+z/S0dUb36 rJ9/6v//07xmgC5EeMYsEMxjvPiTGzXlg6+/q/7b7U2WIq3wblyHbBY6rdtj0Zzr OYkyHR0dRICFahOxZvdHC7y1YnpWaS88ggFmxFAUCFxwDWZzn7vXiXFqX9rkxxis b7GGyTNPSNh8qEEm7Xy+OLtPMqFLSoGYuQdxX4kF0mAJyTnQXi1ycR3yotAOBZLo jDzyoJpFHpIBN4jRFNf6DTqNYxwonSDvWsbBkIJ/pEi5OXCnYlTKRGl+Q0s4vKsC 0Y2OznaFbiYnxw== X-ME-Sender: X-ME-Proxy: From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH 3/3] vcs_info git: In 'git rebase -i', when computing subjects of applied-patches, handle an edge case where the subject is not available. Date: Tue, 2 Oct 2018 15:20:54 +0000 Message-Id: <20181002152054.28358-3-danielsh@tarpaulin.shahaf.local2> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181002152054.28358-1-danielsh@tarpaulin.shahaf.local2> References: <20181002152054.28358-1-danielsh@tarpaulin.shahaf.local2> --- Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index f38a0d370..d9cf1a19e 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -195,6 +195,24 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then # The line is of the form "pick $hash $subject". # Just strip the verb and we're good to go. p=${p#* } + # Special case: in an interactive rebase, if the user wrote "p $shorthash\n" + # in the editor (without a description after the hash), then the .../done + # file will contain "p $longhash $shorthash\n" (git 2.11.0) or "pick $longhash\n" + # (git 2.19.0). + if [[ $p != *\ * ]]; then + # The line is of the form "pick $longhash\n" + # + # Mark the log message subject as unknown. + # TODO: Can we performantly obtain the subject? + p+=" ?" + elif (( ${#${p//[^ ]}} == 1 )) && [[ ${p%% *} == ${p#* }* ]]; then + # The line is of the form "p $longhash $shorthash\n" + # + # The shorthash is superfluous, so discard it, and mark + # the log message subject as unknown. + # TODO: Can we performantly obtain the subject? + p="${p%% *} ?" + fi ;; (x *) # The line is of the form 'exec foo bar baz' where 'foo bar @@ -211,6 +229,7 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then git_patches_applied+=("$p") done if [[ -f "${patchdir}/git-rebase-todo" ]] ; then + # TODO: Process ${patchdir}/git-rebase-todo lines like ${patchdir}/done lines are git_patches_unapplied=( ${${(f)${"$(<"${patchdir}/git-rebase-todo")"}}:#[#]*} ) fi VCS_INFO_git_handle_patches