git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] aliases not working outside of a working copy
@ 2008-03-31 15:19 Santi Béjar
  2008-03-31 15:46 ` Johannes Schindelin
  2008-04-01  4:39 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Santi Béjar @ 2008-03-31 15:19 UTC (permalink / raw)
  To: Git Mailing List

Hi *,

  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.

Santi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] aliases not working outside of a working copy
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2008-03-31 15:46 UTC (permalink / raw)
  To: Santi Béjar; +Cc: Git Mailing List

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1054 bytes --]

Hi,

On Mon, 31 Mar 2008, Santi Béjar wrote:

> 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.

Ah, right.  I think that this hunk:

diff --git a/git.c b/git.c
index 13de801..b7729d7 100644
--- a/git.c
+++ b/git.c
@@ -142,14 +142,14 @@ static int split_cmdline(char *cmdline, const char ***arg

 static int handle_alias(int *argcp, const char ***argv)
 {
-       int nongit = 0, envchanged = 0, ret = 0, saved_errno = errno;
+       int envchanged = 0, ret = 0, saved_errno = errno;
        const char *subdir;
        int count, option_count;
        const char** new_argv;
        const char *alias_command;
        char *alias_string;

-       subdir = setup_git_directory_gently(&nongit);
+       subdir = setup_git_directory_gently(NULL);

        alias_command = (*argv)[0];
        alias_string = alias_lookup(alias_command);


of the commit you mentioned is utterly wrong.

Ciao,
Dscho

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [BUG] aliases not working outside of a working copy
  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
  2008-04-01  8:04   ` Santi Béjar
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2008-04-01  4:39 UTC (permalink / raw)
  To: Santi Béjar; +Cc: Git Mailing List

"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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [BUG] aliases not working outside of a working copy
  2008-04-01  4:39 ` Junio C Hamano
@ 2008-04-01  8:04   ` Santi Béjar
  0 siblings, 0 replies; 4+ messages in thread
From: Santi Béjar @ 2008-04-01  8:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Tue, Apr 1, 2008 at 6:39 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
>  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 ;-)

You're welcome.

Santi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-01  8:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2008-04-01  8:04   ` Santi Béjar

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).