Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #209 from schultetwin1/verify_tracked_files
Browse files Browse the repository at this point in the history
Verifies all files are tracked by git repo
  • Loading branch information
GeertvanHorrik authored Feb 15, 2019
2 parents 1ca147f + 0daaf9e commit 3ef11e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/GitLink/Linker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,25 @@ public static class Linker
repoSourceFiles = _sourceFilesList.ToDictionary(e => e, e => GetNormalizedPath(e, workingDirectory));
}

if (!options.SkipVerify)
{
// Filter to only files which are tracked by git
var commit = repository.Value.Lookup<Commit>(commitId);
if (commit != null)
{
var trackedRepoSourceFiles = repoSourceFiles.Where(file => (commit[file.Value] != null)).ToDictionary(file => file.Key, file => file.Value);

var untrackedSourceFiles = repoSourceFiles.Keys.Except(trackedRepoSourceFiles.Keys);

foreach (var untrackedFile in untrackedSourceFiles)
{
Log.Warning($"Untracked file \"{untrackedFile}\" will not be indexed");
}

repoSourceFiles = trackedRepoSourceFiles;
}
}

string rawUrl = provider.RawGitUrl;
if (rawUrl.Contains(RevisionPlaceholder) || rawUrl.Contains(FilenamePlaceholder))
{
Expand Down
2 changes: 1 addition & 1 deletion src/GitLink/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private static int Main(string[] args)
syntax.DefineOption("u|url", ref remoteGitUrl, s => new Uri(s, UriKind.Absolute), "Url to remote git repository.");
syntax.DefineOption("commit", ref commitId, "The git ref to assume all the source code belongs to.");
syntax.DefineOption("baseDir", ref baseDir, "The path to the root of the git repo.");
syntax.DefineOption("s|skipVerify", ref skipVerify, "Verify all source files are available in source control.");
syntax.DefineOption("s|skipVerify", ref skipVerify, "Skip verifying all source files are available in source control.");
syntax.DefineOption("a|allDepotFiles", ref allDepotFiles, "Index all source files from depot. Add this option for native PDBs (C++).");
syntax.DefineParameter("pdb", ref pdbPath, "The PDB to add source indexing to.");

Expand Down

0 comments on commit 3ef11e0

Please sign in to comment.