git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] emacs: make 'git-status' work with separate git dirs
@ 2012-11-22 15:58 Enrico Scholz
  2012-11-25  6:22 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Enrico Scholz @ 2012-11-22 15:58 UTC (permalink / raw)
  To: git, gitster; +Cc: Enrico Scholz

when trying 'M-x git-status' in a submodule created with recent (1.7.5+)
git, the command fails with

| ... is not a git working tree

This is caused by creating submodules with '--separate-git-dir' but
still checking for a working tree by testing for a '.git' directory.

The patch fixes this by relaxing the existing detection a little bit.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
 contrib/emacs/git.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 65c95d9..5ffc506 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -1671,7 +1671,7 @@ Commands:
   "Entry point into git-status mode."
   (interactive "DSelect directory: ")
   (setq dir (git-get-top-dir dir))
-  (if (file-directory-p (concat (file-name-as-directory dir) ".git"))
+  (if (file-exists-p (concat (file-name-as-directory dir) ".git"))
       (let ((buffer (or (and git-reuse-status-buffer (git-find-status-buffer dir))
                         (create-file-buffer (expand-file-name "*git-status*" dir)))))
         (switch-to-buffer buffer)
-- 
1.7.11.7

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

* Re: [PATCH] emacs: make 'git-status' work with separate git dirs
  2012-11-22 15:58 [PATCH] emacs: make 'git-status' work with separate git dirs Enrico Scholz
@ 2012-11-25  6:22 ` Junio C Hamano
  2012-11-25  9:06   ` Alexandre Julliard
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2012-11-25  6:22 UTC (permalink / raw)
  To: Alexandre Julliard; +Cc: git, Enrico Scholz

Enrico Scholz <enrico.scholz@sigma-chemnitz.de> writes:

> when trying 'M-x git-status' in a submodule created with recent (1.7.5+)
> git, the command fails with
>
> | ... is not a git working tree
>
> This is caused by creating submodules with '--separate-git-dir' but
> still checking for a working tree by testing for a '.git' directory.
>
> The patch fixes this by relaxing the existing detection a little bit.
>
> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> ---

This script already relies on the assumption that nobody sane would
create a directory named ".git" that is not a git repository, and
this loosens the assumption that nobody would create a file named
".git", either.  So I would think it is a sane thing to do, but just
in case if the area expert has better ideas, I am forwarding it.

Ack?

>  contrib/emacs/git.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
> index 65c95d9..5ffc506 100644
> --- a/contrib/emacs/git.el
> +++ b/contrib/emacs/git.el
> @@ -1671,7 +1671,7 @@ Commands:
>    "Entry point into git-status mode."
>    (interactive "DSelect directory: ")
>    (setq dir (git-get-top-dir dir))
> -  (if (file-directory-p (concat (file-name-as-directory dir) ".git"))
> +  (if (file-exists-p (concat (file-name-as-directory dir) ".git"))
>        (let ((buffer (or (and git-reuse-status-buffer (git-find-status-buffer dir))
>                          (create-file-buffer (expand-file-name "*git-status*" dir)))))
>          (switch-to-buffer buffer)

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

* Re: [PATCH] emacs: make 'git-status' work with separate git dirs
  2012-11-25  6:22 ` Junio C Hamano
@ 2012-11-25  9:06   ` Alexandre Julliard
  2012-11-26 23:30     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Julliard @ 2012-11-25  9:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Enrico Scholz

Junio C Hamano <gitster@pobox.com> writes:

> Enrico Scholz <enrico.scholz@sigma-chemnitz.de> writes:
>
>> when trying 'M-x git-status' in a submodule created with recent (1.7.5+)
>> git, the command fails with
>>
>> | ... is not a git working tree
>>
>> This is caused by creating submodules with '--separate-git-dir' but
>> still checking for a working tree by testing for a '.git' directory.
>>
>> The patch fixes this by relaxing the existing detection a little bit.
>>
>> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
>> ---
>
> This script already relies on the assumption that nobody sane would
> create a directory named ".git" that is not a git repository, and
> this loosens the assumption that nobody would create a file named
> ".git", either.  So I would think it is a sane thing to do, but just
> in case if the area expert has better ideas, I am forwarding it.
>
> Ack?

Sure, that's fine.

-- 
Alexandre Julliard
julliard@winehq.org

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

* Re: [PATCH] emacs: make 'git-status' work with separate git dirs
  2012-11-25  9:06   ` Alexandre Julliard
@ 2012-11-26 23:30     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2012-11-26 23:30 UTC (permalink / raw)
  To: Alexandre Julliard; +Cc: git, Enrico Scholz

Alexandre Julliard <julliard@winehq.org> writes:

> Junio C Hamano <gitster@pobox.com> writes:
>
>> Enrico Scholz <enrico.scholz@sigma-chemnitz.de> writes:
>>
>>> when trying 'M-x git-status' in a submodule created with recent (1.7.5+)
>>> git, the command fails with
>>>
>>> | ... is not a git working tree
>>>
>>> This is caused by creating submodules with '--separate-git-dir' but
>>> still checking for a working tree by testing for a '.git' directory.
>>>
>>> The patch fixes this by relaxing the existing detection a little bit.
>>>
>>> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
>>> ---
>>
>> This script already relies on the assumption that nobody sane would
>> create a directory named ".git" that is not a git repository, and
>> this loosens the assumption that nobody would create a file named
>> ".git", either.  So I would think it is a sane thing to do, but just
>> in case if the area expert has better ideas, I am forwarding it.
>>
>> Ack?
>
> Sure, that's fine.

Thanks, both.  Applied.

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

end of thread, other threads:[~2012-11-26 23:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-22 15:58 [PATCH] emacs: make 'git-status' work with separate git dirs Enrico Scholz
2012-11-25  6:22 ` Junio C Hamano
2012-11-25  9:06   ` Alexandre Julliard
2012-11-26 23:30     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).