[PATCH v2 1/2] gitk: show part of submodule log instead of empty pane when listing trees

2018-05-09 Thread Alex Riesen
From: Alex Riesen <raa.l...@gmail.com>

Currently, selecting a name in the file list (bottom right) panel in
"Tree" mode does not do anything useful if the name is a submodule.
If gitk is currently showing a commit, the submodule names are not shown
at all (which is very confusing). If the gitk is showing the uncached
change, the submodules are shown, but focusing a submodule name causes a
Tcl error to appear. And finally, if gitk shows the index, the submodule
is presented as its bare name in the diff/file contents panel.

This change will show the first arbitrarily chosen number of commits.

Signed-off-by: Alex Riesen <raa.l...@gmail.com>
---
 gitk | 44 ++--
 1 file changed, 34 insertions(+), 10 deletions(-)

diff --git a/gitk b/gitk
index a14d7a1..742f36b 100755
--- a/gitk
+++ b/gitk
@@ -7627,9 +7627,10 @@ proc gettreeline {gtf id} {
if {$i < 0} continue
set fname [string range $line [expr {$i+1}] end]
set line [string range $line 0 [expr {$i-1}]]
-   if {$diffids ne $nullid2 && [lindex $line 1] ne "blob"} continue
+   set objtype [lindex $line 1]
+   if {$diffids ne $nullid2 && $objtype ne "blob" && $objtype ne 
"commit" } { continue }
set sha1 [lindex $line 2]
-   lappend treeidlist($id) $sha1
+   lappend treeidlist($id) "$sha1 $objtype"
}
if {[string index $fname 0] eq "\""} {
set fname [lindex $fname 0]
@@ -7659,21 +7660,44 @@ proc showfile {f} {
 global ctext_file_names ctext_file_lines
 global ctext commentend
 
+set submodlog "log --format=%h\\ %aN:\\ %s -100"
+set fcmt ""
 set i [lsearch -exact $treefilelist($diffids) $f]
 if {$i < 0} {
puts "oops, $f not in list for id $diffids"
return
 }
 if {$diffids eq $nullid} {
-   if {[catch {set bf [open $f r]} err]} {
-   puts "oops, can't read $f: $err"
-   return
+   if {[file isdirectory $f]} {
+   # a submodule
+   set qf [shellquote $f]
+   if {[catch {set bf [open "| git -C $qf $submodlog" r]} err]} {
+   puts "oops, can't read submodule $f: $err"
+   return
+   }
+} else {
+   if {[catch {set bf [open $f r]} err]} {
+   puts "oops, can't read $f: $err"
+   return
+   }
}
 } else {
-   set blob [lindex $treeidlist($diffids) $i]
-   if {[catch {set bf [open [concat | git cat-file blob $blob] r]} err]} {
-   puts "oops, error reading blob $blob: $err"
-   return
+   set bo [lindex $treeidlist($diffids) $i]
+   set blob [lindex $bo 0]
+   set objtype [lindex $bo 1]
+   if { "$objtype" eq "blob" } {
+   if {[catch {set bf [open [concat | git cat-file blob $blob] r]} 
err]} {
+   puts "oops, error reading blob $blob: $err"
+   return
+   }
+   } else {
+   # also a submodule
+   set qf [shellquote $f]
+   if {[catch {set bf [open "| git -C $qf $submodlog $blob" r]} err]} {
+   puts "oops, error reading submodule commit: $err"
+   return
+   }
+   set fcmt "/"
}
 }
 fconfigure $bf -blocking 0 -encoding [get_path_encoding $f]
@@ -7683,7 +7707,7 @@ proc showfile {f} {
 lappend ctext_file_names $f
 lappend ctext_file_lines [lindex [split $commentend "."] 0]
 $ctext insert end "\n"
-$ctext insert end "$f\n" filesep
+$ctext insert end "$f$fcmt\n" filesep
 $ctext config -state disabled
 $ctext yview $commentend
 settabs 0
-- 
2.17.0.593.g2029711e64


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



[PATCH v2 2/2] gitk: add an option to run gitk on an item in the file list

2018-05-09 Thread Alex Riesen
From: Alex Riesen <raa.l...@gmail.com>

Similar to a git gui feature which visualizes history in a submodule,
the submodules cause the gitk be started inside the submodule.

Signed-off-by: Alex Riesen <raa.l...@gmail.com>
---
 gitk | 12 
 1 file changed, 12 insertions(+)

diff --git a/gitk b/gitk
index 742f36b..c430dfe 100755
--- a/gitk
+++ b/gitk
@@ -2682,6 +2682,7 @@ proc makewindow {} {
{mc "External diff" command {external_diff}}
{mc "Blame parent commit" command {external_blame 1}}
{mc "Copy path" command {clipboard clear; clipboard append 
$flist_menu_file}}
+   {mc "Run gitk on this" command {flist_gitk}}
 }
 $flist_menu configure -tearoff 0
 
@@ -3555,6 +3556,17 @@ proc flist_hl {only} {
 set gdttype [mc "touching paths:"]
 }
 
+proc flist_gitk {} {
+global flist_menu_file findstring gdttype
+
+set x [shellquote $flist_menu_file]
+if {[file isdirectory $flist_menu_file]} {
+   exec sh -c "cd $x&" &
+} else {
+   exec gitk -- $x &
+}
+}
+
 proc gitknewtmpdir {} {
 global diffnum gitktmpdir gitdir env
 
-- 
2.17.0.593.g2029711e64


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



[PATCH v2 0/2] gitk: improve handling of submodules in the file list panel

2018-05-09 Thread Alex Riesen
From: Alex Riesen <raa.l...@gmail.com>

Currently, the submodule entries in the file list panel are mostly ignored.
This series attempts to improve the situation by showing part of submodule
history when focusing it in the file list panel and by adding a menu element
to start gitk in the submodule (similar to git gui).

This iteration does not address the behaviour of file list panel in tree mode
when gitk is started from a subdirectory (gitk strictly limits the file
listing to the files in that repository, without a way out).
I would like to hear some more opinions regarding changing its behaviour to
always list the full tree.

Alex Riesen (2):
  gitk: show part of submodule log instead of empty pane when listing
trees
  gitk: add an option to run gitk on an item in the file list

 gitk | 56 ++--
 1 file changed, 46 insertions(+), 10 deletions(-)

-- 
2.17.0.593.g2029711e64


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



Re: [PATCH] gitk: do not limit tree mode listing in the file list panel to current sub-directory

2018-05-09 Thread Alex Riesen
Bert Wesarg, Wed, May 09, 2018 14:08:51 +0200:
> >> I noticed that too, while testing your patch and I'm also confused.
> >> But was not able to send a request to Paul yet. ls-tree --full-tree
> >> seems to be one that should be used here, I think.
> >
> > Well, I just tried your suggestion. 'ls-files' doesn't have --full-tree, so
> > for those it is just cd-up.
> >
> > It is on top of the re-sent series.
> 
> I would consider the current behavior as a bug, therefor I would put
> this patch first, and than your other fixes/enhancements.

I might do, just want to hear more opinions on the matter: someone might have
good reasons for the current behaviour and consider a bug the fact that Patch
mode behaves differently, for instance.

And as I completely screwed up the resend of the series, there will definitely
be a re-resend.

Regards,
Alex

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



Re: [PATCH v2 0/2] gitk: improve handling of submodules in the file list panel

2018-05-09 Thread Alex Riesen
Sorry for broken threading... I'll have to work on that.

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



[PATCH v2 2/2] gitk: add an option to run gitk on an item in the file list

2018-05-09 Thread Alex Riesen
From: Alex Riesen <raa.l...@gmail.com>

Similar to a git gui feature which visualizes history in a submodule,
the submodules cause the gitk be started inside the submodule.
---
 gitk | 12 
 1 file changed, 12 insertions(+)

diff --git a/gitk b/gitk
index 742f36b..c430dfe 100755
--- a/gitk
+++ b/gitk
@@ -2682,6 +2682,7 @@ proc makewindow {} {
{mc "External diff" command {external_diff}}
{mc "Blame parent commit" command {external_blame 1}}
{mc "Copy path" command {clipboard clear; clipboard append 
$flist_menu_file}}
+   {mc "Run gitk on this" command {flist_gitk}}
 }
 $flist_menu configure -tearoff 0
 
@@ -3555,6 +3556,17 @@ proc flist_hl {only} {
 set gdttype [mc "touching paths:"]
 }
 
+proc flist_gitk {} {
+global flist_menu_file findstring gdttype
+
+set x [shellquote $flist_menu_file]
+if {[file isdirectory $flist_menu_file]} {
+   exec sh -c "cd $x&" &
+} else {
+   exec gitk -- $x &
+}
+}
+
 proc gitknewtmpdir {} {
 global diffnum gitktmpdir gitdir env
 
-- 
2.17.0.593.g2029711e64

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



[PATCH v2 1/2] gitk: show part of submodule log instead of empty pane when listing trees

2018-05-09 Thread Alex Riesen
From: Alex Riesen <raa.l...@gmail.com>

Currently, selecting a name in the file list (bottom right) panel in
"Tree" mode does not do anything useful if the name is a submodule.
If gitk is currently showing a commit, the submodule names are not shown
at all (which is very confusing). If the gitk is showing the uncached
change, the submodules are shown, but focusing a submodule name causes a
Tcl error to appear. And finally, if gitk shows the index, the submodule
is presented as its bare name in the diff/file contents panel.

This change will show the first arbitrarily chosen number of commits.
---
 gitk | 44 ++--
 1 file changed, 34 insertions(+), 10 deletions(-)

diff --git a/gitk b/gitk
index a14d7a1..742f36b 100755
--- a/gitk
+++ b/gitk
@@ -7627,9 +7627,10 @@ proc gettreeline {gtf id} {
if {$i < 0} continue
set fname [string range $line [expr {$i+1}] end]
set line [string range $line 0 [expr {$i-1}]]
-   if {$diffids ne $nullid2 && [lindex $line 1] ne "blob"} continue
+   set objtype [lindex $line 1]
+   if {$diffids ne $nullid2 && $objtype ne "blob" && $objtype ne 
"commit" } { continue }
set sha1 [lindex $line 2]
-   lappend treeidlist($id) $sha1
+   lappend treeidlist($id) "$sha1 $objtype"
}
if {[string index $fname 0] eq "\""} {
set fname [lindex $fname 0]
@@ -7659,21 +7660,44 @@ proc showfile {f} {
 global ctext_file_names ctext_file_lines
 global ctext commentend
 
+set submodlog "log --format=%h\\ %aN:\\ %s -100"
+set fcmt ""
 set i [lsearch -exact $treefilelist($diffids) $f]
 if {$i < 0} {
puts "oops, $f not in list for id $diffids"
return
 }
 if {$diffids eq $nullid} {
-   if {[catch {set bf [open $f r]} err]} {
-   puts "oops, can't read $f: $err"
-   return
+   if {[file isdirectory $f]} {
+   # a submodule
+   set qf [shellquote $f]
+   if {[catch {set bf [open "| git -C $qf $submodlog" r]} err]} {
+   puts "oops, can't read submodule $f: $err"
+   return
+   }
+} else {
+   if {[catch {set bf [open $f r]} err]} {
+   puts "oops, can't read $f: $err"
+   return
+   }
}
 } else {
-   set blob [lindex $treeidlist($diffids) $i]
-   if {[catch {set bf [open [concat | git cat-file blob $blob] r]} err]} {
-   puts "oops, error reading blob $blob: $err"
-   return
+   set bo [lindex $treeidlist($diffids) $i]
+   set blob [lindex $bo 0]
+   set objtype [lindex $bo 1]
+   if { "$objtype" eq "blob" } {
+   if {[catch {set bf [open [concat | git cat-file blob $blob] r]} 
err]} {
+   puts "oops, error reading blob $blob: $err"
+   return
+   }
+   } else {
+   # also a submodule
+   set qf [shellquote $f]
+   if {[catch {set bf [open "| git -C $qf $submodlog $blob" r]} err]} {
+   puts "oops, error reading submodule commit: $err"
+   return
+   }
+   set fcmt "/"
}
 }
 fconfigure $bf -blocking 0 -encoding [get_path_encoding $f]
@@ -7683,7 +7707,7 @@ proc showfile {f} {
 lappend ctext_file_names $f
 lappend ctext_file_lines [lindex [split $commentend "."] 0]
 $ctext insert end "\n"
-$ctext insert end "$f\n" filesep
+$ctext insert end "$f$fcmt\n" filesep
 $ctext config -state disabled
 $ctext yview $commentend
 settabs 0
-- 
2.17.0.593.g2029711e64


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



[PATCH v2 0/2] gitk: improve handling of submodules in the file list panel

2018-05-09 Thread Alex Riesen
Currently, the submodule entries in the file list panel are mostly ignored.
This series attempts to improve the situation by showing part of submodule
history when focusing it in the file list panel and by adding a menu element
to start gitk in the submodule (similar to git gui).

Alex Riesen (2):
  gitk: show part of submodule log instead of empty pane when listing trees
  gitk: add an option to run gitk on an item in the file list

 gitk | 56 ++--
 1 file changed, 46 insertions(+), 10 deletions(-)

-- 
2.17.0.593.g2029711e64

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



[PATCH] gitk: do not limit tree mode listing in the file list panel to current sub-directory

2018-05-09 Thread Alex Riesen
From: Alex Riesen <raa.l...@gmail.com>

The previous behavior conflicts with the "Patch" mode of the panel,
which always shows the changes from the top-level of the repository.
It is also impossible to get back to the full listing without restarting
gitk.
---

Bert Wesarg, Wed, May 09, 2018 09:19:55 +0200:
> > Frankly, this listing limited to just a sub-directory confuses me a bit. Is
> > there anyway to get to display full repository without changing to the top
> > level?
> 
> I noticed that too, while testing your patch and I'm also confused.
> But was not able to send a request to Paul yet. ls-tree --full-tree
> seems to be one that should be used here, I think.

Well, I just tried your suggestion. 'ls-files' doesn't have --full-tree, so
for those it is just cd-up.

It is on top of the re-sent series.

 gitk | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/gitk b/gitk
index c430dfe..03ead98 100755
--- a/gitk
+++ b/gitk
@@ -7600,18 +7600,18 @@ proc go_to_parent {i} {
 
 proc gettree {id} {
 global treefilelist treeidlist diffids diffmergeid treepending
-global nullid nullid2
+global nullid nullid2 cdup
 
 set diffids $id
 unset -nocomplain diffmergeid
 if {![info exists treefilelist($id)]} {
if {![info exists treepending]} {
if {$id eq $nullid} {
-   set cmd [list | git ls-files]
+   set cmd [list | git -C $cdup ls-files]
} elseif {$id eq $nullid2} {
-   set cmd [list | git ls-files --stage -t]
+   set cmd [list | git -C $cdup ls-files --stage -t]
} else {
-   set cmd [list | git ls-tree -r $id]
+   set cmd [list | git ls-tree --full-tree -r $id]
}
if {[catch {set gtf [open $cmd r]}]} {
return
@@ -7670,7 +7670,7 @@ proc gettreeline {gtf id} {
 proc showfile {f} {
 global treefilelist treeidlist diffids nullid nullid2
 global ctext_file_names ctext_file_lines
-global ctext commentend
+global ctext commentend cdup
 
 set submodlog "log --format=%h\\ %aN:\\ %s -100"
 set fcmt ""
@@ -7680,15 +7680,15 @@ proc showfile {f} {
return
 }
 if {$diffids eq $nullid} {
-   if {[file isdirectory $f]} {
+   if {[file isdirectory "$cdup$f"]} {
# a submodule
-   set qf [shellquote $f]
+   set qf [shellquote "$cdup$f"]
if {[catch {set bf [open "| git -C $qf $submodlog" r]} err]} {
puts "oops, can't read submodule $f: $err"
return
}
 } else {
-   if {[catch {set bf [open $f r]} err]} {
+   if {[catch {set bf [open "$cdup$f" r]} err]} {
puts "oops, can't read $f: $err"
return
}
@@ -7704,7 +7704,7 @@ proc showfile {f} {
}
} else {
# also a submodule
-   set qf [shellquote $f]
+   set qf [shellquote "$cdup$f"]
if {[catch {set bf [open "| git -C $qf $submodlog $blob" r]} err]} {
puts "oops, error reading submodule commit: $err"
return
-- 
2.17.0.593.g2029711e64


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



Re: [PATCH 1/2] gitk: show part of submodule log instead of empty pane when listing trees

2018-05-09 Thread Alex Riesen
Stefan Beller, Tue, May 08, 2018 19:07:29 +0200:
> On Tue, May 8, 2018 at 5:22 AM, Alex Riesen
> <alexander.rie...@cetitec.com> wrote:
> > Currently, the submodules either are not shown at all (if listing a
> > committed tree) or a Tcl error appears (when clicking on a submodule
> > from the index list).
> 
> I do not understand where this appears, yet.
> Where do I have to click to see the effects of this patch?

Er. I meant to say the file list panel (bottom right panel). Sorry,
didn't come out clear. I'll reword the commit message next time.

> > @@ -7659,21 +7660,42 @@ proc showfile {f} {
> >  global ctext_file_names ctext_file_lines
> >  global ctext commentend
> >
> > +set submodlog "git\\ log\\ --format='%h\\ %aN:\\ %s'\\ -100"
> 
> Do we want to respect the config option diff.submodule here?

Probably not. It is already done when the file list panel is in "Patch" mode.
The "Tree" mode of the panel shows the files in full, so the submodules should
be shown similarly: in a format resembling their full (referenced) contents.

> The -100 is chosen rather arbitrarily. Ideally we'd only walk to the
> previous entry?

Yes, the limit is indeed arbitrary. I'm reluctant of listing full history,
though: it might take too long a while (and does, in my line of work). Maybe
an option in the settings? Or some kind of a more natural limit (for 1 second?
Until the end of panel?)

> > -   if {[catch {set bf [open $f r]} err]} {
> > -   puts "oops, can't read $f: $err"
> > -   return
> > +   if {[file isdirectory $f]} {
> > +   # a submodule
> > +   if {[catch {set bf [open "| sh -c cd\\ \"$f\"&&$submodlog" r]} 
> > err]} {
> 
> Can we have $submodlog use the "git -C  command"
> option, then we could save the "cd &&" part, which might even
> save us from spawning a shell?

That's because I forgot about that option. Of course, I'll fix this.
Also need a shellquote for the path.

Thanks!
Alex

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



Re: [PATCH 2/2] gitk: add an option to run gitk on an item in the file list

2018-05-08 Thread Alex Riesen
Bert Wesarg, Tue, May 08, 2018 15:17:03 +0200:
> On Tue, May 8, 2018 at 2:22 PM, Alex Riesen <alexander.rie...@cetitec.com> 
> wrote:
> > +proc flist_gitk {} {
> > +global flist_menu_file findstring gdttype
> > +
> > +set x [shellquote $flist_menu_file]
> 
> this needs to handle cdup, i.e., if gitk is run from a subdirectory,
> all paths needs to be prefixed with $cdup, like: [file join $cdup
> $flist_menu_file]

That, indeed, is easily done:

set x [shellquote [file join $cdup $flist_menu_file]]
if {[file isdirectory $flist_menu_file]} {
exec sh -c "cd $x&" &
} else {
exec gitk -- $x &
}


It just doesn't seem to work: gitk does not find any commits!
Maybe that's because the file panel lists only files for the current
subdirectory (without the path from the repo top-level)? E.g.

mkdir tst
cd tst
git init
mkdir a
touch top-file a/sub-file
git add -A ; git commit -m.
cd a
gitk

Gitk lists only sub-file.

Frankly, this listing limited to just a sub-directory confuses me a bit. Is
there anyway to get to display full repository without changing to the top
level?


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



[PATCH 2/2] gitk: add an option to run gitk on an item in the file list

2018-05-08 Thread Alex Riesen
From: Alex Riesen <raa.l...@gmail.com>

Similar to a git gui feature which visualizes history in a submodule,
the submodules cause the gitk be started inside the submodule.

Signed-off-by: Alex Riesen <raa.l...@gmail.com>
---
 gitk | 12 
 1 file changed, 12 insertions(+)

diff --git a/gitk b/gitk
index d34833f..1ec545e 100755
--- a/gitk
+++ b/gitk
@@ -2682,6 +2682,7 @@ proc makewindow {} {
{mc "External diff" command {external_diff}}
{mc "Blame parent commit" command {external_blame 1}}
{mc "Copy path" command {clipboard clear; clipboard append 
$flist_menu_file}}
+   {mc "Run gitk on this" command {flist_gitk}}
 }
 $flist_menu configure -tearoff 0
 
@@ -3555,6 +3556,17 @@ proc flist_hl {only} {
 set gdttype [mc "touching paths:"]
 }
 
+proc flist_gitk {} {
+global flist_menu_file findstring gdttype
+
+set x [shellquote $flist_menu_file]
+if {[file isdirectory $flist_menu_file]} {
+   exec sh -c "cd $x&" &
+} else {
+   exec gitk -- $x &
+}
+}
+
 proc gitknewtmpdir {} {
 global diffnum gitktmpdir gitdir env
 
-- 
2.17.0.rc1.56.gb9824190bd


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



[PATCH 1/2] gitk: show part of submodule log instead of empty pane when listing trees

2018-05-08 Thread Alex Riesen
From: Alex Riesen <raa.l...@gmail.com>

Currently, the submodules either are not shown at all (if listing a
committed tree) or a Tcl error appears (when clicking on a submodule
from the index list).

This will make it show first arbitrarily chosen number of commits,
which might be only marginally better.

Signed-off-by: Alex Riesen <raa.l...@gmail.com>
---
 gitk | 42 --
 1 file changed, 32 insertions(+), 10 deletions(-)

diff --git a/gitk b/gitk
index a14d7a1..d34833f 100755
--- a/gitk
+++ b/gitk
@@ -7627,9 +7627,10 @@ proc gettreeline {gtf id} {
if {$i < 0} continue
set fname [string range $line [expr {$i+1}] end]
set line [string range $line 0 [expr {$i-1}]]
-   if {$diffids ne $nullid2 && [lindex $line 1] ne "blob"} continue
+   set objtype [lindex $line 1]
+   if {$diffids ne $nullid2 && $objtype ne "blob" && $objtype ne 
"commit" } { continue }
set sha1 [lindex $line 2]
-   lappend treeidlist($id) $sha1
+   lappend treeidlist($id) "$sha1 $objtype"
}
if {[string index $fname 0] eq "\""} {
set fname [lindex $fname 0]
@@ -7659,21 +7660,42 @@ proc showfile {f} {
 global ctext_file_names ctext_file_lines
 global ctext commentend
 
+set submodlog "git\\ log\\ --format='%h\\ %aN:\\ %s'\\ -100"
+set fcmt ""
 set i [lsearch -exact $treefilelist($diffids) $f]
 if {$i < 0} {
puts "oops, $f not in list for id $diffids"
return
 }
 if {$diffids eq $nullid} {
-   if {[catch {set bf [open $f r]} err]} {
-   puts "oops, can't read $f: $err"
-   return
+   if {[file isdirectory $f]} {
+   # a submodule
+   if {[catch {set bf [open "| sh -c cd\\ \"$f\"&&$submodlog" r]} 
err]} {
+   puts "oops, can't read submodule $f: $err"
+   return
+   }
+} else {
+   if {[catch {set bf [open $f r]} err]} {
+   puts "oops, can't read $f: $err"
+   return
+   }
}
 } else {
-   set blob [lindex $treeidlist($diffids) $i]
-   if {[catch {set bf [open [concat | git cat-file blob $blob] r]} err]} {
-   puts "oops, error reading blob $blob: $err"
-   return
+   set bo [lindex $treeidlist($diffids) $i]
+   set blob [lindex $bo 0]
+   set objtype [lindex $bo 1]
+   if { "$objtype" eq "blob" } {
+   if {[catch {set bf [open [concat | git cat-file blob $blob] r]} 
err]} {
+   puts "oops, error reading blob $blob: $err"
+   return
+   }
+   } else {
+   # also a submodule
+   if {[catch {set bf [open "| sh -c cd\\ \"$f\"&&$submodlog\\ $blob" 
r]} err]} {
+   puts "oops, error reading submodule commit: $err"
+   return
+   }
+   set fcmt "/"
}
 }
 fconfigure $bf -blocking 0 -encoding [get_path_encoding $f]
@@ -7683,7 +7705,7 @@ proc showfile {f} {
 lappend ctext_file_names $f
 lappend ctext_file_lines [lindex [split $commentend "."] 0]
 $ctext insert end "\n"
-$ctext insert end "$f\n" filesep
+$ctext insert end "$f$fcmt\n" filesep
 $ctext config -state disabled
 $ctext yview $commentend
 settabs 0
-- 
2.17.0.rc1.56.gb9824190bd


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



[PATCH 0/2] gitk: improve handling of submodules in the file list panel

2018-05-08 Thread Alex Riesen
Currently, the submodule entries in the file list panel are mostly ignored.
This series attempts to improve the situation by showing part of submodule
history when focusing it in the file list panel and by adding a menu element
to start gitk in the submodule (similar to git gui).

  [1/2]: gitk: show part of submodule log instead of empty pane when listing 
trees
  [2/2]: gitk: add an option to run gitk on an item in the file list

 gitk | 54 --
 1 file changed, 44 insertions(+), 10 deletions(-)

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules

2017-12-20 Thread Alex Riesen
Ævar Arnfjörð Bjarmason, Wed, Dec 20, 2017 19:24:19 +0100:
> diff --git a/INSTALL b/INSTALL
> index ffb071e9f0..808e07b659 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -84,9 +84,24 @@ Issues of note:
>  
>   GIT_EXEC_PATH=`pwd`
>   PATH=`pwd`:$PATH
> - GITPERLLIB=`pwd`/perl/blib/lib
> + GITPERLLIB=`pwd`/perl/build/lib
>   export GIT_EXEC_PATH PATH GITPERLLIB

Sincerely sorry for off-topic, I just wonder why this section of INSTALL
uses the backticks for command substitution. Is there a shell which does not
support the alternative form $(...) but has all the rest of the used syntax?


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



[PATCH 2/2] git-gui: ensure the file in the diff pane is in the list of selected files

2016-06-28 Thread Alex Riesen
It is very confusing that the file which diff is displayed is marked as
selected, but it is not in fact selected (that means the array of selected
files does not include the file in question).

Fixing this also improves the use of $FILENAMES in custom defined tools: one
does not have to click the file in the list to make it selected.

Signed-off-by: Alex Riesen <alexander.rie...@cetitec.com>
---
 lib/diff.tcl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/diff.tcl b/lib/diff.tcl
index 0d56986..30bdd69 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -127,6 +127,9 @@ proc show_diff {path w {lno {}} {scroll_pos {}} {callback 
{}}} {
} else {
start_show_diff $cont_info
}
+
+   global current_diff_path selected_paths
+   set selected_paths($current_diff_path) 1
 }
 
 proc show_unmerged_diff {cont_info} {
-- 
2.9.0.45.g28c608e.dirty


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus

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


[PATCH 1/2] git-gui: support for $FILENAMES in tool definitions

2016-06-28 Thread Alex Riesen
This addes a FILENAMES environment variable, which contains the repository
pathnames of all selected files the list.
The variable contains the names separated by LF (\n, \x0a).

If the file names contain LF characters, the tool command might be unable to
unambiguosly split the value of $FILENAME into the separate names.

Note that the file marked and diffed immediately after starting the GUI up,
is not actually selected. One must click on it once to really select it.

Signed-off-by: Alex Riesen <alexander.rie...@cetitec.com>
---
 lib/tools.tcl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/tools.tcl b/lib/tools.tcl
index 6ec9411..413f1a1 100644
--- a/lib/tools.tcl
+++ b/lib/tools.tcl
@@ -69,6 +69,7 @@ proc tools_populate_one {fullname} {
 proc tools_exec {fullname} {
global repo_config env current_diff_path
global current_branch is_detached
+   global selected_paths
 
if {[is_config_true "guitool.$fullname.needsfile"]} {
if {$current_diff_path eq {}} {
@@ -100,6 +101,7 @@ proc tools_exec {fullname} {
 
set env(GIT_GUITOOL) $fullname
set env(FILENAME) $current_diff_path
+   set env(FILENAMES) [join [array names selected_paths] \n]
if {$is_detached} {
set env(CUR_BRANCH) ""
} else {
@@ -121,6 +123,7 @@ proc tools_exec {fullname} {
 
unset env(GIT_GUITOOL)
unset env(FILENAME)
+   unset env(FILENAMES)
unset env(CUR_BRANCH)
catch { unset env(ARGS) }
catch { unset env(REVISION) }
-- 
2.9.0.45.g28c608e.dirty


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus

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


Re: [PATCH 1/2] Support for $FILENAMES in tool definitions

2016-06-28 Thread Alex Riesen
Jakub Narębski, Mon, Jun 27, 2016 19:28:07 +0200:
> On 2016-06-27, Alex Riesen wrote:
> 
> > This adds a FILENAMES environment variable, which contains the repository
> > pathnames of all selected files the list.
> > The variable contains the names separated by spaces.
> 
> Why not separate filenames with end-of-line character (LF)? It would still
> be broken for some filenames, but only for unportable ones.  Filenames with
> internal space (common on MS Windows) would work then.
> 
>   http://www.dwheeler.com/essays/filenames-in-shell.html
>  

Done. Thanks for the reference, BTW.

> If Tcl allows it, you could separate filenames in FILENAMES environment
> variable with NUL ("\0") character...

It allows using of NUL to join the file names. The problem is that the shell
does not know that the variable $FILENAMES doesn't end at the first NUL.

Looks like the script should do the expansion (and quoting!) on its own for
this. Or implement another syntax for custom tools, which will allow for, i.e.
passing the list of files on stdin. LF or NUL separated than.

> > Similar to the FILENAME it is broken yet, if the names contain spaces.
> 
> Could you clarify? Did you meant that FILENAMES environment variable is
> similar to existing FILENAME variable, but broken for filenames which contain
> spaces, or did you mean that both FILENAME (how?) and FILENAMES are broken
> for filenames with spaces in them?

Passing a filename with spaces plainly $FILENAME into the command (i.e.
without quoting) produces multiple arguments instead of one.
The new $FILENAMES produces incorrect number of arguments for files with
spaces for the same reason.

> > Note that the file marked and diffed immediately after starting the GUI up,
> > is not actually selected. One must click on it once to really select it.
> 
> I'm not that familiar with git-gui / gitk; what do you mean by this sentence?

The git-gui (its completely different from gitk) keeps two variables for
current files: a scalar variable for the file diff of which is displayed in
the lower right pane, and a Tcl array (more like a string-to-int map, if I
understand the code) with the names of the files selected in the file list.
The array is populated every time you click on a name in the file list, and
can contain multiple entries if you hold "Ctrl" while clicking.

> Could you summarize how FILENAME and FILENAMES work, please?

These are just environment variables set before running the tool command. They
are unset immediately after starting the command.

The tool command is unconditionally run using "sh -c ", so the
references to the environment variables are expanded by "sh".

Regards,
Alex

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus

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


Re: [PATCH 1/2] Support for $FILENAMES in tool definitions

2016-06-28 Thread Alex Riesen
Johannes Schindelin, Mon, Jun 27, 2016 17:49:30 +0200:
> On Mon, 27 Jun 2016, Alex Riesen wrote:
> 
> > This adds a FILENAMES environment variable, which contains the repository
> > pathnames of all selected files the list.
> > The variable contains the names separated by spaces.
> > 
> > Similar to the FILENAME it is broken yet, if the names contain spaces.
> > 
> > Note that the file marked and diffed immediately after starting the GUI up,
> > is not actually selected. One must click on it once to really select it.
> > 
> > Signed-off-by: Alex Riesen <alexander.rie...@cetitec.com>
> 
> Maybe prefix the subject with `git-gui: ` to indicate that this is for the
> git-gui.git repository?

Done.

> Also, please muster some patience, Pat seems to be super busy these days.

It's alright. Nice to know he's ok, though.

Regards,
Alex


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus

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


Re: [PATCH 2/2] Ensure the file in the diff pane is always in the list of selected files

2016-06-28 Thread Alex Riesen
Jakub Narębski, Mon, Jun 27, 2016 19:32:25 +0200:
> W dniu 2016-06-27 o 15:23, Alex Riesen pisze:
> > It is very confusing that the file, diff of which is displayed and which is
> > marked as selected in the file list, is not, in fact, selected. I.e. the 
> > array
> > of selected files does not contain an entry for it.
> > 
> > Fixing this also improves the use of $FILENAMES in custom defined tools: one
> > does not have to click the file in the list to make it selected.
> 
> Could you improve the readability of the commit message, please? Perhaps
> something like the following:
> 
>   It is very confusing that the file which diff is displayed is marked as
>   selected, but it is not in fact selected (that means the array of selected
>   files does not include the file in question).
> 
>   ...
> 
> This patch lacks sign-off.
> 

Done. Also the prefix.


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus

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


[PATCH 2/2] Ensure the file in the diff pane is always in the list of selected files

2016-06-27 Thread Alex Riesen
It is very confusing that the file, diff of which is displayed and which is
marked as selected in the file list, is not, in fact, selected. I.e. the array
of selected files does not contain an entry for it.

Fixing this also improves the use of $FILENAMES in custom defined tools: one
does not have to click the file in the list to make it selected.
---
 lib/diff.tcl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/diff.tcl b/lib/diff.tcl
index 0d56986..30bdd69 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -127,6 +127,9 @@ proc show_diff {path w {lno {}} {scroll_pos {}} {callback 
{}}} {
} else {
start_show_diff $cont_info
}
+
+   global current_diff_path selected_paths
+   set selected_paths($current_diff_path) 1
 }
 
 proc show_unmerged_diff {cont_info} {
-- 
2.9.0.45.g28c608e.dirty

To: 
Cc: 
Bcc: 
Subject: 
Reply-To: Alex Riesen <alexander.rie...@cetitec.com>


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus

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


[PATCH 1/2] Support for $FILENAMES in tool definitions

2016-06-27 Thread Alex Riesen
This adds a FILENAMES environment variable, which contains the repository
pathnames of all selected files the list.
The variable contains the names separated by spaces.

Similar to the FILENAME it is broken yet, if the names contain spaces.

Note that the file marked and diffed immediately after starting the GUI up,
is not actually selected. One must click on it once to really select it.

Signed-off-by: Alex Riesen <alexander.rie...@cetitec.com>
---

One day the FILENAME and FILENAMES will have to be fixed to properly pass the
file names with spaces. Sorry, I couldn't find how to do it this time around.

 lib/tools.tcl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/tools.tcl b/lib/tools.tcl
index 6ec9411..14d556f 100644
--- a/lib/tools.tcl
+++ b/lib/tools.tcl
@@ -69,6 +69,7 @@ proc tools_populate_one {fullname} {
 proc tools_exec {fullname} {
global repo_config env current_diff_path
global current_branch is_detached
+   global selected_paths
 
if {[is_config_true "guitool.$fullname.needsfile"]} {
if {$current_diff_path eq {}} {
@@ -100,6 +101,7 @@ proc tools_exec {fullname} {
 
set env(GIT_GUITOOL) $fullname
set env(FILENAME) $current_diff_path
+   set env(FILENAMES) [array names selected_paths]
if {$is_detached} {
set env(CUR_BRANCH) ""
} else {
@@ -121,6 +123,7 @@ proc tools_exec {fullname} {
 
unset env(GIT_GUITOOL)
unset env(FILENAME)
+   unset env(FILENAMES)
unset env(CUR_BRANCH)
catch { unset env(ARGS) }
catch { unset env(REVISION) }
-- 
2.9.0.45.g28c608e.dirty


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus

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


Fwd: Runaway git remote if group definition contains a remote by the same name

2013-12-28 Thread Alex Riesen
FWIW, the issue is still present.

-- Forwarded message --
From: Alex Riesen raa.l...@gmail.com
Date: Wed, Nov 17, 2010 at 6:10 PM
Subject: Runaway git remote if group definition contains a remote by
the same name
To: Git Mailing List git@vger.kernel.org


Hi,

it is also a way to create a fork bomb out of the innocent tool on platforms
where pressing Ctrl-C does not terminate subprocesses of the foreground
process (like, of course, Windows).

To reproduce, run

   git -c remotes.origin='origin other' remote update origin

I just cannot look at it right now, and have to resolve to only reporting
the problem to warn people. Something seems to resolve the remotes group
definition over and over again.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: nd/magic-pathspec exposes breakage in git-add--interactive on Windows

2013-08-29 Thread Alex Riesen
On Thu, Aug 29, 2013 at 8:54 AM, Johannes Sixt j.s...@viscovery.net wrote:
 It looks like on Windows we disallow arguments that contain double-quote,
 colon, or asterisk, and otherwise wrap arguments in double-quotes if they
 contain space. Then pass them through qx{}, which I can only guess what it
 does.

Well, the command interpreter of the platform implementation caused
this, I believe.
Quoting of the double quotes for it was too cumbersome for rarely used
combination
(windows, ActiveState Perl, and Git). I guess it is more popular now?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Version 1.8.1 does not compile on Cygwin 1.7.14

2013-01-11 Thread Alex Riesen
This short discussion on GitHub (file git-compat-util.h) might be relevant:

https://github.com/msysgit/git/commit/435bdf8c7ffa493f8f6f2e8f329f8cc22db16ce6#commitcomment-2407194

The change suggested there (to remove an inclusion of windows.h in
git-compat-util.h) might simplify the solution a little. Might even
remove the need for auto-configuration in Makefile (worked for me).
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Version 1.8.1 does not compile on Cygwin 1.7.14

2013-01-11 Thread Alex Riesen
On Fri, Jan 11, 2013 at 9:08 PM, Alex Riesen raa.l...@gmail.com wrote:
 This short discussion on GitHub (file git-compat-util.h) might be relevant:

 https://github.com/msysgit/git/commit/435bdf8c7ffa493f8f6f2e8f329f8cc22db16ce6#commitcomment-2407194

 The change suggested there (to remove an inclusion of windows.h in
 git-compat-util.h) might simplify the solution a little. Might even
 remove the need for auto-configuration in Makefile (worked for me).

Just to be clear, the change is this:

diff --git a/git-compat-util.h b/git-compat-util.h
index 4a1979f..780a919 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -85,12 +85,6 @@
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1

-#ifdef WIN32 /* Both MinGW and MSVC */
-#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
-#include winsock2.h
-#include windows.h
-#endif
-
 #include unistd.h
 #include stdio.h
 #include sys/stat.h
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Parallel make failed in perl/perl.mak

2012-09-17 Thread Alex Riesen
mv: cannot stat `perl.mak': No such file or directory
mv: cannot move `perl.mak' to `perl.mak.old': No such file or directory
Writing perl.mak for Git
Writing MYMETA.yml
Writing perl.mak for Git
Writing MYMETA.yml
Writing perl.mak for Git
Writing MYMETA.yml
make[2]: *** [perl.mak] Error 1
make[1]: *** [instlibdir] Error 2
make: *** [git-difftool] Error 2
make: *** Waiting for unfinished jobs
make[2]: *** [perl.mak] Error 1
make[1]: *** [instlibdir] Error 2
make: *** [git-archimport] Error 2
make[2]: *** [perl.mak] Error 1
make[1]: *** [instlibdir] Error 2
make: *** [git-add--interactive] Error 2

I wasn't able to reproduce it, so this message is the only thing I have.
It was the first compilation after I merged the current master
(v1.7.12-464-g83379df).
Yes, I tried to jump back and forth in time, removing and touching perl.mak,
generating it with previous releases and build with the current. No luck.

Probably the old perl.mak is the problem, and the only thing I can think
for reasons why it wasn't regenerated is this:

diff --git a/perl/Makefile b/perl/Makefile
index 15d96fc..766d02a 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -79,7 +79,7 @@ $(makfile): ../GIT-CFLAGS Makefile
echo instlibdir:  $@
echo '  echo $(instdir_SQ)'  $@
 else
-$(makfile): Makefile.PL ../GIT-CFLAGS
+$(makfile): Makefile.PL ../GIT-CFLAGS Makefile
$(PERL_PATH) $ PREFIX='$(prefix_SQ)' INSTALL_BASE=''
--localedir='$(localedir_SQ)'
 endif

Could someone please take a look at it?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Restore umasks influence on the permissions of work tree created by clone

2012-07-09 Thread Alex Riesen
On Mon, Jul 9, 2012 at 3:41 AM, Junio C Hamano gits...@pobox.com wrote:
 Alex Riesen raa.l...@gmail.com writes:

 The original (shell coded) version of the git-clone just used mkdir(1)
 to create the working directories. The builtin changed the mode argument
 to mkdir(2) to 0755, which was a bit unfortunate, as there are use

 A much more important reason why this is a good change (I think you
 could even say this is a bugfix) is because directories and files in
 the working tree are created with entry.c::create_directories() and
 entry.c::create_file(), and they do honour umask settings, and the
 top-level of the working tree should be handled the same way, no?

Well, the top-level directories of anything are often handled specially,
but yes, I agree indeed. Frankly, I wondered why the top-level wasn't
created safe_create_leading_directories() or something like that.

 cases where umask-controlled creation is preferred and in any case
 it is a well-known behaviour for new directory/file creation.

 Sign-off?

It was an RFC until now :)

Signed-off-by: Alex Riesen raa.l...@gmail.com
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Restore umasks influence on the permissions of work tree created by clone

2012-07-07 Thread Alex Riesen
The original (shell coded) version of the git-clone just used mkdir(1)
to create the working directories. The builtin changed the mode argument
to mkdir(2) to 0755, which was a bit unfortunate, as there are use
cases where umask-controlled creation is preferred and in any case
it is a well-known behaviour for new directory/file creation.
---

On Fri, 6 Jul 2012, Daniel Barkalow wrote:
 On Fri, 6 Jul 2012, Alex Riesen wrote:
 when git-clone was built in, its treatment of umask has changed: the shell
 version respected umask for newly created directories by using plain 
 mkdir(1),
 and the builtin version just uses mkdir(work_tree, 0755).

 Is it intentional?
 
 I have the vague feeling that it was intentional, but it's entirely 
 plausible that I just overlooked that mkdir(2) applies umask and went for 
 the mode that you normally want. I don't think there's any particular need 
 for this operation to be more restrictive than umask.

I didn't look hard enough, but still, I found not much of complaining either
way (frankly - none, but as I said, I didn'l look hard): none before - for
being too permissive, the only one in original post after building the thing
in - for being too restrictive.

Maybe we should reconsider and go back to the old permission handling?

 builtin/clone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/clone.c b/builtin/clone.c
index d3b7fdc..e314b0b 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -708,7 +708,7 @@ int cmd_clone(int argc, const char **argv, const char 
*prefix)
if (safe_create_leading_directories_const(work_tree)  0)
die_errno(_(could not create leading directories of 
'%s'),
  work_tree);
-   if (!dest_exists  mkdir(work_tree, 0755))
+   if (!dest_exists  mkdir(work_tree, 0777))
die_errno(_(could not create work tree dir '%s'.),
  work_tree);
set_git_work_tree(work_tree);
-- 
1.7.11.1.185.g5abe2c9

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


git-clone ignores umask for working tree

2012-07-06 Thread Alex Riesen
Hi list,

when git-clone was built in, its treatment of umask has changed: the shell
version respected umask for newly created directories by using plain mkdir(1),
and the builtin version just uses mkdir(work_tree, 0755).

Is it intentional?

This Stackoverflow question is what got me interested:

http://stackoverflow.com/questions/10637416/git-clone-respects-umask-except-for-top-level-project-directory

and might provide a credible use case.

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


Re: gitk with hyperspace support

2005-09-01 Thread Alex Riesen
On 8/30/05, Paul Mackerras [EMAIL PROTECTED] wrote:
 
 Try now... :)
 
 It also makes the current graph line thicker now, so it's easier to
 pick out where the line you clicked on goes.
 

That's a fine feature :)

BTW, did you sometimes notice lines you can't click at all?
An example is the red line on the most left side of the graph
by SHA 66129f88c4cc719591f687e5c8c764fe9d3e437a.
It goes from blue up-arrow  through green left bump to the grey
down-arrow (on my system in the kernel tree). Clicking on the blue
arrow (on the line, not the arrow itself) will turn the blue line stricken-
through with the red line (a bold blue line with a red streak inside),
the next click leaves me with with just bold blue line and broken
red line above it.

It's on Gentoo's Tcl/Tk 8.4.9.
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Improve handling of . and .. in git-diff-*

2005-08-23 Thread Alex Riesen
On 8/17/05, Linus Torvalds [EMAIL PROTECTED] wrote:
 NOTE! This does _not_ handle .. or . in the _middle_ of a pathspec. If
 you have people who do

BTW, could this (below) be useful for something?

#include string.h
#include stdio.h
#include stdlib.h

// an analog of cd path from a directory cwd.
char* pathexpand(const char* cwd, const char* path)
{
static const char SEP[] = /;
if ( !*path ) // empty path - . (don't move)
path = .;
if ( !*cwd || *SEP == *path ) // no cwd, or path begins with /
cwd = SEP;

int len = strlen(cwd);
char* out = (char*)malloc(len + 1 + strlen(path) + 1);
char* p = strcpy(out, cwd) + len;

if ( *SEP != p[-1] )
*p++ = *SEP;

for ( ; *path; ++path )
{
char * pl = p;
while ( *path  *SEP != *path )
*p++ = *path++;
*p = '\0';

if ( p == pl ) /* ...//... */
; // just ignore

/* ..././...  */
else if ( p - pl == 1  '.' == *pl )
--p; // just ignore

/* .../../...  */
else if ( p - pl == 2  '.' == pl[0]  '.' == pl[1] )
{
// drop last element of the resulting path
if ( --pl  out )
for ( --pl; pl  out  *SEP != *pl; --pl );
p = ++pl;
}
/* .../path/...  */
else if ( *path )
*p++ = *path; // just add the separator
if ( !*path )
break;
}
if ( p  out+1  *SEP == p[-1] )
--p;
*p = '\0';
return out;
}

#ifdef CHECK_PATHEXPAND
static void check(const char * cwd, const char * path, const char * good)
{
static int n = 0;
printf(%-2d: %s$ cd %s, ++n, cwd, path);
char* t = pathexpand(cwd, path);
if ( strcmp(t, good) )
printf( failed(%s)\n, t);
else
printf( \t\t%s\n, t);
free(t);
}

int main(int argc, char** argv)
{
/* 1 */ check(/onelevel, aa, /onelevel/aa);
/* 2 */ check(/, .., /);
/* 3 */ check(/, ../.., /);
/* 4 */ check(/one, aa/../bb, /one/bb);
/* 5 */ check(/one/two, aa//bb, /one/two/aa/bb);
/* 6 */ check(, /aa//bb, /aa/bb);
/* 7 */ check(/one/two, , /one/two);
/* 8 */ check(/one/two, aa/..bb/x/../cc/, /one/two/aa/..bb/cc);
/* 9 */ check(/one/two, aa/x/././cc, /one/two/aa/x/cc);
/* 10 */ check(/one/two, ../../../../aa, /aa);

return 0;
}
#endif
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Improve handling of . and .. in git-diff-*

2005-08-23 Thread Alex Riesen
On 8/23/05, Alex Riesen [EMAIL PROTECTED] wrote:
 On 8/17/05, Linus Torvalds [EMAIL PROTECTED] wrote:
  NOTE! This does _not_ handle .. or . in the _middle_ of a pathspec. If
  you have people who do
 
 BTW, could this (below) be useful for something?
 

Well, a bit of explanation is certainly missing, sorry. The code tries
to emulate
(on purely text level)  the behaviour of chdir(2), including stopping at root,
going back and forth and removing useless (not changing directory)
parts like /./.

The file in the previous message can be tested with :

  gcc -DCHECK_PATHEXPAND patchexpand.c  ./aout

Cheers,
Alex Riesen.

PS: Before anyone asked: the code is mine and free for any use.
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: yet another gitting started

2005-04-18 Thread Alex Riesen
On 4/18/05, randy_dunlap [EMAIL PROTECTED] wrote:
 Here's the beginnings of yet another git usage/howto/tutorial.
 
 It can grow or die... I'll gladly take patches for it,
 or Pasky et al can merge more git plumbing and toilet usages
 into it, with or without me.
 
 http://www.xenotime.net/linux/doc/git-usage-howto

Thanks! Helped me to start :)
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html