This feels like two different methods: import from git to mongo, and import from git to the data directory. I think the code would be cleaner if it were separated that way.