git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 27, 2014, 18:04 UTC
Message-ID
<xmqqd2ezgkt4.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CACsJy8CDeTn8h8uUn_=6ek7BJueN_1i01TB_AeH03RKnf6tNSw@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 24 quoted lines
> On Sat, May 24, 2014 at 12:33 AM, Pasha Bolokhov
> <pasha.bolokhov@gmail.com> 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.
OK, so is that an Acked/Reviewed-by?
Show 5 quoted lines
>
> 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.
Previous: Jakub NarębskiNext: Pasha Bolokhov
Message 9 of 10 in “Add an explicit GIT_DIR to the list of excludes”
  1. Add an explicit GIT_DIR to the list of excludesPasha Bolokhov, May 23, 2014
  2. Junio C HamanoMay 23, 2014
  3. Pasha BolokhovMay 23, 2014
  4. Duy NguyenMay 24, 2014
  5. Pasha BolokhovMay 27, 2014
  6. Jakub NarębskiMay 28, 2014
  7. Pasha BolokhovMay 29, 2014
  8. Jakub NarębskiMay 29, 2014
  9. Junio C HamanoMay 27, 2014
  10. Pasha BolokhovMay 27, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.