Ignore Visual Studio's Temp Files While Working with PG on Windows

Started by Yasirover 1 year ago19 messages
#1Yasir
yasir.hussain.shah@gmail.com
1 attachment(s)

Hi Hackers,

I have been playing with PG on the Windows platform recently. An annoying
thing I faced is that a lot of Visual Studio's temp files kept appearing in
git changed files. Therefore, I am submitting this very trivial patch to
ignore these temp files.

Looking forward to the PG guru's guidance!

Regards...

Yasir Hussain
Principal Software Engineer
Bitnine Global Inc.

Attachments:

v1-ignore-visualstudio-temp-files-while-working-on-windows.patchtext/x-patch; charset=US-ASCII; name=v1-ignore-visualstudio-temp-files-while-working-on-windows.patchDownload
diff --git a/.gitignore b/.gitignore
index 4e911395fe..527e1d8935 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,3 +43,4 @@ lib*.pc
 /Release/
 /tmp_install/
 /portlock/
+/.vs/
#2Yasir
yasir.hussain.shah@gmail.com
In reply to: Yasir (#1)
1 attachment(s)
Fwd: Ignore Visual Studio's Temp Files While Working with PG on Windows

Hi Hackers,

I have been playing with PG on the Windows platform recently. An annoying
thing I faced is that a lot of Visual Studio's temp files kept appearing in
git changed files. Therefore, I am submitting this very trivial patch to
ignore these temp files.

Looking forward to the PG guru's guidance!

Regards...

Yasir Hussain
Principal Software Engineer
Bitnine Global Inc.

Attachments:

v1-ignore-visualstudio-temp-files-while-working-on-windows.patchapplication/x-patch; name=v1-ignore-visualstudio-temp-files-while-working-on-windows.patchDownload
diff --git a/.gitignore b/.gitignore
index 4e911395fe..527e1d8935 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,3 +43,4 @@ lib*.pc
 /Release/
 /tmp_install/
 /portlock/
+/.vs/
#3Peter Eisentraut
peter@eisentraut.org
In reply to: Yasir (#1)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

On 17.05.24 08:09, Yasir wrote:

I have been playing with PG on the Windows platform recently. An
annoying thing I faced is that a lot of Visual Studio's temp files kept
appearing in git changed files. Therefore, I am submitting this very
trivial patch to ignore these temp files.

Our general recommendation is that you put such things into your
personal global git ignore file.

For example, I have in ~/.gitconfig

[core]
excludesFile = ~/.gitexcludes

and then in ~/.gitexcludes I have various ignores that are specific to
my local tooling.

That way we don't have to maintain ignore lists for all the tools in the
world in the PostgreSQL source tree.

#4Yasir
yasir.hussain.shah@gmail.com
In reply to: Peter Eisentraut (#3)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

Nice approach! Thankyou Peter for the guidance.

Regards...

Yasir

On Fri, May 17, 2024 at 11:34 AM Peter Eisentraut <peter@eisentraut.org>
wrote:

Show quoted text

On 17.05.24 08:09, Yasir wrote:

I have been playing with PG on the Windows platform recently. An
annoying thing I faced is that a lot of Visual Studio's temp files kept
appearing in git changed files. Therefore, I am submitting this very
trivial patch to ignore these temp files.

Our general recommendation is that you put such things into your
personal global git ignore file.

For example, I have in ~/.gitconfig

[core]
excludesFile = ~/.gitexcludes

and then in ~/.gitexcludes I have various ignores that are specific to
my local tooling.

That way we don't have to maintain ignore lists for all the tools in the
world in the PostgreSQL source tree.

#5Andrew Dunstan
andrew@dunslane.net
In reply to: Peter Eisentraut (#3)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

On 2024-05-17 Fr 02:34, Peter Eisentraut wrote:

On 17.05.24 08:09, Yasir wrote:

I have been playing with PG on the Windows platform recently. An
annoying thing I faced is that a lot of Visual Studio's temp files
kept appearing in git changed files. Therefore, I am submitting this
very trivial patch to ignore these temp files.

Our general recommendation is that you put such things into your
personal global git ignore file.

For example, I have in ~/.gitconfig

[core]
        excludesFile = ~/.gitexcludes

and then in ~/.gitexcludes I have various ignores that are specific to
my local tooling.

That way we don't have to maintain ignore lists for all the tools in
the world in the PostgreSQL source tree.

or if you want something repo-specific, you can add entries to
.git/info/exclude

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#6Josef Šimánek
josef.simanek@gmail.com
In reply to: Yasir (#1)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

pá 17. 5. 2024 v 8:09 odesílatel Yasir <yasir.hussain.shah@gmail.com> napsal:

Hi Hackers,

I have been playing with PG on the Windows platform recently. An annoying thing I faced is that a lot of Visual Studio's temp files kept appearing in git changed files. Therefore, I am submitting this very trivial patch to ignore these temp files.

see https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer
for various strategies

Anyway if those are not files specific to your setup (like editor
ones), but files which every PG hacker on Windows will generate as
well (which is this case IMHO), it will make sense to add it into
project's gitignore.

Show quoted text

Looking forward to the PG guru's guidance!

Regards...

Yasir Hussain
Principal Software Engineer
Bitnine Global Inc.

#7Yasir
yasir.hussain.shah@gmail.com
In reply to: Josef Šimánek (#6)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

On Sat, May 18, 2024 at 7:27 PM Josef Šimánek <josef.simanek@gmail.com>
wrote:

pá 17. 5. 2024 v 8:09 odesílatel Yasir <yasir.hussain.shah@gmail.com>
napsal:

Hi Hackers,

I have been playing with PG on the Windows platform recently. An

annoying thing I faced is that a lot of Visual Studio's temp files kept
appearing in git changed files. Therefore, I am submitting this very
trivial patch to ignore these temp files.

see
https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer
for various strategies

Anyway if those are not files specific to your setup (like editor
ones), but files which every PG hacker on Windows will generate as
well (which is this case IMHO), it will make sense to add it into
project's gitignore.

.vs directory and temp files within it are created once you open any of the
.sln, .vcproj or .vcxproj files (created with build command when PWD is
postgres/src/tools/msvc) in visual studio. It's a common practice that
developers use visual studio on codebase as it's mostly the default c/c++
files/projects editor.
So, it would be a common case for most of the developers with Windows
platform to add it in project's .gitignore.

Show quoted text

Looking forward to the PG guru's guidance!

Regards...

Yasir Hussain
Principal Software Engineer
Bitnine Global Inc.

#8Yasir
yasir.hussain.shah@gmail.com
In reply to: Josef Šimánek (#6)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

On Sat, May 18, 2024 at 7:27 PM Josef Šimánek <josef.simanek@gmail.com>
wrote:

pá 17. 5. 2024 v 8:09 odesílatel Yasir <yasir.hussain.shah@gmail.com>
napsal:

Hi Hackers,

I have been playing with PG on the Windows platform recently. An

annoying thing I faced is that a lot of Visual Studio's temp files kept
appearing in git changed files. Therefore, I am submitting this very
trivial patch to ignore these temp files.

see
https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer
for various strategies

We can add it to "~/.config/git/ignore" as it will ignore globally on
windows which we don't want. Also we don't have ".git/info/exclude" in PG
project's so the best place left is projects's .gitignore. That's what was
patched.

Show quoted text

Anyway if those are not files specific to your setup (like editor
ones), but files which every PG hacker on Windows will generate as
well (which is this case IMHO), it will make sense to add it into
project's gitignore.

Looking forward to the PG guru's guidance!

Regards...

Yasir Hussain
Principal Software Engineer
Bitnine Global Inc.

#9Tom Lane
tgl@sss.pgh.pa.us
In reply to: Yasir (#8)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

Yasir <yasir.hussain.shah@gmail.com> writes:

We can add it to "~/.config/git/ignore" as it will ignore globally on
windows which we don't want. Also we don't have ".git/info/exclude" in PG
project's so the best place left is projects's .gitignore. That's what was
patched.

As Peter said, we're not going to do that. The intention with
the project's .gitignore files is to ignore files that are
intentionally built by our "make" targets (and, hopefully, will be
removed by "make maintainer-clean"). Anything else that you want
git to ignore should be in a personal ignore list; especially
files that are platform-specific. The fact that it's reasonable
to ignore ".vs" files when working with your toolset doesn't mean
that it's reasonable to ignore them when working on some other
platform.

If we used some other policy, we'd have tons of debates about
which files were reasonable to exclude. For myself, for example,
I exclude "*~" (Emacs backup files) and "*.orig" (patch(1)
backup files) but those choices are very much dependent on the
set of tools I choose to use. Other developers have other
personal exclusion lists. If we tried to make the project's
files be the union of all those lists, we'd be at serious risk
of ignoring stuff we absolutely shouldn't ignore in some contexts.

regards, tom lane

#10Josef Šimánek
josef.simanek@gmail.com
In reply to: Tom Lane (#9)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

so 18. 5. 2024 v 22:36 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:

Yasir <yasir.hussain.shah@gmail.com> writes:

We can add it to "~/.config/git/ignore" as it will ignore globally on
windows which we don't want. Also we don't have ".git/info/exclude" in PG
project's so the best place left is projects's .gitignore. That's what was
patched.

As Peter said, we're not going to do that. The intention with
the project's .gitignore files is to ignore files that are
intentionally built by our "make" targets (and, hopefully, will be
removed by "make maintainer-clean"). Anything else that you want
git to ignore should be in a personal ignore list; especially
files that are platform-specific. The fact that it's reasonable
to ignore ".vs" files when working with your toolset doesn't mean
that it's reasonable to ignore them when working on some other
platform.

If we used some other policy, we'd have tons of debates about
which files were reasonable to exclude. For myself, for example,
I exclude "*~" (Emacs backup files) and "*.orig" (patch(1)
backup files) but those choices are very much dependent on the
set of tools I choose to use. Other developers have other
personal exclusion lists. If we tried to make the project's
files be the union of all those lists, we'd be at serious risk
of ignoring stuff we absolutely shouldn't ignore in some contexts.

But this is different. If I understand it well, just by following
https://www.postgresql.org/docs/16/install-windows-full.html you'll
get those files no matter what is your specific environment (or
specific set of tools).

Show quoted text

regards, tom lane

#11Andrew Dunstan
andrew@dunslane.net
In reply to: Yasir (#8)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

On 2024-05-18 Sa 15:43, Yasir wrote:

On Sat, May 18, 2024 at 7:27 PM Josef Šimánek
<josef.simanek@gmail.com> wrote:

pá 17. 5. 2024 v 8:09 odesílatel Yasir
<yasir.hussain.shah@gmail.com> napsal:

Hi Hackers,

I have been playing with PG on the Windows platform recently. An

annoying thing I faced is that a lot of Visual Studio's temp files
kept appearing in git changed files. Therefore, I am submitting
this very trivial patch to ignore these temp files.

see
https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer
for various strategies

We can add it to "~/.config/git/ignore" as it will ignore globally on
windows which we don't want. Also we don't have ".git/info/exclude" in
PG project's so the best place left is projects's .gitignore. That's
what was patched.

eh? git creates .git/info/exclude in every git repository AFAIK. And
it's referred to here: <https://git-scm.com/docs/gitignore&gt;

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

#12Yasir
yasir.hussain.shah@gmail.com
In reply to: Andrew Dunstan (#11)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

On Sun, May 19, 2024 at 1:45 AM Andrew Dunstan <andrew@dunslane.net> wrote:

On 2024-05-18 Sa 15:43, Yasir wrote:

On Sat, May 18, 2024 at 7:27 PM Josef Šimánek <josef.simanek@gmail.com>
wrote:

pá 17. 5. 2024 v 8:09 odesílatel Yasir <yasir.hussain.shah@gmail.com>
napsal:

Hi Hackers,

I have been playing with PG on the Windows platform recently. An

annoying thing I faced is that a lot of Visual Studio's temp files kept
appearing in git changed files. Therefore, I am submitting this very
trivial patch to ignore these temp files.

see
https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer
for various strategies

We can add it to "~/.config/git/ignore" as it will ignore globally on
windows which we don't want. Also we don't have ".git/info/exclude" in PG
project's so the best place left is projects's .gitignore. That's what was
patched.

eh? git creates .git/info/exclude in every git repository AFAIK. And it's
referred to here: <https://git-scm.com/docs/gitignore&gt;
<https://git-scm.com/docs/gitignore&gt;

Yes, git creates .git/info/exclude but point is, it is not in PG

maintained codebase repo. So, no point adding to it.

BTW, Tom and Peter said it's not going to be added anyway!

Show quoted text

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#13Tom Lane
tgl@sss.pgh.pa.us
In reply to: Josef Šimánek (#10)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

=?UTF-8?B?Sm9zZWYgxaBpbcOhbmVr?= <josef.simanek@gmail.com> writes:

But this is different. If I understand it well, just by following
https://www.postgresql.org/docs/16/install-windows-full.html you'll
get those files no matter what is your specific environment (or
specific set of tools).

Hm? Visual Studio seems like quite a specific tool from here.

I did some googling around the question of project .gitignore
files ignoring .vs/, and was amused to come across this:

https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

which seems like a mighty fine example of where we *don't*
want to go.

regards, tom lane

#14Josef Šimánek
josef.simanek@gmail.com
In reply to: Tom Lane (#13)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

so 18. 5. 2024 v 23:16 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:

=?UTF-8?B?Sm9zZWYgxaBpbcOhbmVr?= <josef.simanek@gmail.com> writes:

But this is different. If I understand it well, just by following
https://www.postgresql.org/docs/16/install-windows-full.html you'll
get those files no matter what is your specific environment (or
specific set of tools).

Hm? Visual Studio seems like quite a specific tool from here.

I initially thought the .vs folder is created just by compiling
PostgreSQL using build.bat (like without opening Visual Studio at
all). But I'm not 100% sure, I'll take a look and report back.

I did some googling around the question of project .gitignore
files ignoring .vs/, and was amused to come across this:

https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

which seems like a mighty fine example of where we *don't*
want to go.

That's clearly a nightmare to maintain. But in this case it should be
all hidden within one .vs folder.

Show quoted text

regards, tom lane

#15Yasir
yasir.hussain.shah@gmail.com
In reply to: Tom Lane (#13)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

On Sun, May 19, 2024 at 2:16 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

=?UTF-8?B?Sm9zZWYgxaBpbcOhbmVr?= <josef.simanek@gmail.com> writes:

But this is different. If I understand it well, just by following
https://www.postgresql.org/docs/16/install-windows-full.html you'll
get those files no matter what is your specific environment (or
specific set of tools).

Hm? Visual Studio seems like quite a specific tool from here.

I did some googling around the question of project .gitignore
files ignoring .vs/, and was amused to come across this:

https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

This is funny Tom. Adding an entry for each type of temp file in .gitignore
is a childish thing, obviously.

which seems like a mighty fine example of where we *don't*

want to go.

I agree we don't want to go in this direction.

Show quoted text

regards, tom lane

#16Yasir
yasir.hussain.shah@gmail.com
In reply to: Josef Šimánek (#14)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

On Sun, May 19, 2024 at 2:23 AM Josef Šimánek <josef.simanek@gmail.com>
wrote:

so 18. 5. 2024 v 23:16 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:

=?UTF-8?B?Sm9zZWYgxaBpbcOhbmVr?= <josef.simanek@gmail.com> writes:

But this is different. If I understand it well, just by following
https://www.postgresql.org/docs/16/install-windows-full.html you'll
get those files no matter what is your specific environment (or
specific set of tools).

Hm? Visual Studio seems like quite a specific tool from here.

I initially thought the .vs folder is created just by compiling
PostgreSQL using build.bat (like without opening Visual Studio at
all). But I'm not 100% sure, I'll take a look and report back.

.vs folder is not created just by compiling PG. It is created if you open
any of .sln, .vcproj or .vcxproj files.
I have verified it.

Show quoted text

I did some googling around the question of project .gitignore
files ignoring .vs/, and was amused to come across this:

https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

which seems like a mighty fine example of where we *don't*
want to go.

That's clearly a nightmare to maintain. But in this case it should be
all hidden within one .vs folder.

regards, tom lane

#17Josef Šimánek
josef.simanek@gmail.com
In reply to: Yasir (#16)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

so 18. 5. 2024 v 23:29 odesílatel Yasir <yasir.hussain.shah@gmail.com> napsal:

On Sun, May 19, 2024 at 2:23 AM Josef Šimánek <josef.simanek@gmail.com> wrote:

so 18. 5. 2024 v 23:16 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:

=?UTF-8?B?Sm9zZWYgxaBpbcOhbmVr?= <josef.simanek@gmail.com> writes:

But this is different. If I understand it well, just by following
https://www.postgresql.org/docs/16/install-windows-full.html you'll
get those files no matter what is your specific environment (or
specific set of tools).

Hm? Visual Studio seems like quite a specific tool from here.

I initially thought the .vs folder is created just by compiling
PostgreSQL using build.bat (like without opening Visual Studio at
all). But I'm not 100% sure, I'll take a look and report back.

.vs folder is not created just by compiling PG. It is created if you open any of .sln, .vcproj or .vcxproj files.
I have verified it.

Yes, I can confirm. Just running build.bat doesn't create .vs. I'm
sorry for confusion and I do agree ignoring ".vs" directory is a local
environment thing and doesn't belong to Postgres .gitignore.

Show quoted text

I did some googling around the question of project .gitignore
files ignoring .vs/, and was amused to come across this:

https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

which seems like a mighty fine example of where we *don't*
want to go.

That's clearly a nightmare to maintain. But in this case it should be
all hidden within one .vs folder.

regards, tom lane

#18Andrew Dunstan
andrew@dunslane.net
In reply to: Yasir (#12)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

On 2024-05-18 Sa 16:54, Yasir wrote:

On Sun, May 19, 2024 at 1:45 AM Andrew Dunstan <andrew@dunslane.net>
wrote:

On 2024-05-18 Sa 15:43, Yasir wrote:

On Sat, May 18, 2024 at 7:27 PM Josef Šimánek
<josef.simanek@gmail.com> wrote:

pá 17. 5. 2024 v 8:09 odesílatel Yasir
<yasir.hussain.shah@gmail.com> napsal:

Hi Hackers,

I have been playing with PG on the Windows platform

recently. An annoying thing I faced is that a lot of Visual
Studio's temp files kept appearing in git changed files.
Therefore, I am submitting this very trivial patch to ignore
these temp files.

see
https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer
for various strategies

We can add it to "~/.config/git/ignore" as it will ignore
globally on windows which we don't want. Also we don't have
".git/info/exclude" in PG project's so the best place left is
projects's .gitignore. That's what was patched.

eh? git creates .git/info/exclude in every git repository AFAIK.
And it's referred to here: <https://git-scm.com/docs/gitignore&gt;
<https://git-scm.com/docs/gitignore&gt;

Yes, git creates .git/info/exclude but point is, it is not in PG
maintained codebase repo. So, no point adding to it.

BTW, Tom and Peter said it's not going to be added anyway!

You've completely missed my point, which is that *you* should be adding
it to that file, as an alternative to using a (locally) global gitignore
file.

I agree with Tom and Peter.

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

#19Yasir
yasir.hussain.shah@gmail.com
In reply to: Andrew Dunstan (#18)
Re: Ignore Visual Studio's Temp Files While Working with PG on Windows

On Sun, May 19, 2024 at 2:35 AM Andrew Dunstan <andrew@dunslane.net> wrote:

On 2024-05-18 Sa 16:54, Yasir wrote:

On Sun, May 19, 2024 at 1:45 AM Andrew Dunstan <andrew@dunslane.net>
wrote:

On 2024-05-18 Sa 15:43, Yasir wrote:

On Sat, May 18, 2024 at 7:27 PM Josef Šimánek <josef.simanek@gmail.com>
wrote:

pá 17. 5. 2024 v 8:09 odesílatel Yasir <yasir.hussain.shah@gmail.com>
napsal:

Hi Hackers,

I have been playing with PG on the Windows platform recently. An

annoying thing I faced is that a lot of Visual Studio's temp files kept
appearing in git changed files. Therefore, I am submitting this very
trivial patch to ignore these temp files.

see
https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer
for various strategies

We can add it to "~/.config/git/ignore" as it will ignore globally on
windows which we don't want. Also we don't have ".git/info/exclude" in PG
project's so the best place left is projects's .gitignore. That's what was
patched.

eh? git creates .git/info/exclude in every git repository AFAIK. And it's
referred to here: <https://git-scm.com/docs/gitignore&gt;
<https://git-scm.com/docs/gitignore&gt;

Yes, git creates .git/info/exclude but point is, it is not in PG

maintained codebase repo. So, no point adding to it.

BTW, Tom and Peter said it's not going to be added anyway!

You've completely missed my point, which is that *you* should be adding it
to that file, as an alternative to using a (locally) global gitignore file.

My bad Andrew.

Show quoted text

I agree with Tom and Peter.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com