From f9cea03851adf54333425692bc4c05bd815474aa Mon Sep 17 00:00:00 2001
From: Han-Wen Nienhuys <hanwen@google.com>
Date: Sat, 17 Sep 2011 01:56:36 -0300
Subject: [PATCH] Unionfs: Add pretty print functions for branchResult and
 os.FileInfo.

---
 unionfs/unionfs.go | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/unionfs/unionfs.go b/unionfs/unionfs.go
index 5af83df..965dd0c 100644
--- a/unionfs/unionfs.go
+++ b/unionfs/unionfs.go
@@ -161,6 +161,19 @@ type branchResult struct {
 	branch int
 }
 
+func printFileInfo(me *os.FileInfo) string {
+	return fmt.Sprintf(
+		"{0%o S=%d L=%d %d:%d %d*%d %d:%d " +
+		"A %.09f M %.09f C %.09f}",
+		me.Mode, me.Size, me.Nlink, me.Uid, me.Gid, me.Blocks, me.Blksize, me.Rdev, me.Ino,
+		float64(me.Atime_ns)*1e-9, float64(me.Mtime_ns)*1e-9, float64(me.Ctime_ns)*1e-9)
+}
+
+func (me branchResult) String() string {
+	return fmt.Sprintf("{%s %v branch %d}", printFileInfo(me.attr), me.code, me.branch)
+}
+
+
 func (me *UnionFs) getBranchAttrNoCache(name string) branchResult {
 	name = stripSlash(name)
 
-- 
2.30.9