git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Clemens Buchacher <drizzd@gmx.net>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Git Mailing List" <git@vger.kernel.org>,
	"Per Lundberg" <per.lundberg@hibox.tv>,
	"Steffen Jost" <jost@tcs.ifi.lmu.de>,
	"Joshua Jensen" <jjensen@workspacewhiz.com>,
	"Matthieu Moy" <git@matthieu-moy.fr>,
	"Holger Hellmuth" <hellmuth@ira.uka.de>,
	"Kevin Ballard" <kevin@sb.org>
Subject: Re: [PATCH 1/1] Introduce "precious" file concept
Date: Fri, 22 Feb 2019 16:46:23 +0700	[thread overview]
Message-ID: <CACsJy8C377NmLv9edNYjinKAQf-P1y5+Nwhdj3vRkz_E__x43Q@mail.gmail.com> (raw)
In-Reply-To: <B168DCB1-7A69-4729-89C7-B513464DD468@gmx.net>

On Wed, Feb 20, 2019 at 6:11 PM Clemens Buchacher <drizzd@gmx.net> wrote:
> >And requiring to mark trashable files manually duplicates a
> >lot of ignore patterns. Have a look at any .gitignore file, the
> >majority of them is for discardable files because "ignored" class was
> >created with those in mind (*.o and friends). So now you would need to
> >add more or less the same set of ignore rules in .gitattributes to
> >mark them trashable, and gitignore/gitattributes rules are not exactly
> >compatible, you can't just blindly copy them over. Every time you add
> >one more .gitignore rule, there's a good chance you need to add a
> >similar rule for trashable attribute.
>
> I agree that ignored precious files are typically a small subset of the ignore files. Maintaining separate rules for ignored files and for trashable files would result in a lot of duplication.
>
> On the other hand, how frequently do we really have to trash ignored files? Trashing a file should only be necessary if a tracked file overwrites an ignored file. When does this happen? I don't think it will happen for *.o files. So in most cases, there is simply no need to specify which files are precious. The default could simply be that all files are precious.
>
> To support more complex use cases, we could specify precious files in addition to ignored files. Only if we specify precious files (and/or enable the ignored-are-trashable config option on a repository level), all other files become trashable.
>
> Functionally this is equivalent the newbie option which you suggest, but I think it is not an issue of newbie vs experienced users but an issue of common vs special use cases.

So far the two conflicting cases are "git checkout/merge" and "git
clean". Ignored files are valuable by default in the former, while
it's expendable by default in the latter.

So if you add this ignored-are-trashable config key (defaults to
false), git-clean -if will not do anything anymore. We _could_ advice
the user to turn the config on (with all the consequences). I don't
know if we have any other use cases that deserve the same advice.

Another option is simply leave the expendable/precious nature of
ignored files undefined like it is now and handle case by case:

 - git-clean learns to use a new attribute "clean". Undefined
attribute is seen as +clean. To keep some files "precious" you update
.gitattributes and add -clean rules.
 - git merge/checkout learns another attribute,
checkout-overwrite-ignore? Undefined attribute is seen as
-checkout-overwrite-ignore (i.e. abort the operation).

We stay away from any generic attribute name in this direction to make
clear it's only applicable to specific use cases.
-- 
Duy

  reply	other threads:[~2019-02-22  9:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-16 11:49 [PATCH 0/1] Introduce "precious" file attribute Nguyễn Thái Ngọc Duy
2019-02-16 11:49 ` [PATCH 1/1] Introduce "precious" file concept Nguyễn Thái Ngọc Duy
2019-02-16 19:36   ` Ævar Arnfjörð Bjarmason
2019-02-17  9:31     ` Duy Nguyen
2019-02-18  9:53       ` Ævar Arnfjörð Bjarmason
2019-02-18 10:14         ` Duy Nguyen
2019-02-19 18:08       ` Junio C Hamano
2019-02-20  1:35         ` Duy Nguyen
2019-02-20  8:31           ` Clemens Buchacher
2019-02-20 22:32           ` Junio C Hamano
2019-02-20  9:19         ` Ævar Arnfjörð Bjarmason
2019-02-20  9:36           ` Steffen Jost
2019-02-20  9:41           ` Duy Nguyen
2019-02-20 10:46             ` Ævar Arnfjörð Bjarmason
2019-02-20 11:11             ` Clemens Buchacher
2019-02-22  9:46               ` Duy Nguyen [this message]
2019-02-20 22:39             ` Junio C Hamano
2019-02-22  9:35               ` Duy Nguyen
2019-02-22 18:07                 ` Junio C Hamano

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=CACsJy8C377NmLv9edNYjinKAQf-P1y5+Nwhdj3vRkz_E__x43Q@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=avarab@gmail.com \
    --cc=drizzd@gmx.net \
    --cc=git@matthieu-moy.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hellmuth@ira.uka.de \
    --cc=jjensen@workspacewhiz.com \
    --cc=jost@tcs.ifi.lmu.de \
    --cc=kevin@sb.org \
    --cc=per.lundberg@hibox.tv \
    /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).