Reduce the number of connects when fetching
[gitweb.git] / revision.c
index 2a59035192baec8265acccf8b5d00aa7b2db4dd7..6e85aaa3fb30e98f3b02f094af7f1763577cdb8d 100644 (file)
@@ -139,6 +139,18 @@ void add_pending_object(struct rev_info *revs, struct object *obj, const char *n
        add_pending_object_with_mode(revs, obj, name, S_IFINVALID);
 }
 
+void add_head_to_pending(struct rev_info *revs)
+{
+       unsigned char sha1[20];
+       struct object *obj;
+       if (get_sha1("HEAD", sha1))
+               return;
+       obj = parse_object(sha1);
+       if (!obj)
+               return;
+       add_pending_object(revs, obj, "HEAD");
+}
+
 static struct object *get_reference(struct rev_info *revs, const char *name, const unsigned char *sha1, unsigned int flags)
 {
        struct object *object;
@@ -1278,8 +1290,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
        if (revs->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT)
                revs->diff = 1;
 
-       /* Pickaxe and rename following needs diffs */
-       if (revs->diffopt.pickaxe || DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES))
+       /* Pickaxe, diff-filter and rename following need diffs */
+       if (revs->diffopt.pickaxe ||
+           revs->diffopt.filter ||
+           DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES))
                revs->diff = 1;
 
        if (revs->topo_order)