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

Re: Question: how to have ls-files use the .gitignore in the index

From
Kevin <compufreak@gmail.com>
Date
Apr 6, 2012, 11:21 UTC
Message-ID
<20120406112113.GA4528@ikke-laptop.buyways.nl>
In-Reply-To
<A5E8E180685CEF45AB9E737A010799805DFACA@cdnz-ex1.corp.cubic.cub>

What I would do is check out the file from the index to a temporary file, and use that as an exclude file.

You can probably use git checkout-index in combination with --temp to create the file.

Kevin
On Tue, Apr 03, 2012 at 11:07:08AM +1200, Holding, Lawrence wrote:
Show 17 quoted lines
> I have a pre-commit hook that checks the index for files that match the
> ignores / excludes in the repository. But sometimes this will run on a
> repository where not all the folders are up-to-date with the tip, and
> will then test against the working tree versions of these files and not
> those in the index.
> 
> from pre-commit:
> 
> 	if git ls-files -i --exclude-standard | grep .
> 	then
> 	    exit 1
> 	fi 
> 
> Is there an option to have ls-files use the excludes in the index
> without checking out the whole file tree?
> 
> Thanks,
Previous: Holding, Lawrence
Message 2 of 2 in “Question: how to have ls-files use the .gitignore in the index”
  1. Holding, LawrenceApr 2, 2012
  2. KevinApr 6, 2012

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.