From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RDNS_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: (qmail 9939 invoked from network); 12 Mar 2020 18:07:19 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from unknown (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTP; 12 Mar 2020 18:07:19 -0000 Received: (qmail 1743 invoked by alias); 12 Mar 2020 18:07:12 -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: 45539 Received: (qmail 18771 invoked by uid 1010); 12 Mar 2020 18:07:12 -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.102.2/25744. spamassassin: 3.4.2. Clear:RC:0(66.111.4.27):SA:0(-1.9/5.0):. Processed in 3.205911 secs); 12 Mar 2020 18:07:12 -0000 X-Envelope-From: danielsh@apache.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: softfail (ns1.primenet.com.au: transitioning SPF record at amazonses.com does not designate 66.111.4.27 as permitted sender) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedruddvhedguddutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogfggedutddqvdejucdlgedtmdenucfjughrpe fhvffufffkofgjfhgggfestdektddtredttdenucfhrhhomhepffgrnhhivghlucfuhhgr hhgrfhcuoegurghnihgvlhhshhesrghprggthhgvrdhorhhgqeenucfkphepjeelrdduje eirdehledrudehvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpegurghnihgvlhhshhesrghprggthhgvrdhorhhg X-ME-Proxy: From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH 2/3] vcs_info git: In non-interactive rebases, obtain applied patches' names. Date: Thu, 12 Mar 2020 18:06:22 +0000 Message-Id: <20200312180623.5751-2-danielsh@tarpaulin.shahaf.local2> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312180623.5751-1-danielsh@tarpaulin.shahaf.local2> References: <20200312180623.5751-1-danielsh@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Qmail-Scanner-2.11: added fake Content-Type header Content-Type: text/plain --- .../VCS_Info/Backends/VCS_INFO_get_data_git | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 6391cd1a6..4731c7400 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -253,11 +253,23 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then local cur=$(< $next) local p subject # Fake patch names for patches "before" the current patch - # - # Note: With git 2.24, (( cur == 1 )), so the loop body never runs. - for ((p = 1; p < cur; p++)); do - printf -v "git_patches_applied[$p]" "%04d ?" "$p" - done + if [[ -r ${patchdir}/rewritten ]]; then + if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" use-simple; then + git_patches_applied=( ${${(f)"$(<${patchdir}/rewritten)"}// */' ?'} ) + else + git_patches_applied=( + ${(f)"$(${vcs_comm[cmd]} log --no-walk=unsorted --pretty='%h %s' ${${(f)"$(<${patchdir}/rewritten)"}%% *} --)"} + ) + fi + else + # Compatibility with old git. In 2.11 and 2.24, at least, + # (( cur == 1 )), so the loop body would never run. However, both + # of these versions have original-commit and orig-head and would + # take the 'if' branch, rather than this 'else' branch. + for ((p = 1; p < cur; p++)); do + printf -v "git_patches_applied[$p]" "%04d ?" "$p" + done + fi # Set $subject to the info for the current patch if [[ -f "${patchdir}/msg-clean" ]]; then subject="${$(< "${patchdir}/msg-clean")[(f)1]}"