When should someone be a coauthor instead of being in the acknowledgements? We had a master's student working on our project.  He set up a database for us, and wrote some of the initial code with me in a pair programming session.  At one point, he had more commits to the repository than any of the other students working on the project.  Then he went to do an internship for the summer, and after that my advisor did not want to keep him on the project for some reason, even though I thought he was friendly and easy to work with.

My advisor chose not to list him as a coauthor, and put him in the acknowledgements section instead.  However, there was another guy (a professor) who didn't write any code at all, and wasn't there throughout most of the project, but he wrote the introduction and related work sections for us, and he got listed as a coauthor, even though he probably did a day's worth of work on the project (maybe two).  In fact, my advisor gave him the coveted last author position, even though my advisor came up with the idea and directed the whole project.

What determines who gets put as a coauthor, and who gets put in the acknowledgement sections?
Usually, the key indicator for co-authorship is the contribution of creative content. Did the student have own ideas that improved the paper? Was the program/database he wrote just a technical thing, or did it contribute scientifically? These are some questions that can help make/understand the decision.

There is a fine line to walk sometimes. Especially between different subject areas, there can be discrepancies who gets to be co-author. Sometimes everybody is counted, sometimes only the first author and his advisor(s) without any students.