Fixed issue #2075: Commit do not show merged files after merge

Fix regression of 70303268784a00771d6db631a96cc59c6e88c279

Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
Deduplicate code

Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>