Skip to content

Commit 3e1c8d5

Browse files
author
Tomas Urbonaitis
committed
Adding the stdin option to fastfetch to stay consistent
1 parent cfe66ef commit 3e1c8d5

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

GVFS/FastFetch/FastFetchVerb.cs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ public class FastFetchVerb
105105
Default = "",
106106
Required = false,
107107
HelpText = "Sets the path and filename for git.exe if it isn't expected to be on %PATH%.")]
108-
public string GitBinPath { get; set; }
109-
108+
public string GitBinPath { get; set; }
109+
110110
[Option(
111111
"folders",
112112
Required = false,
@@ -119,7 +119,14 @@ public class FastFetchVerb
119119
Required = false,
120120
Default = "",
121121
HelpText = "A file containing line-delimited list of folders to fetch")]
122-
public string FolderListFile { get; set; }
122+
public string FolderListFile { get; set; }
123+
124+
[Option(
125+
"stdin-folders-list",
126+
Required = false,
127+
Default = false,
128+
HelpText = "Specify this flag to load folder list from stdin. Same format as when loading from file.")]
129+
public bool FoldersFromStdIn { get; set; }
123130

124131
[Option(
125132
"Allow-index-metadata-update-from-working-tree",
@@ -171,8 +178,8 @@ private int ExecuteWithExitCode()
171178
{
172179
Console.WriteLine("Cannot use --force-checkout option without --checkout option.");
173180
return ExitFailure;
174-
}
175-
181+
}
182+
176183
this.SearchThreadCount = this.SearchThreadCount > 0 ? this.SearchThreadCount : Environment.ProcessorCount;
177184
this.DownloadThreadCount = this.DownloadThreadCount > 0 ? this.DownloadThreadCount : Math.Min(Environment.ProcessorCount, MaxDefaultDownloadThreads);
178185
this.IndexThreadCount = this.IndexThreadCount > 0 ? this.IndexThreadCount : Environment.ProcessorCount;
@@ -185,8 +192,8 @@ private int ExecuteWithExitCode()
185192
{
186193
Console.WriteLine("Must be run within a git repo");
187194
return ExitFailure;
188-
}
189-
195+
}
196+
190197
string commitish = this.Commit ?? this.Branch;
191198
if (string.IsNullOrWhiteSpace(commitish))
192199
{
@@ -238,11 +245,11 @@ private int ExecuteWithExitCode()
238245
tracer.RelatedError(error);
239246
Console.WriteLine(error);
240247
return ExitFailure;
241-
}
242-
248+
}
249+
243250
RetryConfig retryConfig = new RetryConfig(this.MaxAttempts, TimeSpan.FromMinutes(RetryConfig.FetchAndCloneTimeoutMinutes));
244251
BlobPrefetcher prefetcher = this.GetFolderPrefetcher(tracer, enlistment, cacheServer, retryConfig);
245-
if (!BlobPrefetcher.TryLoadFolderList(enlistment, this.FolderList, this.FolderListFile, prefetcher.FolderList, out error))
252+
if (!BlobPrefetcher.TryLoadFolderList(enlistment, this.FolderList, this.FolderListFile, this.FoldersFromStdIn, prefetcher.FolderList, out error))
246253
{
247254
tracer.RelatedError(error);
248255
Console.WriteLine(error);

0 commit comments

Comments
 (0)