Skip to content

Commit a8bc2f3

Browse files
Mpdreamzclaude
andcommitted
Rename RealForPath* to RealGitRootForPath* for clarity
RealForPath → RealGitRootForPath RealForPathWrite → RealGitRootForPathWrite The Git prefix makes explicit that these factory methods resolve the scope root by walking up to the nearest .git boundary from the given path. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 553631c commit a8bc2f3

9 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/Elastic.Documentation.Configuration/FileSystemFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public static ScopedFileSystem ScopeSourceDirectoryForWrite(IFileSystem inner, s
144144
/// and do not exercise this method.
145145
/// </para>
146146
/// </summary>
147-
public static ScopedFileSystem RealForPath(string? path)
147+
public static ScopedFileSystem RealGitRootForPath(string? path)
148148
{
149149
if (path is null)
150150
return RealRead;
@@ -162,7 +162,7 @@ public static ScopedFileSystem RealForPath(string? path)
162162
/// Falls back to <see cref="RealWrite"/> when both are <see langword="null"/>.
163163
/// Use in commands that accept explicit <c>--path</c> and/or <c>--output</c> arguments.
164164
/// </summary>
165-
public static ScopedFileSystem RealForPathWrite(string? path, string? output = null)
165+
public static ScopedFileSystem RealGitRootForPathWrite(string? path, string? output = null)
166166
{
167167
if (path is null && output is null)
168168
return RealWrite;

src/tooling/docs-builder/Commands/DiffCommands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public async Task<int> ValidateRedirects(string? path = null, Cancel ctx = defau
2929
await using var serviceInvoker = new ServiceInvoker(collector);
3030

3131
var service = new LocalChangeTrackingService(logFactory, configurationContext);
32-
var fs = FileSystemFactory.RealForPath(path);
32+
var fs = FileSystemFactory.RealGitRootForPath(path);
3333

3434
serviceInvoker.AddCommand(service, (path, fs),
3535
async static (s, collector, state, _) => await s.ValidateRedirects(collector, state.path, state.fs)

src/tooling/docs-builder/Commands/FormatCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public async Task<int> Format(
4343
await using var serviceInvoker = new ServiceInvoker(collector);
4444

4545
var service = new FormatService(logFactory, configurationContext);
46-
var fs = FileSystemFactory.RealForPath(path);
46+
var fs = FileSystemFactory.RealGitRootForPath(path);
4747

4848
serviceInvoker.AddCommand(service, (path, check, fs),
4949
async static (s, collector, state, ctx) => await s.Format(collector, state.path, state.check, state.fs, ctx)

src/tooling/docs-builder/Commands/IndexCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public async Task<int> Index(
8686
)
8787
{
8888
await using var serviceInvoker = new ServiceInvoker(collector);
89-
var fs = FileSystemFactory.RealForPath(path);
89+
var fs = FileSystemFactory.RealGitRootForPath(path);
9090
var service = new IsolatedIndexService(logFactory, configurationContext, githubActionsService, environmentVariables);
9191
var state = (fs, path,
9292
// endpoint options

src/tooling/docs-builder/Commands/IsolatedBuildCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ public async Task<int> Build(
6262
await using var serviceInvoker = new ServiceInvoker(collector);
6363

6464
var service = new IsolatedBuildService(logFactory, configurationContext, githubActionsService, environmentVariables);
65-
var readFs = inMemory ? FileSystemFactory.InMemory() : FileSystemFactory.RealForPath(path);
65+
var readFs = inMemory ? FileSystemFactory.InMemory() : FileSystemFactory.RealGitRootForPath(path);
6666
// For real builds supply an explicit write FS without .git access; for in-memory null falls back to readFs
67-
var writeFs = inMemory ? null : FileSystemFactory.RealForPathWrite(path, output);
67+
var writeFs = inMemory ? null : FileSystemFactory.RealGitRootForPathWrite(path, output);
6868
var strictCommand = service.IsStrict(strict);
6969

7070
serviceInvoker.AddCommand(service,

src/tooling/docs-builder/Commands/MoveCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public async Task<int> Move(
3838
await using var serviceInvoker = new ServiceInvoker(collector);
3939

4040
var service = new MoveFileService(logFactory, configurationContext);
41-
var fs = FileSystemFactory.RealForPath(path);
41+
var fs = FileSystemFactory.RealGitRootForPath(path);
4242

4343
serviceInvoker.AddCommand(service, (source, target, dryRun, path, fs),
4444
async static (s, collector, state, ctx) => await s.Move(collector, state.source, state.target, state.dryRun, state.path, state.fs, ctx)

src/tooling/docs-builder/Commands/ServeCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal sealed class ServeCommand(ILoggerFactory logFactory, IConfigurationCont
2727
[Command("")]
2828
public async Task Serve(string? path = null, int port = 3000, bool watch = false, Cancel ctx = default)
2929
{
30-
var host = new DocumentationWebHost(logFactory, path, port, FileSystemFactory.RealForPath(path), FileSystemFactory.InMemory(), configurationContext, watch);
30+
var host = new DocumentationWebHost(logFactory, path, port, FileSystemFactory.RealGitRootForPath(path), FileSystemFactory.InMemory(), configurationContext, watch);
3131
await host.RunAsync(ctx);
3232
_logger.LogInformation("Find your documentation at http://localhost:{Port}/{Path}", port,
3333
host.GeneratorState.Generator.DocumentationSet.FirstInterestingUrl.TrimStart('/')

src/tooling/docs-builder/Http/InMemoryBuildState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private async Task ExecuteBuildAsync(string sourcePath, Cancel ct)
169169
// Create a diagnostics collector that streams to our channel
170170
var streamingCollector = new StreamingDiagnosticsCollector(_loggerFactory, this);
171171

172-
var readFs = FileSystemFactory.RealForPath(sourcePath);
172+
var readFs = FileSystemFactory.RealGitRootForPath(sourcePath);
173173
var service = new IsolatedBuildService(_loggerFactory, _configurationContext, new NullCoreService(), SystemEnvironmentVariables.Instance);
174174

175175
_logger.LogInformation("Starting in-memory validation build for {Path}", sourcePath);

src/tooling/docs-builder/Http/StaticWebHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class StaticWebHost
2525
public StaticWebHost(int port, string? path)
2626
{
2727
_contentRoot = path ?? Path.Join(Paths.WorkingDirectoryRoot.FullName, ".artifacts", "assembly");
28-
var fs = FileSystemFactory.RealForPath(path);
28+
var fs = FileSystemFactory.RealGitRootForPath(path);
2929
var dir = fs.DirectoryInfo.New(_contentRoot);
3030
if (!dir.Exists)
3131
throw new Exception($"Can not serve empty directory: {_contentRoot}");

0 commit comments

Comments
 (0)