From: "Eddy Petrișor" <eddy.petrisor@gmail.com>
To: git@vger.kernel.org
Subject: Is context/directory sensitive config possible or even a god idea?
Date: Sat, 10 Mar 2018 00:33:35 +0200 [thread overview]
Message-ID: <CAK0XTWfraH5B+1VkNPqrquLDWac=hB0dAASYXzZbG7oCb4hkkA@mail.gmail.com> (raw)
Hello,
In some situations one person could be involved in various
multi-repository projects and need to use different user.email
information, depending on the project.
A simple example can be using the project specific email identity for
all repositories part of Android, while using the personal email for
personal projects on github.
The developer has currently only 2 options, AFAICT:
a) use --global identity for the personal email and set the Android
identity in all project repos
b) use the reverse, store Android identity in --global gitconfig, and
make sure to set the identity at repo level for personal projects.
Both solutions are suboptimal, especially if both the project in
question has many repositories and the number github projects is high,
because the user must remember to set the non-global user identity
either in all github repos or in each Android repos, after checkout.
In my view, there should be a middle ground, having a
context/directory dependent setting could be a solution.
My idea is somehting like "for all repos cloned in subdirs of
directory ~/src/android, use identity johm.doe@android.org", so the
only thing to remember to make this work is to make sure all android
checkouts are done under ~/src/android, which most people already do
because they need a clean home dir.
When I saw he include.path feature I thought this was exactly that,
but when testing it did not work as I would have liked, the inluded
config is simply added to the global config, if I add this to the
~/.gitconfig file and the target file exists.
I understand the use case I am thinking of is not the one that was
addressed by the include.file feature, so I am thinking git would need
some other setting like
'contextsensitive.include=/home/johndoe/src/android/.gitconfig' which
could mean include the settings from this config is we're in a dir on
the same level a the file, or a directory which has that dir as parent
or ancestor.
What I see already:
1) it would be a perfomance hit if the test for "do we need to apply
any context sensitive setting" must be done on every git command; for
the identity usecase might be less of a problem if only the subcomands
that need user.* would compare the prefix of the current dir with all
all contextsensitive.inludes settings and applying only the longest
one
2) what if the contextsensitive.inluclude file also includes another
contextsensitive.include, could that lead to ambiguous situations?
3) having the feature could allow the user to set other project
specific settings. Nice usecases:
if Android uses --no-ff merge.ff=false in ~/src/andoid/.gitconfig
contextsensitive.inlclude would ensure the expected strategy is used,
and rebase is the preferred behaviour for pull, instead of merge)
--
Eddy Petrișor
next reply other threads:[~2018-03-09 22:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 22:33 Eddy Petrișor [this message]
2018-03-09 22:57 ` Is context/directory sensitive config possible or even a god idea? Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAK0XTWfraH5B+1VkNPqrquLDWac=hB0dAASYXzZbG7oCb4hkkA@mail.gmail.com' \
--to=eddy.petrisor@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).