Hacker News new | ask | show | jobs
by Mithaldu 4154 days ago
Ok, here, have a better example:

I contract for a company which has set rules for their stuff. Trying to change these rules would be an amount of effort similar to becoming CEO, starting out as a deckswabber.

One of their project is a web app. It has an .htaccess file. In production it is configured to run like this:

    Addhandler fcgid-script .fcgi
However in development i want it to run like this:

    Addhandler cgi-script .fcgi
Normally you'd just put the entire file on ignore with --assume-unchanged, but that doesn't work well, since the file also contains other bits of configuration that are important for the app, and get changed fairly frequently.

OP's tool is perfect for this kind of situation.

5 comments

Another example: IDE configuration settings.

Projects sometimes check in an IDE formatting file settings to ensure that all developers use the same formatting. There are a couple of times where I wanted to add my own little formatting detail (which didn't conflict with the project's) but couldn't because doing so would mark that file modified and force me to remember to undo my changes before each push.

With the hack from the article, I have now a working solution out of this.

FWIW we moved to a .htaccess.dist setup and our build tool would populate the actual .htaccess file with either of your examples depending if you were building for development or production.

.htaccess is ignored while the .htaccess.dist template is part of the reop

That still means i need to trigger a rebuild on every pull/checkout/reset. Only a marginal improvement, really.
We only need to rebuild that file when we want to change it, which doesn't happen often. It's been at least a year since I changed my local dev copy for our main project and has survived many pulls/branches/resets

What kinda stuff are you putting in .htaccess that changes so often?

What happens if someone accidentaly committed the Addhandler cgi-script .fcgi change?

Note that --assume-unchanged means you are promissing to git that the file hasn't changed, so it doesn't have to lookt at it every time you invoke git status (for performance reasons).

When you break that promise, git will complain, just like you said.

Actually this is a good example. You should not have apache configuration in your .htaccess file. It should be in the actual apache config.
> Trying to change these rules would be an amount of effort similar to becoming CEO

That's not even remotely possible.