From ad7a880fc166051267202f870896f8f27d6999c8 Mon Sep 17 00:00:00 2001 From: Spencer Date: Sun, 8 Jun 2025 16:37:47 +0000 Subject: [PATCH] --- doc/forum/Import_-_Changing_Largefiles.mdwn | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 doc/forum/Import_-_Changing_Largefiles.mdwn diff --git a/doc/forum/Import_-_Changing_Largefiles.mdwn b/doc/forum/Import_-_Changing_Largefiles.mdwn new file mode 100644 index 0000000000..a49fe3d970 --- /dev/null +++ b/doc/forum/Import_-_Changing_Largefiles.mdwn @@ -0,0 +1,20 @@ +# Changing Largefile Specification for Imported Trees + +If you want files to be large/small *after* already importing a tree from an `importtree` enabled remote, well, it appears you can't. + +I tried removing the imported branch via `git branch -d --remote /`. +While this produces a new clean import commit upon running `import` again, it does *not* respect changes to `.gitattributes`. +Instead, `git-annex` seems to hold onto information about which files were large/small in a given special remote. +So, the only way to change what are considered large files and small files is to create a new special remote entirely :/ + +For most people, this should not be too problematic since the history of imported trees isn't too important, but for some diffs on an external tree may be valuable. +Is there any interest in addressing this issue? +For a better understanding, here is a MWE to reproduce this: + +1. Create an `importtree` enabled special remote for a fresh repo without a `.gitattributes` file (or at least one without `annex.largefiles` attributes) +1. Import (e.g. `gx import -f tree main`) from this tree and note that all files are considered large (e.g. `git log --raw tree/main` -> `git show `) +1. Modify/create a local `.gitattributes` file (and add it to the index) that would specify one of the tree files as small (i.e. `annex.largefiles` does *not* match) +1. Attempt new import, or do `git branch -d --remote tree/main` and perform new import. +1. Note that all files are still considered large. + +Maybe there's another way of fixing this that I don't know about, but as far as I know, from this point you have to delete the special remote and redo the above now with the desired `.gitattributes` file staged for files in this external tree to be imported as small.