diff options
author | Doug Anderson <dianders@google.com> | 2011-04-07 13:36:30 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2011-04-07 16:51:50 -0400 |
commit | 2630dd9787c1b75b70a980175ffa41b63f59e3b8 (patch) | |
tree | d160084fbdc7fcff49e6f52b7cf0212a52482692 | |
parent | dafb1d68d33137779c96a83c7e42cac0e7a27ca4 (diff) | |
download | git-repo-2630dd9787c1b75b70a980175ffa41b63f59e3b8.tar.gz |
Fixed problems w/ 2nd repo init if first repo init had bad URL.
This is the simplest fix: if we had problems syncing the
manifest.git directory and we were the ones that created it,
we should delete it. This doesn't try to do anything complex
like try to recover from a .repo directory that got broken in
some other way.
This is filed as: <http://crosbug.com/13403>
TEST=manual
Init once with a bad URL:
$ repo init -u http://foobar.example.com
Getting manifest ...
from http://foobar.example.com
Connection closed by 172.22.121.77
error: Couldn't resolve host 'foobar.example.com' while accessing http://foobar.example.com/info/refs
fatal: HTTP request failed
fatal: cannot obtain manifest http://foobar.example.com
Init again: identical to the first. Good:
$ repo init -u http://foobar.example.com
Getting manifest ...
from http://foobar.example.com
Connection closed by 172.22.121.77
error: Couldn't resolve host 'foobar.example.com' while accessing http://foobar.example.com/info/refs
fatal: HTTP request failed
fatal: cannot obtain manifest http://foobar.example.com
Init with correct URL:
$ repo init -u http://git.chromium.org/git/manifest -m minilayout.xml
Getting manifest ...
from http://git.chromium.org/git/manifest
[ ... cut ... ]
repo initialized in /.../repoiniterr
Try a bad URL after a good one; it doesn't get saved (good):
$ repo init -u http://foobar.example.com
Connection closed by 172.22.121.77
error: Couldn't resolve host 'foobar.example.com' while accessing http://foobar.example.com/info/refs
fatal: HTTP request failed
fatal: cannot obtain manifest http://foobar.example.com
Just to confirm, I can still do a good one after a bad...
$ repo init -u http://git.chromium.org/git/manifest -m minilayout.xml
Your Name [George Washington]:
Your Email [george@washington.example.com]:
Your identity is: George Washington <george@washington.example.com>
is this correct [y/n]? y
repo initialized in /.../repoiniterr
Change-Id: I1692821a330d97b1d218b2e191a93245b33f2362
-rw-r--r-- | subcmds/init.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index 17edfa05..37910843 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -14,6 +14,7 @@ | |||
14 | # limitations under the License. | 14 | # limitations under the License. |
15 | 15 | ||
16 | import os | 16 | import os |
17 | import shutil | ||
17 | import sys | 18 | import sys |
18 | 19 | ||
19 | from color import Coloring | 20 | from color import Coloring |
@@ -137,6 +138,11 @@ to update the working directory files. | |||
137 | if not m.Sync_NetworkHalf(): | 138 | if not m.Sync_NetworkHalf(): |
138 | r = m.GetRemote(m.remote.name) | 139 | r = m.GetRemote(m.remote.name) |
139 | print >>sys.stderr, 'fatal: cannot obtain manifest %s' % r.url | 140 | print >>sys.stderr, 'fatal: cannot obtain manifest %s' % r.url |
141 | |||
142 | # Better delete the manifest git dir if we created it; otherwise next | ||
143 | # time (when user fixes problems) we won't go through the "is_new" logic. | ||
144 | if is_new: | ||
145 | shutil.rmtree(m.gitdir) | ||
140 | sys.exit(1) | 146 | sys.exit(1) |
141 | 147 | ||
142 | syncbuf = SyncBuffer(m.config) | 148 | syncbuf = SyncBuffer(m.config) |