Update index while creating file in git clone.

Update the git-index while we are creating the files. This avoid re-calculating the sha values of the files again.

This optimizes git clone by 15-20% (spark checkout taking 43-46 secs now as compared to 55-58 secs before).

@devoncarew