Doesn't handle bare repos
njamesp opened this issue · 4 comments
I have a directory full of bare repos (i.e. mirrors), and getup fails to update them:
Traceback (most recent call last):
File "/usr/local/Cellar/gitup/0.2.3/libexec/bin/gitup", line 9, in
load_entry_point('gitup==0.2.3', 'console_scripts', 'gitup')()
File "/usr/local/Cellar/gitup/0.2.3/libexec/lib/python2.7/site-packages/gitup/script.py", line 90, in run
main()
File "/usr/local/Cellar/gitup/0.2.3/libexec/lib/python2.7/site-packages/gitup/script.py", line 82, in main
update_directories(args.directories_to_update, update_args)
File "/usr/local/Cellar/gitup/0.2.3/libexec/lib/python2.7/site-packages/gitup/update.py", line 296, in update_directories
_update_directory(full_path, update_args, is_bookmark=False)
File "/usr/local/Cellar/gitup/0.2.3/libexec/lib/python2.7/site-packages/gitup/update.py", line 275, in _update_directory
_update_subdirectories(path, long_name, update_args)
File "/usr/local/Cellar/gitup/0.2.3/libexec/lib/python2.7/site-packages/gitup/update.py", line 256, in _update_subdirectories
_update_repository(repo, _update_args)
File "/usr/local/Cellar/gitup/0.2.3/libexec/lib/python2.7/site-packages/gitup/update.py", line 240, in _update_repository
_update_branches(repo, active, merge, rebase)
File "/usr/local/Cellar/gitup/0.2.3/libexec/lib/python2.7/site-packages/gitup/update.py", line 207, in _update_branches
active.checkout()
File "/usr/local/Cellar/gitup/0.2.3/libexec/vendor/lib/python2.7/site-packages/git/refs/head.py", line 219, in checkout
self.repo.git.checkout(self, *_kwargs)
File "/usr/local/Cellar/gitup/0.2.3/libexec/vendor/lib/python2.7/site-packages/git/cmd.py", line 440, in
return lambda _args, *_kwargs: self._call_process(name, _args, *_kwargs)
File "/usr/local/Cellar/gitup/0.2.3/libexec/vendor/lib/python2.7/site-packages/git/cmd.py", line 834, in _call_process
return self.execute(make_call(), **_kwargs)
File "/usr/local/Cellar/gitup/0.2.3/libexec/vendor/lib/python2.7/site-packages/git/cmd.py", line 627, in execute
raise GitCommandError(command, status, stderr_value)
git.exc.GitCommandError: 'git checkout master' returned with exit code 128
@njamesp Hi; I'm having a bit of trouble figuring out the proper way to handle bare repositories. It seems like git does some strange things behind the scenes depending on how you have your repo set up.
Can you paste your repo's config
file? Scrub URLs if you want but leave the rest of the file intact if possible. Also, what's your usual method for updating the mirrors (since git pull
doesn't work, is it just git fetch
or something else)? Thanks!
Thanks for the quick response! See below.
On May 30, 2015, at 2:30 PM, Ben Kurtovic notifications@github.com wrote:
@njamesp https://github.com/njamesp Hi; I'm having a bit of trouble figuring out the proper way to handle bare repositories. It seems like git does some strange things behind the scenes depending on how you have your repo set up.
[core]
repositoryformatversion = 0
filemode = true
bare = true
ignorecase = true
precomposeunicode = true
[remote "stash"]
url = ssh://git@stash.numerica.us/ ssh://git@stash.numerica.us/...
fetch = +refs/heads/:refs/remotes/stash/
[remote "origin"]
url = /Users/nparrish/Numerica/...
fetch = +refs/heads/:refs/remotes/origin/
Can you paste your repo's config file? Scrub URLs if you want but leave the rest of the file intact if possible. Also, what's your usual method for updating the mirrors (since git pull doesn't work, is it just git fetch or something else)? Thanks!I usually do just git fetch, but that doesn’t update any tracking branches.
In a bare repo, you can do:
git branch Foo origin/Foo
But then if origin/Foo changes upstream, the local version of Foo does not change with a fetch.
So, the primary issue I run into is that you can’t checkout a branch to update it.
—
Reply to this email directly or view it on GitHub #14 (comment).
Thanks, I think I've got a satisfactory solution for this.
There was a bug with remote fetching in certain cases (but not yours); I fixed that in a9e2a1f.
In 5a4e49e I fixed the error you were having. Remotes are updated correctly, but no branches are modified, so gitup acts like a batch git fetch
.
In 31a9477 I redid the way branch updates work. For any branch where you've explicitly set an upstream (such as by doing git branch foo origin/foo
as you mentioned), gitup should correctly fast-forward it on updates, but won't do anything if a merge or rebase is required. Since you're we're dealing with bare repos here, that should always work, unless someone does something funny (forced pushes that break history?) in which case you'll have to deal with that manually.
Awesome. This is working much better now. Thanks for the quick fix.
Nick
On Jun 6, 2015, at 12:39 AM, Ben Kurtovic notifications@github.com wrote:
Thanks, I think I've got a satisfactory solution for this.
There was a bug with remote fetching in certain cases (but not yours); I fixed that in a9e2a1f a9e2a1f.
In 5a4e49e 5a4e49e I fixed the error you were having. Remotes are updated correctly, but no branches are modified, so gitup acts like a batch git fetch.
In 31a9477 31a9477 I redid the way branch updates work. For any branch where you've explicitly set an upstream (such as by doing git branch foo origin/foo as you mentioned), gitup should correctly fast-forward it on updates, but won't do anything if a merge or rebase is required. Since you're we're dealing with bare repos here, that should always work, unless someone does something funny (forced pushes that break history?) in which case you'll have to deal with that manually.
—
Reply to this email directly or view it on GitHub #14 (comment).