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

Cannot process files that have names beginning with a dot #75

Closed
leni8ec opened this issue Apr 15, 2020 · 7 comments
Closed

Cannot process files that have names beginning with a dot #75

leni8ec opened this issue Apr 15, 2020 · 7 comments

Comments

@leni8ec
Copy link

leni8ec commented Apr 15, 2020

This command can not be performed:
git filter-repo --path-rename Assets/.gitattributes:.gitattributes

I tried to specify the files in quotation marks ` or ", but this had no effect.
The problem was solved only using the same command, but through the file:
git filter-repo --paths-from-file ..\file_name.txt

Git 2.26.0.windows.1, Windows 10, PowerShell 7

PS D:\Project> git filter-repo --path-rename Assets/.gitattributes:.gitattributes
Traceback (most recent call last):
  File "C:\Scoop\apps\git-filter-repo\2.26.0\git-filter-repo", line 3908, in <module>
    args = FilteringOptions.parse_args(sys.argv[1:])
  File "C:\Scoop\apps\git-filter-repo\2.26.0\git-filter-repo", line 2160, in parse_args
    args = parser.parse_args(input_args)
  File "C:\Scoop\apps\python\current\lib\argparse.py", line 1768, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "C:\Scoop\apps\python\current\lib\argparse.py", line 1800, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "C:\Scoop\apps\python\current\lib\argparse.py", line 2006, in _parse_known_args
    start_index = consume_optional(start_index)
  File "C:\Scoop\apps\python\current\lib\argparse.py", line 1946, in consume_optional
    take_action(action, args, option_string)
  File "C:\Scoop\apps\python\current\lib\argparse.py", line 1874, in take_action
    action(self, namespace, argument_values, option_string)
  File "C:\Scoop\apps\git-filter-repo\2.26.0\git-filter-repo", line 1630, in __call__
    if values[0] and values[1] and not (
IndexError: list index out of range
.gitattributes : The term '.gitattributes' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
 name, or if a path was included, verify that the path is correct and try again.
At line:1 char:95
+ ... it-filter-repo.ps1 --path-rename Assets\.gitattributes;.gitattributes
+                                                            ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (.gitattributes:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
@newren
Copy link
Owner

newren commented Apr 20, 2020

At line:1 char:95
+ ... it-filter-repo.ps1 --path-rename Assets\.gitattributes;.gitattributes
+                                                            ~~~~~~~~~~~~~~

I see here that the error message uses a semicolon rather than a colon. Does this mean you actually mis-typed the command and used the wrong character here, or does it mean that PowerShell is screwy in yet another way and that it unhelpfully transliterated the colon into a semicolon for you? (If so, this seems like it'd be at least the third way that PowerShell screws things up for users; see #36 and #56)

@newren
Copy link
Owner

newren commented Apr 28, 2020

No response; I'll assume you just typoed the ':' into a ';' based on the error message and close this out. Let me know if that's a bad assumption and you have any more information.

@newren newren closed this as completed Apr 28, 2020
@unennhexium
Copy link

unennhexium commented Apr 3, 2023

I'm facing with this right now.

Error: --path-rename expects one colon in its argument: <old_name:new_name>.
Tool Name Version Note
OS Windows 11 22H2 build 22621.1105 Pro for Workstation
GIT GIT for Windows 2.40.0.windows.1 Bundled Git Bash
Python Python3 3.11.2 Microsoft Store
Terminal Emulator Windows Terminal 1.1610262.0 Microsoft Store

image

@unennhexium
Copy link

unennhexium commented Apr 3, 2023

And like @leni8ec, I was able to get this to work using a --paths-from-file with:

.github/workflows/stable-windows-man-arch.yml==>.github/workflows/stable-windows-manual.yml

image

@newren
Copy link
Owner

newren commented Apr 3, 2023

And what happens if you run

$ echo git filter-repo --path-rename .github/workflows/stable-windows-man-arch.yml:.github/workflows/stable-windows-manual.yml

? Note that I have put an echo at the front of the command, which means it'll run a different command that will simply print out what was passed to it.

@unennhexium
Copy link

Output:

git filter-repo --path-rename .github/workflows/stable-windows-man-arch.yml:.github/workflows/stable-windows-manual.yml

image

@newren
Copy link
Owner

newren commented Apr 3, 2023

Wow, so you clearly have a single colon in the line you typed, and echo doesn't munge it, but filter-repo clearly doesn't see a colon. What happens if you change your command from

git filter-repo --path-rename .github/workflows/stable-windows-man-arch.yml:.github/workflows/stable-windows-manual.yml

to

python3 git-filter-repo --path-rename .github/workflows/stable-windows-man-arch.yml:.github/workflows/stable-windows-manual.yml

? Do you still get the --path-rename expects one colon in its argument error?

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

3 participants