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

ugit properties should be aware if the folder is a git folder. #198

Closed
trackd opened this issue Oct 26, 2023 · 1 comment
Closed

ugit properties should be aware if the folder is a git folder. #198

trackd opened this issue Oct 26, 2023 · 1 comment

Comments

@trackd
Copy link

trackd commented Oct 26, 2023

ugit should not assume that all files are git files.
either it should look for .git folders and/or configurable paths where the properties are active.

Example

Get-Item -Path C:\Windows\notepad.exe | Select-Object *
WARNING: 'C:\Windows' is not a git repository
WARNING: 'C:\Windows' is not a git repository
WARNING: 'C:\Windows' is not a git repository
WARNING: 'C:\Windows' is not a git repository
WARNING: 'C:\Windows' is not a git repository
WARNING: 'C:\Windows' is not a git repository
WARNING: 'C:\Windows' is not a git repository
WARNING: 'C:\Windows' is not a git repository
WARNING: 'C:\Windows' is not a git repository
WARNING: 'C:\Windows' is not a git repository

Get-Item -Path C:\Windows\notepad.exe | gm -Type AliasProperty,ScriptMethod,ScriptProperty

   TypeName: System.IO.FileInfo

Name          MemberType     Definition
----          ----------     ----------
Changes       AliasProperty  Changes = GitChanges
Diff          AliasProperty  Diff = GitDiff
GitDifference AliasProperty  GitDifference = GitDiff
GitHistory    AliasProperty  GitHistory = GitChanges
GitLog        AliasProperty  GitLog = GitLogs
HasChanged    AliasProperty  HasChanged = GitDirty
HasChanges    AliasProperty  HasChanges = GitDirty
History       AliasProperty  History = GitChanges
IsUnstaged    AliasProperty  IsUnstaged = GitDirty
Logs          AliasProperty  Logs = GitLogs
Target        AliasProperty  Target = LinkTarget
GitChanges    ScriptMethod   System.Object GitChanges();
BaseName      ScriptProperty System.Object BaseName {get=if ($this.Extension.Length -gt 0){$this.Name.Remove($this.Name.Length - $this.Extension.Length)}else{$this.Name…
GitDiff       ScriptProperty System.Object GitDiff {get=Push-Location $this.Directory…
GitDirty      ScriptProperty System.Object GitDirty {get=Push-Location $this.Directory…
GitLogs       ScriptProperty System.Object GitLogs {get=Push-Location $this.Directory…
VersionInfo   ScriptProperty System.Object VersionInfo {get=[System.Diagnostics.FileVersionInfo]::GetVersionInfo($this.FullName);}
@StartAutomating
Copy link
Owner

@trackd I hear what you're asking.

Unfortunately, it's there's not a way to only apply type extensions to files if they are in a git directory (and there are benefits to being able to get file-related info from git).

What I can do is this: remove the warnings.

Sound acceptable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants