git: how to list only the paths of files needing merge?

git ls-files --unmerged (or git ls-files -u) will do this. From the git-book docs:

-u

--unmerged

Show unmerged files in the output (forces --stage)

Depending on your specific needs, you may want to include other statuses as well, or may want to include other "staging numbers" as described in this related StackOverflow question What is the equivalent git ls-files command to see the same information as git status?.

As on the man page, git ls-files is a plumbing command, so it should be stable and should not require additional processing.