bug report: `git stash save -u` deletes directory whose contents are .gitignored

2015-10-13 Thread lennart spitzner
hi,

- `git stash save -u` deletes a directory, even though the _contents_
of that directory are .gitignored (e.g. "foo/*" in .gitignore).
Detailed reproduction below.
- The behaviour is not present when instead .gitignoring the directory
itself (e.g. "foo"). This does imo not excuse the behaviour of the
described case.
- The behaviour is not present with just `git stash save`.
- The expected behaviour is: Only files listed in `git status` are
stashed away; other things are left untouched. Potential exception:
empty directories.
- I am aware that `git stash save -u` is supposed to have semantics
involving the equivalent of `reset --hard` and `clean -f`. Neither of
those expose the directory-deletion behaviour.

additional comments, not directly relevant to this bug:
- both `git stash save; git stash pop` and `git stash save -u; git
stash pop` should ideally behave as an "identity effect". The latter
might affect the index (i.e. have an effect equivalent to `git reset`
or something in that direction). Any other effect / special cases are
bad interface design imo. If a differing design was chosen on purpose,
i am thankful for pointers on the reasoning.
- no, i luckily did not truely lose files due to the current behaviour.

lennart



reproduction:

> git init
Initialized empty Git repository in $SOMEDIR/.git/
> mkdir ignore-contents
> echo "ignore-contents/*" > .gitignore
> git add .gitignore
> git commit -m "initial" > /dev/null
> touch ignore-contents/blah.txt
> touch abc.txt
> git status
On branch master
Untracked files:
  (use "git add ..." to include in what will be committed)

  abc.txt

nothing added to commit but untracked files present (use "git add" to
track)
> ls -1a
.
..
abc.txt
.git
.gitignore
ignore-contents
> git stash save -u
Saved working directory and index state WIP on master: adc468b initial
HEAD is now at adc468b initial
> ls -1a
.
..
.git
.gitignore
> git stash pop &> /dev/null
> ls -1a
.
..
abc.txt
.git
.gitignore
> git --version
git version 2.6.1
--
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


appropriate mailing list for gitk patches

2014-11-13 Thread lennart spitzner
Hello folks,

I have a patch for gitk. Should i send it to this list, or is there some
other?  git/Documentation/SubmittingPatches mentions
git://ozlabs.org/~paulus/gitk (the master of which i based my commit
on), but never mentions any list(s) by name (only the Git mailing
list, which i presume is this one).

Also, a minor question regarding patches: I wondered why patches do not
mention the commit id that the patch(es) are based on. My current guess
is that the diffs containing the sha1's is considered sufficient. Is
this the case? Are there more/other aspects?

Lennart
--
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/1] gitk: Add support for --author-date-order

2014-11-13 Thread lennart spitzner
gitk previously allowed sort-by-committer-date.
Now also allow sort-by-author-date.

Separate the three options for ordering in a new line in the
view-config-dialogue, using radio buttons.

Signed-off-by: Lennart Spitzner l...@informatik.uni-kiel.de
---
Found this useful for displaying a history with a rebase-heavy workflow,
where the committer-timestamps were largely different from
author-timestamps; sort-by-author-date produces a much simpler graph.

I do not really know much tcl, so review closely :p

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

