git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH v2 2/3] pack-objects: remove bogus comment
Date: Wed,  1 Feb 2012 22:17:19 +0700	[thread overview]
Message-ID: <1328109440-9510-2-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1328109440-9510-1-git-send-email-pclouds@gmail.com>

The comment was introduced in b5d97e6 (pack-objects: run rev-list
equivalent internally. - 2006-09-04), stating that

git pack-objects [options] base-name <refs...>

is acceptable and refs should be passed into rev-list. But that's not
true. All arguments after base-name are ignored.

Remove the comment and reject this syntax (i.e. no more arguments after
base name)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/pack-objects.c |   15 +--------------
 t/t5300-pack-object.sh |    4 ++++
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 297f792..80e3114 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2484,23 +2484,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 		usage(pack_usage);
 	}
 
-	/* Traditionally "pack-objects [options] base extra" failed;
-	 * we would however want to take refs parameter that would
-	 * have been given to upstream rev-list ourselves, which means
-	 * we somehow want to say what the base name is.  So the
-	 * syntax would be:
-	 *
-	 * pack-objects [options] base <refs...>
-	 *
-	 * in other words, we would treat the first non-option as the
-	 * base_name and send everything else to the internal revision
-	 * walker.
-	 */
-
 	if (!pack_to_stdout)
 		base_name = argv[i++];
 
-	if (pack_to_stdout != !base_name)
+	if (pack_to_stdout != !base_name || argv[i])
 		usage(pack_usage);
 
 	if (!pack_to_stdout && !pack_size_limit)
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 602806d..d9d856b 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -38,6 +38,10 @@ test_expect_success \
     'pack without delta' \
     'packname_1=$(git pack-objects --window=0 test-1 <obj-list)'
 
+test_expect_success \
+    'pack-objects with bogus arguments' \
+    'test_must_fail git pack-objects --window=0 test-1 blah blah <obj-list'
+
 rm -fr .git2
 mkdir .git2
 
-- 
1.7.8.36.g69ee2

  reply	other threads:[~2012-02-01 15:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31 13:48 [PATCH] pack-objects: convert to use parse_options() Nguyễn Thái Ngọc Duy
2012-01-31 23:29 ` Junio C Hamano
2012-02-01 14:30   ` Nguyen Thai Ngoc Duy
2012-02-01 14:49     ` Nguyen Thai Ngoc Duy
2012-02-01 15:17 ` [PATCH v2 1/3] pack-objects: do not accept "--index-version=version," Nguyễn Thái Ngọc Duy
2012-02-01 15:17   ` Nguyễn Thái Ngọc Duy [this message]
2012-02-01 15:17   ` [PATCH v2 3/3] pack-objects: convert to use parse_options() Nguyễn Thái Ngọc Duy
2012-02-03  0:31   ` [PATCH v2 1/3] pack-objects: do not accept "--index-version=version," Junio C Hamano

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=1328109440-9510-2-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).