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

Re: [PATCH V3] check-ignore: Add option to ignore index contents

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 5, 2013, 22:27 UTC
Message-ID
<xmqqbo46hpk7.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20130905160801.GA22710@opensourcesolutions.co.uk>
Dave Williams <dave@opensourcesolutions.co.uk> writes:
Show 7 quoted lines
> check-ignore currently shows how .gitignore rules would treat untracked
> paths. Tracked paths do not generate useful output.  This prevents
> debugging of why a path became tracked unexpectedly unless that path is
> first removed from the index with `git rm --cached <path>`.
>
> This option (-i, --no-index) simply by-passes the check for the path
> being in the index and hence allows tracked paths to be checked too.

Now the long option name is "--no-index", it makes me wonder if "-i" is a good synonym for it, and the longer I stare at it, the more certain I become convinced that it is a bad choice.

Do we even need a short-and-sweet one-letter option for this? I'd prefer starting with only the long option.

I came up with a squashable tweak to remove "-i" on top of this patch; will tentatively queue this patch with it to 'pu'.

> In particlar Junio queried my approach in
> builtin/git-check-ignores.c that bypassed the functions that check
> a path is in the index as well as avoiding reading the index in
> the first place.
Thanks.

I think this version is cleaner without those "if (!no_index)" used for special casing in the codeflow. An empty index is a valid state, in which the in-core index starts when any git program begins. Not reading the index should be the only thing necessary to mimick the state in which nothing has been added to the index, and if that is not the case, we have found a bug in the existing code.

Show 5 quoted lines
> Regarding the test script I have tidied up the variables containing the
> separate option switches so they dont contain leading spaces, instead I
> have added spaces as needed when formatting the command line.  This
> not only improves my patch but also the existing code which was a little
> inconsistent in this respect.
Yeah, that's very much appreciated.
Show 8 quoted lines
> Finally I have rebased from the latest commmit on master to pick up
> unrelated recent changes made to builtin/check-ignores.c and updated my
> code to be consistent with this.
>
> Hopefully I have put these patch notes in the right place now! Let me
> know if not.
>
> Dave
Nicely done.
Previous: Dave WilliamsNext: Dave Williams
Message 2 of 4 in “check-ignore: Add option to ignore index contents”
  1. check-ignore: Add option to ignore index contentsDave Williams, Sep 5, 2013
  2. Junio C HamanoSep 5, 2013
  3. Dave WilliamsSep 6, 2013
  4. Junio C HamanoSep 6, 2013

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.