diff --git a/gitk b/gitk
index 78358a7..c176b79 100755
--- a/gitk
+++ b/gitk
@@ -155,11 +155,12 @@ proc unmerged_files {files} {
 }
  proc parseviewargs {n arglist} {
-global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env
+global vdatemode vauthordatemode vmergeonly vflags vdflags vrevs vfiltered 
vorigargs env
 global vinlinediff
 global worddiff git_version
  set vdatemode($n) 0
+set vauthordatemode($n) 0
 set vmergeonly($n) 0
 set vinlinediff($n) 0
 set glflags {}
@@ -185,6 +186,12 @@ proc parseviewargs {n arglist} {
set origargs [lreplace $origargs $i $i]
incr i -1
}
+   --author-date-order {
+   set vauthordatemode($n) 1
+   # remove from origargs in case we hit an unknown option
+   set origargs [lreplace $origargs $i $i]
+   incr i -1
+   }
-[puabwcrRBMC] -
--no-renames - --full-index - --binary - --abbrev=* -
--find-copies-harder - -l* - --ext-diff - --no-ext-diff -
@@ -690,17 +697,21 @@ proc seeds {v} {
 }
  proc newvarc {view id} {
-global varcid varctok parents children vdatemode
+global varcid varctok parents children vdatemode vauthordatemode
 global vupptr vdownptr vleftptr vbackptr varcrow varcix varcstart
 global commitdata commitinfo vseedcount varccommits vlastins
  set a [llength $varctok($view)]
 set vid $view,$id
-if {[llength $children($vid)] == 0 || $vdatemode($view)} {
+if {[llength $children($vid)] == 0 || $vdatemode($view) || 
$vauthordatemode($view)} {
if {![info exists commitinfo($id)]} {
parsecommit $id $commitdata($id) 1
}
-   set cdate [lindex [lindex $commitinfo($id) 4] 0]
+   if {$vauthordatemode($view)} {
+   set cdate [lindex [lindex $commitinfo($id) 2] 0]
+   } else {
+   set cdate [lindex [lindex $commitinfo($id) 4] 0]
+   }
if {![string is integer -strict $cdate]} {
set cdate 0
}
@@ -800,7 +811,7 @@ proc splitvarc {p v} {
  proc renumbervarc {a v} {
 global parents children varctok varcstart varccommits
-global vupptr vdownptr vleftptr vbackptr vlastins varcid vtokmod vdatemode
+global vupptr vdownptr vleftptr vbackptr vlastins varcid vtokmod vdatemode 
vauthordatemode
  set t1 [clock clicks -milliseconds]
 set todo {}
@@ -836,7 +847,7 @@ proc renumbervarc {a v} {
  $children($v,$id)]
}
set oldtok [lindex $varctok($v) $a]
-   if {!$vdatemode($v)} {
+   if {!($vdatemode($v) || $vauthordatemode($v))} {
set tok {}
} else {
set tok $oldtok
@@ -1411,7 +1422,7 @@ proc check_interest {id scripts} {
  proc getcommitlines {fd inst view updating}  {
 global cmitlisted leftover
-global commitidx commitdata vdatemode
+global commitidx commitdata vdatemode vauthordatemode
 global parents children curview hlview
 global idpending ordertok
 global varccommits varcid varctok vtokmod vfilelimit vshortids
@@ -1553,7 +1564,7 @@ proc getcommitlines {fd inst view updating}  {
} elseif {$a == 0  [llength $children($vid)] == 1} {
set k [lindex $children($vid) 0]
if {[llength $parents($view,$k)] == 1 
-   (!$vdatemode($view) ||
+   (!($vdatemode($view) || $vauthordatemode($view)) ||
 $varcid($view,$k) == [llength $varctok($view)] - 1)} {
set a $varcid($view,$k)
}
@@ -3987,8 +3998,11 @@ set known_view_options {
 {limit_lbl l+  {}   {mc Limit and/or skip a number of 
revisions (positive integer):}}
 {limit t10  *. --max-count=*  {mc Number to show:}}
 {skip  t10  .  --skip=*   {mc Number to skip:}}
+{order_l   l+  {}   {mc Ordering:}}
+{order_s   r0   .  {}   {mc Default order}}
+{order_c   r1   .  {--date-order -d}  {mc Strictly sort by 
(committer) date}}
+{order_a   r2   .  --author-date-order  {mc Strictly sort by author 
date}}
 {misc_lbl  l+  {}   {mc Miscellaneous options:}}
-{dorderb*. {--date-order -d}  {mc Strictly sort by date}}
 {lrightb.  --left-right   {mc Mark branch sides}}
 {first b