git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Santi Béjar" <sbejar@gmail.com>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: Re: [BUG] aliases not working outside of a working copy
Date: Mon, 31 Mar 2008 21:39:48 -0700	[thread overview]
Message-ID: <7v1w5qkx2j.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 8aa486160803310819r3a905bbeg5f993a55aaf6efbf@mail.gmail.com

"Santi Béjar" <sbejar@gmail.com> writes:

>   I use the following alias:
>
> [alias]
>         wdiff = diff --color-words
>
> and it no longer works outside of a working copy since:
>
> af05d67 (Always set *nongit_ok in setup_git_directory_gently())
>
> The problem is with the alias system that detects if you are in a
> working copy, not with the command, as the
> command just works fine.

I was wondering if anybody was using git alias outside git repository, as
I thought such a use would be somewhat unorthodox.  The easter egg took 6
days to get discovered.

I'll commit this on 'master'.  Thanks for satisfying my curiosity ;-)

-- >8 --
[PATCH] Accept git aliases outside a git repository

af05d67 (Always set *nongit_ok in setup_git_directory_gently(),
2008-03-25) had a change from the patch originally submitted that resulted
in disabling aliases outside a git repository.

It turns out that some people used "alias.fubar = diff --color-words" in
$HOME/.gitconfig to use non-git command outside git repositories, and this
change broke such a usage, so this resurrects the support.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git.c b/git.c
index b7729d7..c4e4644 100644
--- a/git.c
+++ b/git.c
@@ -148,8 +148,9 @@ static int handle_alias(int *argcp, const char ***argv)
 	const char** new_argv;
 	const char *alias_command;
 	char *alias_string;
+	int unused_nongit;
 
-	subdir = setup_git_directory_gently(NULL);
+	subdir = setup_git_directory_gently(&unused_nongit);
 
 	alias_command = (*argv)[0];
 	alias_string = alias_lookup(alias_command);
-- 
1.5.5.rc2.155.gb0a67

  parent reply	other threads:[~2008-04-01  4:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-31 15:19 [BUG] aliases not working outside of a working copy Santi Béjar
2008-03-31 15:46 ` Johannes Schindelin
2008-04-01  4:39 ` Junio C Hamano [this message]
2008-04-01  8:04   ` Santi Béjar

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=7v1w5qkx2j.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=sbejar@gmail.com \
    /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).