Skip to content

Commit 3a2ec52

Browse files
pcloudsgitster
authored andcommitted
pack-objects: remove bogus comment
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6a30134 commit 3a2ec52

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

builtin/pack-objects.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,23 +2484,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
24842484
usage(pack_usage);
24852485
}
24862486

2487-
/* Traditionally "pack-objects [options] base extra" failed;
2488-
* we would however want to take refs parameter that would
2489-
* have been given to upstream rev-list ourselves, which means
2490-
* we somehow want to say what the base name is. So the
2491-
* syntax would be:
2492-
*
2493-
* pack-objects [options] base <refs...>
2494-
*
2495-
* in other words, we would treat the first non-option as the
2496-
* base_name and send everything else to the internal revision
2497-
* walker.
2498-
*/
2499-
25002487
if (!pack_to_stdout)
25012488
base_name = argv[i++];
25022489

2503-
if (pack_to_stdout != !base_name)
2490+
if (pack_to_stdout != !base_name || argv[i])
25042491
usage(pack_usage);
25052492

25062493
if (!pack_to_stdout && !pack_size_limit)

t/t5300-pack-object.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ test_expect_success \
3838
'pack without delta' \
3939
'packname_1=$(git pack-objects --window=0 test-1 <obj-list)'
4040

41+
test_expect_success \
42+
'pack-objects with bogus arguments' \
43+
'test_must_fail git pack-objects --window=0 test-1 blah blah <obj-list'
44+
4145
rm -fr .git2
4246
mkdir .git2
4347

0 commit comments

Comments
 (0)