From: Jiang Xin <worldhello.net@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] Use clean.requireforce to protect untracked files.
Date: Sat, 04 Jun 2011 00:20:37 +0800 [thread overview]
Message-ID: <4DE909D5.9050805@gmail.com> (raw)
In-Reply-To: <7vipsnar23.fsf@alter.siamese.dyndns.org>
I do agree there are ignored-but-precious type of files exist in practice.
Introducing such ignored-but-precious class through attributes or .gitignore
is fine, and the definition of the class can broadcast to others through
.gitattributes or .gitignore, it's cool. But it sounds a bit complicated.
This afternoon's hack on config variable "clean.requestForce" feets my needs,
but it also has drawbacks:
1. Define a global "clean.requestForce" variable like this:
$ git config --global clean.requestForce LockIgnored
2. Then in one repository,
* You can : git clean -f
* But you cannot : git clean -f -x
3. If want to override such global setting, simply
$ git config clean.requestForce true
The side-effect of this hack is that an unhacked git will complain:
fatal: bad config value for 'clean.requireforce' in .git/config
于 11-6-3 下午11:11, Junio C Hamano 写道:
> Jiang Xin <worldhello.net@gmail.com> writes:
>
>> Untracked files may be significant for certain repositories, but if run the
>> command "git clean -fdx" by accident, all untracked files will be lost.
>
> Don't add -x without thinking, then. It is the way to tell the command "I
> want to remove all the untracked files and I REALLY MEAN IT". It is often
> used to say "I do not trust Makefile and I want to remove what 'make
> clean' would leave behind".
>
> A slightly related tangent is that we only have three classes of paths:
>
> - tracked ones
> - untracked ones, where there are two subclasses
> - unignored ones (e.g. new source file you haven't added)
> - ignored ones (e.g. build artifacts like *.o files)
>
> and because of that, the general design is to consider "ignored" files
> expendable during various operations. Sometimes people deliberately "ignore"
> files that they consider not expendable, which is (by today's definition)
> a wrong thing to do, but I think in the longer term we should add a way to
> mark them as "ignored but precious".
>
> http://thread.gmane.org/gmane.comp.version-control.git/172818/focus=172846
>
> Nobody has designed how this fourth class should behave (and how the
> behaviour of the "ignored" should change, if any) yet, but a rough outline
> would probably be:
>
> - precious files are the ones that are ignored (by today's definition,
> i.e. .gitignore mechanism consideres they are ignored) but marked as
> "precious" in some other way [*1*]. They will
>
> - not appear in "Untracked files:" section in "git status" output;
> - not be added by "git add" without "-f", just like other ignored files;
> - not be overwritten or removed to make room while switching branches;
> - not be removed with "clean -f -x" [*2*].
>
> - ignored files will stay to be "expendable".
>
> I suspect there may be some codepaths that incorrectly treat them as not
> expendable, and protect their lossage. We would want to fix them after we
> introduce the "precious" class.
>
> [Footnotes]
>
> *1* We could invent a way to sneak such entries in .gitignore, but I am
> inclined to think it would be cleaner to define "precious" attribute and
> let the attributes mechanism handle this.
>
> *2* This is just off the top of my head without thinking things
> through. It might turn out that it makes more sense ot remove them.
--
蒋鑫
北京群英汇信息技术有限公司
邮件: worldhello.net@gmail.com
网址: http://www.ossxp.com/
http://blog.ossxp.com/
电话: 010-51262007, 13910430470
传真: 010-51262007
prev parent reply other threads:[~2011-06-03 16:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-03 11:12 [PATCH] Use clean.requireforce to protect untracked files Jiang Xin
2011-06-03 15:11 ` Junio C Hamano
2011-06-03 16:20 ` Jiang Xin [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=4DE909D5.9050805@gmail.com \
--to=worldhello.net@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).