Blame predictable-and-reproducible-filenames.patch

5671b8
diff -ur doxygen-1.9.2.orig/src/dirdef.cpp doxygen-1.9.2/src/dirdef.cpp
5671b8
--- doxygen-1.9.2.orig/src/dirdef.cpp	2021-08-17 19:10:43.000000000 +0200
5671b8
+++ doxygen-1.9.2/src/dirdef.cpp	2021-09-12 21:25:51.878853938 +0200
5671b8
@@ -47,7 +47,7 @@
5671b8
     virtual bool isLinkableInProject() const;
5671b8
     virtual bool isLinkable() const;
5671b8
     virtual QCString displayName(bool=TRUE) const { return m_dispName; }
5671b8
-    virtual const QCString &shortName() const { return m_shortName; }
5671b8
+    virtual const QCString shortName() const { return m_shortName; }
5671b8
     virtual void addSubDir(DirDef *subdir);
5671b8
     virtual const FileList &getFiles() const { return m_fileList; }
5671b8
     virtual void addFile(const FileDef *fd);
5671b8
@@ -66,6 +66,7 @@
5671b8
     virtual void setDiskName(const QCString &name) { m_diskName = name; }
5671b8
     virtual void sort();
5671b8
     virtual void setParent(DirDef *parent);
5671b8
+    virtual void setDirCount(int count);
5671b8
     virtual void setLevel();
5671b8
     virtual void addUsesDependency(const DirDef *usedDir,const FileDef *srcFd,
5671b8
                                    const FileDef *dstFd,bool inherited);
5671b8
@@ -92,7 +93,7 @@
5671b8
     QCString m_shortName;
5671b8
     QCString m_diskName;
5671b8
     FileList m_fileList;                 // list of files in the group
5671b8
-    int m_dirCount;
5671b8
+    int m_dirCount = -1;
5671b8
     int m_level;
5671b8
     DirDef *m_parent;
5671b8
     UsedDirLinkedMap m_usedDirs;
5671b8
@@ -107,8 +108,6 @@
5671b8
 //----------------------------------------------------------------------
5671b8
 // method implementation
5671b8
 
5671b8
-static int g_dirCount=0;
5671b8
-
5671b8
 DirDefImpl::DirDefImpl(const QCString &path) : DefinitionMixin(path,1,1,path)
5671b8
 {
5671b8
   bool fullPathNames = Config_getBool(FULL_PATH_NAMES);
5671b8
@@ -132,7 +131,6 @@
5671b8
     m_dispName = m_dispName.left(m_dispName.length()-1);
5671b8
   }
5671b8
 
5671b8
-  m_dirCount   = g_dirCount++;
5671b8
   m_level=-1;
5671b8
   m_parent=0;
5671b8
 }
5671b8
@@ -163,6 +161,11 @@
5671b8
    m_parent=p;
5671b8
 }
5671b8
 
5671b8
+void DirDefImpl::setDirCount(int count)
5671b8
+{
5671b8
+  m_dirCount=count;
5671b8
+}
5671b8
+
5671b8
 void DirDefImpl::addFile(const FileDef *fd)
5671b8
 {
5671b8
   m_fileList.push_back(fd);
5671b8
@@ -993,7 +996,6 @@
5671b8
   {
5671b8
     for (const auto &fd : *fn)
5671b8
     {
5671b8
-      //printf("buildDirectories %s\n",qPrint(fd->name()));
5671b8
       if (fd->getReference().isEmpty())
5671b8
       {
5671b8
         DirDef *dir;
5671b8
@@ -1038,7 +1040,24 @@
5671b8
   std::sort(Doxygen::dirLinkedMap->begin(),
5671b8
             Doxygen::dirLinkedMap->end(),
5671b8
             [](const auto &d1,const auto &d2)
5671b8
-            { return qstricmp(d1->shortName(),d2->shortName()) < 0; });
5671b8
+            {
5671b8
+              QCString s1 = d1->shortName(), s2 = d2->shortName();
5671b8
+              int i = qstricmp(s1,s2);
5671b8
+              if (i==0) // if sort name are equal, sort on full path
5671b8
+              {
5671b8
+                QCString n1 = d1->name(), n2 = d2->name();
5671b8
+                int n = qstricmp(n1,n2);
5671b8
+                return n < 0;
5671b8
+              }
5671b8
+              return i < 0;
5671b8
+            });
5671b8
+
5671b8
+  // set the directory count identifier
5671b8
+  int dirCount=0;
5671b8
+  for (const auto &dir : *Doxygen::dirLinkedMap)
5671b8
+  {
5671b8
+    dir->setDirCount(dirCount++);
5671b8
+  }
5671b8
 
5671b8
   computeCommonDirPrefix();
5671b8
 }
5671b8
diff -ur doxygen-1.9.2.orig/src/dirdef.h doxygen-1.9.2/src/dirdef.h
5671b8
--- doxygen-1.9.2.orig/src/dirdef.h	2021-05-12 20:51:20.000000000 +0200
5671b8
+++ doxygen-1.9.2/src/dirdef.h	2021-09-12 21:25:42.394830066 +0200
5671b8
@@ -95,7 +95,7 @@
5671b8
     virtual bool isLinkableInProject() const = 0;
5671b8
     virtual bool isLinkable() const = 0;
5671b8
     virtual QCString displayName(bool=TRUE) const = 0;
5671b8
-    virtual const QCString &shortName() const = 0;
5671b8
+    virtual const QCString shortName() const = 0;
5671b8
     virtual void addSubDir(DirDef *subdir) = 0;
5671b8
     virtual const FileList &getFiles() const = 0;
5671b8
     virtual void addFile(const FileDef *fd) = 0;
5671b8
@@ -115,6 +115,7 @@
5671b8
     virtual void writeTagFile(TextStream &t) = 0;
5671b8
 
5671b8
     virtual void setDiskName(const QCString &name) = 0;
5671b8
+    virtual void setDirCount(int count) = 0;
5671b8
     virtual void sort() = 0;
5671b8
     virtual void setParent(DirDef *parent) = 0;
5671b8
     virtual void setLevel() = 0;