func WriteTree(directory string) (oid string, err error) {
	tree := ""
	var files []os.FileInfo
	if files, err = ioutil.ReadDir(directory); err != nil {
		return "", err
	}
	for _, f := range files {
		if IsIgnored(f.Name()) {
			continue
		}
		log.Println(f.Name())
		path := fmt.Sprintf("%s/%s", directory, f.Name())
		if f.IsDir() {
			oid, err = WriteTree(path)
			tree += fmt.Sprintf("%s %s %s\n", storage.TREE, oid, f.Name())
		} else {
			var data []byte
			if data, err = ioutil.ReadFile(path); err != nil {
				return "", err
			}
			oid, err = storage.PutObject(string(data), storage.BLOB)
			tree += fmt.Sprintf("%s %s %s\n", storage.BLOB, oid, f.Name())
		}
		if err != nil {
			return "", err
		}
	}
	oid, err = storage.PutObject(tree, storage.TREE)
	return oid, err
}
/*
WriteTree saves the directory in the content object storage with recursion
*/
WriteTree saves the directory in the content object storage with recursion
/ * WriteTree saves the directory in the content object storage with recursion * /
func WriteTree(directory string) (oid string, err error) {
	tree := ""
	var files []os.FileInfo
	if files, err = ioutil.ReadDir(directory); err != nil {
		return "", err
	}
	for _, f := range files {
		if IsIgnored(f.Name()) {
			continue
		}
		log.Println(f.Name())
		path := fmt.Sprintf("%s/%s", directory, f.Name())
		if f.IsDir() {
			oid, err = WriteTree(path)
			tree += fmt.Sprintf("%s %s %s\n", storage.TREE, oid, f.Name())
		} else {
			var data []byte
			if data, err = ioutil.ReadFile(path); err != nil {
				return "", err
			}
			oid, err = storage.PutObject(string(data), storage.BLOB)
			tree += fmt.Sprintf("%s %s %s\n", storage.BLOB, oid, f.Name())
		}
		if err != nil {
			return "", err
		}
	}
	oid, err = storage.PutObject(tree, storage.TREE)
	return oid, err
}
func WriteTree ( directory string ) ( oid string , err error ) { tree := " " var files [ ] os . FileInfo if files , err = ioutil . ReadDir ( directory ) ; err != nil { return " " , err } for _ , f := range files { if IsIgnored ( f . Name ( ) ) { continue } log . Println ( f . Name ( ) ) path := fmt . Sprintf ( " " , directory , f . Name ( ) ) if f . IsDir ( ) { oid , err = WriteTree ( path ) tree += fmt . Sprintf ( " \n " , storage . TREE , oid , f . Name ( ) ) } else { var data [ ] byte if data , err = ioutil . ReadFile ( path ) ; err != nil { return " " , err } oid , err = storage . PutObject ( string ( data ) , storage . BLOB ) tree += fmt . Sprintf ( " \n " , storage . BLOB , oid , f . Name ( ) ) } if err != nil { return " " , err } } oid , err = storage . PutObject ( tree , storage . TREE ) return oid , err }
WriteTree saves the directory in the content object storage with recursion
WriteTree saves the directory in the content object storage with recursion