On Tue, Aug 19, 2014 at 10:06:23PM -0400, Paul Smith wrote: > One of the platforms I need to build on is Windows and we're using > cmake to generate MSVC project files. MSVC allows you to build one > of a small number of different "types" of output, such as "Debug", > "Release", etc. Additionally, we have many different "targets" that > are built: one for each library, executable, unit test program, etc. > > The way MSVC (or cmake, I'm not sure) organizes the output is that > for a source directory SRC and a target SOMELIB built for "Debug" > for example, the object files will be: > > SRC/foo.cpp > SRC/SOMELIB.dir/Debug/foo.obj > > Note that here only SRC and SRC/foo.cpp are actually part of the > Git repository; the other directories/files are not tracked.
Is there a specific reason you aren't using a separate build
directory? (AFAIU this is the convention for CMake.)
> Now, adding all the target directories ("SOMELIB.dir") to .gitignore
> individually is a big pain since there are so many. And adding "*.dir"
> to .gitignore seems like it might match some stuff that we might want.
>
> So, I added the "type" directories to .gitignore, like this:
>
> Debug
> Release
>
> (also, these directories are used by Mac OS Xcode so need to be ignored
> anyway).
>
> This works great for "git status"; it doesn't show the "SOMELIB.dir"
> directory as "untracked" because after the .gitignore stuff is through
> getting rid of files that is just an empty directory.
>
> However after some head-banging today I discovered that "git clean
> -fdX" (which is what I normally use to clean out workspaces) won't
> delete these files. Apparently "git clean -X" uses a different
> algorithm than "git status" for matching .gitignore contents and since
> SOMELIB.dir is not ignored, "git clean" skips over it rather than
> looking inside it for ignored files.
>
> So I had this situation where I had stale object files in my workspace
> and "git status" showed I had no untracked files, but "git clean -fdX"
> didn't clean up the stale object files.
>
> Does it seem incorrect to anyone else that "git clean -X" doesn't delete
> all the files in your workspace that are considered ignored by "git
> status"?
How does `git clean -fdx` behave?
I've never really understood the difference between -x and -X, but
I've always used only -x and it behaves exactly the way I expect it
to.
/M
--
Magnus Therning OpenPGP: 0xAB4DFBA4
email: [email protected] jabber: [email protected]
twitter: magthe http://therning.org/magnus
Perl is another example of filling a tiny, short-term need, and then
being a real problem in the longer term.
-- Alan Kay
pgp4UkikVDciR.pgp
Description: PGP signature
