[PATCH 1/2] clone: respect the settings in $HOME/.gitconfig and /etc/gitconfig

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After initializing the config in the newly-created repository, we
need to unset GIT_CONFIG so that the global configs are read again.

Noticed by Pieter de Bie.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---

	On Fri, 27 Jun 2008, Pieter de Bie wrote:

	> I sometimes use url.insteadOf to create a shortcut to a central 
	> repository. For example, having something like[*1*]
	> 
	> [url "git://repo.or.cz/git/"]
	> 	insteadOf = "repo:"
	> 
	> in my global gitconfig allows me to do a 'git fetch 
	> repo:dscho.git'. I'd also like to use that with git clone :).
	> Currently if I try that, I get
	> 
	> Vienna:~ pieter$ git clone repo:dscho.git
	> Initialize dscho/.git
	> Initialized empty Git repository in /Users/pieter/dscho/.git/
	> ssh: Error resolving hostname repo: nodename nor servname provided,
	>	or not known
	> fatal: The remote end hung up unexpectedly
	> 
	> [...]
	>
	> Is there an easy fix for this?

	Yes ;-)

 builtin-clone.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/builtin-clone.c b/builtin-clone.c
index 17baa20..965b5fc 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -424,6 +424,13 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 	fprintf(stderr, "Initialize %s\n", git_dir);
 	init_db(option_template, option_quiet ? INIT_DB_QUIET : 0);
 
+	/*
+	 * At this point, the config exists, so we do not need the
+	 * environment variable.  We actually need to unset it, too, to
+	 * re-enable parsing of the global configs.
+	 */
+	unsetenv(CONFIG_ENVIRONMENT);
+
 	if (option_reference)
 		setup_reference(git_dir);
 
-- 
1.5.6.173.gde14c

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux