git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] Git add <device file> silently fails

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 17, 2010, 16:38 UTC
Message-ID
<7v4oja3uh7.fsf@alter.siamese.dyndns.org>
In-Reply-To
<u2s81b0412b1004170744u4cc3c0e1z6d7019fe405a67ec@mail.gmail.com>
Alex Riesen <raa.lkml@gmail.com> writes:
> I think something like this should make the accident more
> noticable:

The early skippage done in dir.c (read-directory-recursive) should treat these as ignored just like paths that are ignored with .gitignore mechanism, and if we do so, we shouldn't need this patch to add another codepath to give notification to the user (we would however still need to reword "'add -f' if you really want to add it", though).

Show 13 quoted lines
> 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)
Previous: Alex RiesenNext: Alex Riesen
Message 5 of 9 in “[BUG] Git add <device file> silently fails”
  1. Andreas GruenbacherApr 17, 2010
  2. Alex RiesenApr 17, 2010
  3. Andreas GruenbacherApr 17, 2010
  4. Alex RiesenApr 17, 2010
  5. Junio C HamanoApr 17, 2010
  6. Alex RiesenApr 17, 2010
  7. Alex RiesenApr 17, 2010
  8. Andreas GruenbacherApr 17, 2010
  9. Junio C HamanoApr 19, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.