gitweb: Fix shortlog only showing HEAD revision.
[gitweb.git] / xdiff / xemit.c
index ad5bfb191003f14cd71b2ec7f39fd72ac86eda9b..e291dc7608c4ab9b54a5d049bf3b555704e37fe8 100644 (file)
@@ -86,11 +86,10 @@ static void xdl_find_func(xdfile_t *xf, long i, char *buf, long sz, long *ll) {
                if (len > 0 &&
                    (isalpha((unsigned char)*rec) || /* identifier? */
                     *rec == '_' ||     /* also identifier? */
-                    *rec == '(' ||     /* lisp defun? */
-                    *rec == '#')) {    /* #define? */
+                    *rec == '$')) {    /* mysterious GNU diff's invention */
                        if (len > sz)
                                len = sz;
-                       if (len && rec[len - 1] == '\n')
+                       while (0 < len && isspace((unsigned char)rec[len - 1]))
                                len--;
                        memcpy(buf, rec, len);
                        *ll = len;
@@ -100,13 +99,31 @@ static void xdl_find_func(xdfile_t *xf, long i, char *buf, long sz, long *ll) {
 }
 
 
+int xdl_emit_common(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
+                   xdemitconf_t const *xecfg) {
+       xdfile_t *xdf = &xe->xdf1;
+       const char *rchg = xdf->rchg;
+       long ix;
+
+       for (ix = 0; ix < xdf->nrec; ix++) {
+               if (rchg[ix])
+                       continue;
+               if (xdl_emit_record(xdf, ix, "", ecb))
+                       return -1;
+       }
+       return 0;
+}
+
 int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
                  xdemitconf_t const *xecfg) {
        long s1, s2, e1, e2, lctx;
        xdchange_t *xch, *xche;
-       char funcbuf[40];
+       char funcbuf[80];
        long funclen = 0;
 
+       if (xecfg->flags & XDL_EMIT_COMMON)
+               return xdl_emit_common(xe, xscr, ecb, xecfg);
+
        for (xch = xche = xscr; xch; xch = xche->next) {
                xche = xdl_get_hunk(xch, xecfg);