From: Petr Baudis <pasky@suse.cz>
To: eschvoca <eschvoca@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: How do I clear the directory cache
Date: Fri, 21 Oct 2005 12:52:35 +0200 [thread overview]
Message-ID: <20051021105235.GF30889@pasky.or.cz> (raw)
In-Reply-To: <2b05065b0510202023i62ab7c03uea1381d76535dcc7@mail.gmail.com>
Dear diary, on Fri, Oct 21, 2005 at 05:23:28AM CEST, I got a letter
where eschvoca <eschvoca@gmail.com> told me that...
> Yes, "cg-reset --adds-removals" is what I want (how do I do this with
> pure git?).
git-read-tree HEAD
git-update-cache --refresh
> I would like to clear/reset the index because I've screwed it all up.
> I don't think I can do as you suggested because of the way I got into
> this mess.
>
> I'm using git/cogito to version control my hard drive and I've been
> gradually adding more entries into the .gitignore file because some
> files change too frequently or I don't want them backed up. The OS
> modified a bunch of files, I cg-rm'd 1/4 of them, then I changed my
> mind and added them back, also did some genuine cg-adds, etc. and now
> I'm all confused (it's a whole hard drive).
Well, cg-status should show you what you effectively did, and then you
could just do something like:
cg-status -w | grep ^D | tr '\n' '\0' | xargs -0 cg-add
cg-status -w | grep ^A | tr '\n' '\0' | xargs -0 cg-rm
> If other people are interested in doing this I can pass on the lessons
> I learned.
>
> What I found it git is amazingly fast! cg-status only takes a few
> seconds. I think there are some problems if you try to do:
>
> cd /
> cg-add -r usr
> cg-commit -m "take a long break"
>
> It seems that cg-add-ing and cg-commit-ing smaller chunks is faster
> than one big chunk.
Interesting. I cannot spot anything which would bog it down in Cogito.
Is both cg-add and cg-commit significantly slower? (That is, if it takes
longer than sum of the smaller chunks.) Perhaps it's a cache issue, not
everything from the chunk fits into your cache during cg-add, so
cg-commit has to reread it from the disk.
> I think commands for the following should be added to cogito:
I'd prefer:
> cg-status -<status_flag> # list files with given status flag (without
> status flag in column 1)
> git-ls-files [--others|--deleted|etc] --exclude-per-directory=/.gitignore
All right, this might be useful. Implemented as cg-status -s '?' and such,
thanks for the idea.
> cg-add [-r] -<status_flag> # add files with a given status flag
> git-ls-files [--others|--deleted|etc]
> --exclude-per-directory=/.gitignore | while read i; do cg-add "$i;
> done
>
> cg-rm [-r] -<status_flag> # you get the idea.
>
> cg-addremove # recursively add new files, remove deleted files
I implemented the cg-reset --adds-removes option, but I don't feel
comfortable with the cg-add change - just -r would be enough to add new
files, and if you are in mess big enough, you can just cg-reset. It
would be useful to make cg-rm symmetric to cg-add, though. Then you
could do just
cg-add -r . && cg-rm -r .
and it would be equivalent to cg-addremove.
> I use "while read i" so it will work with spaces in filenames.
And break with leading spaces unless you modified $IFS properly. Note
that those people having filenames starting by spaces are either
seriously sick or script kiddies who just rooted you (or warez kiddies
on your FTP server with anonymously-writable incoming).
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.
next prev parent reply other threads:[~2005-10-21 10:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-17 14:20 How do I clear the directory cache eschvoca
2005-10-20 8:59 ` Petr Baudis
2005-10-21 3:23 ` eschvoca
2005-10-21 4:09 ` Junio C Hamano
2005-10-21 20:16 ` eschvoca
2005-10-21 21:00 ` Linus Torvalds
2005-10-21 10:52 ` Petr Baudis [this message]
2005-10-21 20:40 ` eschvoca
2005-10-21 21:43 ` Petr Baudis
2005-10-22 19:20 ` eschvoca
2005-10-22 21:09 ` Petr Baudis
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051021105235.GF30889@pasky.or.cz \
--to=pasky@suse.cz \
--cc=eschvoca@gmail.com \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).