How "ipfs add" work?

When using “ipfs add” to add a file, ipfs will create a hash for this file, and build merkle dag, as well as adding blocks of this file into datastore. Will ipfs announce self having this hash via dht.Provide?

Yes unless you pass the --local flag. If you do that, IPFS will only announce it when it re-provides (every few hours).

thanks a lot, find code where announce happened once each block added.