Skip Menu |

This queue is for tickets about the Git-Repository-Plugin-Log CPAN distribution.

Report information
The Basics
Id: 110098
Status: resolved
Priority: 0/
Queue: Git-Repository-Plugin-Log

People
Owner: Nobody in particular
Requestors: kaoru [...] slackwise.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.312
Fixed in: (no value)



Subject: Tests fail with git config "diff.noprefix = true"
Hey, I tried installing Git::Repository::Plugin::Log this morning and t/40-plugin-log.t failed because I have the diff.noprefix option enabled in my ~/.gitconfig file. # got: 'diff --git file file # new file mode 100644 # index 0000000..e69de29 # ' # expected: 'diff --git a/file b/file # new file mode 100644 # index 0000000..e69de29 # ' Assuming you are calling git from the command-line, you could pass '-c diff.noprefix=false' as a parameter to ensure consistent output. alex@yuzu:~/example$ git diff | head -n 1 diff --git weaver.ini weaver.ini alex@yuzu:~/example$ git -c 'diff.noprefix=false' diff | head -n 1 diff --git a/weaver.ini b/weaver.ini Sorry for not sending a patch. I only came across this on my way to patch another CPAN module :-) - Alex
Subject: Re: [rt.cpan.org #110098] Tests fail with git config "diff.noprefix = true"
Date: Tue, 8 Dec 2015 09:22:50 +0100
To: Alex Balhatchet via RT <bug-Git-Repository-Plugin-Log [...] rt.cpan.org>
From: "Philippe Bruhat (BooK)" <book [...] cpan.org>
Hi, On Sat, Dec 05, 2015 at 04:08:58AM -0500, Alex Balhatchet via RT wrote: Show quoted text
> > I tried installing Git::Repository::Plugin::Log this morning and > t/40-plugin-log.t failed because I have the diff.noprefix option enabled > in my ~/.gitconfig file.
Thanks for the report. Show quoted text
> Assuming you are calling git from the command-line, you could pass > '-c diff.noprefix=false' as a parameter to ensure consistent output.
This would fix this particular issue, but git has many many configuration options that change the output of porcelain commands. After doing a little research, it seems the accepted way to ensure git does not load any configuration file besides .git/config is to set the environmen to: GIT_CONFIG_NOSYSTEM=1 XDG_CONFIG_HOME= HOME= I'll implement this as a general solution to the probleme of local configs when running a test suite for Git::Repository modules. Show quoted text
> Sorry for not sending a patch. I only came across this on my way to > patch another CPAN module :-)
Thanks again for you report. Without it, I'd never have spent the few minutes it took to figure this out. -- Philippe Bruhat (BooK) Freedom is not an individual effort. Yours comes only when you grant others theirs. (Moral from Groo The Wanderer #5 (Epic))
On Tue Dec 08 03:23:01 2015, BOOK wrote: Show quoted text
> After doing a little research, it seems the accepted way to ensure git > does not load any configuration file besides .git/config is to set the > environmen to: > > GIT_CONFIG_NOSYSTEM=1 > XDG_CONFIG_HOME= > HOME= >
Ah nice. I saw that GIT_CONFIG_NOSYSTEM exists and was surprised to see there wasn't a GIT_CONFIG_NOHOME option to go along with it. I guess setting HOME to empty is a fine hack to get around that :-) Show quoted text
> I'll implement this as a general solution to the probleme of local > configs > when running a test suite for Git::Repository modules.
Awesome! :-) Thanks.
On Tue Dec 08 05:37:04 2015, KAORU wrote: Show quoted text
> On Tue Dec 08 03:23:01 2015, BOOK wrote:
> > After doing a little research, it seems the accepted way to ensure > > git > > does not load any configuration file besides .git/config is to set > > the > > environmen to: > > > > GIT_CONFIG_NOSYSTEM=1 > > XDG_CONFIG_HOME= > > HOME= > >
> > Ah nice. I saw that GIT_CONFIG_NOSYSTEM exists and was surprised to > see there wasn't a GIT_CONFIG_NOHOME option to go along with it. I > guess setting HOME to empty is a fine hack to get around that :-)
Fixed in 2c08b0fc6bb40a87d682d203983562854e5c7a65. Will do a release soon. I've also added a section about those variables in the Git::Repository tutorial. Thanks again! -- BooK
Excellent :-)