Re: erratic behavior commit --allow-empty
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Oct 2, 2012, 08:26 UTC
- Message-ID
- <506AA51E.9010209@viscovery.net>
- In-Reply-To
- <CAB9Jk9BynCunFHRFhGKoyDA-qof1iu6w952sAgSs2_JWb8+U3A@mail.gmail.com>
Am 10/2/2012 9:51, schrieb Angelo Borsotti:
Show 30 quoted lines
> This is the log of the second execution: > > $ emptycommit > + rm -rf local > + mkdir local > + cd local > + git init > Initialized empty Git repository in d:/gtest/local/.git/ > + echo aaa > + git add f1 > warning: LF will be replaced by CRLF in f1. > The file will have its original line endings in your working directory. > + git commit -m A > [master (root-commit) 1b86218] A > warning: LF will be replaced by CRLF in f1. > The file will have its original line endings in your working directory. > 1 file changed, 1 insertion(+) > create mode 100644 f1 > + git checkout --orphan feature > Switched to a new branch 'feature' > + git commit -m A --allow-empty > [feature (root-commit) 1b86218] A > warning: LF will be replaced by CRLF in f1. > The file will have its original line endings in your working directory. > 1 file changed, 1 insertion(+) > create mode 100644 f1 > + git rev-list --all --pretty=oneline > 1b8621851f6ae2943347da655661e9d5dc978208 A > >>>>>> note that git commit -m A --allow-empty DOES NOT create a commit
Note that git commit -m A --allow-empty *DID* create a commit. Only, that it received the same name (SHA1) as the commit you created before it because it had the exact same contents (files, parents, author, committer, and timestamps). Obviously, your script was executed sufficiently fast that the two commits happend in the same second.
-- Hannes