Skip to content

Commit

Permalink
pack-objects: remove bogus comment
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Feb 1, 2012
1 parent 6a30134 commit 3a2ec52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
15 changes: 1 addition & 14 deletions builtin/pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions t/t5300-pack-object.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3a2ec52

Please sign in to comment.