Use PowerShell to check an xml file in the Git staging area -
i'm using git asp.net web site passwords stored in web.config file. keep getting committed, set configuration section encryption, connectionstrings
section of file encrypted -- unless decrypt fool around it.
then prevent accidentally committing un-encrypted, wrote little powershell script local pre-commit hook invokes:
# verifies web.config's connectionstrings encrypted. [xml]$config = get-content .\code\slicerweb\web.config if ($config.configuration.connectionstrings.encrypteddata) { exit 0 } else { write-output "connectionstrings section not encrypted." exit 1 }
and works fine, , enough. realize should check contents of file in index (staging area), rather current file on disk.
how can get-content
of file exists in index?
you can use : prefix access objects in current index. should work
[xml]$config = git show :./code/slicerweb/web.config
(backslashes in path not work here)
Comments
Post a Comment