andsens / homeshick

git dotfiles synchronizer written in bash
MIT License
2.11k stars 145 forks source link

homeshick refresh mistakenly counts repos as fresh #101

Closed PerilousApricot closed 8 years ago

PerilousApricot commented 10 years ago

I tried to do a homeshick refresh on an old machine that I had just added a new castle "dotfiles_private" to but didn't add the origin. I got the following

homeshick refresh
     outdated dotfiles
     outdated dotfiles_private
     outdated homeshick
      refresh The castles dotfiles,dotfiles_private,homeshick are outdated.
        pull? [yN] y
         pull dotfiles
         pull dotfiles_private
        error Unable to pull /Users/meloam/.homesick/repos/dotfiles_private. Git says:
fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched.

I didn't end up getting to pull homeshick, but the caching said it was okay:

homeshick refresh
        fresh dotfiles
        fresh dotfiles_private
        fresh homeshick

I assume that the "last updated" flag is updated before the pull successfully returns?

PerilousApricot commented 10 years ago

I meant to add, I was later able to manually pull the homeshick dir:

$ homeshick cd homeshick
$ git pull
remote: Counting objects: 60, done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 60 (delta 20), reused 48 (delta 19)
Unpacking objects: 100% (60/60), done.
From git://github.com/andsens/homeshick
   5e603ae..3c25d3b  master     -> origin/master
   991e771..1ac04fd  development -> origin/development
 * [new branch]      testing    -> origin/testing
Updating 5e603ae..3c25d3b
Fast-forward
 CONTRIBUTING.md        |  55 +++++++++++++++++++
 README.md              |  19 +++----
 test/interactive       |   2 +
 test/setup-default.sh  |  15 ++++++
 test/suites/check.bats | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
 utils/exit_status.sh   |   1 +
 utils/git.sh           |  10 +++-
 7 files changed, 293 insertions(+), 27 deletions(-)
 create mode 100644 CONTRIBUTING.md
 create mode 100755 test/setup-default.sh
andsens commented 10 years ago

I assume that the "last updated" flag is updated before the pull successfully returns?

You are correct, its done to keep the code a little more simple, but this is obviously a problem, so I'll fix it to do the expected thing.

I am not sure whether homeshick should continue pulling the next repo on fail or not? Currently homeshick stops the whole process, but the pulls are independent of each other, meaning no error can affect the next pull, so I'd say errors should be caught in the main loop and then it should continue.

PerilousApricot commented 10 years ago

I agree, a bad pull should be trapped, then after all the pulls are done, a "Hey, you didn't manage to pull repos X Y and Z" message could be shown to the user.

andsens commented 10 years ago

I created #105 to track the more general issue of not failing half-way through. If that gets implemented properly there would be no need to fix the issue at hand, unless of course a refresh can fail in some other way.

EDIT: Of course it can :-) See #104, d'uh

andsens commented 8 years ago

Fixed in dev and testing :-)

You can go ahead and try out the testing branch if you like. I'll let the changes simmer there for a while before merging into master.

andsens commented 8 years ago

Fixed :-)