Skip to content

Instantly share code, notes, and snippets.

@rev22
Created April 3, 2014 13:38
Show Gist options
  • Save rev22/9954517 to your computer and use it in GitHub Desktop.
Save rev22/9954517 to your computer and use it in GitHub Desktop.
Allow a different file name rather than .gitignore, as a per-directory include file in git
--- git-2.0~next.20140207.orig/dir.c
+++ git-2.0~next.20140207/dir.c
@@ -1589,7 +1589,7 @@ void setup_standard_excludes(struct dir_
const char *path;
char *xdg_path;
- dir->exclude_per_dir = ".gitignore";
+ dir->exclude_per_dir = ignore_per_dir;
path = git_path("info/exclude");
if (!excludes_file) {
home_config_paths(NULL, &xdg_path, "ignore");
--- git-2.0~next.20140207.orig/environment.c
+++ git-2.0~next.20140207/environment.c
@@ -44,6 +44,7 @@ int pager_use_color = 1;
const char *editor_program;
const char *askpass_program;
const char *excludes_file;
+const char *ignore_per_dir = ".gitignore";
enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
int read_replace_refs = 1; /* NEEDSWORK: rename to use_replace_refs */
enum eol core_eol = EOL_UNSET;
--- git-2.0~next.20140207.orig/config.c
+++ git-2.0~next.20140207/config.c
@@ -872,6 +872,10 @@ static int git_default_core_config(const
return 0;
}
+ if (!strcmp(var, "core.ignoreperdir")) {
+ return git_config_string(&ignore_per_dir, var, value);
+ }
+
/* Add other config variables here and to Documentation/config.txt. */
return 0;
}
--- git-2.0~next.20140207.orig/cache.h
+++ git-2.0~next.20140207/cache.h
@@ -1249,6 +1249,7 @@ extern int check_pager_config(const char
extern const char *editor_program;
extern const char *askpass_program;
extern const char *excludes_file;
+extern const char *ignore_per_dir;
/* base85 */
int decode_85(char *dst, const char *line, int linelen);
--- git-2.0~next.20140207.orig/Documentation/config.txt
+++ git-2.0~next.20140207/Documentation/config.txt
@@ -511,6 +511,11 @@ core.excludesfile::
If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ignore
is used instead. See linkgit:gitignore[5].
+core.ignoreperdir::
+ Specify an alternative to '.gitignore' as a per-directory
+ exclude-file. If this is not set, the default '.gitignore' is used.
+ If this is empty, no per-directory exclude file is used.
+
core.askpass::
Some commands (e.g. svn and http interfaces) that interactively
ask for a password can be told to use an external program given
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment