Skip to contentSkip to conversation

Bug#757297: 'git status' output is confusing after 'git add -N'

DISCUSSION Duy Nguyen 2 participants 2 messages Jun 15, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Duy Nguyen

author
#1 lore raw
Quoted 19 lines · Jonathan Nieder

Package: git
Version: 1:2.0.0-1
Tags: upstream

  $ git init foo
  Initialized empty Git repository in /tmp/t/foo/.git/
  $ cd foo
  $ echo hi >README
  $ git add -N README
  $ git status
  On branch master

Initial commit

Changes to be committed:
(use "git rm --cached <file>..." to unstage)

new file: README

Quoted 8 lines

Changes not staged for commit:
(use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory)

modified: README

If I then run "git commit", it does not actually commit the addition of the README file.

We used to reject such a commit operation before 3f6d56d (commit:
ignore intent-to-add entries instead of refusing - 2012-02-07) so it was harder to misunderstand this case.

Quoted 7 lines

It would be clearer to have a separate section,like so:

Tracked files not to be committed:
(use "git rm --cached <file>..." to stop tracking)

new file: README

Or make the "Changes not staged for commit" part say "new file:
README" ("modified" is implied)

Signature · 1 line
Duy
#2 lore raw
Quoted 35 lines · Duy Nguyen
Quoted 19 lines · Jonathan Nieder

Package: git
Version: 1:2.0.0-1
Tags: upstream

  $ git init foo
  Initialized empty Git repository in /tmp/t/foo/.git/
  $ cd foo
  $ echo hi >README
  $ git add -N README
  $ git status
  On branch master

Initial commit

Changes to be committed:
(use "git rm --cached <file>..." to unstage)

new file: README

Quoted 8 lines

Changes not staged for commit:
(use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory)

modified: README

If I then run "git commit", it does not actually commit the addition of the README file.

We used to reject such a commit operation before 3f6d56d (commit:
ignore intent-to-add entries instead of refusing - 2012-02-07) so it was harder to misunderstand this case.

Quoted 2 lines

It would be clearer to have a separate section,like so:

Quoted 8 lines
Quoted 5 lines

Tracked files not to be committed:
(use "git rm --cached <file>..." to stop tracking)

new file: README

Or make the "Changes not staged for commit" part say "new file:
README" ("modified" is implied)

Yeah, after reading the justification in the quoted commit, I agree that it is status that is at fault in the above; "new file: README" is part of "Changes not staged for commit" in this case (it is told to the index, but the user never said it is "for commit" yet, which is the whole point of "-N"), so instead of adding a new section, I agree that it should be classified as "new file" not "modified" there.