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

diff doesn't work for first commit #1124

Closed
ylecuyer opened this issue Aug 7, 2018 · 7 comments · Fixed by #1261
Closed

diff doesn't work for first commit #1124

ylecuyer opened this issue Aug 7, 2018 · 7 comments · Fixed by #1261
Assignees

Comments

@ylecuyer
Copy link
Contributor

ylecuyer commented Aug 7, 2018

Because of this line:

return git(newFileDiffArgs, repoPath, true);

If you want to see the diff of the very first commit of a git repo you will see the current file content instead of the original one.

@jung-kim
Copy link
Collaborator

jung-kim commented Aug 8, 2018

I remember having an issue with the very first commit of a new repo as ungit try to compare with previous commit that doesn't exist.

I don't remember if I ever fixed it, but will fix it

@jung-kim
Copy link
Collaborator

It seems to be working... Can you tell me how I can replicate?

screen shot 2018-08-11 at 16 43 54

@jung-kim jung-kim closed this as completed Oct 1, 2018
@ylecuyer
Copy link
Contributor Author

ylecuyer commented Oct 1, 2018

You have to add another commit and modify the file to reproduce the error

@jung-kim jung-kim reopened this Oct 1, 2018
@jung-kim
Copy link
Collaborator

jung-kim commented Oct 1, 2018

Ah Okay, will retest later and reevaluate

@jung-kim jung-kim self-assigned this Oct 1, 2018
@ylecuyer
Copy link
Contributor Author

ylecuyer commented Oct 9, 2018

This also happens if you look for an old commit and locally modify the same file as one in the commit. Then the diff for the select file in the commit will show the current file content

@jung-kim
Copy link
Collaborator

screen shot 2018-10-15 at 20 16 51

It seems that I can see the 2nd and 1st commit...? are you at a particular screen dimension?

@ylecuyer
Copy link
Contributor Author

I have found a way to reproduce:

cd ~
mkdir ungit-temp
cd ungit-temp
git init
echo "a" > text.txt
git add -A
git commit -m "commit"

first_commit
Everything is OK

Revert the commit

second
Everything is OK

Check the first commit

second_b
NOT OK should be +a (though the +1/-0 is ok on top)

echo "b" > text.txt

Stage

stage
Everything is OK

Reverted commit
revert_commit
NOT OK should be - a (+0/-1 is ok on top though)

Initial commit
initial_commit
NOT OK should be - a (+1/-0 is ok on top though)

git add -A
git commit -m "change"

New commit
change
Everything is OK

Reverted commit
reverted_ok
Went back to is OK

Initial commit
initial_nok
Still not OK (should be + a)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants