diff --git a/io/io/inc/ROOT/TBufferMerger.hxx b/io/io/inc/ROOT/TBufferMerger.hxx
index 1746c54e664ed2d1e3962789a70d82118c7526de..9440d25d9cad54a0ebe8e382c92768893860d01b 100644
--- a/io/io/inc/ROOT/TBufferMerger.hxx
+++ b/io/io/inc/ROOT/TBufferMerger.hxx
@@ -96,6 +96,20 @@ public:
     */
    void SetMergeOptions(const TString& options);
 
+   /** Indicates that the file will not contain any TTree objects
+    * and thus that steps that are specific to TTree can be skipped */
+   void SetNotrees(Bool_t notrees=kFALSE)
+   {
+      fMerger.SetNotrees(notrees);
+   }
+
+   /** Returns whether the the file has been marked as not containing any TTree objects
+    * and thus that steps that are specific to TTree can be skipped */
+   Bool_t GetNotrees() const
+   {
+      return fMerger.GetNotrees();
+   }
+
    friend class TBufferMergerFile;
 
 private:
diff --git a/io/io/inc/TFileMerger.h b/io/io/inc/TFileMerger.h
index c2d4e6414e89937ed6dcc7157bcfd2c4eb71021e..85959ed44a324885cdaa56d64c06c596697efebd 100644
--- a/io/io/inc/TFileMerger.h
+++ b/io/io/inc/TFileMerger.h
@@ -122,6 +122,7 @@ public:
    virtual Bool_t Merge(Bool_t = kTRUE);
    virtual Bool_t PartialMerge(Int_t type = kAll | kIncremental);
    virtual void   SetFastMethod(Bool_t fast=kTRUE)  {fFastMethod = fast;}
+           Bool_t GetNotrees() const { return fNoTrees; }
    virtual void   SetNotrees(Bool_t notrees=kFALSE) {fNoTrees = notrees;}
    virtual void        RecursiveRemove(TObject *obj);
 
diff --git a/io/io/src/TBufferMergerFile.cxx b/io/io/src/TBufferMergerFile.cxx
index 634fa8a50645bdff1dc74d1a3ac3b38517361feb..9c09d081b11622907cff159b62b2fd058e94961a 100644
--- a/io/io/src/TBufferMergerFile.cxx
+++ b/io/io/src/TBufferMergerFile.cxx
@@ -31,7 +31,8 @@ Int_t TBufferMergerFile::Write(const char *name, Int_t opt, Int_t bufsize)
 {
    // Make sure the compression of the basket is done in the unlocked thread and
    // not in the locked section.
-   TMemFile::Write(name, opt | TObject::kOnlyPrepStep, bufsize);
+   if (!fMerger.GetNotrees())
+      TMemFile::Write(name, opt | TObject::kOnlyPrepStep, bufsize);
 
    // Instead of Writing the TTree, doing a memcpy, Pushing to the queue
    // then Reading and then deleting, let's see if we can just merge using