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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 24, 2014 at 12:33 AM, Pasha Bolokhov
<pasha.bolokhov@xxxxxxxxx> wrote:
> 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_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
>
> Although an analogous comparison of any given path against '.git'
> is done in treat_path(), this does not seem to be the right place
> to compare against GIT_DIR. Instead, the excludes provide an
> effective mechanism of ignoring a file/directory, and adding GIT_DIR
> as an exclude is equivalent of 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

I like this approach. A search of "exclude-standard" in Documentation/
gives git-grep.txt and git-ls-files.txt. I don't know if we need to
add something about this extra exclude rule to those .txt. If it's so
obvious that this should be the expected behavior, then probably not.

The case of "git grep --exclude-standard" is interesting because it's
intended to work without a repository. First reaction was would
get_git_dir() return NULL in that case. But it should return ".git" so
we're good.
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]