git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Avi Halachmi via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
	Avi Halachmi <avihpit@yahoo.com>
Subject: [PATCH v2 0/8] git-prompt: support more shells v2
Date: Thu, 15 Aug 2024 13:14:05 +0000	[thread overview]
Message-ID: <pull.1750.v2.git.git.1723727653.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1750.git.git.1721762306.gitgitgadget@gmail.com>

This addresses review comment on part 6/8 (git-prompt: add fallback for
shells without $'...') which requested to use one form for all shells
instead $'...' where supported and a fallback otherwise.

Parts 7/8 and 8/8 are rebased trivially on top of updated part 6/8.

Using the GitGitGadget github interface, so I don't know whether it will
send only the 3 updated patches, or all 8 as v2.

Potential followups which this series does not address:

 * A comment on part 6/8 suggested to add to CodingGuidelines some of the
   guidelines in the commit messages, without being specific, likely
   referring to part 5/8 (git-prompt: add some missing quotes).

 * The same comment to 6/8 posted a suggested patch to CodingGuidelines to
   disallow bashism [[...]], and disallow $'...' - which is comliant (POSIX
   2024) but not supported in all shells.

Avi Halachmi (:avih) (8):
  git-prompt: use here-doc instead of here-string
  git-prompt: fix uninitialized variable
  git-prompt: don't use shell arrays
  git-prompt: replace [[...]] with standard code
  git-prompt: add some missing quotes
  git-prompt: don't use shell $'...'
  git-prompt: ta-da! document usage in other shells
  git-prompt: support custom 0-width PS1 markers

 contrib/completion/git-prompt.sh | 191 ++++++++++++++++++++-----------
 1 file changed, 126 insertions(+), 65 deletions(-)


base-commit: d19b6cd2dd72dc811f19df4b32c7ed223256c3ee
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1750%2Favih%2Fprompt-compat-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1750/avih/prompt-compat-v2
Pull-Request: https://github.com/git/git/pull/1750

