Quick question
How to display ignored files of the whole project using only core git?
I've tried:
git-ls-files -o -i -X .git/info/exclude
and it only showed me the excluded files in the current directory...
Signature · 4 lines
GPG Key id: 0xD1F10BA2 Fingerprint: 96E2 304A B9C4 949A 10A0 9105 9543 0453 D1F1 0BA2 AstralStorm
Quoted 7 lines · Radoslaw Szkodzinski
How to display ignored files of the whole project using only core git?
I've tried:
git-ls-files -o -i -X .git/info/exclude
and it only showed me the excluded files in the current directory...
With the git.git repository itself, I tried:
$ cat /var/tmp/i *.c $ git ls-files -i -X /var/tmp/i | head -n 6 apply.c arm/sha1.c blob.c cat-file.c check-ref-format.c checkout-index.c
So I am not sure what you mean. You wanted to "display ignored files of the whole project", right? I am getting arm/sha1.c here in my output, so I do not understand the issue here...
Quoted 12 lines · Junio C Hamano
With the git.git repository itself, I tried:
$ cat /var/tmp/i *.c $ git ls-files -i -X /var/tmp/i | head -n 6 apply.c arm/sha1.c blob.c cat-file.c check-ref-format.c checkout-index.c
Quoted 4 lines
So I am not sure what you mean. You wanted to "display ignored files of the whole project", right? I am getting
arm/sha1.chere in my output, so I do not understand the issue here...
Wrong. I wanted to display files that are ignored and not checked in. (unlike your example)
That's why I used the -o (--others).
Try your example with git repo's .gitignore and any .o file. I would like to use it for backup~ hunting purposes in a script and not have to worry about find and other less portable tools.
Signature · 4 lines
GPG Key id: 0xD1F10BA2 Fingerprint: 96E2 304A B9C4 949A 10A0 9105 9543 0453 D1F1 0BA2 AstralStorm
Quoted 2 lines · Radoslaw Szkodzinski
Wrong. I wanted to display files that are ignored and not checked in. (unlike your example)
Wow, you have a strong voice.
Quoted 1 line
That's why I used the -o (--others).
You asked it to show either ignored or others.
Quoted 2 lines
I would like to use it for backup~ hunting purposes in a script and not have to worry about find and other less portable tools.
I usually do this for that:
git ls-files -o '*~'
Quoted 2 lines · Junio C Hamano
Wow, you have a strong voice.
I didn't want to sound rude at all, of course.
Quoted 4 lines
Quoted 1 line
That's why I used the -o (--others).
You asked it to show either ignored or others.
So here's the catch? I don't think so.
But the manpage isn't totally clear in this matter.
When I specify just -o, it gives me files which weren't ignored too. -o -i gives me only ignored files.
Plain -i returns nothing.
With git directory, compare:
git-ls-files -o -i -X .gitignore
with:
git-ls-files -o
The remainder is:
git-ls-files -o -X .gitignore
I have the documentation built.
(Yes, I'm not including its .gitignore on purpose)
Quoted 8 lines
Quoted 3 lines
I would like to use it for backup~ hunting purposes in a script and not have to worry about find and other less portable tools.
I usually do this for that:
git ls-files -o '*~'
Also good. I have *~ in ignored too, so I think -o -i will suffice.
Signature · 4 lines
GPG Key id: 0xD1F10BA2 Fingerprint: 96E2 304A B9C4 949A 10A0 9105 9543 0453 D1F1 0BA2 AstralStorm
Quoted 8 lines · Radoslaw Szkodzinski
How to display ignored files of the whole project using only core git?
I've tried:
git-ls-files -o -i -X .git/info/exclude
and it only showed me the excluded files in the current directory...
Well, since you're telling it to only show excluded files, it will also only show excluded directories.
Which is admittedly insane. You don't want to exclude directories. Or maybe you do, but then we should add the "/" to the end before we do the exclusion.
This patch (untested) will never exclude directories. Which may or may not be the right thing.
Junio? Others? Comments?
Linus
---
ls-files.c +2 -2
@@ -276,8 +276,6 @@ static void read_directory(const char *pcontinue ; len =strlen (de->d_name);memcpy (fullname + baselen, de->d_name, len+1 ); -if (excluded (fullname) != show_ignored) -continue ;switch (DTYPE (de)) {struct stat st;
@@ -304,6 +302,8 @@ static void read_directory(const char *pcase DT_LNK :break ; } +if (excluded (fullname) != show_ignored) +continue ;add_name (fullname, baselen + len); }closedir (dir);
Quoted 4 lines · Linus Torvalds
Well, since you're telling it to only show excluded files, it will also only show excluded directories.
Quoted 9 lines
Which is admittedly insane. You don't want to exclude directories. Or maybe you do, but then we should add the "/" to the end before we do the exclusion.
This patch (untested) will never exclude directories. Which may or may not be the right thing.
Junio? Others? Comments?
For me it seems to do the right thing, although I have no need to exclude directories. If I really needed to, I'd say something like:
/excluded_dir/*
in .git/info/exclude, and it would show the files as being excluded.
Signature · 4 lines
GPG Key id: 0xD1F10BA2 Fingerprint: 96E2 304A B9C4 949A 10A0 9105 9543 0453 D1F1 0BA2 AstralStorm
Radoslaw Szkodzinski, Mon, Feb 13, 2006 19:26:03 +0100:
Quoted 11 lines
Quoted 10 lines · Linus Torvalds
Well, since you're telling it to only show excluded files, it will also only show excluded directories.
Which is admittedly insane. You don't want to exclude directories. Or maybe you do, but then we should add the "/" to the end before we do the exclusion.
This patch (untested) will never exclude directories. Which may or may not be the right thing.
I actually quiet like it how it is.
Quoted 10 lines
Quoted 2 lines
Junio? Others? Comments?
For me it seems to do the right thing, although I have no need to exclude directories. If I really needed to, I'd say something like:
/excluded_dir/*
in .git/info/exclude, and it would show the files as being excluded.
What's wrong with .gitignore in the excluded_dir containing everything you don't want to see, or even just "*"?
Quoted 10 lines · Linus Torvalds
Which is admittedly insane. You don't want to exclude directories. Or maybe you do, but then we should add the "/" to the end before we do the exclusion.
This patch (untested) will never exclude directories. Which may or may not be the right thing.
Junio? Others? Comments?
Linus
I might have sounded negative or happy with status quo in my earlier messages but that was not intended. I am swamped and have not formed an opinion.