receive-pack: switch global variable 'commands' to a parameter
[gitweb.git] / imap-send.c
index 5631930bc3462c5d85d29e7e840f1cf24cd7111b..379dec491f63c24406644c40f94390a021519ddb 100644 (file)
@@ -1306,8 +1306,14 @@ static int count_messages(struct msg_data *msg)
 
        while (1) {
                if (!prefixcmp(p, "From ")) {
+                       p = strstr(p+5, "\nFrom: ");
+                       if (!p) break;
+                       p = strstr(p+7, "\nDate: ");
+                       if (!p) break;
+                       p = strstr(p+7, "\nSubject: ");
+                       if (!p) break;
+                       p += 10;
                        count++;
-                       p += 5;
                }
                p = strstr(p+5, "\nFrom ");
                if (!p)