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

n-update fails #10

Closed
brbsix opened this issue Jan 28, 2017 · 1 comment
Closed

n-update fails #10

brbsix opened this issue Jan 28, 2017 · 1 comment

Comments

@brbsix
Copy link

brbsix commented Jan 28, 2017

The last few times that I've run n-update, I've received errors similar to the following:

$ n-update
Check for updates to n (version 2.1.3, installed in '/home/user/.n/n')? (y/N) y
-- Checking for updates...
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 1), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/tj/n
 + 55a021b...560670e master     -> origin/master  (forced update)
 * [new tag]         v2.1.4     -> v2.1.4
fatal: refusing to merge unrelated histories
n-update: ERROR: ABORTING due to unexpected error.

I would guess that this is caused by the --depth 1 flag (discussed in #6 and introduced in 9e9347d). Because there is no history, instead of just pulling in the changes, git thinks you are trying to merge two different entirely unrelated projects together. You can use --allow-unrelated-histories to ignore the warning, but then you end up with a bunch of merge conflicts. Assuming that's the problem, maybe replace git pull --depth 1 with something like git fetch --depth 1 && git reset --hard origin/master?

mklement0 added a commit that referenced this issue Jan 28, 2017
mklement0 added a commit that referenced this issue Jan 28, 2017
mklement0 added a commit that referenced this issue Jan 28, 2017
  * [fix] for [#10](#10): `n-update` could fail to update `n` due to how it updated the local
    copy of the `n` repo.
@mklement0
Copy link
Owner

mklement0 commented Jan 28, 2017

@brbsix: I appreciate your bringing this to my attention and especially suggesting a fix - it is now implemented, and seems to be working OK.

To update an installed copy of n-update, do the following:

cd "$N_PREFIX/bin"
curl https://raw.githubusercontent.com/mklement0/n-install/stable/bin/n-update > n-update

and then run n-update again.

mklement0 added a commit that referenced this issue Jan 28, 2017
mklement0 added a commit that referenced this issue Jan 28, 2017
mklement0 added a commit that referenced this issue Jan 28, 2017
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

No branches or pull requests

3 participants
@mklement0 @brbsix and others