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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 gitster@xxxxxxxxx [gitster@xxxxxxxxx] in
https://public-inbox.org/git/pull.298.git.gitgitgadget@xxxxxxxxx/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, "''");

-- 
gitgitgadget



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux