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

[PATCH] Add a makefile rule to regenerate .gitignore from the make variables.

From
Pierre Habouzit <madcoder@debian.org>
Date
Dec 11, 2007, 09:24 UTC
Message-ID
<20071211092429.GE30948@artemis.madism.org>
In-Reply-To
<20071211092101.GD30948@artemis.madism.org>
  This allow that the commands that moved away, were renamed, or the new
commands gets added in a simple fashion.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
    This is an alternative patch that aims at solving the problem at once,
    running "make ignore" or "make .gitignore" will regenerate the list of
    commands and test programs and add it in a sorted way at the end.
 .gitignore |   60 +++++++++++++++++++++++++++---------------------------------
 Makefile   |    7 +++++++
 2 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/.gitignore b/.gitignore
index 5eaba41..52cb353 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,28 @@
 GIT-CFLAGS
 GIT-GUI-VARS
 GIT-VERSION-FILE
+git-core-*/?*
+gitk-wish
+common-cmds.h
+*.tar.gz
+*.dsc
+*.deb
+git.spec
+*.exe
+*.[aos]
+*.py[co]
+config.mak
+autom4te.cache
+config.cache
+config.log
+config.status
+config.mak.autogen
+config.mak.append
+configure
+tags
+TAGS
+cscope*
+### Automatic ignore list
 git
 git-add
 git-add--interactive
@@ -31,18 +53,17 @@ git-cvsexportcommit
 git-cvsimport
 git-cvsserver
 git-daemon
+git-describe
 git-diff
 git-diff-files
 git-diff-index
 git-diff-tree
-git-describe
 git-fast-export
 git-fast-import
 git-fetch
 git-fetch--tool
 git-fetch-pack
 git-filter-branch
-git-findtags
 git-fmt-merge-msg
 git-for-each-ref
 git-format-patch
@@ -59,7 +80,6 @@ git-index-pack
 git-init
 git-init-db
 git-instaweb
-git-local-fetch
 git-log
 git-lost-found
 git-ls-files
@@ -69,9 +89,8 @@ git-mailinfo
 git-mailsplit
 git-merge
 git-merge-base
-git-merge-index
 git-merge-file
-git-merge-tree
+git-merge-index
 git-merge-octopus
 git-merge-one-file
 git-merge-ours
@@ -79,13 +98,14 @@ git-merge-recursive
 git-merge-resolve
 git-merge-stupid
 git-merge-subtree
+git-merge-tree
 git-mergetool
 git-mktag
 git-mktree
-git-name-rev
 git-mv
-git-pack-redundant
+git-name-rev
 git-pack-objects
+git-pack-redundant
 git-pack-refs
 git-parse-remote
 git-patch-id
@@ -120,10 +140,6 @@ git-show
 git-show-branch
 git-show-index
 git-show-ref
-git-ssh-fetch
-git-ssh-pull
-git-ssh-push
-git-ssh-upload
 git-stash
 git-status
 git-stripspace
@@ -144,34 +160,12 @@ git-verify-pack
 git-verify-tag
 git-whatchanged
 git-write-tree
-git-core-*/?*
-gitk-wish
 gitweb/gitweb.cgi
 test-absolute-path
 test-chmtime
 test-date
 test-delta
-test-dump-cache-tree
 test-genrandom
 test-match-trees
 test-parse-options
 test-sha1
-common-cmds.h
-*.tar.gz
-*.dsc
-*.deb
-git.spec
-*.exe
-*.[aos]
-*.py[co]
-config.mak
-autom4te.cache
-config.cache
-config.log
-config.status
-config.mak.autogen
-config.mak.append
-configure
-tags
-TAGS
-cscope*
diff --git a/Makefile b/Makefile
index ccc9f3c..50c8b9a 100644
--- a/Makefile
+++ b/Makefile
@@ -946,6 +946,13 @@ $(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
 $(XDIFF_LIB): $(XDIFF_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
 
+.gitignore: Makefile
+	$(QUIET_GEN)$(RM) $@+ && ( \
+	    sed -e '/^### Automatic ignore list$$/q' $@ \
+	    $(foreach p,$(sort $(OTHER_PROGRAMS) $(ALL_PROGRAMS) $(BUILT_INS)),&& echo $p) \
+	    $(foreach t,$(sort $(TEST_PROGRAMS)),&& echo $t) \
+	) > $@+ && mv $@+ $@
+ignore: .gitignore
 
 doc:
 	$(MAKE) -C Documentation all
-- 
1.5.3.7.2224.gb695b
Previous: Pierre Habouzit
Message 2 of 2 in “add git-browse-help to the ignore list”
  1. add git-browse-help to the ignore listPierre Habouzit, Dec 11, 2007
  2. Add a makefile rule to regenerate .gitignore from the make variables.Pierre Habouzit, Dec 11, 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.