[PATCH v8] Add an explicit GIT_DIR to the list of excludes

2014-06-14 Thread Pasha Bolokhov
dding GIT_DIR as an exclude is equivalent to putting it into '.gitignore'. Function setup_standard_excludes() was chosen because that is the place where the excludes are initialized by the commands that are concerned about excludes Signed-off-by: Pasha Bolokhov --- Rename output files in t

Re: [PATCH alt-v3] Improve function dir.c:trim_trailing_spaces()

2014-06-13 Thread Pasha Bolokhov
Thanks for the fix. I knew these backslashes could cause trouble. No doubt the fixed version reads better than a hundred backslashes On Fri, Jun 13, 2014 at 4:25 PM, Jeff King wrote: > On Fri, Jun 13, 2014 at 01:23:47PM -0700, Junio C Hamano wrote: > >> This passes with your shell set to dash bu

[PATCH v7] Add an explicit GIT_DIR to the list of excludes

2014-06-13 Thread Pasha Bolokhov
dding GIT_DIR as an exclude is equivalent to putting it into '.gitignore'. Function setup_standard_excludes() was chosen because that is the place where the excludes are initialized by the commands that are concerned about excludes Signed-off-by: Pasha Bolokhov --- Brush up the test -- make s

Re: [PATCH v6] Add an explicit GIT_DIR to the list of excludes

2014-06-13 Thread Pasha Bolokhov
>> + test_cmp status.actual.2 status.expect.2 > > It is customary to call the files 'expect' and 'actual'. Furthermore, > swap the order so that in case of a failure the diff shows how the > actual text was changed from the expected text: > > test_cmp status.expect.2 sta

[PATCH v6] Add an explicit GIT_DIR to the list of excludes

2014-06-11 Thread Pasha Bolokhov
dding GIT_DIR as an exclude is equivalent to putting it into '.gitignore'. Function setup_standard_excludes() was chosen because that is the place where the excludes are initialized by the commands that are concerned about excludes Signed-off-by: Pasha Bolokhov --- Negate the 'basen

Re: [PATCH v5] Add an explicit GIT_DIR to the list of excludes

