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

Drop --no-update-remote-refs based on upstream feedback #300

Merged
merged 1 commit into from
Jan 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Scalar.Common/Git/GitProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,12 @@ public Result BackgroundFetch(string remote)
string refspec = $"+{ScalarConstants.DotGit.Refs.Heads.RefName}/*"
+ $":{ScalarConstants.DotGit.Refs.Scalar.Hidden.RefName}/{remote}/*";

// By using "--no-update-remote-refs", the user will see their remote refs update
// By using "--refmap", we override the configured refspec,
// ignoring the normal "+refs/heads/*:refs/remotes/<remote>/*".
// The user will see their remote refs update
// normally when they do a foreground fetch.
return this.InvokeGitInWorkingDirectoryRoot(
$"fetch {remote} --quiet --prune --no-update-remote-refs \"{refspec}\"",
$"fetch {remote} --quiet --prune --no-tags --refmap= \"{refspec}\"",
fetchMissingObjects: true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,17 @@ public void FetchStep()
string refsRemotesOrigin = Path.Combine(refsRoot, "remotes", "origin");
string refsHidden = Path.Combine(refsRoot, "scalar", "hidden");
string refsHiddenOriginFake = Path.Combine(refsHidden, "origin", "fake");
string packedRefs = Path.Combine(this.Enlistment.RepoRoot, ".git", "packed-refs");

// Removing refs makes the next fetch need to download a new pack
this.fileSystem.DeleteDirectory(refsHeads);
this.fileSystem.DeleteDirectory(refsRemotesOrigin);
this.fileSystem.DeleteDirectory(this.PackRoot);
this.fileSystem.CreateDirectory(this.PackRoot);
this.fileSystem.DirectoryExists(refsRemotesOrigin).ShouldBeFalse($"{refsRemotesOrigin} was not deleted");
if (this.fileSystem.FileExists(packedRefs))
{
this.fileSystem.DeleteFile(packedRefs);
}

this.Enlistment.RunVerb("fetch");

Expand Down