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

script: double change #89

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

script: double change #89

wants to merge 8 commits into from

Conversation

Dil3mm4
Copy link
Contributor

@Dil3mm4 Dil3mm4 commented Jun 18, 2018

save_the_dev function that stashes current work to reapply if after sync do get bleeding edge patches on everything saving the dev's ass;
adding some humor to the interation with user;
fix some roms makefiles assign;

save_the_dev function that stashes current work to reapply if after sync do get bleeding edge patches on everything saving the dev's ass;
adding some humor to the interation with user;
@Dil3mm4
Copy link
Contributor Author

Dil3mm4 commented Jun 18, 2018

#86 it's there too.

@Dil3mm4 Dil3mm4 mentioned this pull request Jun 18, 2018
separating stash and stash applying via two functions now
Copy link
Owner

@phhusson phhusson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, "why not"

Perhaps it would be better to repo forall -c 'git stash', rather than just saving device/phh/treble

build-dakkar.sh Outdated
@@ -100,14 +101,14 @@ function get_rom_type() {
mainrepo="https://github.com/PixelExperience/manifest"
mainbranch="oreo-mr1"
localManifestBranch="android-8.1"
treble_generate="pixel"
treble_generate=""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it really matters, but I guess they don't need extra_make_options either

build-dakkar.sh Outdated
}

function restore_the_dev() {
if [ -d device/phh/trble ] && [ -z "$stashstatus" ];then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, trble => treble

@@ -300,6 +301,25 @@ function jack_env() {
fi
}

function save_the_dev() {
if [ -d device/phh/treble ];then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please invert this to reduce indentation and for better clarity

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invert?
What do you mean ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like
[ -d device/phh/treble] && return

build-dakkar.sh Outdated

function restore_the_dev() {
if [ -d device/phh/trble ] && [ -z "$stashstatus" ];then
cd device/phh/treble
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a subshell, instead of cd xxx; .... ; cd $curpath which is error prone

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as said earlier, should be already in subshell since this is a function

build-dakkar.sh Outdated
function save_the_dev() {
if [ -d device/phh/treble ];then
cd device/phh/treble
if git stash -u | grep -q 'No local changes to save';then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

broken indentation

@@ -300,6 +301,25 @@ function jack_env() {
fi
}

function save_the_dev() {
if [ -d device/phh/treble ];then
cd device/phh/treble
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a subshell, instead of cd xxx; .... ; cd $curpath which is error prone

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a function doesn't automatically assume to execute stuff in subshell?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if that's the case, you can just drop the cd $oldpwd

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stuff is, the execution of this script is in the root of sync, if I drop the cd it will stash on the whole rom files and not only on DT

build-dakkar.sh Outdated
if [ -d device/phh/treble ];then
cd device/phh/treble
if git stash -u | grep -q 'No local changes to save';then
stashstatus=blank
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"blank" when you're later checking for "empty" is weird -_-'

build-dakkar.sh Outdated
function save_the_dev() {
if [ -d device/phh/treble ];then
cd device/phh/treble
if git stash -u | grep -q 'No local changes to save';then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make more sense to if ! git stash -u;then instead

build-dakkar.sh Outdated
function restore_the_dev() {
if [ -d device/phh/trble ] && [ -z "$stashstatus" ];then
cd device/phh/treble
git stash apply
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering this might/will fail, some error handling should be done here

Copy link
Contributor Author

@Dil3mm4 Dil3mm4 Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this fails due to set -e should automatically stop the whole script notifying the user about the failed stash, so I dunno what we should handle further.

dropping $curpath as function should already run in subshells;
typo, trble => treble;
function init_main_repo_ref: ask user if it has a reference path to sync from and let him do that in the case.
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.

None yet

2 participants