From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carl Worth Subject: [PATCH] git-add: Add support for --, documentation, and test. Date: Tue, 21 Feb 2006 15:33:49 -0800 Message-ID: <87pslgs2w2.wl%cworth@cworth.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Tue_Feb_21_15:33:48_2006-1"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Cc: git@vger.kernel.org X-From: git-owner@vger.kernel.org Wed Feb 22 00:35:15 2006 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FBh2I-0004Gs-Et for gcvg-git@gmane.org; Wed, 22 Feb 2006 00:35:14 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751216AbWBUXfL (ORCPT ); Tue, 21 Feb 2006 18:35:11 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751220AbWBUXfL (ORCPT ); Tue, 21 Feb 2006 18:35:11 -0500 Received: from theworths.org ([217.160.253.102]:64140 "EHLO theworths.org") by vger.kernel.org with ESMTP id S1751216AbWBUXfJ (ORCPT ); Tue, 21 Feb 2006 18:35:09 -0500 Received: (qmail 14795 invoked from network); 21 Feb 2006 18:35:08 -0500 Received: from localhost (HELO raht.cworth.org) (127.0.0.1) by localhost with SMTP; 21 Feb 2006 18:35:08 -0500 To: Junio C Hamano User-Agent: Wanderlust/2.14.0 (Africa) Emacs/21.4 Mule/5.0 (SAKAKI) Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: --pgp-sign-Multipart_Tue_Feb_21_15:33:48_2006-1 Content-Type: text/plain; charset=US-ASCII This adds support to git-add to allow the common -- to separate command-line options and file names. It adds documentation and a new git-add test case as well. --- [In my tree on the git-add-dash-dash branch.] Documentation/git-add.txt | 7 ++++++- git-add.sh | 4 ++++ t/t3700-add.sh | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletions(-) create mode 100755 t/t3700-add.sh af9363cd7aec2b39ad7ba4594e2c4d4757e8f644 diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt index 89e4614..7e29383 100644 --- a/Documentation/git-add.txt +++ b/Documentation/git-add.txt @@ -7,7 +7,7 @@ git-add - Add files to the index file. SYNOPSIS -------- -'git-add' [-n] [-v] ... +'git-add' [-n] [-v] [--] ... DESCRIPTION ----------- @@ -26,6 +26,11 @@ OPTIONS -v:: Be verbose. +--:: + This option can be used to separate command-line options from + the list of files, (useful when filenames might be mistaken + for command-line options). + DISCUSSION ---------- diff --git a/git-add.sh b/git-add.sh index 13fad82..d6a4bc7 100755 --- a/git-add.sh +++ b/git-add.sh @@ -14,6 +14,10 @@ while : ; do -v) verbose=--verbose ;; + --) + shift + break + ;; -*) usage ;; diff --git a/t/t3700-add.sh b/t/t3700-add.sh new file mode 100755 index 0000000..7c61034 --- /dev/null +++ b/t/t3700-add.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Copyright (c) 2006 Carl D. Worth +# + +test_description='Test of git-add, including the -- option.' + +. ./test-lib.sh + +test_expect_success \ + 'Test of git-add' \ + 'touch foo && git-add foo' + +test_expect_success \ + 'Post-check that foo is in the index' \ + 'git-ls-files --error-unmatch foo' + +test_expect_success \ + 'Test that "git-add -- -q" works' \ + 'touch -- -q && git-add -- -q' + +test_done -- 1.2.2.g0a5f5-dirty --pgp-sign-Multipart_Tue_Feb_21_15:33:48_2006-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBD+6Nd6JDdNq8qSWgRAmSYAJ4j2Cd7NsqY5gMqS/vdSHXbQ1D/CwCgl63P tX205n3ZsWJpo9eeJb7kuSQ= =52jF -----END PGP SIGNATURE----- --pgp-sign-Multipart_Tue_Feb_21_15:33:48_2006-1--