-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
Staged diffs aren't displayed in a repository without commits #1110
Comments
Still an issue on commit f4cdf65. This occurs in all repositories with no HEAD (both newly I had written a bug report, but decided to not file it after finding this existing issue. My original bug reportIn a repo with no HEAD (either after `git init` or `git checkout --orphan`), if I create a file and stage it, Git Cola's Diff pane doesn't show the contents of the file.In a repo with a HEAD, if I create a file and stage it, Git Cola's Diff pane does show the contents of the file (on a green background, indicating the entire file is added relative to HEAD). I'm using the git-cola-git AUR package on commit f4cdf65.
|
When there is no commit in the repo, there is no HEAD revision. Therefore the diff command returns an error (fatal: bad revision 'head'), and git-cola then use empty text as the diff fallback. To fix the issue, the diff_helper is updated to check if `ref` exists, and if `ref` doesn't exist, we drop it and not pass it to the git diff. The check is done through the rev_parse wrapper in gitcmds, which will simply return back `ref`, when it is not in git. When viewing the diff of a staged file in a commit-less repo, the ref would be 'HEAD'. Dropping 'HEAD' from parameter will make git compare the staged file against file in the working directory. Issue: git-cola#1110 Reported-By: kyanres Signed-off-by: mmargoliono
When there is no commit in the repo, there is no HEAD revision. Therefore the diff command returns an error (fatal: bad revision 'head'), and git-cola then use empty text as the diff fallback. To fix the issue, the diff_helper is updated to check if `ref` exists, and if `ref` doesn't exist, we drop it and not pass it to the git diff. The check is done through the rev_parse wrapper in gitcmds, which will simply return back `ref`, when it is not in git. When viewing the diff of a staged file in a commit-less repo, the ref would be 'HEAD'. Dropping 'HEAD' from parameter will make git compare the staged file against file in the working directory. Issue: git-cola#1110 Reported-By: kyanres Signed-off-by: mmargoliono
Keep diff_helper() simpler by lifting the ref verification up into the DiffStaged command. This ensures that other diff_helper() use cases are not impacted by the fix for git-cola#1110. Related-to: git-cola#1149 Signed-off-by: David Aguilar <davvid@gmail.com>
Using the git-cola-git AUR package, pointing to main 74e94ae. Now showing a file diff works, but staged images don't show anything. And if I stage an image, quit and reopen Git Cola, and scroll on the image, the app crashes:
|
Some callbacks may fire before the scene has been initialized. Guard against spurious mousewhell events. Related-to: git-cola#1110 Signed-off-by: David Aguilar <davvid@gmail.com>
Thanks for the heads-up @nyanpasu64 -- I just pushed b63bc42 which should guard against the scenario you ran into. Interesting I couldn't reproduce it, but I added some extra guard checks. BTW, I noticed the traceback above says Nonetheless, this should be better behaved going forward. Cheers |
I'm using the
When I put this file in an empty folder, then run |
Hello!
To reproduce :
Then use git cola to stage the file.
Observed behavior :
When foo is Untracked, the Diff view shows its contents.
When foo is Staged, the Diff view is empty.
Expected behavior :
I need to see what's staged before committing :-) + to be able to unstage some lines.
Hope that helps.
I got around that problem by doing a first commit for .gitignore and squashing it later with rebase -i --root
git version 2.25.1
cola version 3.6
The text was updated successfully, but these errors were encountered: