tags 476595 + upstream wontfix
quit

Hi Guido,

Guido Günther wrote:

> for #476347 it'd be nice to have a:
>       git-add --allow-empty <filepattern>

"git add" is for humans and its behavior and output are potential to
change as our understanding of humans improves; "git update-index" is
for machines, is dead simple, and should do better for this task, I
suspect.

It works like this:

1. Come up with a list of paths.  For example,

        git ls-files -c -o -- <pattern>

lists all files matching <pattern>.

        git ls-files -o --exclude-standard -- <pattern>

lists untracked files not excluded by .gitignore and matching
<pattern>.

2. Feed the paths to update-index.  For example,

        git ls-files -c -o -- <pattern> |
        git update-index --verbose --add --stdin

adds all paths matching <pattern> just like "git add <pattern>" would,
except it still works if some files matching <pattern> would have been
excluded by .gitignore and does not require a special case for the
empty list.

That said, thanks for reporting and please feel free to bring this up
on the git list[1] if update-index does not meet your needs.

[1] [email protected] (no subscription needed --- the
convention is to always reply-to-all there).



--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to