git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 5/11] git-applypatch: Usage string clean-up, emit usage string at incorrect invocation

From
MCMarco Costalba <mcostalba@gmail.com>
Date
Dec 15, 2005, 20:30 UTC
Message-ID
<43A1D24B.5070603@gmail.com>
In-Reply-To
<20051215195528.GA14388@c165.ib.student.liu.se>
Fredrik Kuivinen wrote:
Show 25 quoted lines
> On Wed, Dec 14, 2005 at 02:45:42PM +0200, Timo Hirvonen wrote:
> 
>>On Tue, 13 Dec 2005 21:20:57 -0800
>>Junio C Hamano <junkio@cox.net> wrote:
>>
>>
>>>freku045@student.liu.se writes:
>>>
>>>
>>>> . git-sh-setup
>>>> 
>>>>+[[ "$#" = "3" || "$#" = "4" ]] || usage
>>>>+
>>>
>>>I do not see much advantage to use [[...]] construct here.
>>
>>[[ ]] is bashishm. Does not work with ash.
>>
>>
>>test $# -ge 3 && test $# -le 4 || usage
>>
>>You don't need to quote $# because it is always defined (and always
>>non-negative integer).  You can't unset or set it.
> 
> 
This patch seems not working for me:
$ git-applymbox -k 0001-JUST-A-TEST.txt
1 patch(es) to process.
Usage: /home/marco/bin/git-applypatch <msg> <patch> <info> [<signoff>]
where
$ cat 0001-JUST-A-TEST.txt
 From nobody Mon Sep 17 00:00:00 2001
Subject: [PATCH] JUST A TEST
From: Marco Costalba <mcostalba@gmail.com>
Date: 1134677832 +0100
---
  git-applypatch.sh |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
ee8ea125fd2b0598e26e1556210abb9d0edc459a
diff --git a/git-applypatch.sh b/git-applypatch.sh
index e8ba34a..26b4cba 100755
--- a/git-applypatch.sh
+++ b/git-applypatch.sh
@@ -10,7 +10,7 @@
  ##     $3 - "info" file with Author, email and subject
  ##     $4 - optional file containing signoff to add
  ##
-
+## JUST A TEST
  USAGE='<msg> <patch> <info> [<signoff>]'
  . git-sh-setup

--
0.99.9.GIT


The offending patch is

Author: Junio C Hamano <junkio@cox.net>
Date:   14/12/2005 03:19:12
Parent: git-repack: Usage string clean-up, emit usage at incorrec...

    applypatch: no need to do non-portable [[ ... ]]


    ... when old, proven, case would do.

    Signed-off-by: Junio C Hamano <junkio@cox.net>

--- a/git-applypatch.sh
+++ b/git-applypatch.sh
@@ -14,7 +14,7 @@
  USAGE='<msg> <patch> <info> [<signoff>]'
  . git-sh-setup

-[[ "$#" = "3" || "$#" = "4" ]] || usage
+case "$#" in 3|4) usage ;; esac

  final=.dotest/final-commit
  ##


reverting the patch everything works fine.

Marco
Previous: Fredrik KuivinenNext: Junio C Hamano
Message 11 of 17 in “Usage string clean-up”
  1. 0/11 Usage string clean-upfreku045@student.liu.se, Dec 13, 2005
  2. 8/11 git-lost-found: Usage string clean-up, emit usage string at incorrect invocationfreku045@student.liu.se, Dec 13, 2005
  3. 4/11 git-am: Usage string clean-upfreku045@student.liu.se, Dec 13, 2005
  4. 3/11 git-revert: Usage string clean-upfreku045@student.liu.se, Dec 13, 2005
  5. 2/11 git-verify-tag: Usage string clean-up, emit usage string at incorrect invocationfreku045@student.liu.se, Dec 13, 2005
  6. 1/11 Trivial usage string clean-upfreku045@student.liu.se, Dec 13, 2005
  7. 5/11 git-applypatch: Usage string clean-up, emit usage string at incorrect invocationfreku045@student.liu.se, Dec 13, 2005
  8. Junio C HamanoDec 14, 2005
  9. Timo HirvonenDec 14, 2005
  10. Fredrik KuivinenDec 15, 2005
  11. Marco CostalbaDec 15, 2005
  12. Junio C HamanoDec 15, 2005
  13. 7/11 git-fetch: Usage string clean-up, emit usage string at unrecognized optionfreku045@student.liu.se, Dec 13, 2005
  14. 6/11 git-cherry: Usage string clean-up, use the 'usage' functionfreku045@student.liu.se, Dec 13, 2005
  15. 9/11 git-prune: Usage string clean-up, use the 'usage' functionfreku045@student.liu.se, Dec 13, 2005
  16. 11/11 git-repack: Usage string clean-up, emit usage at incorrect invocationfreku045@student.liu.se, Dec 13, 2005
  17. 10/11 git-rebase: Usage string clean-up, emit usage string at incorrect invocationfreku045@student.liu.se, Dec 13, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.