.gitignore: Keep track of archived files as they are added to a new git repo
PATCH 1/1 .gitignore: Keep track of archived files as they are added to a new git repo
From: Like Xu <[email protected]>
With thousands of commits going into mainline each development cycle, the metadata .git folder size is gradually expanding (1GB+), and for some developers (most likely testers) who don't care about the lengthy git-log, they just use git-archive to distribute a certain version of code (~210MB) and rebuild git repository from anywhere for further code changes, e.g.
$ git init && git add . -A
Then unfortunately, the file tracking metadata from the original git-repo using "git add -f" will also be lost, to the point where part of source files wrapped by git-archive may be accidentally cleaned up:
$ git clean -nxdf Would remove Documentation/devicetree/bindings/.yamllint Would remove drivers/clk/.kunitconfig Would remove drivers/gpu/drm/tests/.kunitconfig Would remove drivers/hid/.kunitconfig Would remove fs/ext4/.kunitconfig Would remove fs/fat/.kunitconfig Would remove kernel/kcsan/.kunitconfig Would remove lib/kunit/.kunitconfig Would remove mm/kfence/.kunitconfig Would remove tools/testing/selftests/arm64/tags/ Would remove tools/testing/selftests/kvm/.gitignore Would remove tools/testing/selftests/kvm/Makefile Would remove tools/testing/selftests/kvm/config Would remove tools/testing/selftests/kvm/settings
This asymmetry is very troubling to those users since finding out which files to track with "git add -f" clearly requires priori knowledge on various subsystems. The eradication of this little issue requires naturally making git-init aware of all .gitignore restrictions at different file tree hierarchies. Similar issues can be troubleshot with "git check-ignore -v" for any mistakenly cleaned files.
--- .gitignore | 2 ++ tools/testing/selftests/arm64/.gitignore | 2 ++ tools/testing/selftests/kvm/.gitignore | 4 ++++ 3 files changed, 8 insertions(+) create mode 100644 tools/testing/selftests/arm64/.gitignore
.gitignore +2 -0
@@ -102,6 +102,8 @@ modules.order !.gitignore !.mailmap !.rustfmt.toml +!.yamllint +!.kunitconfig # # Generated include files
tools/testing/selftests/arm64/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +!tags
tools/testing/selftests/kvm/.gitignore +4 -0
@@ -5,3 +5,7 @@ !*.h !*.S !*.sh +!.gitignore +!Makefile +!settings +!config
Signature · 1 line
2.39.1
Quoted 31 lines · Like Xu
From: Like Xu <[email protected]>
With thousands of commits going into mainline each development cycle, the metadata .git folder size is gradually expanding (1GB+), and for some developers (most likely testers) who don't care about the lengthy git-log, they just use git-archive to distribute a certain version of code (~210MB) and rebuild git repository from anywhere for further code changes, e.g.
$ git init && git add . -AThen unfortunately, the file tracking metadata from the original git-repo using "git add -f" will also be lost, to the point where part of source files wrapped by git-archive may be accidentally cleaned up:
$ git clean -nxdf Would remove Documentation/devicetree/bindings/.yamllint Would remove drivers/clk/.kunitconfig Would remove drivers/gpu/drm/tests/.kunitconfig Would remove drivers/hid/.kunitconfig Would remove fs/ext4/.kunitconfig Would remove fs/fat/.kunitconfig Would remove kernel/kcsan/.kunitconfig Would remove lib/kunit/.kunitconfig Would remove mm/kfence/.kunitconfig Would remove tools/testing/selftests/arm64/tags/ Would remove tools/testing/selftests/kvm/.gitignore Would remove tools/testing/selftests/kvm/Makefile Would remove tools/testing/selftests/kvm/config Would remove tools/testing/selftests/kvm/settings
Quoted 8 lines
This asymmetry is very troubling to those users since finding out which files to track with "git add -f" clearly requires priori knowledge on various subsystems. The eradication of this little issue requires naturally making git-init aware of all .gitignore restrictions at different file tree hierarchies. Similar issues can be troubleshot with "git check-ignore -v" for any mistakenly cleaned files.
Signed-off-by Like Xu <[email protected]>
tools/testing/selftests/kvm/.gitignore is already meh.
I hope somebody will submit a better fix.
Quoted 44 lines
--- .gitignore | 2 ++ tools/testing/selftests/arm64/.gitignore | 2 ++ tools/testing/selftests/kvm/.gitignore | 4 ++++ 3 files changed, 8 insertions(+) create mode 100644 tools/testing/selftests/arm64/.gitignore.gitignore +2
-0@@ -102,6 +102,8 @@ modules.order !.gitignore !.mailmap !.rustfmt.toml +!.yamllint +!.kunitconfig # # Generated include filestools/testing/selftests/arm64/.gitignore new file +2
-0@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +!tagstools/testing/selftests/kvm/.gitignore +4
-1@@ -5,3 +5,7 @@ !*.h !*.S !*.sh +!.gitignore +!Makefile +!settings +!config --2.39.1
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 39 lines · Masahiro Yamada
Quoted 38 lines · Like Xu
From: Like Xu <[email protected]>
With thousands of commits going into mainline each development cycle, the metadata .git folder size is gradually expanding (1GB+), and for some developers (most likely testers) who don't care about the lengthy git-log, they just use git-archive to distribute a certain version of code (~210MB) and rebuild git repository from anywhere for further code changes, e.g.
$ git init && git add . -AThen unfortunately, the file tracking metadata from the original git-repo using "git add -f" will also be lost, to the point where part of source files wrapped by git-archive may be accidentally cleaned up:
$ git clean -nxdf Would remove Documentation/devicetree/bindings/.yamllint Would remove drivers/clk/.kunitconfig Would remove drivers/gpu/drm/tests/.kunitconfig Would remove drivers/hid/.kunitconfig Would remove fs/ext4/.kunitconfig Would remove fs/fat/.kunitconfig Would remove kernel/kcsan/.kunitconfig Would remove lib/kunit/.kunitconfig Would remove mm/kfence/.kunitconfig Would remove tools/testing/selftests/arm64/tags/ Would remove tools/testing/selftests/kvm/.gitignore Would remove tools/testing/selftests/kvm/Makefile Would remove tools/testing/selftests/kvm/config Would remove tools/testing/selftests/kvm/settingsThis asymmetry is very troubling to those users since finding out which files to track with "git add -f" clearly requires priori knowledge on various subsystems. The eradication of this little issue requires naturally making git-init aware of all .gitignore restrictions at different file tree hierarchies. Similar issues can be troubleshot with "git check-ignore -v" for any mistakenly cleaned files.
Quoted 9 lines
Quoted 1 line
Signed-off-by Like Xu <[email protected]>
tools/testing/selftests/kvm/.gitignoreis already meh.I hope somebody will submit a better fix.
If we don't append "!.gitignore" to tools/testing/selftests/kvm/.gitignore, the same issue still exists due to the "*" entry in the same file:
# git version 2.31.1 $ git clean -nxdf Would remove tools/testing/selftests/kvm/.gitignore
Is there a better move for this kind of git usage, or could any maintainer pick this up? Thanks.
Quoted 48 lines
Quoted 46 lines
--- .gitignore | 2 ++ tools/testing/selftests/arm64/.gitignore | 2 ++ tools/testing/selftests/kvm/.gitignore | 4 ++++ 3 files changed, 8 insertions(+)create mode 100644
tools/testing/selftests/arm64/.gitignore.gitignore +2
-0@@ -102,6 +102,8 @@ modules.order !.gitignore !.mailmap !.rustfmt.toml +!.yamllint +!.kunitconfig # # Generated include filestools/testing/selftests/arm64/.gitignore new file +2
-0@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +!tagstools/testing/selftests/kvm/.gitignore +4
-1@@ -5,3 +5,7 @@ !*.h !*.S !*.sh +!.gitignore +!Makefile +!settings +!config --2.39.1
Quoted 8 lines · Like Xu
From: Like Xu <[email protected]>
With thousands of commits going into mainline each development cycle, the metadata .git folder size is gradually expanding (1GB+), and for some developers (most likely testers) who don't care about the lengthy git-log, they just use git-archive to distribute a certain version of code (~210MB) and rebuild git repository from anywhere for further code changes, e.g.
Quoted 8 lines
$ git init && git add . -AThen unfortunately, the file tracking metadata from the original git-repo using "git add -f" will also be lost, to the point where part of source files wrapped by git-archive may be accidentally cleaned up:
$ git clean -nxdf Would remove Documentation/devicetree/bindings/.yamllint
https://lore.kernel.org/all/[email protected]/
Best regards,
Krzysztof