Skip to contentSkip to conversation

tools: add two local .gitignore files

PATCH Superseded Juergen Gross 2 participants 11 messages Nov 22, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover tools: add two local .gitignore files

After a new build on my system (OpenSUSE Leap 15.5) "git status" will print out:

Untracked files:
(use "git add <file>..." to include in what will be committed)
tools/pygrub/pygrub.egg-info/ tools/python/xen.egg-info/

This small patch series fixes that by adding the related entries to local .gitignore files, while moving the existing global entries for those directories to them.

Juergen Gross (2):
tools/pygrub: add .gitignore file
tools/python: add .gitignore file

 .gitignore              | 4 ----
 tools/pygrub/.gitignore | 2 ++
 tools/python/.gitignore | 4 ++++
 3 files changed, 6 insertions(+), 4 deletions(-)
 create mode 100644 tools/pygrub/.gitignore
 create mode 100644 tools/python/.gitignore
Signature · 1 line
2.35.3
#1 lore raw

PATCH 1/2 tools/pygrub: add .gitignore file

Add a local .gitignore file for tools/pygrub.

As at least on some systems (e.g. OpenSUSE Leap 15.5) the build will produce a tools/pygrub/pygrub.egg-info directory, add it to the new .gitignore file, too.

---
 .gitignore              | 1 -
 tools/pygrub/.gitignore | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 tools/pygrub/.gitignore
