Re: committing empty diffs
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Feb 12, 2007, 20:10 UTC
- Message-ID
- <Pine.LNX.4.64.0702121202480.8424@woody.linux-foundation.org>
- In-Reply-To
- <68948ca0702121149p4d87ae07jd3aa532a0df79156@mail.gmail.com>
On Mon, 12 Feb 2007, Don Zickus wrote:
> > Considering git-commit doesn't allow this (probably for good reason), > is it technically safe to do the following sequence of events?
Yes. There's nothing *technically* wrong with an empty commit. The reason "git commit" doesn't do it is that it's just almost always a mistake.
> tree=$(git-write-tree) #basically the same tree HEAD points to > commit=$(echo $IDEAS | git-commit-tree $tree -p HEAD) > git-update-ref HEAD $commit HEAD
If you know ahead-of-time that the tree is HEAD, there's no reason to do the "git-write-tree". You can just use "HEAD^{tree}" instead (and in fact, I think git-commit-tree will happily just take HEAD directly).
And please give a log messages for "git-update-ref"
Please do make sure to do some of the other sanity checks that "git commit" does, though. It is a good idea to at least verify that the commit message isn't empty etc.
Linus