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

[PATCH v2 2/3] pack-objects: remove bogus comment

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Feb 1, 2012, 15:17 UTC
Message-ID
<1328109440-9510-2-git-send-email-pclouds@gmail.com>
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
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 6 of 8 in “pack-objects: convert to use parse_options()”
  1. pack-objects: convert to use parse_options()Nguyễn Thái Ngọc Duy, Jan 31, 2012
  2. Junio C HamanoJan 31, 2012
  3. Nguyen Thai Ngoc DuyFeb 1, 2012
  4. Nguyen Thai Ngoc DuyFeb 1, 2012
  5. 1/3 pack-objects: do not accept "--index-version=version,"Nguyễn Thái Ngọc Duy, Feb 1, 2012
  6. 2/3 pack-objects: remove bogus commentNguyễn Thái Ngọc Duy, Feb 1, 2012
  7. 3/3 pack-objects: convert to use parse_options()Nguyễn Thái Ngọc Duy, Feb 1, 2012
  8. Junio C HamanoFeb 3, 2012

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.