Show 64 quoted lines
> bundles are constructing a pack-file containing all objects in the
> discovered commit range.
>
> Adding --objects to a 'git bundle' command might cause a slower command,
> but at least it will not have a hard failure when the user supplies this
> option. We can also disable walking trees and blobs in advance of this
> walk.
>
> Signed-off-by: Derrick Stolee <derrickstolee@github.com>
> ---
> bundle.c | 10 +++++++++-
> t/t6020-bundle-misc.sh | 12 ++++++++++++
> 2 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/bundle.c b/bundle.c
> index a0bb687b0f4..dc56db9a50a 100644
> --- a/bundle.c
> +++ b/bundle.c
> @@ -451,6 +451,12 @@ struct bundle_prerequisites_info {
> int fd;
> };
>
> +
> +static void ignore_object(struct object *obj, const char *v, void *data)
> +{
> + /* Do nothing. */
> +}
> +
> static void write_bundle_prerequisites(struct commit *commit, void *data)
> {
> struct bundle_prerequisites_info *bpi = data;
> @@ -544,7 +550,9 @@ int create_bundle(struct repository *r, const char *path,
> die("revision walk setup failed");
> bpi.fd = bundle_fd;
> bpi.pending = &revs_copy.pending;
> - traverse_commit_list(&revs, write_bundle_prerequisites, NULL, &bpi);
> +
> + revs.blob_objects = revs.tree_objects = 0;
> + traverse_commit_list(&revs, write_bundle_prerequisites, ignore_object, &bpi);
> object_array_remove_duplicates(&revs_copy.pending);
>
> /* write bundle refs */
> diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh
> index b13e8a52a93..6522401617d 100755
> --- a/t/t6020-bundle-misc.sh
> +++ b/t/t6020-bundle-misc.sh
> @@ -475,4 +475,16 @@ test_expect_success 'clone from bundle' '
> test_cmp expect actual
> '
>
> +test_expect_success 'unfiltered bundle with --objects' '
> + git bundle create all-objects.bdl \
> + --all --objects &&
> + git bundle create all.bdl \
> + --all &&
> +
> + # Compare the headers of these files.
> + head -11 all.bdl >expect &&
> + head -11 all-objects.bdl >actual &&
> + test_cmp expect actual
> +'
> +
> test_done
>