.gitignore +0 -1
index 2cea994934..3009545af2 100644
@@ -213,7 +213,6 @@ tools/misc/xencov
 tools/pkg-config/*
 tools/qemu-xen-build
 tools/xentrace/xenalyze
-tools/pygrub/build/*
 tools/python/build/*
 tools/tests/depriv/depriv-fd-checker
 tools/tests/x86_emulator/*.bin
tools/pygrub/.gitignore new file +2 -0
new file mode 100644
index 0000000000..8c64b5dfeb
@@ -0,0 +1,2 @@
+build/*
+pygrub.egg-info/*
Signature · 1 line
2.35.3
#2 lore raw

PATCH 2/2 tools/python: add .gitignore file

In reply to Juergen Gross

Add a local .gitignore file for tools/python.

As at least on some systems (e.g. OpenSUSE Leap 15.5) the build will produce a tools/python/xen.egg-info directory, add it to the new .gitignore file, too.

---
 .gitignore              | 3 ---
 tools/python/.gitignore | 4 ++++
 2 files changed, 4 insertions(+), 3 deletions(-)
 create mode 100644 tools/python/.gitignore
.gitignore +0 -3
index 3009545af2..5b8f23271e 100644
@@ -213,7 +213,6 @@ tools/misc/xencov
 tools/pkg-config/*
 tools/qemu-xen-build
 tools/xentrace/xenalyze
-tools/python/build/*
 tools/tests/depriv/depriv-fd-checker
 tools/tests/x86_emulator/*.bin
 tools/tests/x86_emulator/*.tmp
@@ -370,8 +369,6 @@ tools/ocaml/test/raise_exception
 tools/debugger/kdd/kdd
 tools/firmware/etherboot/ipxe.tar.gz
 tools/firmware/etherboot/ipxe/
-tools/python/xen/lowlevel/xl/_pyxl_types.c
-tools/python/xen/lowlevel/xl/_pyxl_types.h
 tools/xl/xl
 
 docs/txt/misc/*.txt
tools/python/.gitignore new file +4 -0
new file mode 100644
index 0000000000..ffee7b4c4b
@@ -0,0 +1,4 @@
+build/*
+xen.egg-info/*
+xen/lowlevel/xl/_pyxl_types.c
+xen/lowlevel/xl/_pyxl_types.h
Signature · 1 line
2.35.3
#3 lore raw

Re: [PATCH 2/2] tools/python: add .gitignore file

tools/python/.gitignore line 1

Quoted 4 lines · Juergen Gross
tools/python/.gitignore new file +1 -0
@@ -0,0 +1,4 @@
+build/*

Are this and just build/ actually equivalent? Looking at our top-level .gitignore, I see e.g. extras/ and install/*, which I would expect want both treating the same? The form with a wildcard, to me at least, doesn't obviously include the directory itself ...

tools/python/.gitignore line 4

Quoted 3 lines
tools/python/.gitignore new file +3 -0
+xen.egg-info/*
+xen/lowlevel/xl/_pyxl_types.c
+xen/lowlevel/xl/_pyxl_types.h

Since wildcards can be used here, how about just

xen/lowlevel/xl/_pyxl_types.[ch]

?

Jan

#4 lore raw

Re: [PATCH 2/2] tools/python: add .gitignore file

Quoted 10 lines · Jan Beulich

tools/python/.gitignore line 1

Quoted 4 lines · Juergen Gross
tools/python/.gitignore new file +1 -0
@@ -0,0 +1,4 @@
+build/*

Are this and just build/ actually equivalent? Looking at our top-level .gitignore, I see e.g. extras/ and install/*, which I would expect want both treating the same? The form with a wildcard, to me at least, doesn't obviously include the directory itself ...

The .gitignore specification [1] suggests that we should use build/ (same for the new entry), as otherwise entries in subdirectories would not match.

I'm not sure why "git status" doesn't show those files in deeper levels, but maybe I've misread the doc.

Quoted 8 lines

tools/python/.gitignore line 4

Quoted 4 lines
tools/python/.gitignore new file +3 -0
+xen.egg-info/*
+xen/lowlevel/xl/_pyxl_types.c
+xen/lowlevel/xl/_pyxl_types.h

Since wildcards can be used here, how about just

xen/lowlevel/xl/_pyxl_types.[ch]

Fine with me.

Juergen

[1]: https://git-scm.com/docs/gitignore

#5 lore raw

Re: [PATCH 2/2] tools/python: add .gitignore file

Quoted 12 lines · Juergen Gross
Quoted 10 lines · Jan Beulich

tools/python/.gitignore line 1

Quoted 4 lines · Juergen Gross
tools/python/.gitignore new file +1 -0
@@ -0,0 +1,4 @@
+build/*

Are this and just build/ actually equivalent? Looking at our top-level .gitignore, I see e.g. extras/ and install/*, which I would expect want both treating the same? The form with a wildcard, to me at least, doesn't obviously include the directory itself ...

Quoted 2 lines

The .gitignore specification [1] suggests that we should use build/ (same for the new entry), as otherwise entries in subdirectories would not match.

The description there of what a trailing slash means isn't really clear. Nothing is said about anything underneath the specified directory. Also nothing is said about what a trailing /* means towards the named directory.

What _is_ said is that all the new entries here should start with a slash, to avoid matching similarly named subdirectories further into tools/python/. Unless I misunderstand the intention of this .gitignore entry and the goal is to match anywhere in the subtree.

Jan

#6 lore raw

Re: [PATCH 2/2] tools/python: add .gitignore file

Quoted 13 lines · Jan Beulich
Quoted 12 lines · Juergen Gross
Quoted 10 lines · Jan Beulich

tools/python/.gitignore line 1

Quoted 4 lines · Juergen Gross
tools/python/.gitignore new file +1 -0
@@ -0,0 +1,4 @@
+build/*

Are this and just build/ actually equivalent? Looking at our top-level .gitignore, I see e.g. extras/ and install/*, which I would expect want both treating the same? The form with a wildcard, to me at least, doesn't obviously include the directory itself ...

Quoted 4 lines
Quoted 2 lines

The .gitignore specification [1] suggests that we should use build/ (same for the new entry), as otherwise entries in subdirectories would not match.

The description there of what a trailing slash means isn't really clear.

"If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories."

"The pattern foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo"

Quoted 2 lines

Nothing is said about anything underneath the specified directory. Also nothing is said about what a trailing /* means towards the named directory.

"The pattern foo/*, matches foo/test.json (a regular file), foo/bar (a directory), but it does not match foo/bar/hello.c (a regular file), as the asterisk in the pattern does not match bar/hello.c which has a slash in it."

Quoted 4 lines

What _is_ said is that all the new entries here should start with a slash, to avoid matching similarly named subdirectories further into tools/python/. Unless I misunderstand the intention of this .gitignore entry and the goal is to match anywhere in the subtree.

You are right, I should change that.

Juergen

#7 lore raw

Re: [PATCH 2/2] tools/python: add .gitignore file

Quoted 17 lines · Juergen Gross
Quoted 16 lines · Jan Beulich
Quoted 14 lines · Juergen Gross
Quoted 10 lines · Jan Beulich

tools/python/.gitignore line 1

Quoted 4 lines · Juergen Gross
tools/python/.gitignore new file +1 -0
@@ -0,0 +1,4 @@
+build/*

Are this and just build/ actually equivalent? Looking at our top-level .gitignore, I see e.g. extras/ and install/*, which I would expect want both treating the same? The form with a wildcard, to me at least, doesn't obviously include the directory itself ...

The .gitignore specification [1] suggests that we should use build/ (same for the new entry), as otherwise entries in subdirectories would not match.

Quoted 7 lines
Quoted 1 line

The description there of what a trailing slash means isn't really clear.

"If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories."

"The pattern foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo"

But this is all about entries named "foo". Nothing is said about whether foo/ also includes foo/bar.c.

Quoted 6 lines
Quoted 2 lines

Nothing is said about anything underneath the specified directory. Also nothing is said about what a trailing /* means towards the named directory.

"The pattern foo/*, matches foo/test.json (a regular file), foo/bar (a directory), but it does not match foo/bar/hello.c (a regular file), as the asterisk in the pattern does not match bar/hello.c which has a slash in it."

Similarly here - nothing is said about foo itself. Yet from us successfully using foo/* entries I derive that they actually cover foo as well, no matter whether that's actually sensible.

Jan

#8 lore raw

Re: [PATCH 2/2] tools/python: add .gitignore file

Quoted 20 lines · Jan Beulich
Quoted 19 lines · Juergen Gross
Quoted 17 lines · Jan Beulich
Quoted 12 lines · Juergen Gross
Quoted 10 lines · Jan Beulich

tools/python/.gitignore line 1

Quoted 4 lines · Juergen Gross
tools/python/.gitignore new file +1 -0
@@ -0,0 +1,4 @@
+build/*

Are this and just build/ actually equivalent? Looking at our top-level .gitignore, I see e.g. extras/ and install/*, which I would expect want both treating the same? The form with a wildcard, to me at least, doesn't obviously include the directory itself ...

Quoted 2 lines

The .gitignore specification [1] suggests that we should use build/ (same for the new entry), as otherwise entries in subdirectories would not match.

The description there of what a trailing slash means isn't really clear.

Quoted 8 lines
Quoted 5 lines

"If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories."

"The pattern foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo"

But this is all about entries named "foo". Nothing is said about whether foo/ also includes foo/bar.c.

"... and paths underneath it" is rather clear IMHO.

Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

Nothing is said about anything underneath the specified directory. Also nothing is said about what a trailing /* means towards the named directory.

"The pattern foo/*, matches foo/test.json (a regular file), foo/bar (a directory), but it does not match foo/bar/hello.c (a regular file), as the asterisk in the pattern does not match bar/hello.c which has a slash in it."

Similarly here - nothing is said about foo itself. Yet from us successfully using foo/* entries I derive that they actually cover foo as well, no matter whether that's actually sensible.

I guess this is covered by "*" matching an empty string, too. I agree that this isn't spelled out explicitly anywhere, but it can be implied from:

"The pattern hello.* matches any file or directory whose name begins with hello."

I agree this should be mentioned explicitly to be the case.

Juergen

#9 lore raw

Re: [PATCH 2/2] tools/python: add .gitignore file

Quoted 24 lines · Juergen Gross
Quoted 23 lines · Jan Beulich
Quoted 22 lines · Juergen Gross
Quoted 13 lines · Jan Beulich
Quoted 12 lines · Juergen Gross
Quoted 10 lines · Jan Beulich

tools/python/.gitignore line 1

Quoted 4 lines · Juergen Gross
tools/python/.gitignore new file +1 -0
@@ -0,0 +1,4 @@
+build/*

Are this and just build/ actually equivalent? Looking at our top-level .gitignore, I see e.g. extras/ and install/*, which I would expect want both treating the same? The form with a wildcard, to me at least, doesn't obviously include the directory itself ...

Quoted 4 lines
Quoted 2 lines

The .gitignore specification [1] suggests that we should use build/ (same for the new entry), as otherwise entries in subdirectories would not match.

The description there of what a trailing slash means isn't really clear.

"If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories."

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

"The pattern foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo"

But this is all about entries named "foo". Nothing is said about whether foo/ also includes foo/bar.c.

"... and paths underneath it" is rather clear IMHO.

Considering other text - no. To me is means other directories named foo/, e.g. bar/foo/.

Jan

#10 lore raw

Re: [PATCH 2/2] tools/python: add .gitignore file

In reply to Jan Beulich
Quoted 32 lines · Jan Beulich
Quoted 17 lines · Juergen Gross
Quoted 16 lines · Jan Beulich
Quoted 14 lines · Juergen Gross
Quoted 10 lines · Jan Beulich

tools/python/.gitignore line 1

Quoted 4 lines · Juergen Gross
tools/python/.gitignore new file +1 -0
@@ -0,0 +1,4 @@
+build/*

Are this and just build/ actually equivalent? Looking at our top-level .gitignore, I see e.g. extras/ and install/*, which I would expect want both treating the same? The form with a wildcard, to me at least, doesn't obviously include the directory itself ...

The .gitignore specification [1] suggests that we should use build/ (same for the new entry), as otherwise entries in subdirectories would not match.

Quoted 7 lines
Quoted 1 line

The description there of what a trailing slash means isn't really clear.

"If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories."

"The pattern foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo"

But this is all about entries named "foo". Nothing is said about whether foo/ also includes foo/bar.c.

Quoted 3 lines
Quoted 2 lines

Nothing is said about anything underneath the specified directory. Also nothing is said about what a trailing /* means towards the named directory.

Quoted 7 lines
Quoted 3 lines

"The pattern foo/*, matches foo/test.json (a regular file), foo/bar (a directory), but it does not match foo/bar/hello.c (a regular file), as the asterisk in the pattern does not match bar/hello.c which has a slash in it."

Similarly here - nothing is said about foo itself. Yet from us successfully using foo/* entries I derive that they actually cover foo as well, no matter whether that's actually sensible.

This can all be tested rather easily with "git check-ignore" (assuming that git itself is trusted to act correctly).

My tests were done with git version 2.35.3

This test suggests that "/build/*" won't match with "build", but with "build/x" and "build/x/y".

"/build/" matches with "build", "build/x" and "build/x/y".

So using "/build/" seems to be the pattern to use.

Juergen