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

2014-06-04 Thread Duy Nguyen
On Wed, Jun 4, 2014 at 3:55 AM, Pasha Bolokhov wrote: >> The case when $GIT_DIR points to a _file_ seems uncovered. >> setup_git_directory() will transform the file to the directory >> internally and we never know the .git file's path (so we can't exclude >> it). So people could accidentally add t

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 =

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

2014-05-29 Thread Duy Nguyen
On Thu, May 29, 2014 at 5:11 AM, Pasha Bolokhov wrote: >>> + len = strlen(n_git); /* real_path() has stripped trailing slash */ >>> + for (i = len - 1; i > 0 && !is_dir_sep(n_git[i]); i--) ; >>> + basename = n_git + i; >>> + if (is_dir_sep(*basename)) >>> + ba

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; >> + const char *r_git, *gitdir = get_g

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

2014-05-28 Thread Duy Nguyen
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; > + const char *r_git, *gitdir = get_git_dir(); > + char *n_git, *basename; > + int len

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

2014-05-26 Thread Pasha Bolokhov
When an explicit '--git-dir' option points to a directory inside the work tree, git treats it as if it were any other directory. In particular, 'git status' lists it as untracked, while 'git add -A' stages the metadata directory entirely Add GIT_DIR to the list of excludes in setup_standard_exclud