From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17275 invoked from network); 13 Apr 2021 11:58:53 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Apr 2021 11:58:53 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1618315133; b=mctmjbcCLOJuU0a9RWFjhoWkaNFDsNlpiztuRfS7F6qqz9Zwusqgb77fJaZIDFC1fjXvxJIxLg Ki3llm0DWpjTOGJkUHjG1AYN50Z3AL6DjI2tWK8C5/wZaKKlU0RBn6wQG7pg8lpFppN+f1eIUN zkzih7XQKXkGF4zKr7dlmv6xDCGcKGZLp1Vsrw1eE16BVLXpyU8u91zMXm0wZEs1nQSQa09z0j vdMMVRlA20bVy2egBhOImRB4mZXDZmHhp7zM+8gWb83DLbmVv7H7hXIOdI27dZuBJfm0T8KL/8 hmMYtTIyGlOpiLUrX8KKlT0bynLhAh8fY/srGjCYgt51YQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-pf1-f171.google.com) smtp.remote-ip=209.85.210.171; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1618315133; bh=a+RyhINyNbFwSyZ3P2M6UuXYb7T7NvI9wn7DctRlhk8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature:DKIM-Signature; b=Rngz6enSH7TcMqAfVQAetBwdyyfROwovi4iYI/sQ4YI/B9RvuI7oLduKACgGCOB7/sXpqOHuss Ec4LVVb/kGhfpjuPbonUYoP7QlfKbPlfkZaY+w5nUL0DXJneVVd0my6rNxCDNlGcGDa95JWy6u 3zKrvzzzCxos0DqhcZIPiNYtgzQa9CUbGsAcxuv99dqwepY37bRyHuAReu8MsZeDcx3RnhB4UK A3yAlRuqp9YpwHNG1e57fYayZYaA8yiDa/i9OMazGsy2qWzjCjbfBRkAIerw+VwVrxv+l+Fa7a NUf8YFUnjCe+mFlu713T7seOHidpVJ1L25FnhQjbXKJX/g==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=wGACYIEzCnQA9TBs8IqHMWiSwr3H7JxkLnLjfXyTISg=; b=DxT2IELJDTdYMXgHWmw0ZN/lWZ Ifn12qQ+uZvNZfO2eZTaBYrsSja+JqjO7Aox5YTtwemfzxzPGd/Ee2yWBSfHwKcI62C4mQvBEe2gN X9gJbe1hZOMjmxoS/bdC26n3oyZBHxFYHaEvsfezbwolMOvk4DBJXgOXgVBIYOreb+2Zz2zU2iyu0 ojKl6COJ02mMB4wryXXbE1RpYqSjMSQ6gEbvYZPHDYT+y3+n2vst7JuX4qPJDEmgvKUZexS7VFEo0 S39lS1JJHoqAvkp/EFW6kT8qB59SKAHfKXW05J/OHUZI5eDsH0omphL6R3ersdcU3vvN0EDr8P6Lj m0iV8VFg==; Received: from authenticated user by zero.zsh.org with local id 1lWHgy-000NGd-SJ; Tue, 13 Apr 2021 11:58:53 +0000 Authentication-Results: zsh.org; iprev=pass (mail-pf1-f171.google.com) smtp.remote-ip=209.85.210.171; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-pf1-f171.google.com ([209.85.210.171]:34526) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lWHgj-000N0m-GJ; Tue, 13 Apr 2021 11:58:38 +0000 Received: by mail-pf1-f171.google.com with SMTP id 10so2397844pfl.1; Tue, 13 Apr 2021 04:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wGACYIEzCnQA9TBs8IqHMWiSwr3H7JxkLnLjfXyTISg=; b=VK+4mhaLV+pIIxv2Cj6q+EtocXViaTvycckwfpBw0t/j/kfMzNIr6YEwI+Fc8Vr3Wj uMO/+cXE2gbTR3t6FUc1Tlt/37CFS69j14MWaz0Zt72p3LiTWmx7u3BRt8O/8Y7JuRh2 ezuwqTs27nO8udEYVTyVS4fQW8T5IhQgx2mN8esGFyA7/9O+RVIW0//27bCCDN2BRLON MlDuWZy8pmvnirHHWz+UCRbrM/ZX6TYyTr9Yz4TihPTcS2ZJC+gQHqwfUd4JDb45Pxz1 shgZpC/GRivc1L3+lrnRjzdXzCnjk3g+BLIE7+ZGQR/UDzg4LHMQd/ni9kazzu1XVPoW fLbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wGACYIEzCnQA9TBs8IqHMWiSwr3H7JxkLnLjfXyTISg=; b=bI6ov9pRUdaRQSG0zukyMVblZ4i6gJt6Qp3JPeLV9MAXbS8iJjctPLu1UyhnjVNvzw z4IY2q46j/NLWtaE0CtfNu4p/EdIfdom8ZGO4WHPNR5gjInA3GY9vqYsfM2WfBTArfu7 eNdTqZn67lfSMfqWLXVC5fPgqTJSrsYcp3GCJD6Lks9tPB79KOBvm4JSL44IF/tmkMKw /50RkV95fJzHYaT+BlDKFtG4YeVVyeJkft9Mv/Alojt/80sT3cPry5plZhFHsKVCb4h9 /gzlaeF2Ki2X68cEdpYGDapt1rFm0XOgfSS3Vu67MlAXwnBkmggttjn7X7NEW2bVQy8q L4uA== X-Gm-Message-State: AOAM531TVgFtjw5CsExnxYzIIksfmz6Af0kSA8RrMFQ63weVfZYLFIU8 /R0CZ+fUjJpnFgeRaTS/y/98TtNKG1x3yw== X-Google-Smtp-Source: ABdhPJwJesAqHpWlPOJ11HmFrRwSQwvPznllREVJGVax44DAd3fNMvmwJ0UXishe2YyB6uWLcuSB+g== X-Received: by 2002:a63:1f4d:: with SMTP id q13mr21287056pgm.453.1618315116246; Tue, 13 Apr 2021 04:58:36 -0700 (PDT) Received: from localhost ([61.6.235.213]) by smtp.gmail.com with ESMTPSA id w18sm2130648pjh.19.2021.04.13.04.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 04:58:35 -0700 (PDT) Date: Tue, 13 Apr 2021 19:58:30 +0800 From: Tim Lee To: Daniel Shahaf Cc: Lawrence =?utf-8?Q?Vel=C3=A1zquez?= , zsh-workers@zsh.org Subject: Re: [PATCH] Improve vcs_info example for ahead/behind git commits Message-ID: <20210413115830.5wogi3e7dh2tthmw@localhost> References: <20210328213628.7rwz62bq5p2isd6b@home-guest> <20210329070611.GM18178@tarpaulin.shahaf.local2> <20210329093056.fegqam75id4yfkiq@home-guest> <20210329103927.qzky3fyevptfflvj@home-guest> <1b0343d9-87c2-4a0d-860f-30a390d7034d@www.fastmail.com> <87d2c775-18f3-4664-9a3f-de62f5b71777@www.fastmail.com> <20210413113441.GD6819@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210413113441.GD6819@tarpaulin.shahaf.local2> X-Seq: 48525 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: > Tim: Would you have time to address the remaining points from the > original review, https://zsh.org/workers/48306, either by implementing > them and sending a revised patch, or by counterarguing them? I think I'll just porpose something simple, since I'm not very familiar with ZSH. Patch: diff --git a/Misc/vcs_info-examples b/Misc/vcs_info-examples index 94b8a7b5e..d33d0ceed 100644 --- a/Misc/vcs_info-examples +++ b/Misc/vcs_info-examples @@ -179,14 +179,10 @@ function +vi-git-st() { local ahead behind local -a gitstatus - # for git prior to 1.7 - # ahead=$(git rev-list origin/${hook_com[branch]}..HEAD | wc -l) - ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) + ahead=$(git rev-list --count ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null) (( $ahead )) && gitstatus+=( "+${ahead}" ) - # for git prior to 1.7 - # behind=$(git rev-list HEAD..origin/${hook_com[branch]} | wc -l) - behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) + behind=$(git rev-list --count HEAD..${hook_com[branch]}@{upstream} 2>/dev/null) (( $behind )) && gitstatus+=( "-${behind}" ) hook_com[misc]+=${(j:/:)gitstatus}