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

[PATCH] Unify the use of standard set of exclude files

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 15, 2007, 06:38 UTC
Message-ID
<7v4pfo813i.fsf_-_@gitster.siamese.dyndns.org>
In-Reply-To
<7vsl39l0b7.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> We probably could change git-ls-files to use the standard set
> when no excludes are specified from the command line, or
> something like that, but this will be a change in semantics that
> would affect the scripts in a subtle way.  I am somewhat
> reluctant to make such a change.
So here it is.

This teaches "git ls-files" to read the standard set of exclude files when no exclude patterns nor files is given from the command line. We used to error out in such a case.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-ls-files.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index e0b856f..50dcb89 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -542,11 +542,8 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
 		ps_matched = xcalloc(1, num);
 	}
 
-	if (dir.show_ignored && !exc_given) {
-		fprintf(stderr, "%s: --ignored needs some exclude pattern\n",
-			argv[0]);
-		exit(1);
-	}
+	if (dir.show_ignored && !exc_given)
+		setup_standard_excludes(&dir);
 
 	/* With no flags, we default to showing the cached files */
 	if (!(show_stage | show_deleted | show_others | show_unmerged |
Previous: Miles BaderNext: Jeff King
Message 9 of 16 in “git-clean won't read global ignore”
  1. shunichi fujiNov 13, 2007
  2. Pierre HabouzitNov 13, 2007
  3. Junio C HamanoNov 14, 2007
  4. Andreas EricssonNov 14, 2007
  5. Junio C HamanoNov 14, 2007
  6. Johannes SchindelinNov 14, 2007
  7. Miles BaderNov 15, 2007
  8. Miles BaderNov 15, 2007
  9. Unify the use of standard set of exclude filesJunio C Hamano, Nov 15, 2007
  10. Jeff KingNov 15, 2007
  11. Junio C HamanoNov 15, 2007
  12. Jeff KingNov 15, 2007
  13. Junio C HamanoNov 15, 2007
  14. Matthieu MoyNov 15, 2007
  15. Junio C HamanoNov 15, 2007
  16. Matthieu MoyNov 15, 2007

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.