git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aviv Eyal <avivey@gmail.com>
To: git@vger.kernel.org
Subject: git add --intent-to-add silently creates empty commits
Date: Wed, 14 Sep 2016 22:01:05 -0700	[thread overview]
Message-ID: <CAGHT48L2s_nf-oSGPKrOB7uo5UAkCScNh+Ju5xH1dE5DFVnHwA@mail.gmail.com> (raw)

Hello,

I think this is an unintended behavior, but I might be wrong:

Using `git add -N` allows creating of empty commits:


git init test && cd test
echo text > file
git add --intent-to-add file
git commit -m 'Empty commit'
echo $?                                    # prints 0
git log -1 -p --format='' HEAD | wc -l     # prints 0
git status -s                              # prints `AM file`


I'd expect `git commit` to error out instead of producing an empty commit.

I've seen this with git 2.8.1 and 2.10.0.129.g35f6318

Thanks,
Aviv

             reply	other threads:[~2016-09-15  5:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15  5:01 Aviv Eyal [this message]
2016-09-15 17:48 ` git add --intent-to-add silently creates empty commits Junio C Hamano
2016-09-19 13:16   ` Duy Nguyen

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=CAGHT48L2s_nf-oSGPKrOB7uo5UAkCScNh+Ju5xH1dE5DFVnHwA@mail.gmail.com \
    --to=avivey@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).