Skip to contentSkip to conversation

git-gui: make "Git GUI Here" Explorer extension more robust

PATCH In review Markus Heidelberg 4 participants 10 messages Jun 15, 2016 – Aug 13, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-gui: make "Git GUI Here" Explorer extension more robust

Starting git-gui via Windows Explorer shell extension caused problems when not started from the project directory, but from a directory within the project: starting the Explorer from the git-gui menu "Explore Working Copy" didn't work then.

Starting git-gui via Explorer shell extension from the .git directory didn't work at all.

To make these things possible, "cd .." until we see .git/

---
 windows/git-gui.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
windows/git-gui.sh +3 -0
index 53c3a94..16c4a2a 100644
@@ -4,6 +4,9 @@ exec wish "$0" -- "$@"
 
 if { $argc >=2 && [lindex $argv 0] == "--working-dir" } {
 	cd [lindex $argv 1]
+	while { ![file isdirectory .git] } {
+		cd ..
+	}
 	set argv [lrange $argv 2 end]
 	incr argc -2
 }
Signature · 1 line
1.6.2.1.409.gad7bf.dirty
#1 lore raw

Hi,

Quoted 9 lines · Markus Heidelberg

Starting git-gui via Windows Explorer shell extension caused problems when not started from the project directory, but from a directory within the project: starting the Explorer from the git-gui menu "Explore Working Copy" didn't work then.

Starting git-gui via Explorer shell extension from the .git directory didn't work at all.

To make these things possible, "cd .." until we see .git/

How does this interact with GIT_WORK_TREE? And with bare repositories?

Ciao,
Dscho

#2 lore raw

Johannes Schindelin, 30.03.2009:

Quoted 9 lines

Hi,

Quoted 5 lines · Markus Heidelberg

Starting git-gui via Windows Explorer shell extension caused problems when not started from the project directory, but from a directory within the project: starting the Explorer from the git-gui menu "Explore Working Copy" didn't work then.

Quoted 6 lines
Quoted 4 lines

Starting git-gui via Explorer shell extension from the .git directory didn't work at all.

To make these things possible, "cd .." until we see .git/

How does this interact with GIT_WORK_TREE?

Not sure. What's the use case for a globally set GIT_WORK_TREE, how is it used?

Quoted 1 line

And with bare repositories?

Git-gui doesn't seem to work with bare repositories, I get "Cannot use funny .git directory: ."
when started on the command line.

But I just noticed, that it will obviously "cd .." forever, if no .git/ was found. Somehow the root directory has to be catched.

Markus

#3 lore raw
Quoted 3 lines · Markus Heidelberg

But I just noticed, that it will obviously "cd .." forever, if no .git/ was found. Somehow the root directory has to be catched.

Yup. I'm dropping this patch for now because of this issue, but I'll look at it again if its addressed in another version. :-)

Signature · 1 line
Shawn.
#4 lore raw
Quoted 7 lines · Shawn O. Pearce
Quoted 3 lines · Markus Heidelberg

But I just noticed, that it will obviously "cd .." forever, if no .git/ was found. Somehow the root directory has to be catched.

Yup. I'm dropping this patch for now because of this issue, but I'll look at it again if its addressed in another version. :-)

I have a couple of pending patches to fix git gui handling of repositories, including support for nonstandard repository locations and bare repositories. You can find them at

http://git.oblomov.eu/git

and specifically

http://git.oblomov.eu/git/patches/b2e4c32e13df1b7f18e7b4a9f746650471a3122e..a63526bf3238cf25d9a5521f7ee35ed1bd11cb16

I got distracted by real-life issue and forgot to resend them. I'll try to find the time again later on this week. I'm not entirely sure these solve Markus' problem though.

Signature · 1 line
Giuseppe "Oblomov" Bilotta
#7 lore raw
In reply to Markus Heidelberg

Hi,

Quoted 12 lines · Markus Heidelberg

Johannes Schindelin, 30.03.2009:

Quoted 10 lines · Markus Heidelberg
Quoted 9 lines

Starting git-gui via Windows Explorer shell extension caused problems when not started from the project directory, but from a directory within the project: starting the Explorer from the git-gui menu "Explore Working Copy" didn't work then.

Starting git-gui via Explorer shell extension from the .git directory didn't work at all.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

To make these things possible, "cd .." until we see .git/

How does this interact with GIT_WORK_TREE?

Not sure. What's the use case for a globally set GIT_WORK_TREE, how is it used?

You can call git gui with a non-global GIT_WORK_TREE by something like this, even on Windows (which your patch does not special case, anyway):

	$ GIT_WORK_TREE=/bla/blub git gui
Quoted 5 lines
Quoted 1 line

And with bare repositories?

Git-gui doesn't seem to work with bare repositories, I get "Cannot use funny .git directory: ."
when started on the command line.

