Re: [PATCH 4/4] config: allow including config from repository blobs
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 26, 2012, 21:14 UTC
- Message-ID
- <7vbopq2mk9.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20120126074208.GD30474@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> +You can also include configuration from a blob stored in your repository > +by setting the special `include.ref` variable to the name of an object > +containing your configuration data (in the same format as a regular > +config file).
Hmm, the concept is surely *fun*, but is this really worth it?
With this, projects could include README that says something like this:
When working with our project, we would suggest using some tweaks to the configuration file. For your convenience, a copy of it already exists in the clone of your repository, and all you have to do is to run this in your repository:
$ git config include.ref 4774acaf6657efed
We may update the set of recommended tweaks from time to time, so
watch this README file for such updates, and re-run the above command
with the updated blob object name as needed.Note: if you are paranoid and suspect that the project might give you trojan horse, you could inspect the recommended tweaks first before including them, like this:
$ git cat-file -p 4774acaf6657efed
The blob will be included in the repository and the most natural way for such a project to arrange things is to keep it together with the source tree, perhaps in a separate hierarchy, say "dev_tools/std_gitconfig" or something. Without the update in patches 3 and 4, the project should be able to update the above for its participants with minimum fuss, e.g.
diff --git a/README b/README index af31555..203d255 100644 --- a/README +++ b/README @@ -3,14 +3,15 @@ already exists in the clone of your repository, and all you have to do is to run this in your repository: - $ git config include.ref 4774acaf6657efed + $ cp dev_tools/std_gitconfig .git/std_gitconfig + $ git config include.path std_gitconfig We may update the set of recommended tweaks from time to time, so - watch this README file for such updates, and re-run the above command - with the updated blob object name as needed. + watch "git log -p dev_tools/std_gitconfig" for such updates and + update your .git/std_gitconfig as needed. Note: if you are paranoid and suspect that the project might give you trojan horse, you could inspect the recommended tweaks first before including them, like this: - $ git cat-file -p 4774acaf6657efed + $ less dev_tools/std_gitconfig