Re: erratic behavior commit --allow-empty
- From
Lars Noschinski <lars@public.noschinski.de>
- Date
- Oct 5, 2012, 08:15 UTC
- Message-ID
- <loom.20121004T190952-797@post.gmane.org>
- In-Reply-To
- <CAB9Jk9D5c-7QKkUFtur4rxBfiaPFzGaMi-+m=Owje_Aaoc6XJQ@mail.gmail.com>
Angelo Borsotti <angelo.borsotti <at> gmail.com> writes:
Show 9 quoted lines
> take a git commit without --allow-empty: if the trees are equal, it > creates no commit, > and if the trees are different it creates one. > Take then a git commit --allow-empty: if the trees are equal it may > create a commit or > not depending on the parent, message, author and date; if the trees > are different it > creates a commit. > So, the statement does not apply to commits in general.
It does (as already shown to you). The ID of a commit object depends on the author, the time, the tree, and the commit message (did I forget something?). If all these are equal, no new physical object will be created.
Independent of this: If you are on a branch "foo" pointing to a commit A and successfully do a commit (with --allow-empty or not), "foo" will afterwards point to a commit B different from A. So, a successful "git commit (--allow-empty)" will always add a commit to the branch you are on.
-- Lars.