Around here, it's perfectly legal and efficient. I have a few rental homes with gas water heaters located in attached sheds. I never worry about damages from leaky water heaters in those homes.
The vent has to meet certain code too. Check your local code. I hope you pull a permit for this job, since it involves extending/moving your gas line. Good luck.