Re: Efficient way to import snapshots?
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Jul 30, 2007, 19:52 UTC
- Message-ID
- <alpine.LFD.0.999.0707301240330.4161@woody.linux-foundation.org>
- In-Reply-To
- <20070730192922.GB64467@nowhere>
[ Junio added, because I think I noticed a performance bug ]
On Mon, 30 Jul 2007, Craig Boston wrote:
> > A couple questions on that: > > 1. Will it notice deleted files?
Yes, although I think you need to do "git commit -a" for that.
"git add ." could (and perhaps _should_) notice them and remove them from the cache, but doesn't. Whether that's the right behaviour or not (it does seem a bit strange that "git add" would actually remove files from the index too) is up for debate.
But with "git commit -a", it will be noticed at commit time, at least.
That said, I just noticed something nasty: "git add ." is *horrible*. It does the full SHA1 re-computation even though the index is up-to-date. That's really nasty.
So right now, due to this performance bug, it's actually much better to do something more complex, namely something like
git ls-files -o | git update-index --add --stdin git commit -a
which is a lot more efficient than just doing "git add .".
Junio? I _thought_ we already took the index into account with "git add", but we obviously don't.
> 2. How can I tell it what branch to commit to?
Whatever branch is checked out in the GIT_DIR will be the one that it commits to.
Linus