git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: <git@vger.kernel.org>
Cc: "'Ævar Arnfjörð Bjarmason'" <avarab@gmail.com>,
	"'Cameron Boehmer'" <cameron.boehmer@gmail.com>,
	"Randall S. Becker" <rsbecker@nexbridge.com>
Subject: Re: [RFC] git clean --local
Date: Tue, 04 Dec 2018 11:45:51 +0900	[thread overview]
Message-ID: <xmqqk1kqf1r4.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <xmqqk1kriuu8.fsf@gitster-ct.c.googlers.com> (Junio C. Hamano's message of "Mon, 03 Dec 2018 04:37:03 +0900")

Junio C Hamano <gitster@pobox.com> writes:

> If "git clean" takes a pathspec, perhaps you can give a negative
> pathspec to exclude whatever you do not want to get cleaned,
> something like
>
> 	git clean '*.o' ':!precious.o'
>
> to say "presious.o is ignored (hence normally expendable), but I do
> not want to clean it with this invocation of 'git clean'"?

Hmph, this leads me to an interesting thought.  With today's code,
these two commands behave in meaningfully different ways when I mark
some paths that match .gitignore patterns with the precious
attribute.

	echo "*.ignored" >>.git/info/exclude
	echo "precious.* precious" >>.git/info/attributes

	: >expendable.ignored 2>precious.ignored

	git clean -n -x
	git clean -n -x ':(exclude,attr:precious)'

I am not suggesting that giving "git clean" a configuration knob
that always append pathspec elements, which would allow users to use
the mechanism to set the above magic pathspec, would be a good
approach.  If we were to follow through this line of thought, an
obvious thing to do is to always unconditonally append the above
magic pathspec internally when running "git clean", which would mean

 * Existing projects and users' repositories will see no behaviour
   change, because they are unaware of the "precious" attribute.

 * People who learn the new feature can start using the "ignored but
   precious" class, without any need for transition period.



      parent reply	other threads:[~2018-12-04  2:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-01 22:51 [RFC] git clean --local Cameron Boehmer
2018-12-02  0:04 ` Junio C Hamano
2018-12-02  4:43   ` Junio C Hamano
2018-12-02 13:25 ` Ævar Arnfjörð Bjarmason
2018-12-02 17:37   ` Randall S. Becker
2018-12-02 19:37     ` Junio C Hamano
2018-12-03  7:40       ` Cameron Boehmer
2018-12-04  2:45       ` Junio C Hamano [this message]

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=xmqqk1kqf1r4.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=cameron.boehmer@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rsbecker@nexbridge.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).