Skip to content

Commit 4167cb6

Browse files
committed
Update remote URL before fetch
1 parent 1b9bf5f commit 4167cb6

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

bin/git-cache-http-server.js

+6-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Main.hx

+5-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ class Main {
2929
ChildProcess.exec('git clone --quiet --mirror "$remote" "$local"', callback);
3030
}
3131

32-
static function fetch(local, callback)
32+
static function fetch(remote, local, callback)
3333
{
34-
ChildProcess.exec('git -C "$local" fetch --quiet', callback);
34+
ChildProcess.exec('git -C "$local" remote set-url origin "$remote"', function(err, stdout, stderr) {
35+
ChildProcess.exec('git -C "$local" fetch --quiet', callback);
36+
});
3537
}
3638

3739
static function authenticate(params, callback)
@@ -48,8 +50,8 @@ class Main {
4850
{
4951
if (!updatePromises.exists(local)) {
5052
updatePromises[local] = new Promise(function(resolve, reject) {
51-
fetch(local, function (ferr, stdout, stderr) {
5253
trace('INFO: updating: fetching from $remote');
54+
fetch(remote, local, function (ferr, stdout, stderr) {
5355
if (ferr != null) {
5456
trace("WARN: updating: fetch failed");
5557
trace(stdout);

0 commit comments

Comments
 (0)