I see, tnx for the pointer.

Would inclusion of this patch be viable option then?


Patch below, it is possible to look at it here to:

Patch: 
https://github.com/teonsystems/git/commit/27449825ff4d7bb3eecb5a3e32692aaf1ab1a026
Branch: 
https://github.com/teonsystems/git/commits/feature/configurable-gitignore-filename



commit 27449825ff4d7bb3eecb5a3e32692aaf1ab1a026
Author: Bostjan Skufca <bost...@a2o.si>
Date:   Thu Sep 4 20:20:30 2014 +0000

    .gitignore: make '.gitignore' filename configurable

    When using git with detached work tree and .git directory,
    it is currently impossible to use multiple git repositories
    with the same workdir, as .gitignore is always parsed.

    This feature keeps the original '.gitignore' file as default
    at almost no performance penalty, and enables reconfiguring
    git to use alternate filename when obtaining per-dir exclusion
    patterns.

diff --git a/Documentation/config.txt b/Documentation/config.txt
index c55c22a..1c63b13 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -507,6 +507,17 @@ be delta compressed, but larger binary media
files won't be.
 +
 Common unit suffixes of 'k', 'm', or 'g' are supported.

+core.excludesperdirfilename::
+ By default, Git checks for presence of .gitignore files to read
+ exclude patterns from. This option enables the customization of
+ per-dir exclude patterns filename that is by default called
+ '.gitignore', to arbitrary filename.
++
+This setting is not implicitly distributed when transferring
+changes between repository clones. In order to achieve identical
+behaviour in all repository clones, each repository clone must
+set this option to the same value.
+
 core.excludesfile::
  In addition to '.gitignore' (per-directory) and
  '.git/info/exclude', Git looks into this file for patterns
diff --git a/cache.h b/cache.h
index 4d5b76c..ff952b4 100644
--- a/cache.h
+++ b/cache.h
@@ -392,6 +392,7 @@ static inline enum object_type
object_type(unsigned int mode)
 #define NO_REPLACE_OBJECTS_ENVIRONMENT "GIT_NO_REPLACE_OBJECTS"
 #define GITATTRIBUTES_FILE ".gitattributes"
 #define INFOATTRIBUTES_FILE "info/attributes"
+#define GITIGNORE_FILE ".gitignore"
 #define ATTRIBUTE_MACRO_PREFIX "[attr]"
 #define GIT_NOTES_REF_ENVIRONMENT "GIT_NOTES_REF"
 #define GIT_NOTES_DEFAULT_REF "refs/notes/commits"
@@ -1423,6 +1424,7 @@ extern int check_pager_config(const char *cmd);

 extern const char *editor_program;
 extern const char *askpass_program;
+extern const char *excludes_per_dir_filename;
 extern const char *excludes_file;

 /* base85 */
diff --git a/config.c b/config.c
index a191328..da80556 100644
--- a/config.c
+++ b/config.c
@@ -847,6 +847,9 @@ static int git_default_core_config(const char
*var, const char *value)
  if (!strcmp(var, "core.askpass"))
  return git_config_string(&askpass_program, var, value);

+ if (!strcmp(var, "core.excludesperdirfilename"))
+ return git_config_string(&excludes_per_dir_filename, var, value);
+
  if (!strcmp(var, "core.excludesfile"))
  return git_config_pathname(&excludes_file, var, value);

diff --git a/dir.c b/dir.c
index bd274a7..8b429c3 100644
--- a/dir.c
+++ b/dir.c
@@ -1624,7 +1624,12 @@ void setup_standard_excludes(struct dir_struct *dir)
  const char *path;
  char *xdg_path;

- dir->exclude_per_dir = ".gitignore";
+ if (excludes_per_dir_filename) {
+ dir->exclude_per_dir = excludes_per_dir_filename;
+ } else {
+ dir->exclude_per_dir = GITIGNORE_FILE;
+ }
+
  path = git_path("info/exclude");
  if (!excludes_file) {
  home_config_paths(NULL, &xdg_path, "ignore");
diff --git a/environment.c b/environment.c
index 565f652..0d48ef9 100644
--- a/environment.c
+++ b/environment.c
@@ -43,6 +43,7 @@ const char *pager_program;
 int pager_use_color = 1;
 const char *editor_program;
 const char *askpass_program;
+const char *excludes_per_dir_filename;
 const char *excludes_file;
 enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
 int check_replace_refs = 1;
diff --git a/t/t7515-status-changed-gitignore-filename.sh
b/t/t7515-status-changed-gitignore-filename.sh
new file mode 100755
index 0000000..ed7de42
--- /dev/null
+++ b/t/t7515-status-changed-gitignore-filename.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+test_description='status with changed default .gitignore filename'
+. ./test-lib.sh
+
+
+#
+# Check if only single file is in 'untracked' state: file2
+# file1 is excluded by ignore pattern in .gitignore (default)
+#
+test_expect_success 'status with default .gitignore filename' '
+ mkdir repo-default &&
+ (cd repo-default && git init &&
+ echo "/file1" > .gitignore  &&
+ git add .gitignore &&
+ touch file1 &&
+ touch file2 &&
+ COUNT_UNTRACKED=`git status | grep -P "^\t" | grep -P -v "^\tnew
file:" | grep -c .` &&
+ if [ "$COUNT_UNTRACKED" == "1" ]; then
+  true
+ else
+  false
+ fi
+ )
+'
+
+
+#
+# Check if only single file is in 'untracked' state: file2
+# file1 is excluded by ignore pattern in .gitexclude (modified
default ignore filename)
+#
+test_expect_success 'status with .gitignore filename reconfigured to
.gitexclude' '
+ mkdir repo-modified &&
+ (cd repo-modified && git init &&
+ git config --add core.excludesperdirfilename .gitexclude &&
+ echo "/file1" > .gitexclude  &&
+ git add .gitexclude &&
+ touch file1 &&
+ touch file2 &&
+ COUNT_UNTRACKED=`git status | grep -P "^\t" | grep -P -v "^\tnew
file:" | grep -c .` &&
+ if [ "$COUNT_UNTRACKED" == "1" ]; then
+  true
+ else
+  false
+ fi
+ )
+'
+
+
+#
+# Check if .gitignore is ignored when default exclude filename is changed
+# file1 is excluded by ignore pattern in .gitexclude (modified
default ignore filename)
+#
+test_expect_success 'ignore .gitignore when reconfigured to use .gitexclude' '
+ mkdir repo-modified-failure &&
+ (cd repo-modified-failure && git init &&
+ git config --add core.excludesperdirfilename .gitexclude &&
+ echo "/file1" > .gitignore  &&
+ git add .gitignore &&
+ touch file1 &&
+ touch file2 &&
+ COUNT_UNTRACKED=`git status | grep -P "^\t" | grep -P -v "^\tnew
file:" | grep -c .` &&
+ if [ "$COUNT_UNTRACKED" == "2" ]; then
+  true
+ else
+  false
+ fi
+ )
+'
+
+
+test_done


b.


On 2 September 2014 01:33, Duy Nguyen <pclo...@gmail.com> wrote:
> On Tue, Sep 2, 2014 at 3:30 AM, Bostjan Skufca <bost...@a2o.si> wrote:
>> There is currently no way to transfer/share repository configuration
>> between clones.
>
> See http://article.gmane.org/gmane.comp.version-control.git/216624
> --
> Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to