Skip to content

quote: handle null and empty strings in sq_quote_buf_pretty()

Garima Singh via GitGitGadget git 5 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest1 patch 0 repliesNew
  2. v41 patch 1 replySuperseded
  3. v31 patch 3 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v21 patch2 repliesSuperseded
v11 patch3 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1sq_quote_buf_pretty: don't drop empty argumentsquote.c t/t0014-alias.sh+13 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 0/1] quote: handle null and empty strings in sq_quote_buf_pretty()

Hey,

Empty arguments passed on the command line can be a represented by a '', however sq_quote_buf_pretty was incorrectly dropping these arguments altogether. Fix this problem by ensuring that such arguments are emitted as '' instead.

Looking forward to your review. Cheers! Garima Singh

Reported by: Junio Hamano [email protected] [[email protected]] in
https://public-inbox.org/git/[email protected]/T/#m9e33936067ec2066f675aa63133a2486efd415fd

Garima Singh (1):
sq_quote_buf_pretty: don't drop empty arguments

 quote.c          | 6 ++++++
 t/t0014-alias.sh | 7 +++++++
 2 files changed, 13 insertions(+)

base-commit: 5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-314%2Fgarimasi514%2FcoreGit-fixQuote-v5
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-314/garimasi514/coreGit-fixQuote-v5
Pull-Request: https://github.com/gitgitgadget/git/pull/314

Range-diff vs v4:

1: a6a0217ce6 ! 1: 412626ccf9 sq_quote_buf_pretty: don't drop empty arguments

     @@ -17,9 +17,6 @@
       	static const char ok_punct[] = "+,-./:=@_^";
       	const char *p;
       
     -+	if (!src) 
     -+		BUG("Cannot append a NULL token to the buffer");
     -+	
      +	/* Avoid losing a zero-length string by adding '' */ 
      +	if (!*src) {
      +		strbuf_addstr(dst, "''");
Signature · 1 line
gitgitgadget