Re: [PATCH 4/7] completion: add tests for invalid variable name among completion words

2012-11-18 Thread Felipe Contreras
On Sat, Nov 17, 2012 at 12:05 PM, SZEDER Gábor wrote: > @@ -155,6 +156,12 @@ test_expect_success '__gitcomp - suffix' ' > test_cmp expected out > ' > > +test_expect_failure '__gitcomp - doesnt fail because of invalid variable > name' ' > + ( > + __gitcomp "$invalid_v

Re: [PATCH 4/7] completion: add tests for invalid variable name among completion words

2012-11-18 Thread Felipe Contreras
On Sun, Nov 18, 2012 at 12:40 AM, Jonathan Nieder wrote: > SZEDER Gábor wrote: > >> The breakage can >> be simply bogus possible completion words, but it can also be a >> failure: >> >> $ git branch '${foo.bar}' >> $ git checkout >> bash:

Re: [PATCH 2/7] completion: fix args of run_completion() test helper

2012-11-18 Thread Felipe Contreras
On Sat, Nov 17, 2012 at 12:05 PM, SZEDER Gábor wrote: > test_expect_success 'basic' ' > - run_completion "git \"\"" && > + run_completion git "" && I don't like this approach. I prefer run_completion "git " So that it's similar to how test_completion is called: run_completion "gi

Re: [PATCH 3/7] completion: add tests for the __gitcomp_nl() completion helper function

2012-11-18 Thread Felipe Contreras
On Sat, Nov 17, 2012 at 12:05 PM, SZEDER Gábor wrote: > Test __gitcomp_nl()'s basic functionality, i.e. that trailing space, > prefix, and suffix are added correctly. > > Signed-off-by: SZEDER Gábor > --- > t/t9902-completion.sh | 84 > +++ > 1 fi

[PATCH 0/4] Some pathspec wildcard optimization

2012-11-18 Thread Nguyễn Thái Ngọc Duy
This ports the "*.c" optimization from .gitignore to pathspec code. Nguyễn Thái Ngọc Duy (4): pathspec: save the non-wildcard length part pathspec: do exact comparison on the leading non-wildcard part pathspec: apply "*.c" optimization from exclude tree_entry_interesting: do basedir compar

[PATCH 1/4] pathspec: save the non-wildcard length part

2012-11-18 Thread Nguyễn Thái Ngọc Duy
We marks pathspec with wildcards with the field use_wildcard. We could do better by saving the length of the non-wildcard part, which can be for optimizations such as f9f6e2c (exclude: do strcmp as much as possible before fnmatch - 2012-06-07) Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/ls-f

[PATCH 2/4] pathspec: do exact comparison on the leading non-wildcard part

2012-11-18 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- dir.c | 18 +- dir.h | 8 tree-walk.c | 6 -- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/dir.c b/dir.c index c391d46..e4e6ca1 100644 --- a/dir.c +++ b/dir.c @@ -34,6 +34,21 @@ int fnmatch_icas

[PATCH 3/4] pathspec: apply "*.c" optimization from exclude

2012-11-18 Thread Nguyễn Thái Ngọc Duy
-O2 build on linux-2.6, without the patch: $ time git rev-list --quiet HEAD -- '*.c' real0m40.770s user0m40.290s sys 0m0.256s With the patch $ time ~/w/git/git rev-list --quiet HEAD -- '*.c' real0m34.288s user0m33.997s sys 0m0.205s The above command is not supposed to

[PATCH 4/4] tree_entry_interesting: do basedir compare on wildcard patterns when possible

2012-11-18 Thread Nguyễn Thái Ngọc Duy
Currently we treat "*.c" and "path/to/*.c" the same way. Which means we check all possible paths in repo against "path/to/*.c". One could see that "path/elsewhere/foo.c" obviously cannot match "path/to/*.c" and we only need to check all paths _inside_ "path/to/" against that pattern. This patch ch

Re: [PATCH 1/7] completion: make the 'basic' test more tester-friendly

2012-11-18 Thread Felipe Contreras
On Sun, Nov 18, 2012 at 12:00 AM, Jonathan Nieder wrote: > SZEDER Gábor wrote: > >> The 'basic' test uses 'grep -q' to filter the resulting possible >> completion words while looking for the presence or absence of certain >> git commands, and relies on grep's exit status to indicate a failure. > [

