Bug 283352 - Diff with New Files
Summary: Diff with New Files
Status: RESOLVED FIXED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: git (show other bugs)
Version: git master
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: 1.2.3
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-04 21:14 UTC by David E. Narvaez
Modified: 2011-10-05 00:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David E. Narvaez 2011-10-04 21:14:24 UTC
Version:           git master (using KDE 4.7.1) 
OS:                Linux

I wanted to draw your attention to the following use case: In git, if you have changes that include new files these are not shown with git diff, but with git diff HEAD. So, currently, if I want to generate a patch that includes new files, I can't do that from the View Differences... menu in the Git plugin. Would it be good to change the command to git diff HEAD instead? Would it break anything else?

Reproducible: Didn't try

Steps to Reproduce:
To replicate this use case you can do the following:

$ mkdir gittest
$ cd gittest
$ git init
$ echo "First file" > first-file
$ git add first-file
$ git commit -m "adding first file"
$ echo "First file modified" > first-file
$ echo "Second file" > second-file
$ git add second-file
$ git diff
$ git diff HEAD

Actual Results:  
First diff does not include the new file.

Expected Results:  
Second diff includes the new file.
Comment 1 Aleix Pol 2011-10-04 22:15:48 UTC
Why do you want the new files on the diff?
Comment 2 David E. Narvaez 2011-10-04 22:23:36 UTC
(In reply to comment #1)
> Why do you want the new files on the diff?

My use case? As a KDE Developer, I need the new files I create when I implement new features to be submitted in the review patch.

In general, I think you can always find use cases where you need the new files included in the patch and use cases where you don't, so it's just a matter of which case do we want to support, or change the UI to opt in/out the new files.
Comment 3 Aleix Pol 2011-10-05 00:01:28 UTC
instead of "git diff HEAD" you probably want "git diff --cached" no?
Comment 4 Aleix Pol 2011-10-05 00:37:41 UTC
Git commit 91cb3d32588b7f5a3d866805e4583caa464c81cd by Aleix Pol.
Committed on 05/10/2011 at 02:35.
Pushed by apol into branch 'master'.

In case we're comparing BASE to WORKING, add the staged changes as well.

BUG: 283352

M  +12   -3    plugins/git/gitplugin.cpp
M  +1    -2    plugins/git/gitplugin.h

http://commits.kde.org/kdevplatform/91cb3d32588b7f5a3d866805e4583caa464c81cd