git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Matheus Tavares Bernardino <matheus.bernardino@usp.br>
To: Elijah Newren <newren@gmail.com>
Cc: Philip Oakley <philipoakley@iee.email>,
	Git Mailing List <git@vger.kernel.org>,
	mailnew4ster@gmail.com
Subject: Re: gitignore + commit with excludes = bug
Date: Mon, 10 May 2021 16:37:39 -0300	[thread overview]
Message-ID: <CAHd-oW7veyN+qetv-Mf-qPa+bcah=JCz6mSRAzunVgaFRxdbnA@mail.gmail.com> (raw)
In-Reply-To: <CABPp-BFpeoENLADH-e6dCc0PyEVQyHueY6PV8AZYbD+a3iceXA@mail.gmail.com>

On Mon, May 10, 2021 at 4:27 PM Elijah Newren <newren@gmail.com> wrote:
>
> Thanks for tracking this down.  Your analysis and patch look correct
> to me, but perhaps we could simplify the code a bit.  Instead of
> looping twice, perhaps insert the following code above the if-checks:
>
> +               /*
> +                * We can have a bunch of exclusion rules:
> +                *    .gitignore
> +                *    *.log
> +                *    !settings.log
> +                * and we're trying to see if the path matches one of these,
> +                * but note that the last one is a "negated exclusion rule",
> +                * for the excludes to match this pathspec, it needs to not
> +                * match the negated exclusion.
> +                */
> +               int retval = (item->magic & PATHSPEC_EXCLUDE) ? 0 : 1;
>
> and then change all the "return 1" statements to "return retval".

Hmm, but then wouldn't something like `git add ignored :^ignored` also
trigger the warning, as we see 'ignored' first, and return 1 before
seeing ':^ignored'?

  reply	other threads:[~2021-05-10 19:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-01 18:37 Paul Jackson
2021-05-04 12:55 ` Philip Oakley
2021-05-04 14:06   ` Matheus Tavares
2021-05-09  6:21     ` Paul Jackson
2021-05-10 16:20       ` Philip Oakley
2021-05-10 19:27     ` Elijah Newren
2021-05-10 19:37       ` Matheus Tavares Bernardino [this message]
2021-05-10 22:34         ` Elijah Newren
2021-05-11  2:23           ` Matheus Tavares Bernardino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHd-oW7veyN+qetv-Mf-qPa+bcah=JCz6mSRAzunVgaFRxdbnA@mail.gmail.com' \
    --to=matheus.bernardino@usp.br \
    --cc=git@vger.kernel.org \
    --cc=mailnew4ster@gmail.com \
    --cc=newren@gmail.com \
    --cc=philipoakley@iee.email \
    --subject='Re: gitignore + commit with excludes = bug' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git