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

Mackup breaks oh-my-zsh upgrade #1384

Closed
ileitch opened this issue May 27, 2019 · 19 comments · Fixed by #1674
Closed

Mackup breaks oh-my-zsh upgrade #1384

ileitch opened this issue May 27, 2019 · 19 comments · Fixed by #1674

Comments

@ileitch
Copy link

ileitch commented May 27, 2019

I'm using the iCould engine, no other configuration.

After running mackup backup -f, the ~/.oh-my-zsh is left in a dirty state, which breaks upgrade_oh_my_zsh.

➜  .oh-my-zsh git:(master) ✗ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	deleted:    custom/example.zsh
	deleted:    custom/plugins/example/example.plugin.zsh
	deleted:    custom/themes/example.zsh-theme

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	custom

no changes added to commit (use "git add" and/or "git commit -a")
➜  ~ upgrade_oh_my_zsh
Updating Oh My Zsh
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.
There was an error updating. Try again later?
@joshmedeski
Copy link
Contributor

I had this issue too. This happens when you add anything to the custom directory (with or without Mackup`).

All you have to do is the following in the terminal

$ cd ~/.oh-my-zsh
$ git stash
$ upgrade_oh_my_zsh
$ git stash pop

Hope that helps!

@ileitch
Copy link
Author

ileitch commented May 28, 2019

The directory is being created by Mackup. When I git reset --hard origin/HEAD, running mackup always re-creates it.

@joshmedeski
Copy link
Contributor

Yes, since Mackup uses symbolic links there's no other way I can think of to achieve this. Hopefully, my steps work for you, it's a little bit of a pain but doesn't take too long.

@ileitch
Copy link
Author

ileitch commented May 28, 2019

Yeah I've already been getting by by doing this. The ability to disable certain apps would be nice.

@joshmedeski
Copy link
Contributor

You can choose not to sync an application if you'd rather not deal with this issue and not backup oh-my-zsh with Mackup

@ileitch
Copy link
Author

ileitch commented May 28, 2019

Ah perfect, thanks 👍

@lorenzofanchi
Copy link
Contributor

lorenzofanchi commented Jun 2, 2019

@joshmedeski Isn't the issue that Mackup creates symlinks that cannot be stashed?

This is the error I get when trying to stash my changes:

error: 'custom/example.zsh' is beyond a symbolic link
fatal: Unable to process path custom/example.zsh
Cannot save the current worktree state

Do you have an idea on how I could solve this?

[edit]
I just resorted to resetting the repo as @ileitch suggested.

git reset --hard origin/HEAD &&
upgrade_oh_my_zsh

Then re-installed my custom plugins and ran mackup backup -f

@girishso
Copy link

@lorenzofanchi @joshmedeski

Isn't the issue that Mackup creates symlinks that cannot be stashed?

Yes.

I didn't want to re-install my plugins and themes, so I created a branch my-custom

git checkout -b my-custom
git add .
git commit -m "fix mackup"
git checkout master
upgrade_oh_my_zsh
git merge my-custom

All seems well. Hope this helps someone in future.

@leoredi
Copy link

leoredi commented Jun 24, 2020

Up

@lra
Copy link
Owner

lra commented Jun 24, 2020

Up

Sorry, but what am I supposed to do? =)

@sergiodk5
Copy link

@lorenzofanchi @joshmedeski

Isn't the issue that Mackup creates symlinks that cannot be stashed?

Yes.

I didn't want to re-install my plugins and themes, so I created a branch my-custom

git checkout -b my-custom
git add .
git commit -m "fix mackup"
git checkout master
upgrade_oh_my_zsh
git merge my-custom

All seems well. Hope this helps someone in future.

This worked for me perfectly!

@bvdputte
Copy link

Up

Sorry, but what am I supposed to do? =)

I'ld say - at least in the mean time until a working solution is found - remove oh-my-zsh from the mackup supported list since it breaks upgrading it?

lra added a commit that referenced this issue Jan 1, 2021
@lra lra closed this as completed in #1674 Jan 1, 2021
lra added a commit that referenced this issue Jan 1, 2021
@lra
Copy link
Owner

lra commented Jan 1, 2021

@bvdputte Done.

@masterix21
Copy link

Hi guys, I solved it like so:

mv ~/.oh-my-zsh/custom ~/.oh-my-zsh/custom-sym
omz update
mv ~/.oh-my-zsh/custom-sym ~/.oh-my-zsh/custom

@LucasLarson
Copy link
Contributor

Alternatively, in ~/.zshrc, replace this:

ZSH_CUSTOM=${ZSH}/custom

with this:

# assuming Mackup is in `~/Dropbox/Mackup`
ZSH_CUSTOM=${HOME}/Dropbox/Mackup/.oh-my-zsh/custom

(via).

@masterix21
Copy link

@LucasLarson it sounds much better! Yeah. Thanks.

@casey-robertson
Copy link

Hmm - this seemed to work and now it's not.

Alternatively, in ~/.zshrc, replace this:

ZSH_CUSTOM=${ZSH}/custom

with this:

# assuming Mackup is in `~/Dropbox/Mackup`
ZSH_CUSTOM=${HOME}/Dropbox/Mackup/.oh-my-zsh/custom

(via).

Also tried the git checkout, git add, git merge workflow and got this:

fatal: Not possible to fast-forward, aborting.

@k3n
Copy link

k3n commented Jun 25, 2021

@lorenzofanchi @joshmedeski

Isn't the issue that Mackup creates symlinks that cannot be stashed?

Yes.

I didn't want to re-install my plugins and themes, so I created a branch my-custom

git checkout -b my-custom
git add .
git commit -m "fix mackup"
git checkout master
upgrade_oh_my_zsh
git merge my-custom

All seems well. Hope this helps someone in future.

This is great, thanks for sharing.

One problem I found though is that you can't easily upgrade the next time, since your local master will differ from origin, which will leave you with a mess. I solved it a slightly different way (going to use the OMZ git aliases, since we're in the project ;)):

gcb my-custom \
    && gaa \
    && gcmsg "My custom OMZ" \
    && gcm \
    && upgrade_oh_my_zsh \
    && gco - \
    && grbm

Instead of merging, I rebased my custom branch to master.

Now when new commits are made to master, all I need to do is:

gcm && gl && gco - && grbm

@piotrpalek
Copy link

sorry to revive this old issue, but is there any update on oh-my-zsh support?

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.