Re: [PATCH 1/7] completion: make the 'basic' test more tester-friendly

2012-11-18 Thread Felipe Contreras
On Sat, Nov 17, 2012 at 12:05 PM, SZEDER Gábor wrote: > The 'basic' test uses 'grep -q' to filter the resulting possible > completion words while looking for the presence or absence of certain > git commands, and relies on grep's exit status to indicate a failure. > > This works fine as long as th

Re: Local clones aka forks disk size optimization

2012-11-18 Thread Sitaram Chamarty
On Fri, Nov 16, 2012 at 11:34 PM, Enrico Weigelt wrote: > >> Provide one "main" clone which is bare, pulls automatically, and is >> there to stay (no pruning), so that all others can use that as a >> reliable alternates source. > > The problem here, IMHO, is the assumption, that the main repo will

[PATCH v3 0/6] completion: test consolidations

2012-11-18 Thread Felipe Contreras
These started from a discussion with SZEDER, but then I realized there were many improvements possible. Changes since v2: * Updated comments and commit messages Changes since v1: * A lot more cleanups Felipe Contreras (6): completion: add comment for test_completion() completion: standar

[PATCH v3 1/6] completion: add comment for test_completion()

2012-11-18 Thread Felipe Contreras
So that it's easier to understand what it does. Also, make sure we pass only the first argument for completion. Shouldn't cause any functional changes because run_completion only checks $1. Signed-off-by: Felipe Contreras --- t/t9902-completion.sh | 6 +- 1 file changed, 5 insertions(+), 1

[PATCH v3 2/6] completion: standardize final space marker in tests

2012-11-18 Thread Felipe Contreras
The rest of the code uses ' Z$'. Lets use that for test_completion_long() as well. Signed-off-by: Felipe Contreras --- t/t9902-completion.sh | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 2276a

[PATCH v3 3/6] completion: simplify tests using test_completion_long()

2012-11-18 Thread Felipe Contreras
No need to duplicate that functionality. Signed-off-by: Felipe Contreras --- t/t9902-completion.sh | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index f4c7342..6a250ad 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-co

[PATCH v3 4/6] completion: consolidate test_completion*() tests

2012-11-18 Thread Felipe Contreras
No need to have two versions; if a second argument is specified, use that, otherwise use stdin. Signed-off-by: Felipe Contreras --- t/t9902-completion.sh | 30 +- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/t/t9902-completion.sh b/t/t9902-completio

[PATCH v3 5/6] completion: refactor __gitcomp related tests

2012-11-18 Thread Felipe Contreras
Lots of duplicated code removed! No functional changes. Signed-off-by: Felipe Contreras --- t/t9902-completion.sh | 76 ++- 1 file changed, 27 insertions(+), 49 deletions(-) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 90a9a91

[PATCH v3 6/6] completion: simplify __gitcomp() test helper

2012-11-18 Thread Felipe Contreras
By using print_comp as suggested by SZEDER Gábor. Signed-off-by: Felipe Contreras --- t/t9902-completion.sh | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index fba632f..42db3da 100755 --- a/t/t9902-completion.sh

[RFC/PATCH v2 0/8] completion: compgen/compadd cleanups

2012-11-18 Thread Felipe Contreras
Hi, These were hinted by SZEDER, so I went ahead and implemented the changes trying to keep in mind the new zsh completion werapper. The resulting code should be more efficient, and a known breakage is fixed. The first two patches are transplanted from another patch series which most likely is no

[RFC/PATCH v2 1/8] completion: trivial test improvement

2012-11-18 Thread Felipe Contreras
Instead of passing a dummy "", let's check if the last character is a space, and then move the _cword accordingly. Apparently we were passing "" all the way to compgen, which fortunately expanded it to nothing. Lets do the right thing though. Signed-off-by: Felipe Contreras --- t/t9902-complet

[RFC/PATCH v2 2/8] completion: get rid of empty COMPREPLY assignments

2012-11-18 Thread Felipe Contreras
There's no functional reason for those, the only purpose they are supposed to serve is to say "we don't provide any words here", but even for that it's not used consitently. Signed-off-by: Felipe Contreras --- contrib/completion/git-completion.bash | 27 --- 1 file change

[RFC/PATCH v2 3/8] completion: add new __gitcompadd helper

