Re: [PATCH v2 2/5] p0008-abbrev.sh: Test find_unique_abbrev() perf
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 26, 2017, 09:27 UTC
- Message-ID
- <xmqq8th1ajy9.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170925095452.66833-3-dstolee@microsoft.com>
Derrick Stolee <dstolee@microsoft.com> writes:
Show 8 quoted lines
> diff --git a/t/helper/test-abbrev.c b/t/helper/test-abbrev.c > new file mode 100644 > index 000000000..6866896eb > --- /dev/null > +++ b/t/helper/test-abbrev.c > @@ -0,0 +1,19 @@ > +#include "cache.h" > +#include <stdio.h>
Same comment on <stdio.h> as [1/5] applies.
Show 5 quoted lines
> +
> +int cmd_main(int ac, const char **av)
> +{
> + struct object_id oid;
> + char hex[GIT_MAX_HEXSZ + 2];Why +2 (as opposed to +1)?
Show 26 quoted lines
> + const char *end;
> +
> + setup_git_directory();
> +
> + while (fgets(hex, GIT_MAX_HEXSZ + 2, stdin)) {
> + hex[GIT_MAX_HEXSZ] = 0;
> + if (!parse_oid_hex(hex, &oid, &end))
> + find_unique_abbrev(oid.hash, MINIMUM_ABBREV);
> + }
> +
> + exit(0);
> +}
> diff --git a/t/perf/p0008-abbrev.sh b/t/perf/p0008-abbrev.sh
> new file mode 100755
> index 000000000..ba25e7824
> --- /dev/null
> +++ b/t/perf/p0008-abbrev.sh
> @@ -0,0 +1,22 @@
> +#!/bin/bash
> +
> +test_description='Test object disambiguation through abbreviations'
> +. ./perf-lib.sh
> +
> +test_perf_large_repo
> +
> +test-list-objects 100000 | sort -R > objs.txtI thought "sort randomly" was a GNUism. Does it work across platforms? I think not.
Show 14 quoted lines
> + > +test_perf 'find_unique_abbrev() for existing objects' ' > + test-abbrev < objs.txt > +' > + > +test-list-objects 100000 --missing | sort -R > objs.txt > + > +test_perf 'find_unique_abbrev() for missing objects' ' > + test-abbrev < objs.txt > +' > + > +rm objs.txt > + > +test_done