From: Alex Riesen Date: Sat, 17 Apr 2010 14:44:05 GMT Subject: Re: [BUG] Git add silently fails Message-ID: In-Reply-To: <201004171624.17797.agruen@suse.de> On Sat, Apr 17, 2010 at 16:24, Andreas Gruenbacher wrote: > However, when trying to add a device special file, update_callback() ends up > never getting called, no error message is produced, and git add silently > fails: > >        $ sudo mknod foobar c 1 3 >        $ git add foobar >   $ echo $? >        0 I think something like this should make the accident more noticable: diff --git a/builtin/add.c b/builtin/add.c index 87d2980..9c4a5f2 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -347,6 +347,8 @@ static int add_files(struct dir_struct *dir, int flags) die("no files added"); } + if (!dir->nr) + die("No files selected for addition"); for (i = 0; i < dir->nr; i++) if (add_file_to_cache(dir->entries[i]->name, flags)) { if (!ignore_add_errors)