What's the best practice for handling system-specific information under version control?

Posted by Joe on Stack Overflow See other posts from Stack Overflow or by Joe
Published on 2009-01-07T05:46:13Z Indexed on 2010/03/29 4:53 UTC
Read the original article Hit count: 182

I'm new to version control, so I apologize if there is a well-known solution to this. For this problem in particular, I'm using git, but I'm curious about how to deal with this for all version control systems.

I'm developing a web application on a development server. I have defined the absolute path name to the web application (not the document root) in two places. On the production server, this path is different. I'm confused about how to deal with this.

I could either:

  1. Reconfigure the development server to share the same path as the production
  2. Edit the two occurrences each time production is updated.

I don't like #1 because I'd rather keep the application flexible for any future changes. I don't like #2 because if I start developing on a second development server with a third path, I would have to change this for every commit and update.

What is the best way to handle this? I thought of:

  1. Using custom keywords and variable expansion (such as setting the property $PATH$ in the version control properties and having it expanded in all the files). Git doesn't support this because it would be a huge performance hit.

  2. Using post-update and pre-commit hooks. Possibly the likely solution for git, but every time I looked at the status, it would report the two files as being changed. Not really clean.

  3. Pulling the path from a config file outside of version control. Then I would have to have the config file in the same location on all servers. Might as well just have the same path to begin with.

Is there an easy way to deal with this? Am I over thinking it?

© Stack Overflow or respective owner

Related posts about version-control

Related posts about git