Revision: 76519
          http://sourceforge.net/p/brlcad/code/76519
Author:   starseeker
Date:     2020-07-27 15:04:10 +0000 (Mon, 27 Jul 2020)
Log Message:
-----------
A quick test suggests we might be able to avoid writing blob.fi files - would 
be nice if true, since it makes things more compact and faster

Modified Paths:
--------------
    brlcad/trunk/misc/repoconv/verify/verify.cpp
    brlcad/trunk/misc/repowork/commit.cpp

Modified: brlcad/trunk/misc/repoconv/verify/verify.cpp
===================================================================
--- brlcad/trunk/misc/repoconv/verify/verify.cpp        2020-07-27 14:50:08 UTC 
(rev 76518)
+++ brlcad/trunk/misc/repoconv/verify/verify.cpp        2020-07-27 15:04:10 UTC 
(rev 76519)
@@ -112,9 +112,17 @@
     return git_sha1;
 }
 
+/* Even if writing out the blobs is disabled, we still need to calculate the
+ * sha1 hashes for the tree output. */
 void
-build_blobs(std::vector<filemodify> &mods, std::string &sha1)
+process_blobs(std::vector<filemodify> &mods, std::string &sha1)
 {
+    // The -blob.fi file is prepared in case the tree incorporates a blob that
+    // was never preserved in the original conversion.  blob.fi files take a
+    // significant amount of space and slow subsequent fast-imports, so they
+    // should be enabled only if that situation is discovered.
+//#define WRITE_BLOBS
+#ifdef WRITE_BLOBS
     std::string sha1file = sha1 + std::string("-blob.fi");
     std::ofstream outfile(sha1file.c_str(), std::ifstream::binary);
     if (!outfile.good()) {
@@ -121,6 +129,7 @@
        std::cerr << "Could not open file: " << sha1file << "\n";
        exit(-1);
     }
+#endif
 
     for (size_t i = 0; i < mods.size(); i++) {
        std::string path = std::string("brlcad/") + mods[i].path;
@@ -138,14 +147,18 @@
            const char *b = reinterpret_cast<char*>(buffer.data());
            mods[i].hash = git_sha1(b, size);
 
+#ifdef WRITE_BLOBS
            outfile << "blob\n";
            outfile << "data " << size << "\n";
            outfile.write(reinterpret_cast<char*>(buffer.data()), size);
+#endif
        }
        file.close();
     }
 
+#ifdef WRITE_BLOBS
     outfile.close();
+#endif
 }
 
 int
@@ -154,7 +167,7 @@
     std::vector<filemodify> mods;
     get_exec_paths(mods);
     get_noexec_paths(mods);
-    build_blobs(mods, sha1);
+    process_blobs(mods, sha1);
 
     std::string sha1file = sha1 + std::string("-tree.fi");
     std::ofstream outfile(sha1file.c_str(), std::ifstream::binary);

Modified: brlcad/trunk/misc/repowork/commit.cpp
===================================================================
--- brlcad/trunk/misc/repowork/commit.cpp       2020-07-27 14:50:08 UTC (rev 
76518)
+++ brlcad/trunk/misc/repowork/commit.cpp       2020-07-27 15:04:10 UTC (rev 
76519)
@@ -507,6 +507,7 @@
        return 0;
     }
 
+#if 0
     // If this is a rebuild, write the blobs first
     if (c->id.sha1.length()) {
        if (c->s->rebuild_commits.find(c->id.sha1) != 
c->s->rebuild_commits.end()) {
@@ -525,6 +526,7 @@
            s1b.close();
        }
     }
+#endif
 
     // Header
     if (c->notes_commit) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to