Skip to content

Implement diffs for pkgbuild viewing.#447

Merged
Morganamilo merged 1 commit intoJguer:masterfrom
Morganamilo:fix#131
Jun 1, 2018
Merged

Implement diffs for pkgbuild viewing.#447
Morganamilo merged 1 commit intoJguer:masterfrom
Morganamilo:fix#131

Conversation

@Morganamilo
Copy link
Contributor

diff viewing can be toggled via --[no]showdiffs. When enabled diffs will
be shown for packages between the current HEAD and upstream's HEAD.
Packages downloaded via tarballs will just have their pkgbuilds printed.

git diff is used to show diffs. Therefore the pager for diffs can be
shown via the PAGER and GIT_PAGER enviroment variables.

Fixes #131 after all this time.

@Morganamilo
Copy link
Contributor Author

This follows the default git diff + less behaviour. So small diffs are printed directly, while larger diffs stay in less interactively. This annoys me a little. What do you think about that? Worth coming up with a solution for? @Jguer

@Jguer
Copy link
Owner

Jguer commented Jun 1, 2018

I'll check it out. Would you prefer to always go to less or that they should be always printed directly?

@Morganamilo
Copy link
Contributor Author

I would like it to always go to less, but then piping manually is more annoying and less wont display colour without the -R flag.

@Morganamilo
Copy link
Contributor Author

Morganamilo commented Jun 1, 2018

Git uses -F/--quit-if-one-screen by default for less. If you export your own less flags LESS=RSX then that overrides this and less will always show. I'll consider this problem solved.

There's another problem with empty diffs but that should be an easy fix.

diff viewing can be toggled via --[no]showdiffs. When enabled diffs will
be shown for packages between the current HEAD and upstream's HEAD.
Packages downloaded via tarballs will be shown in full using the editor

git diff is used to show diffs. Therefore the pager for diffs can be
set via the PAGER and GIT_PAGER enviroment variables.
@Morganamilo
Copy link
Contributor Author

I changed the UX a little, I'd say I'm happy with it. Setting LESS=RX makes it perfect. Maybe that should go into the FAQ.

@Morganamilo Morganamilo merged commit 5b6c410 into Jguer:master Jun 1, 2018
@Jguer
Copy link
Owner

Jguer commented Jun 3, 2018

@Morganamilo after I check the diff of an upgrade package how would I go about editing that PKGBUILD?

@Morganamilo
Copy link
Contributor Author

You'd have to open the file in your editor yourself or use --noshowdiffs. This is why I had the diffs always show the full file paths. I don't know how important editing is to you. I always saw it as viewing but you also happened to be in an editor.

I thought It would be tedious to have edit and diff prompts at the same time. Maybe you can think of something that works.

@Jguer
Copy link
Owner

Jguer commented Jun 3, 2018

Requires more work:
We could menu it, NONE (default) , DIFF, EDIT

Less work:
If you don't care for the diff then you also don't care to edit. So only ask to EDIT if you DIFFED it

For me the less work option works

@Morganamilo
Copy link
Contributor Author

Thinking about it, Would probably work to replace the Would you like to continue with the install Y/n dialog with something along the lines of continue, abort, go back and edit.

@Jguer
Copy link
Owner

Jguer commented Jun 5, 2018

Yes maybe it would work, I'll try and think of designs over that as welll

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 this pull request may close these issues.

2 participants