Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let git diff show "intent-to-add" files as new files #647

Closed
dscho opened this issue May 28, 2020 · 2 comments
Closed

Let git diff show "intent-to-add" files as new files #647

dscho opened this issue May 28, 2020 · 2 comments
Labels
leftoverbits From the Git mailing list: https://lore.kernel.org/git/?q=%23leftoverbits

Comments

@dscho
Copy link
Member

dscho commented May 28, 2020

There is this feature where you can call git add -N file to tell Git that you intend to stage the file later, but do not want to stage any content yet. The intuitive thing for git diff would be to report those files with the new file header.

Not only that, by not showing that header, git add -p does not show the expected prompt. Example:

  $ git init
  $ >empty
  $ echo content >not-empty
  $ git add -N .
  $ git add -p
  diff --git a/not-empty b/not-empty
  index e69de29..d95f3ad 100644
  --- a/not-empty
  +++ b/not-empty
  @@ -0,0 +1 @@
  +content
  (1/1) Stage this hunk [y,n,q,a,d,e,?]? n

For full details, see https://lore.kernel.org/git/20200527230357.GB546534@coredump.intra.peff.net/ (and https://lore.kernel.org/git/nycvar.QRO.7.76.6.2005272150220.56@tvgsbejvaqbjf.bet/, which marked this as #leftoverbits).

@dscho dscho added the leftoverbits From the Git mailing list: https://lore.kernel.org/git/?q=%23leftoverbits label May 28, 2020
@phillipwood
Copy link

Is this still relevant? Didn't you fix it diff in 85953a3 ("diff-files --raw: show correct post-image of intent-to-add files", 2020-07-01) and I've just landed 75a009d ("add -p: fix editing of intent-to-add paths", 2020-09-09)

@dscho
Copy link
Member Author

dscho commented Sep 23, 2020

I totally did! Thank you for your diligence.

@dscho dscho closed this as completed Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
leftoverbits From the Git mailing list: https://lore.kernel.org/git/?q=%23leftoverbits
Projects
None yet
Development

No branches or pull requests

2 participants