2014-06-09 Thread Pasha Bolokhov
> On Thu, Jun 5, 2014 at 3:15 AM, Pasha Bolokhov > wrote: >> + /* only add it if GIT_DIR does not end with '.git' or '/.git' */ >> + if (len < 4 || strcmp(n_git + len - 4, ".git") || >> + (len > 4 && n_git[

[PATCH v5] Add an explicit GIT_DIR to the list of excludes

2014-06-04 Thread Pasha Bolokhov
dding GIT_DIR as an exclude is equivalent to putting it into '.gitignore'. Function setup_standard_excludes() was chosen because that is the place where the excludes are initialized by the commands that are concerned about excludes Signed-off-by: Pasha Bolokhov --- basename() is not nee

Re: [PATCH v4] Add an explicit GIT_DIR to the list of excludes

2014-06-03 Thread Pasha Bolokhov
On Thu, May 29, 2014 at 4:42 AM, Duy Nguyen wrote: + const char *worktree = get_git_work_tree(); + + if (worktree == NULL || + dir_inside_of(n_git, get_git_work_tree()) >= 0) { + struct exclude_list *el =

[PATCH alt-v3] Improve function dir.c:trim_trailing_spaces()

2014-06-02 Thread Pasha Bolokhov
y, the code in 8ba87adad6 does not reset 'last_space' when a backslash is encountered and the above line stays intact as a result. Add a test at the end of t/t0008-ignores.sh to exhibit this behavior Signed-off-by: Pasha Bolokhov --- Add /* fallthrough */ comment to switch(), remove TABs in test

[PATCH alt-v2] Improve function dir.c:trim_trailing_spaces()

2014-06-02 Thread Pasha Bolokhov
y, the code in 8ba87adad6 does not reset 'last_space' when a backslash is encountered and the above line stays intact as a result. Add a test at the end of t/t0008-ignores.sh to exhibit this behavior Signed-off-by: Pasha Bolokhov --- After correcting for the trailing backslash 'text\', a

[PATCH] Improve function dir.c:trim_trailing_spaces()

2014-05-31 Thread Pasha Bolokhov
y, the code in 8ba87adad6 does not reset 'last_space' when a backslash is encountered and the above line stays intact as a result. Add a test at the end of t/t0008-ignores.sh to exhibit this behavior Signed-off-by: Pasha Bolokhov --- Correct 'if()' statements to conform to the general sty

[PATCH alt-v1] Improve function dir.c:trim_trailing_spaces()

2014-05-30 Thread Pasha Bolokhov
x27;last_space' when a backslash is encountered and the above line stays intact as a result. Add a test at the end of t/t0008-ignores.sh to exhibit this behavior Signed-off-by: Pasha Bolokhov --- Instead of the "optimized" version, which had complaints about reasonability, I am

Re: [PATCH] Improve function dir.c:trim_trailing_spaces()

2014-05-29 Thread Pasha Bolokhov
On Thu, May 29, 2014 at 1:13 PM, Jeff King wrote: > On Wed, May 28, 2014 at 04:45:57PM -0700, Pasha Bolokhov wrote: > >> Move backwards from the end of the string (more efficient for >> lines which do not have trailing spaces or have just a couple). > > The original co

Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes

2014-05-28 Thread Pasha Bolokhov
Agree, but "partial" here means... what? just a little doc? On Wed, May 28, 2014 at 11:53 AM, Jakub Narębski wrote: > W dniu 2014-05-27 19:16, Pasha Bolokhov pisze: > >>>> Add GIT_DIR to the list of excludes in setup_standard_excludes(), >>>> while chec

[PATCH] Improve function dir.c:trim_trailing_spaces()

2014-05-28 Thread Pasha Bolokhov
Move backwards from the end of the string (more efficient for lines which do not have trailing spaces or have just a couple). Slightly more rare occurrences of 'text \' with a backslash in between spaces are handled correctly. Namely, the code in 8ba87adad6 does not reset 'last_space' when a b

Re: [PATCH v4] Add an explicit GIT_DIR to the list of excludes

2014-05-28 Thread Pasha Bolokhov
On Wed, May 28, 2014 at 5:36 AM, Duy Nguyen wrote: > On Tue, May 27, 2014 at 10:56 AM, Pasha Bolokhov > wrote: >> @@ -1588,6 +1588,38 @@ void setup_standard_excludes(struct dir_struct *dir) >> { >> const char *path; >> char *xdg_path; >>

Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes

2014-05-27 Thread Pasha Bolokhov
I've sent out version [PATCH v4] with most of the things addressed. That one hasn't been reviewed by anyone yet On Tue, May 27, 2014 at 11:04 AM, Junio C Hamano wrote: > Duy Nguyen writes: > >> On Sat, May 24, 2014 at 12:33 AM, Pasha Bolokhov >> wrote: >>>

Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes

2014-05-27 Thread Pasha Bolokhov
>> Add GIT_DIR to the list of excludes in setup_standard_excludes(), >> while checking that GIT_DIR is not just '.git', in which case it >> would be ignored by default, and that GIT_DIR is inside GIT_WORK_TREE >> > gives git-grep.txt and git-ls-files.txt. I don't know if we need to > add something

[PATCH v4] Add an explicit GIT_DIR to the list of excludes

2014-05-26 Thread Pasha Bolokhov
where the excludes are initialized by the commands that are concerned about excludes Signed-off-by: Pasha Bolokhov --- Improve test tree structure. Add a check for work_tree==NULL in dir.c:setup_standard_excludes When work_tree is NULL, there is no concept of whether the repo is withi

Re: more concerns about '--git-dir'

2014-05-23 Thread Pasha Bolokhov
>> You won't notice anything different in the output of course, but the >> environment will be odd: >> GIT_DIR=../tmp/./././.git >> GIT_WORK_TREE=$HOME/tmp >> Notice how the work-tree has been normalized and git-dir hasn't. It's >> kinda hard to imagine when this can lead to an error, but n

Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes

2014-05-23 Thread Pasha Bolokhov
Hi, > >> /* "--git-dir" has been given */ > > ... or it could have come from GIT_DIR environment, no? Yes, it does not matter where it came from, but I'll correct the comment > > Does this "additional exclude" need to kick in if GIT_DIR is set to > "/home/pasha/w/.git"? That is, w

more concerns about '--git-dir'

2014-05-23 Thread Pasha Bolokhov
Hi, Since at it, I have discovered a couple more minor things with this rarely-used option. I'm however a bit wary of stepping on somebody's nerve with this sort of picking things.. :) Nevertheless, 1) an apparent missing "normalize_path(git_dir)", when GIT_DIR is an abso

[PATCH v3] Add an explicit GIT_DIR to the list of excludes

2014-05-23 Thread Pasha Bolokhov
where the excludes are initialized by the commands that are concerned about excludes Signed-off-by: Pasha Bolokhov --- Slightly brush-up comments, and fix ">file" style in the test, together with fixing the &&-chain. One thing is, when you do "git --git-dir meta init&

[PATCH v2] Add an explicit GIT_DIR to the list of excludes

2014-05-22 Thread Pasha Bolokhov
where the excludes are initialized by the commands that are concerned about excludes Signed-off-by: Pasha Bolokhov --- Add a test and change the documentation which now reflects the fact that 'setup_standard_excludes()' has to be called for the setup purpo

[PATCH] Add an explicit GIT_DIR to the list of excludes

2014-05-20 Thread Pasha Bolokhov
where the excludes are initialized by the commands that are concerned about excludes Signed-off-by: Pasha Bolokhov --- dir.c | 20 1 file changed, 20 insertions(+) diff --git a/dir.c b/dir.c index 98bb50f..07e36f3 100644 --- a/dir.c +++ b/dir.c @@ -1588,6 +1588,26 @@ void setu

Re: Problem: staging of an alternative repository

2014-05-17 Thread Pasha Bolokhov
Hi again I've come up with a fix for this. It's just two and a half lines, and required more studying the code than typing. A lot of path-processing work has been implemented in "abspath.c" and "dir.c", including the symlinks and checking whether one path is a subdirectory of another.

Re: Problem: staging of an alternative repository

2014-05-07 Thread Pasha Bolokhov
Hi, I've looked more attentively, here are my observations and the resulting suggestions: - Suggest only to check *string-wise* the given "path" against $GIT_DIR. Both or one of them may be relative paths (but comparison best be performed when converted to absolute paths). That's the only sol

Re: Problem: staging of an alternative repository

2014-05-01 Thread Pasha Bolokhov
Hi Jonathan Thanks for the answers > I think it's more that it never came up. Excluding the current > $GIT_DIR from what "git add" can add (on top of the current rule of > excluding all instances of ".git") seems like a sensible change, > assuming it can be done without hurting the code too

Problem: staging of an alternative repository

2014-04-30 Thread Pasha Bolokhov
Hi It turns out Git treats the directory '.git' differently enough from everything else. That may be ok, but here's one place where I encountered an unpleasant (and imho unexpected) behaviour: if you supply a different repository base name, say, '.git_new', by either setting GIT_D