We currently check that any 40-hex object name we receive is
not also a refname, and output a warning if this is the
case.  When "rev-list --stdin" is used to receive object
names, we may receive a large number of inputs, and the cost
of checking each name as a ref is relatively high.

Commit 25fba78d already dropped this warning for "cat-file
--batch-check". The same reasoning applies for "rev-list
--stdin". Let's disable the check in that instance.

Here are before and after numbers:

  $ git rev-list --all >commits

  $ best-of-five -i commits ./git rev-list --stdin --no-walk --pretty=raw

  real    0m0.675s
  user    0m0.552s
  sys     0m0.120s

  $ best-of-five -i commits ./git rev-list --stdin --no-walk --pretty=raw

  real    0m0.415s
  user    0m0.400s
  sys     0m0.012s

Signed-off-by: Jeff King <p...@peff.net>
Obviously we drop this one (and revert 25fba78d) if I can just make the
check faster.

 revision.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/revision.c b/revision.c
index a68fde6..87d04dd 100644
--- a/revision.c
+++ b/revision.c
@@ -1576,7 +1576,9 @@ static void read_revisions_from_stdin(struct rev_info 
        struct strbuf sb;
        int seen_dashdash = 0;
+       int save_warning = warn_on_object_refname_ambiguity;
+       warn_on_object_refname_ambiguity = 0;
        strbuf_init(&sb, 1000);
        while (strbuf_getwholeline(&sb, stdin, '\n') != EOF) {
                int len = sb.len;
@@ -1595,6 +1597,7 @@ static void read_revisions_from_stdin(struct rev_info 
                        die("bad revision '%s'", sb.buf);
+       warn_on_object_refname_ambiguity = save_warning;
        if (seen_dashdash)
                read_pathspec_from_stdin(revs, &sb, prune);
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to