2516 deduplicate attachements on compaction

This is replacing PR https://github.com/apache/couchdb-couch/pull/22
You need to add whitespace between these two functions.