2012-11-18 Thread Felipe Contreras
The idea is to never touch the COMPREPLY variable directly. This allows other completion systems override __gitcompadd, and do something different instead. Also, this allows the simplification of the completion tests (separate patch). There should be no functional changes. Signed-off-by: Felipe

[RFC/PATCH v2 4/8] tmp: completion: add SZEDER's tests

2012-11-18 Thread Felipe Contreras
Separate patch series, but the results are relevant. + modifications from me. Signed-off-by: Felipe Contreras --- t/t9902-completion.sh | 61 +++ 1 file changed, 61 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 79

[RFC/PATCH v2 5/8] completion: get rid of compgen

2012-11-18 Thread Felipe Contreras
The functionality we use from compgen is not much, we can do the same manually, with drastical improvements in speed, specially when dealing with only a few rods. This patch also has the sideffect that brekage reported by Jeroen Meijer and SZEDER Gábor gets fixed because we no longer expand the re

[RFC/PATCH v2 6/8] tmp: completion: mark SZEDER's tests as fixed

2012-11-18 Thread Felipe Contreras
Signed-off-by: Felipe Contreras --- t/t9902-completion.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 7fb5b50..4e2f4fb 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -174,7 +174,7 @@ test_expect_suc

[RFC/PATCH v2 7/8] completion: get rid of __gitcomp_1

2012-11-18 Thread Felipe Contreras
There's no point in calling a separate function that is only used in one place. Specially considering that there's no need to call compgen, and we traverse the words ourselves both in __gitcompadd, and __gitcomp_1. So lets squash the functions together, and traverse only once. This improves perfo

[RFC/PATCH v2 8/8] completion: small optimization

2012-11-18 Thread Felipe Contreras
No need to calculate a new $c with a space if we are not going to do anything it with it. There should be no functional changes, except that a word "foo " with no suffixes can't be matched. But $cur cannot have a space at the end anyway. So it's safe. Based on the code from SZEDER Gábor. Signed-

Re: using multiple version of git simultaneously

2012-11-18 Thread arif
On 11/17/2012 10:16 PM, Jeff King wrote: > On Sat, Nov 17, 2012 at 02:50:31PM +, Tomas Carnecky wrote: > >> On Sat, 17 Nov 2012 20:25:21 +0600, arif wrote: > >> Install each version into its own prefix (~/git/1.8.0/, ~/git/1.7.0/ etc). > > Once you have done that, you can also symlink the b

[PATCH v6 0/2] New zsh wrapper

2012-11-18 Thread Felipe Contreras
Hi, It looks like there's some resistance with the other patches this series was depending upon, so lets get rid of them, they are not really needed. This version should be ready to merge. The second patch is new, in order for users to get the same features when sourcing the bash script (they do

[PATCH v6 1/2] completion: add new zsh completion

2012-11-18 Thread Felipe Contreras
It seems there's always issues with zsh's bash completion emulation. I've tried to fix as many as I could[1], and most of the fixes are already in the latest version of zsh, but still, there are issues. There is no point going through all that pain; the emulation is easy to achieve, and this patch

[PATCH v6 2/2] completion: start moving to the new zsh completion

2012-11-18 Thread Felipe Contreras
Zsh's bash completion emulation is buggy, not properly maintained, and we have some workarounds in place for different bugs that appeared in various versions. Since I'm the only one that has worked on that code lately[1], it might make snese to use the code I wrote specifically for git. The advan

Re: t5801-remote-helpers.sh fails

2012-11-18 Thread Torsten Bögershausen
On 18.11.12 09:23, Felipe Contreras wrote: > Hi, > > On Sun, Nov 18, 2012 at 6:50 AM, Torsten Bögershausen wrote: > >> I managed to have a working solution for >> "d) add a check for the bash version to the top of the test in t/" >> Please see diff below. >> >> This unbreaks the test suite here.

Motd message on git cloning

2012-11-18 Thread Adam Stankiewicz
I'm dreaming about git feature that shows custom message on git clone. It would be extremely helpful for informing the person cloning about init scripts he/she need to execute (for example submodule inits or hooks set up). For now there is no way to make sure cloning person will receive such messag

Re: Motd message on git cloning

2012-11-18 Thread Drew Northup
On Sun, Nov 18, 2012 at 11:04 AM, Adam Stankiewicz wrote: > I'm dreaming about git feature that shows custom message on git clone. > It would be extremely helpful for informing the person cloning about > init scripts he/she need to execute (for example submodule inits or > hooks set up). For now t

