linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] .gitignore: Keep track of archived files as they are added to a new git repo
@ 2023-01-30  9:04 Like Xu
  2023-01-30 16:06 ` Masahiro Yamada
  2023-01-31 19:10 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 4+ messages in thread
From: Like Xu @ 2023-01-30  9:04 UTC (permalink / raw)
  To: Will Deacon, Paolo Bonzini, Masahiro Yamada
  Cc: Catalin Marinas, Shuah Khan, Miguel Ojeda, Wedson Almeida Filho,
	Alex Gaynor, Kees Cook, Andrew Davis, linux-kernel,
	linux-arm-kernel, linux-kselftest, kvm

From: Like Xu <likexu@tencent.com>

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.

Signed-off-by: Like Xu <likexu@tencent.com>
---
 .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

diff --git a/.gitignore b/.gitignore
index 20dce5c3b9e0..fa39e98caee3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -102,6 +102,8 @@ modules.order
 !.gitignore
 !.mailmap
 !.rustfmt.toml
+!.yamllint
+!.kunitconfig
 
 #
 # Generated include files
diff --git a/tools/testing/selftests/arm64/.gitignore b/tools/testing/selftests/arm64/.gitignore
new file mode 100644
index 000000000000..135d709d2d65
--- /dev/null
+++ b/tools/testing/selftests/arm64/.gitignore
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+!tags
diff --git a/tools/testing/selftests/kvm/.gitignore b/tools/testing/selftests/kvm/.gitignore
index 6d9381d60172..96561c8e06e0 100644
--- a/tools/testing/selftests/kvm/.gitignore
+++ b/tools/testing/selftests/kvm/.gitignore
@@ -5,3 +5,7 @@
 !*.h
 !*.S
 !*.sh
+!.gitignore
+!Makefile
+!settings
+!config
\ No newline at end of file
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] .gitignore: Keep track of archived files as they are added to a new git repo
  2023-01-30  9:04 [PATCH] .gitignore: Keep track of archived files as they are added to a new git repo Like Xu
@ 2023-01-30 16:06 ` Masahiro Yamada
  2023-01-31  9:47   ` Like Xu
  2023-01-31 19:10 ` Krzysztof Kozlowski
  1 sibling, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2023-01-30 16:06 UTC (permalink / raw)
  To: Like Xu
  Cc: Will Deacon, Paolo Bonzini, Catalin Marinas, Shuah Khan,
	Miguel Ojeda, Wedson Almeida Filho, Alex Gaynor, Kees Cook,
	Andrew Davis, linux-kernel, linux-arm-kernel, linux-kselftest,
	kvm

On Mon, Jan 30, 2023 at 6:04 PM Like Xu <like.xu.linux@gmail.com> wrote:
>
> From: Like Xu <likexu@tencent.com>
>
> 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.
>
> Signed-off-by: Like Xu <likexu@tencent.com>



tools/testing/selftests/kvm/.gitignore is already meh.

I hope somebody will submit a better fix.




> ---
>  .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
>
> diff --git a/.gitignore b/.gitignore
> index 20dce5c3b9e0..fa39e98caee3 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -102,6 +102,8 @@ modules.order
>  !.gitignore
>  !.mailmap
>  !.rustfmt.toml
> +!.yamllint
> +!.kunitconfig
>
>  #
>  # Generated include files
> diff --git a/tools/testing/selftests/arm64/.gitignore b/tools/testing/selftests/arm64/.gitignore
> new file mode 100644
> index 000000000000..135d709d2d65
> --- /dev/null
> +++ b/tools/testing/selftests/arm64/.gitignore
> @@ -0,0 +1,2 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +!tags
> diff --git a/tools/testing/selftests/kvm/.gitignore b/tools/testing/selftests/kvm/.gitignore
> index 6d9381d60172..96561c8e06e0 100644
> --- a/tools/testing/selftests/kvm/.gitignore
> +++ b/tools/testing/selftests/kvm/.gitignore
> @@ -5,3 +5,7 @@
>  !*.h
>  !*.S
>  !*.sh
> +!.gitignore
> +!Makefile
> +!settings
> +!config
> \ No newline at end of file
> --
> 2.39.1
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] .gitignore: Keep track of archived files as they are added to a new git repo
  2023-01-30 16:06 ` Masahiro Yamada
@ 2023-01-31  9:47   ` Like Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Like Xu @ 2023-01-31  9:47 UTC (permalink / raw)
  To: Masahiro Yamada, Paolo Bonzini
  Cc: Catalin Marinas, Shuah Khan, Miguel Ojeda, Wedson Almeida Filho,
	Alex Gaynor, Kees Cook, Andrew Davis, linux-kernel,
	linux-arm-kernel, linux-kselftest, kvm, Will Deacon

On 31/1/2023 12:06 am, Masahiro Yamada wrote:
> On Mon, Jan 30, 2023 at 6:04 PM Like Xu <like.xu.linux@gmail.com> wrote:
>>
>> From: Like Xu <likexu@tencent.com>
>>
>> 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.
>>
>> Signed-off-by: Like Xu <likexu@tencent.com>
> 
> 
> 
> tools/testing/selftests/kvm/.gitignore is 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.

> 
> 
>> ---
>>   .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
>>
>> diff --git a/.gitignore b/.gitignore
>> index 20dce5c3b9e0..fa39e98caee3 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -102,6 +102,8 @@ modules.order
>>   !.gitignore
>>   !.mailmap
>>   !.rustfmt.toml
>> +!.yamllint
>> +!.kunitconfig
>>
>>   #
>>   # Generated include files
>> diff --git a/tools/testing/selftests/arm64/.gitignore b/tools/testing/selftests/arm64/.gitignore
>> new file mode 100644
>> index 000000000000..135d709d2d65
>> --- /dev/null
>> +++ b/tools/testing/selftests/arm64/.gitignore
>> @@ -0,0 +1,2 @@
>> +# SPDX-License-Identifier: GPL-2.0-only
>> +!tags
>> diff --git a/tools/testing/selftests/kvm/.gitignore b/tools/testing/selftests/kvm/.gitignore
>> index 6d9381d60172..96561c8e06e0 100644
>> --- a/tools/testing/selftests/kvm/.gitignore
>> +++ b/tools/testing/selftests/kvm/.gitignore
>> @@ -5,3 +5,7 @@
>>   !*.h
>>   !*.S
>>   !*.sh
>> +!.gitignore
>> +!Makefile
>> +!settings
>> +!config
>> \ No newline at end of file
>> --
>> 2.39.1
>>
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] .gitignore: Keep track of archived files as they are added to a new git repo
  2023-01-30  9:04 [PATCH] .gitignore: Keep track of archived files as they are added to a new git repo Like Xu
  2023-01-30 16:06 ` Masahiro Yamada
@ 2023-01-31 19:10 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-31 19:10 UTC (permalink / raw)
  To: Like Xu, Will Deacon, Paolo Bonzini, Masahiro Yamada
  Cc: Catalin Marinas, Shuah Khan, Miguel Ojeda, Wedson Almeida Filho,
	Alex Gaynor, Kees Cook, Andrew Davis, linux-kernel,
	linux-arm-kernel, linux-kselftest, kvm

On 30/01/2023 10:04, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
> 
> 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

https://lore.kernel.org/all/20230127150225.18148-1-andriy.shevchenko@linux.intel.com/

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-31 19:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30  9:04 [PATCH] .gitignore: Keep track of archived files as they are added to a new git repo Like Xu
2023-01-30 16:06 ` Masahiro Yamada
2023-01-31  9:47   ` Like Xu
2023-01-31 19:10 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).