Bug#290332: [PATCH] [lndir] ignore revision info of more SCMs

2011-03-05 Thread Cyril Brulebois
Hi,

Philipp A. Hartmann p...@sorgh.de (06/02/2009):
 tags 290332 +patch
 thanks

thanks for the patch.

 Attached is a patch, that extends the list of known revision
 information directories to include Arch, Darcs, Git, and Mercurial.
 
 To ease the future development of an --ignore option, the previous
 logic is changed to use a loop over a static list, instead of
 hard-coded comparisons.
 
 If I have missed some other important SCM implementation, or got
 some of the corresponding directories wrong, please let me know.

It would be even better to (possibly refresh the patch if needed and)
send it upstream for review:
  http://wiki.x.org/wiki/Development/Documentation/SubmittingPatches

Alternatively, you could open a bug there, against the xorg product:
  http://bugs.freedesktop.org/

but the former option is usually the better when one has a patch
ready.

Adding the submitter to the loop while I'm at it.

KiBi.


signature.asc
Description: Digital signature


Bug#290332: [PATCH] [lndir] ignore revision info of more SCMs

2009-02-06 Thread Philipp A. Hartmann
tags 290332 +patch
thanks

Hi all,

I stumbled across this issue recently, had a look at the code and fixed
it for me.

Attached is a patch, that extends the list of known revision
information directories to include Arch, Darcs, Git, and Mercurial.

To ease the future development of an --ignore option, the previous
logic is changed to use a loop over a static list, instead of hard-coded
comparisons.

If I have missed some other important SCM implementation, or got some of
the corresponding directories wrong, please let me know.

Best regards,
Philipp
From e8da6643c57b8b8f6a18c11fe2cf2c313efefc8b Mon Sep 17 00:00:00 2001
From: Philipp A. Hartmann p...@sorgh.de
Date: Thu, 5 Feb 2009 13:03:50 +0100
Subject: [PATCH] ignore revision info of more SCMs

This commit extends the list of known revision information
directories to include Arch, Darcs, Git, and Mercurial.

To ease the future development of an --ignore option, the
logic is changed to use a static list, instead of hard-coded
comparisons.

Signed-off-by: Philipp A. Hartmann p...@sorgh.de
---
 lndir/lndir.c   |   33 +
 lndir/lndir.man |   11 +++
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/lndir/lndir.c b/lndir/lndir.c
index cd1d983..f391761 100644
--- a/lndir/lndir.c
+++ b/lndir/lndir.c
@@ -141,6 +141,21 @@ equivalent(char *lname, char *rname, char **p)
 return !strcmp(lname, rname);
 }
 
+static char * revinfo_dirs[] =
+{
+   BitKeeper,
+   RCS,
+   SCCS,
+   CVS,
+   CVS.adm,
+   .svn,
+   {arch},
+   .arch-ids,
+   _darcs,
+   .git,
+   .hg,
+   NULL /* end of list */
+};
 
 /* Recursively create symbolic links from the current directory to the from
directory.  Assumes that files described by fs and ts are directories. */
@@ -153,7 +168,7 @@ dodir (char *fn,/* name of from directory, 
either absolute or
 {
 DIR *df;
 struct dirent *dp;
-char buf[MAXPATHLEN + 1], *p;
+char buf[MAXPATHLEN + 1], *p, **rd;
 char symbuf[MAXPATHLEN + 1];
 char basesym[MAXPATHLEN + 1];
 struct stat sb, sc;
@@ -212,17 +227,11 @@ dodir (char *fn,  /* name of from directory, 
either absolute or
   dp-d_name[2] == '\0')))
continue;
if (!with_revinfo) {
-   if (!strcmp (dp-d_name, BitKeeper))
-   continue;
-   if (!strcmp (dp-d_name, RCS))
-   continue;
-   if (!strcmp (dp-d_name, SCCS))
-   continue;
-   if (!strcmp (dp-d_name, CVS))
-   continue;
-   if (!strcmp (dp-d_name, CVS.adm))
-   continue;
-   if (!strcmp (dp-d_name, .svn))
+   for (rd = revinfo_dirs; *rd; ++rd) {
+   if (!strcmp (dp-d_name, *rd))
+   break;
+   }
+   if (*rd) /* found revinfo dir */
continue;
}
ocurdir = rcurdir;
diff --git a/lndir/lndir.man b/lndir/lndir.man
index 244e8a5..4823896 100644
--- a/lndir/lndir.man
+++ b/lndir/lndir.man
@@ -76,8 +76,10 @@ argument may be relative (e.g., ../src) and is relative to
 (not the current directory).
 .PP 
 .\ CVS.adm is used by the Concurrent Versions System.
-Note that BitKeeper, RCS, SCCS, .svn, CVS and CVS.adm directories are
-shadowed only if the \fB\-withrevinfo\fP flag is specified.
+.\ .hg is used by Mercurial.
+Note that BitKeeper, RCS, SCCS, CVS, CVS.adm, {arch}, .arch-ids,
+_darcs, .git, .hg, and .svn directories are shadowed only if the
+\fB\-withrevinfo\fP flag is specified.
 .PP
 If you add files, simply run
 .I lndir
@@ -105,8 +107,9 @@ If the link is to a directory, this is almost certainly the 
wrong thing.
 This option exists mostly to emulate the behavior the C version of
 \fIlndir\fP had in X11R6.  Its use is not recommended.
 .IP \-withrevinfo
-Causes any BitKeeper, RCS, SCCS, .svn, CVS and CVS.adm subdirectories to be
-treated as any other directory, rather than ignored.
+Causes any BitKeeper, RCS, SCCS, CVS, CVS.adm, {arch}, .arch-ids,
+_darcs, .git, .hg, and .svn subdirectories to be treated as
+any other directory, rather than ignored.
 .SH DIAGNOSTICS
 The program displays the name of each subdirectory it enters, followed
 by a colon.  The \fB\-silent\fP option suppresses these messages.
-- 
1.6.0.6



signature.asc
Description: PGP signature