Re: Auto-repo-repair

2012-11-18 Thread Drew Northup
On Sat, Nov 17, 2012 at 4:21 AM, Enrico Weigelt wrote: > Hi, > >> You can't reliably just grab the broken objects, because most >> transports >> don't support grabbing arbitrary objects (you can do it if you have >> shell access to a known-good repository, but it's not automated). > > can we intro

Re: Motd message on git cloning

2012-11-18 Thread Adam Stankiewicz
It we would agree that .git/motd should serve as MOTD file then at the beginning there would be no noise at all, because currently no repository contains that file. I don't think developers would place there non-critical information about the repository. The community would blame them for that. A

Re: git-reset man page

2012-11-18 Thread Drew Northup
On Sat, Nov 10, 2012 at 3:46 PM, Krzysztof Mazur wrote: > On Sat, Nov 10, 2012 at 12:02:12PM -0800, Junio C Hamano wrote: >> Krzysztof Mazur writes: >> >> > Maybe we should just add that is an shortcut for >> > and fix places where paths and pathspec are mixed or is used as >> > . >> >> We sho

Re: Auto-repo-repair

2012-11-18 Thread Enrico Weigelt
> How would the broken repository be sure of what it is missing to > request it from the other side? fsck will find missing objects. > > -- > -Drew Northup > -- > "As opposed to vegetable or mineral error?" > -John Pescatore, SANS New

Re: Local clones aka forks disk size optimization

2012-11-18 Thread Enrico Weigelt
Hi, > That's not the only problem. I believe you only get the savings when > the main repo gets the commits first. Which is probably ok most of > the time but it's worth mentioning. Well, the saving will just be deferred to the point where the commit finally went to the main repo and downstream

Re: Local clones aka forks disk size optimization

2012-11-18 Thread Jörg Rosenkranz
2012/11/15 Javier Domingo > > Is there any way to avoid this? I mean, can something be done in git, > that it checks for (when pulling) the same objects in the other forks? I've been using git-new-workdir (https://github.com/git/git/blob/master/contrib/workdir/git-new-workdir) for a similar prob

Re: git-reset man page

2012-11-18 Thread Krzysztof Mazur
On Sun, Nov 18, 2012 at 11:55:09AM -0500, Drew Northup wrote: > > > So we should always use "" for exact path, and "" for > > pathspecs patterns as defined in gitglossary. I think it's better > > to avoid "" and always use "..." or "..." > > I suspect that the only reason why the differentiation

[PATCH] USE CGYWIN_V15_WIN32API as macro to select api for cygwin

2012-11-18 Thread Mark Levedahl
The previous macro was confusing to some, and did not include "cygwin" in its name. The updated name more clearly expresses a choice of the win32api implementation that shipped with version 1.5 of cygwin. Signed-off-by: Mark Levedahl --- Makefile| 6 +++--- compat/cygwin.c | 2 +- 2 file

verifying git file contents without checking out history?

2012-11-18 Thread Marc Weber
git clone --depth=20 $url; git checkout $hash How to verify that I have the contents I think I have - given that I trust my local git executable? Would it be enough to also store the git log --pretty=format:%T $hash value and check that only? %T is the root tree hash. Does git checkout verify th

Re: Auto-repo-repair

2012-11-18 Thread Drew Northup
On Sun, Nov 18, 2012 at 11:55 AM, Enrico Weigelt wrote: > >> How would the broken repository be sure of what it is missing to >> request it from the other side? > > fsck will find missing objects. And what about the objects referred to by objects that are missing? Jeff's solution doesn't suffer f

Re: verifying git file contents without checking out history?

2012-11-18 Thread Junio C Hamano
Marc Weber writes: > git clone --depth=20 $url; git checkout $hash > > How to verify that I have the contents I think I have - given that I > trust my local git executable? Define what you mean by "contents". Do you care only about the tree state recorded in that $hash, and you also trust that

Re: verifying git file contents without checking out history?

2012-11-18 Thread Marc Weber
Excerpts from Junio C Hamano's message of Mon Nov 19 05:55:18 +0100 2012: > Define what you mean by "contents". contents = the files git archive HEAD would put into an archive, those determining a build result. How could the repo be compromised: 1) An attacker triest to find a hash collision in t