Oh? I thought there was some discussion recently that was explicitely about git gui with bare repositories. But I have to time-share my brain these days, so my memory might well show some bit flips.

Ciao,
Dscho

#8 lore raw
Quoted 11 lines · Johannes Schindelin
Quoted 6 lines · Markus Heidelberg

Johannes Schindelin, 30.03.2009:

Quoted 1 line

And with bare repositories?

Git-gui doesn't seem to work with bare repositories, I get "Cannot use funny .git directory: ."
when started on the command line.

Oh? I thought there was some discussion recently that was explicitely about git gui with bare repositories. But I have to time-share my brain these days, so my memory might well show some bit flips.

At best, you can get blame to run on a bare repository, but that's it. Most of the git-gui UI is designed for viewing the status of the working tree, or manipulating the index and/or files in that working tree. There are fairly good reasons why it doesn't work on a bare repository.

Of course, fetch/push would be fine a bare repository, but I consider that use case to be not worth the cost it would be in code to make it possible. We'd have to if out huge blocks of git-gui code, maybe 80%+ of git-gui.sh, and that script is already hairy enough (3477 lines).

Signature · 1 line
Shawn.
#9 lore raw
In reply to Johannes Schindelin

Johannes Schindelin, 30.03.2009:

Quoted 20 lines

Hi,

Quoted 16 lines · Markus Heidelberg

Johannes Schindelin, 30.03.2009:

Quoted 13 lines · Markus Heidelberg
Quoted 10 lines

Starting git-gui via Windows Explorer shell extension caused problems when not started from the project directory, but from a directory within the project: starting the Explorer from the git-gui menu "Explore Working Copy" didn't work then.

Starting git-gui via Explorer shell extension from the .git directory didn't work at all.

To make these things possible, "cd .." until we see .git/

How does this interact with GIT_WORK_TREE?

Quoted 7 lines
Quoted 2 lines

Not sure. What's the use case for a globally set GIT_WORK_TREE, how is it used?

You can call git gui with a non-global GIT_WORK_TREE by something like this, even on Windows (which your patch does not special case, anyway):

	$ GIT_WORK_TREE=/bla/blub git gui

The patch only affected git-gui started via Explorer, i.e. invoked with --working-dir. But it's right that core.worktree can be set in the repository.
However, git-gui currently doesn't support the gitdir outside of the working directory, but it may not be wise to build up on this!?

Hmm, more complicated than I initially thought.

Markus

#6 lore raw
In reply to Giuseppe Bilotta

Giuseppe Bilotta, 31.03.2009:

Quoted 14 lines · Shawn O. Pearce
Quoted 8 lines
Quoted 3 lines · Markus Heidelberg

But I just noticed, that it will obviously "cd .." forever, if no .git/ was found. Somehow the root directory has to be catched.

Yup. I'm dropping this patch for now because of this issue, but I'll look at it again if its addressed in another version. :-)

I have a couple of pending patches to fix git gui handling of repositories, including support for nonstandard repository locations and bare repositories. You can find them at

Quoted 5 lines

http://git.oblomov.eu/git

and specifically

http://git.oblomov.eu/git/patches/b2e4c32e13df1b7f18e7b4a9f746650471a3122e..a63526bf3238cf25d9a5521f7ee35ed1bd11cb16

I just tried these two patches on Windows (Uhh, Qemu is too slow for this, I have to setup something else).

Quoted 3 lines

I got distracted by real-life issue and forgot to resend them. I'll try to find the time again later on this week. I'm not entirely sure these solve Markus' problem though.

Starting git-gui via Explorer "Git GUI Here" is now possible from the .git/ directory with your patches, but it doesn't show the working tree status. Also "Explore Working Copy" wants to open the .git directory then instead of the project directory (I say "want" because of the issue I just sent a patch out). It seems to be as non-functional as if you run "git status" inside of .git/

Markus

#5 lore raw
In reply to Shawn O. Pearce
Quoted 7 lines · Shawn O. Pearce
Quoted 3 lines · Markus Heidelberg

But I just noticed, that it will obviously "cd .." forever, if no .git/ was found. Somehow the root directory has to be catched.

Yup. I'm dropping this patch for now because of this issue, but I'll look at it again if its addressed in another version. :-)

I have a couple of pending patches to fix git gui handling of repositories, including support for nonstandard repository locations and bare repositories. You can find them at

http://git.oblomov.eu/git

and specifically

http://git.oblomov.eu/git/patches/b2e4c32e13df1b7f18e7b4a9f746650471a3122e..a63526bf3238cf25d9a5521f7ee35ed1bd11cb16

I got distracted by real-life issue and forgot to resend them. I'll try to find the time again later on this week. I'm not entirely sure these solve Markus' problem though.

Signature · 1 line
Giuseppe "Oblomov" Bilotta