configure.ac: stronger test for pthread linkage
[gitweb.git] / diff-no-index.c
index 49c4536d1d2bee8ffe463966e8783f0195562738..0320605a84178ffb2ab9384b8ee9fbac7df16a73 100644 (file)
@@ -97,8 +97,27 @@ static int queue_diff(struct diff_options *o,
        if (get_mode(name1, &mode1) || get_mode(name2, &mode2))
                return -1;
 
-       if (mode1 && mode2 && S_ISDIR(mode1) != S_ISDIR(mode2))
-               return error("file/directory conflict: %s, %s", name1, name2);
+       if (mode1 && mode2 && S_ISDIR(mode1) != S_ISDIR(mode2)) {
+               struct diff_filespec *d1, *d2;
+
+               if (S_ISDIR(mode1)) {
+                       /* 2 is file that is created */
+                       d1 = noindex_filespec(NULL, 0);
+                       d2 = noindex_filespec(name2, mode2);
+                       name2 = NULL;
+                       mode2 = 0;
+               } else {
+                       /* 1 is file that is deleted */
+                       d1 = noindex_filespec(name1, mode1);
+                       d2 = noindex_filespec(NULL, 0);
+                       name1 = NULL;
+                       mode1 = 0;
+               }
+               /* emit that file */
+               diff_queue(&diff_queued_diff, d1, d2);
+
+               /* and then let the entire directory be created or deleted */
+       }
 
        if (S_ISDIR(mode1) || S_ISDIR(mode2)) {
                struct strbuf buffer1 = STRBUF_INIT;