Closed
Description
It appears one can add a file outside of the repo using the insert-beginning
demo.
Steps to reproduce
mkdir insert-outside && cd insert-outside
git init && git commit --allow-empty -m init
echo outside! > ../an-outside-file
insert-beginning --file ../an-outside-file
This will result in something like
$ git log -p
commit 61116276d40336ab23974003597ed167d36bf2d6 (HEAD -> main)
Author: Erik Cervin Edin <[email protected]>
Date: Tue Jun 15 16:34:50 2021 +0200
init
diff --git a/../an-outside-file b/../an-outside-file
new file mode 100755
index 0000000..b454f01
--- /dev/null
+++ b/../an-outside-file
@@ -0,0 +1 @@
+outside!
Trying to undo results in
$ git filter-repo --paths ../an-outside-file --invert
Parsed 1 commitserror: invalid path '../an-outside-file'
fatal: Could not reset index file to revision 'HEAD'.
or
$ git filter-repo --path-rename "../an-outside-file:an-outside-file"
Error: Invalid path component '..' found in '../an-outside-file:an-outside-file'
It seems possible to really mess up a repository doing this.