Re: [PATCH] git.el: handle default excludesfile properly
- Date: Sat, 3 Mar 2018 17:36:51 -0800
- From: Dorab Patel <dorabpatel@xxxxxxxxx>
- Subject: Re: [PATCH] git.el: handle default excludesfile properly
[[Pardon the duplicate. I forgot to send via text/plain and the
mailing list bounced it, so resending.]]
Thanks for the feedback.
Correct me if I'm wrong, but my understanding, from
https://git-scm.com/docs/gitignore, is that $HOME/.gitignore is used
only if it is specified as the value of core.excludesfile in
~/.gitconfig. It is not used by default. If that is so, then the
proposed (and original) code works. The changes I am proposing handle
the default case, when core.excludesfile is not specified.
Looking deeper into how the function git-get-exclude-files is used, I
see that it is only being called from git-run-ls-files-with-excludes.
So, perhaps, a better (or additional) fix might be to add the
parameter "--exclude-standard" in the call to git-run-ls-files from
within git-run-ls-files-with-excludes. And remove the need for
get-get-exclude-files altogether. Presumably, "--exclude-standard"
handles the default case with/without XDG_CONFIG_HOME correctly. The
question I'd have then is: why didn't the original author use that
option? Either I'm missing something? Or the option was added later,
after the original code was written? Or something else?
On Sat, Mar 3, 2018 at 12:42 AM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> On Fri, Mar 2, 2018 at 10:48 PM, Dorab Patel <dorabpatel@xxxxxxxxx> wrote:
>> The previous version only looked at core.excludesfile for locating the
>> excludesfile. So, when core.excludesfile was not defined, it did not
>> use the possible default locations.
>> The current version uses either $XDG_CONFIG_HOME/git/ignore or
>> $HOME/.config/git/ignore for the default excludesfile location
>> depending on whether XDG_CONFIG_HOME is defined or not. As per the
>> documentation of gitignore.
> Perhaps take $HOME/.gitignore into account too?
>> Signed-off-by: Dorab Patel <dorabpatel@xxxxxxxxx>