Range-diff vs v1:

 1:  9ce5ddadf0b = 1:  9ce5ddadf0b git-prompt: use here-doc instead of here-string
 2:  680ecb52404 = 2:  680ecb52404 git-prompt: fix uninitialized variable
 3:  7e994eae7bc = 3:  7e994eae7bc git-prompt: don't use shell arrays
 4:  232340902a1 = 4:  232340902a1 git-prompt: replace [[...]] with standard code
 5:  4f77b7eb7f1 = 5:  4f77b7eb7f1 git-prompt: add some missing quotes
 6:  1c1b58e20ca ! 6:  363b7015763 git-prompt: add fallback for shells without $'...'
     @@ Metadata
      Author: Avi Halachmi (:avih) <avihpit@yahoo.com>
      
       ## Commit message ##
     -    git-prompt: add fallback for shells without $'...'
     +    git-prompt: don't use shell $'...'
      
          $'...' is new in POSIX (2024), and some shells support it in recent
          versions, while others have had it for decades (bash, zsh, ksh93).
      
          However, there are still enough shells which don't support it, and
     -    it's cheap to provide a fallback for them, so let's do that instead
     -    of dismissing it as "it's compliant".
     +    it's cheap to use an alternative form which works in all shells,
     +    so let's do that instead of dismissing it as "it's compliant".
     +
     +    It was agreed to use one form rather than $'...' where supported and
     +    fallback otherwise.
      
          shells where $'...' works:
          - bash, zsh, ksh93, mksh, busybox-ash, dash master, free/net bsd sh.
     @@ contrib/completion/git-prompt.sh
       __git_printf_supports_v=
       printf -v __git_printf_supports_v -- '%s' yes >/dev/null 2>&1
       
     -+__git_SOH=$'\1' __git_STX=$'\2' __git_ESC=$'\33'
     -+__git_LF=$'\n' __git_CRLF=$'\r\n'
     -+
     -+if [ $'\101' != A ]; then  # fallback for shells without $'...'
     -+   __git_CRLF=$(printf "\r\n\1\2\33")  # CR LF SOH STX ESC
     -+   __git_ESC=${__git_CRLF#????}; __git_CRLF=${__git_CRLF%?}
     -+   __git_STX=${__git_CRLF#???};  __git_CRLF=${__git_CRLF%?}
     -+   __git_SOH=${__git_CRLF#??};   __git_CRLF=${__git_CRLF%?}
     -+   __git_LF=${__git_CRLF#?}
     -+fi
     ++# like __git_SOH=$'\001' etc but works also in shells without $'...'
     ++eval "$(printf '
     ++	__git_SOH="\001" __git_STX="\002" __git_ESC="\033"
     ++	__git_LF="\n" __git_CRLF="\r\n"
     ++')"
      +
       # stores the divergence from upstream in $p
       # used by GIT_PS1_SHOWUPSTREAM
 7:  4a086ffc360 = 7:  4aa75cdb5dd git-prompt: ta-da! document usage in other shells
 8:  f241c3ae1e4 = 8:  e71ddcd2232 git-prompt: support custom 0-width PS1 markers

-- 
gitgitgadget

  parent reply	other threads:[~2024-08-15 13:14 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-23 19:18 [PATCH 0/8] git-prompt: support more shells Avi Halachmi via GitGitGadget
2024-07-23 19:18 ` [PATCH 1/8] git-prompt: use here-doc instead of here-string Avi Halachmi (:avih) via GitGitGadget
2024-07-23 19:18 ` [PATCH 2/8] git-prompt: fix uninitialized variable Avi Halachmi (:avih) via GitGitGadget
2024-07-23 19:18 ` [PATCH 3/8] git-prompt: don't use shell arrays Avi Halachmi (:avih) via GitGitGadget
2024-07-23 19:18 ` [PATCH 4/8] git-prompt: replace [[...]] with standard code Avi Halachmi (:avih) via GitGitGadget
2024-07-23 19:18 ` [PATCH 5/8] git-prompt: add some missing quotes Avi Halachmi (:avih) via GitGitGadget
2024-07-23 19:40   ` Junio C Hamano
2024-07-24  0:47     ` avih
2024-07-23 19:18 ` [PATCH 6/8] git-prompt: add fallback for shells without $'...' Avi Halachmi (:avih) via GitGitGadget
2024-07-23 20:25   ` Junio C Hamano
2024-07-24  2:08     ` avih
2024-07-25 11:27       ` avih
2024-07-25 13:28         ` avih
2024-07-25 16:24           ` Junio C Hamano
2024-07-25 20:03             ` avih
2024-07-25 16:19         ` Junio C Hamano
2024-08-14 18:09     ` avih
2024-08-14 19:32       ` Junio C Hamano
2024-08-15  4:17         ` avih
2024-08-15 12:44           ` Junio C Hamano
2024-07-23 19:18 ` [PATCH 7/8] git-prompt: ta-da! document usage in other shells Avi Halachmi (:avih) via GitGitGadget
2024-07-23 19:18 ` [PATCH 8/8] git-prompt: support custom 0-width PS1 markers Avi Halachmi (:avih) via GitGitGadget
2024-07-23 22:50 ` [PATCH 0/8] git-prompt: support more shells brian m. carlson
2024-07-24  2:41   ` avih
2024-07-24 15:29     ` Junio C Hamano
2024-07-24 17:08       ` avih
2024-07-24 17:13       ` Junio C Hamano
2024-08-15 13:14 ` Avi Halachmi via GitGitGadget [this message]
2024-08-15 13:14   ` [PATCH v2 1/8] git-prompt: use here-doc instead of here-string Avi Halachmi (:avih) via GitGitGadget
2024-08-16  8:50     ` Patrick Steinhardt
2024-08-16  9:37       ` avih
2024-08-16 10:52         ` Patrick Steinhardt
2024-08-15 13:14   ` [PATCH v2 2/8] git-prompt: fix uninitialized variable Avi Halachmi (:avih) via GitGitGadget
2024-08-15 13:14   ` [PATCH v2 3/8] git-prompt: don't use shell arrays Avi Halachmi (:avih) via GitGitGadget
2024-08-16  8:50     ` Patrick Steinhardt
2024-08-16  9:53       ` avih
2024-08-16 10:52         ` Patrick Steinhardt
2024-08-16 11:35           ` avih
2024-08-16 12:38             ` Patrick Steinhardt
2024-08-15 13:14   ` [PATCH v2 4/8] git-prompt: replace [[...]] with standard code Avi Halachmi (:avih) via GitGitGadget
2024-08-15 16:27     ` Junio C Hamano
2024-08-16 10:36       ` avih
2024-08-16 16:42         ` Junio C Hamano
2024-08-15 13:14   ` [PATCH v2 5/8] git-prompt: add some missing quotes Avi Halachmi (:avih) via GitGitGadget
2024-08-15 16:36     ` Junio C Hamano
2024-08-15 17:35       ` avih
2024-08-15 19:15         ` Junio C Hamano
2024-08-15 19:53           ` avih
2024-08-15 13:14   ` [PATCH v2 6/8] git-prompt: don't use shell $'...' Avi Halachmi (:avih) via GitGitGadget
2024-08-15 13:14   ` [PATCH v2 7/8] git-prompt: ta-da! document usage in other shells Avi Halachmi (:avih) via GitGitGadget
2024-08-16  8:50     ` Patrick Steinhardt
2024-08-16  9:59       ` avih
2024-08-15 13:14   ` [PATCH v2 8/8] git-prompt: support custom 0-width PS1 markers Avi Halachmi (:avih) via GitGitGadget
2024-08-15 18:48   ` [PATCH v2 0/8] git-prompt: support more shells v2 Junio C Hamano
2024-08-16  8:50     ` Patrick Steinhardt
2024-08-17  9:25   ` [PATCH v3 0/8] git-prompt: support more shells v3 Avi Halachmi via GitGitGadget
2024-08-17  9:25     ` [PATCH v3 1/8] git-prompt: use here-doc instead of here-string Avi Halachmi (:avih) via GitGitGadget
2024-08-17  9:25     ` [PATCH v3 2/8] git-prompt: fix uninitialized variable Avi Halachmi (:avih) via GitGitGadget
2024-08-17  9:25     ` [PATCH v3 3/8] git-prompt: don't use shell arrays Avi Halachmi (:avih) via GitGitGadget
2024-08-17  9:25     ` [PATCH v3 4/8] git-prompt: replace [[...]] with standard code Avi Halachmi (:avih) via GitGitGadget
2024-08-17  9:25     ` [PATCH v3 5/8] git-prompt: add some missing quotes Avi Halachmi (:avih) via GitGitGadget
2024-08-17  9:38       ` Eric Sunshine
2024-08-17 10:07         ` avih
2024-08-17 16:28           ` Junio C Hamano
2024-08-17 18:02             ` avih
2024-08-17  9:25     ` [PATCH v3 6/8] git-prompt: don't use shell $'...' Avi Halachmi (:avih) via GitGitGadget
2024-08-17  9:25     ` [PATCH v3 7/8] git-prompt: ta-da! document usage in other shells Avi Halachmi (:avih) via GitGitGadget
2024-08-17  9:26     ` [PATCH v3 8/8] git-prompt: support custom 0-width PS1 markers Avi Halachmi (:avih) via GitGitGadget
2024-08-20  1:48     ` [PATCH v4 0/8] git-prompt: support more shells v4 Avi Halachmi via GitGitGadget
2024-08-20  1:48       ` [PATCH v4 1/8] git-prompt: use here-doc instead of here-string Avi Halachmi (:avih) via GitGitGadget
2024-08-20  1:48       ` [PATCH v4 2/8] git-prompt: fix uninitialized variable Avi Halachmi (:avih) via GitGitGadget
2024-08-20  1:48       ` [PATCH v4 3/8] git-prompt: don't use shell arrays Avi Halachmi (:avih) via GitGitGadget
2024-08-20  1:48       ` [PATCH v4 4/8] git-prompt: replace [[...]] with standard code Avi Halachmi (:avih) via GitGitGadget
2024-08-20  1:48       ` [PATCH v4 5/8] git-prompt: add some missing quotes Avi Halachmi (:avih) via GitGitGadget
2024-08-20  1:48       ` [PATCH v4 6/8] git-prompt: don't use shell $'...' Avi Halachmi (:avih) via GitGitGadget
2024-08-20  1:48       ` [PATCH v4 7/8] git-prompt: ta-da! document usage in other shells Avi Halachmi (:avih) via GitGitGadget
2024-08-20  1:48       ` [PATCH v4 8/8] git-prompt: support custom 0-width PS1 markers Avi Halachmi (:avih) via GitGitGadget
2024-08-20 15:32       ` [PATCH v4 0/8] git-prompt: support more shells v4 Junio C Hamano
2024-08-20 15:47         ` avih
2024-08-28 19:54           ` avih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1750.v2.git.git.1723727653.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=avihpit@yahoo.com \
    --cc=git@vger.kernel.org \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).