git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: Petr Baudis <pasky@suse.cz>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] Workaround git < 1.2.0 ignoring .gitignore in parent directories
Date: Tue, 14 Feb 2006 13:05:22 -0500	[thread overview]
Message-ID: <20060214180522.13766.22633.stgit@dv.roinet.com> (raw)
In-Reply-To: <20060214180520.13766.78172.stgit@dv.roinet.com>

Add --exclude-from for all existing .gitignore files in parent
directories up to the repository root.  This is not needed for git 1.2.0
and newer.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 cg-Xlib |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/cg-Xlib b/cg-Xlib
index 85a21c2..af278b6 100644
--- a/cg-Xlib
+++ b/cg-Xlib
@@ -230,6 +230,22 @@ list_untracked_files()
 			EXCLUDE[${#EXCLUDE[@]}]="--exclude-from=$EXCLUDEFILE"
 		fi
 		EXCLUDE[${#EXCLUDE[@]}]="--exclude-per-directory=.gitignore"
+		# Workaround for git < 1.2.0
+		if [ -n "$_git_relpath" ]; then
+			local dir="${_git_relpath%/}"
+			local reldir=".."
+			while [ "$dir" != "." ]; do
+				if [ "${dir%/*}" = "$dir" ]; then
+					dir="."
+				else
+					dir="${dir%/*}"
+				fi
+				if [ -f "$reldir/.gitignore" ]; then
+					EXCLUDE[${#EXCLUDE[@]}]="--exclude-from=$dir/.gitignore"
+				fi
+				reldir="../$reldir"
+			done
+		fi
 	fi
 	local listdirs=
 	[ "$squashflag" = "squashdirs" ] && listdirs=--directory

      reply	other threads:[~2006-02-14 18:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-14 18:05 [PATCH 1/2] cg-clean shouldn't clean untracked directories without -d Pavel Roskin
2006-02-14 18:05 ` Pavel Roskin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060214180522.13766.22633.stgit@dv.roinet.com \
    --to=proski@gnu.org \
    --cc=git@vger.kernel.org \
    --cc=pasky@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).