Git Product home page Git Product logo

git-wrapper's Introduction

git-wrapper's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

git-wrapper's Issues

Test failure due to git not being installed

Output from '/usr/local/bin/make test':

PERL_DL_NONLAZY=1 /export/home/cpant4/perl5/bin/perl5.15.0 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
# Testing Git::Wrapper 0.015
t/00-load.t ............. ok
open3: exec of git init failed at /export/home/cpant4/.cpan/build/Git-Wrapper-0.015-uyrDin/blib/lib/Git/Wrapper.pm line 68
t/basic.t ............... 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
t/pod-coverage.t ........ skipped: Test::Pod::Coverage 1.04 required for testing POD coverage
t/pod.t ................. skipped: Test::Pod 1.14 required for testing POD
t/release-pod-syntax.t .. skipped: these tests are for release candidate testing

Test Summary Report
-------------------
t/basic.t             (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
Files=5, Tests=1,  1 wallclock secs ( 0.02 usr  0.01 sys +  0.12 cusr  0.02 csys =  0.17 CPU)
Result: FAIL
Failed 1/5 test programs. 0/1 subtests failed.
make: *** [test_dynamic] Error 255

tests fail on Win32 with bad $HOME

If $HOME is set to an invalid value on a Win32 system, the initial $git->init() call in t/basic.t fails (due to the underlying git init call not being able to load the global gitconfig file, because it's looking for it in at a path that isn't valid on Win32 systems).

One suggested option is to check for this in Makefile.PL and refuse to install if $HOME is set but the directory doesn't exist. I'm not sure that's the right solution.

An alternative is to check that the $git->init() call in t/basic.t succeeds, and issue a BAILOUT if it doesn't. This seems like a better solution in that it's more generic (and because if that first git init doesn't work the test suite is pretty well fucked for going forward).

commit-tree needs to be special cased

14:28 < frew> genehack: look at that commit I just pasted; that stuff is stuff that Git::Wrapper doesn't support that apparently wouldn't be hard to add 14:29 < frew> genehack: https://github.com/frioux/dist-zilla-plugin-git/blob/427260770320c48fcdf71394c794405c3f6a027c/lib/Dist/Zilla/Plugin/Git/CommitBuild.pm#L113 14:29 < dipsy> [ dist-zilla-plugin-git/lib/Dist/Zilla/Plugin/Git/CommitBuild.pm at 427260770320c48fcdf71394c794405c3f6a027c · frioux/dist-zilla-plugin-git · GitHub ] 14:29 < frew> genehack: that may be more helpful

Test fails with tab/space issue

The tests fail during install with:

# Testing git version: 2.9.2
#   Failed test 'message'
#   at t/basic.t line 77.
#          got: 'FIRST
# 
#         BODY
# '
#     expected: 'FIRST
# 
#   BODY
# '
# Looks like you failed 1 test of 26.
t/basic.t ................. 
Dubious, test returned 1 (wstat 256, 0x100)

Ubuntu 14.4, but I rather suspect the git version might be to blame. I checked some green CPAN testers output and it was using 1.8.3, e.g.
http://www.cpantesters.org/cpan/report/7f455f80-c654-11e4-b221-9e126cbd7f71

perl -v
This is perl 5, version 22, subversion 0 (v5.22.0) built for x86_64-linux

git --version
git version 2.9.2

tests fail because of ~/.gitconfig

If user have ~/.gitconfig with:

[commit]
	gpgsign = true

then tests fail with:

t/basic.t .. # Testing git version: 2.10.2

ok 1
ok 2
ok 3 - repo is dirty
error: gpg failed to sign the data
fatal: failed to write commit object
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 128 just after 3.

Looks like you need to force use of own global config in tests.

echo -ne doesn't work

echo -ne in sh on MacOS doesn't take args. So the CommitBuild doesn't work and the git mktree give format error because the "-ne" is send as a simple display.

A better way to do is simply use "open" command. But I have quick fix by surrouding the command by "bash -c 'cmd'" ...

so $cmd = qq{bash -c 'echo -ne "$cmd" | git mktree'};

problem with $git->log

This code:

use Git::Wrapper;
my $git = Git::Wrapper->new($repo_path_here);
$git->log('--oneline','-1');

produces this:

$ ./test.pl 
unhandled: $SHA $MSG at /opt/perl-5.14.2/lib/site_perl/5.14.2/Git/Wrapper.pm line 164.

when running git log --oneline -1 produces just:

$SHA $MSG

(Reported by @perigrin on IRC.)

Spaces in filename

Git::Wrapper fails horribly if the filename contains spaces. Yet such filenames are legal in a git repository.

Fixing this bug properly - so that all possible filenames are handled correctly - could be difficult. But it would be an improvement to handle just space characters, perhaps by using quotation marks in the git command line.

Test failure due to old git version - git branch color argument

With git 1.7.0.4 the test basic.t fails with the following error:

t/basic.t .................. 21/? #
error: option `color' takes no value
usage: git branch [options] [-r | -a] [--merged | --no-merged]
   or: git branch [options] [-l] [-f] <branchname> [<start-point>]
   or: git branch [options] [-r] (-d | -D) <branchname>
   or: git branch [options] (-m | -M) [<oldbranch>] <newbranch>

Generic options
    -v, --verbose         be verbose
    -t, --track           set up tracking mode (see git-pull(1))
    --set-upstream        change upstream info
    --color               use colored output
    -r                    act on remote-tracking branches
    --contains <commit>   print only branches that contain the commit
    --abbrev[=<n>]        use <n> digits to display SHA-1s

Specific git-branch actions:
    -a                    list both remote-tracking and local branches
    -d                    delete fully merged branch
    -D                    delete branch (even if not merged)
    -m                    move/rename a branch and its reflog
    -M                    move/rename a branch, even if target exists
    -l                    create the branch's reflog
    -f, --force           force creation (when already exists)
    --no-merged <commit>  print only not merged branches
    --merged <commit>     print only merged branches

# Tests were run but no plan was declared and done_testing() was not seen.

This error is caused by the branch method in Git/Wrapper.pm . In older versions of Git the param --color takes no argument, is either --color or --no-color.

git branch [--color | --no-color] [-r | -a]

This is different in newer versions of Git

git branch [--color[=] | --no-color] [-r | -a]

Handling of encoding

It occurred to me that the lines returned by Git::Wrapper are octects, not characters. I understand that this is undertested, given that most of us write commit messages in English/ASCII only, however, looking at the source, it seems that no attempt to decode the strings is done.

This is not a bug per se, but I'd suggest to formalize this in the documentation, so people using the module are aware of what kind of strings to expect.

win32 support

this makes me a sad panda: http://matrix.cpantesters.org/?dist=Git-Wrapper+0.031

We seem to be losing a lot of test coverage, which has cascading effects on the distributions that use this module, because of a few small booboos in the tests. Would it be possible to detect the presence of git earlier, say in Makefile.PL, so a NA result could be returned instead of FAIL?

Path::Class needs a minimum version

Name: Path::Class::File
Version: 0.25
Directory: /usr/share/perl5/vendor_perl
File: /usr/share/perl5/vendor_perl/Path/Class/File.pm
Core module: no

I had this version installed and a test was failing with ->spew missing, it must have been added between 0.25 and 0.32

t/basic.t failing for old git versions (1.7 / 1.8)

The t/basic.t tests is failing on 0.046 for git versions 1.7.1 and 1.8.2.3. Here are the logs that I have:

# Testing git version: 1.7.1

#   Failed test 'expected copy score'
#   at t/basic.t line 150.
#          got: undef
#     expected: '100'

#   Failed test 'expected copy type'
#   at t/basic.t line 151.
#          got: 'A'
#     expected: 'C'

#   Failed test 'using RUN('log','--format=%H') to get all four commit SHAs'
#   at t/basic.t line 201.
# Looks like you failed 3 tests of 34.
t/basic.t .......
Dubious, test returned 3 (wstat 768, 0x300)
Failed 3/34 subtests
    (less 2 skipped subtests: 29 okay)
# Testing git version: 1.8.2.3

ok 1
ok 2
ok 3 - repo is dirty
ok 4 - repo is clean
ok 5
ok 6
ok 7 - one log entry
ok 8 - id
ok 9 - message
ok 10 - threw Git::Wrapper::Exception
ok 11 - date
ok 12 - id
ok 13 - log(--oneline) dies
ok 14 - RUN(log --oneline) lives
ok 15 - one log entry
ok 16 - one raw log entry
ok 17 - expected raw modification object
ok 18 - still one raw log entry
ok 19 - expected score
ok 20 - expected type
ok 21 - expected filename
ok 22 - one for the third time
ok 23 - expected copy score
ok 24 - expected copy type
ok 25 - expected copy filename
ok 26 - Attempt to commit interactively fails quickly
ok 27 # skip  : .git/COMMIT_EDITMSG: Permission denied
# error: T
not ok 28 - using RUN('log','--format=%H') to get all four commit SHAs

#   Failed test 'using RUN('log','--format=%H') to get all four commit SHAs'
#   at t/basic.t line 201.
ok 29 - argument test: long arg, no spaces in val
ok 30 - argument test: long arg, spaces in val
ok 31 - argument test: short arg, no spaces in val
ok 32 - argument test: short arg, spaces in val
ok 33 - new branch name is correct
ok 34 - passing content with -STDIN option
1..34
# Looks like you failed 1 test of 34.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/34 subtests
    (less 1 skipped subtest: 32 okay)

Test Summary Report
-------------------
t/basic.t (Wstat: 256 Tests: 34 Failed: 1)
  Failed test:  28
  Non-zero exit status: 1
Files=1, Tests=34,  1 wallclock secs ( 0.03 usr  0.00 sys +  0.17 cusr  0.23 csys =  0.43 CPU)
Result: FAIL

log to include filenames

It would be handy for log entries to have a filenames method which returns a list of files changed. This would involve changing the git log call to a different format such as git log --stat and parsing it accordingly.

Documentation: add non-option parameter

This Git::Wrapper newbie spent time untangling two Git::Wrapper behaviours to understand why git->clone wasn't doing what he expected.
Number 1: I wasn't sure how to add non-option parameters, i.e., a parameter on the command line that is not associated with an --option. An example is the repo url in git clone $repo_url. I blundered around trying every combination of hashs and lists before stumbling across #97 which made it clear in an example. The cpan/module documentation only covers options added with or without values. Perhaps you could help newbies out by explicitly explaining there how to add a non-option parameter.
These teeting problems aside, thanks for a great module.

0.043 fails with old git

t/basic.t skips creating a second commit if the installed git is so old that it does not support --allow-empty-message, but then it always expects to find 2 commits.
Simple fix:

@@ -143,6 +143,7 @@ sub _timeout (&) {
     return $timeout;
 }

+my $commit_count=1;
 SKIP: {
     if ( versioncmp( $git->version , '1.7.0.5') eq -1 ) {
       skip 'testing old git without commit --allow-empty-message support' , 1;
@@ -168,10 +169,11 @@ SKIP: {

     @log = $git->log();
     is(@log, 2, 'two log entries, one with empty commit message');
+    ++$commit_count;
 };

 my @out = $git->RUN('log','--format=%H');
-ok scalar @out == 2, q{using RUN('log','--format=%H') to get all 2 commit SHAs}
+ok scalar @out == $commit_count, qq{using RUN('log','--format=%H') to get all $

 # test --message vs. -m
 my @arg_tests = (

Need to strip ANSI colour codes from output

My git config includes this:

[color] 
        diff = auto
        status = auto
        branch = auto
        interactive = auto
        ui = true

And this:

perl -MGit::Wrapper -wle'print Git::Wrapper->new(".")->branch'

...has "master" in green.

One side effect of this is that any code that compares branch strings literally (for example, [Git::CheckFor::CorrectBranch]) will fail.

All git commands need to be run with colors turned off, or alternatively the output needs to be cleaned up before returning it.

Test failure due to old copy of git

Below is the error stack from stage 'make test':

[MSG] [Sun Jul 17 10:46:21 2011] cp lib/Git/Wrapper.pm blib/lib/Git/Wrapper.pm
Manifying blib/man3/Git::Wrapper.3

[ERROR] [Sun Jul 17 10:46:35 2011] MAKE TEST failed: PERL_DL_NONLAZY=1 /Volumes/Media/smoke/bare/perl-5.12.0/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
# Testing Git::Wrapper 0.015
t/00-load.t ............. ok
error: unknown option `porcelain'
usage: git status [options] [--] <filepattern>...

    -q, --quiet           be quiet
    -v, --verbose         be verbose

Commit message options
    -F, --file <FILE>     read log from file
    --author <AUTHOR>     override author for commit
    -m, --message <MESSAGE>
                          specify commit message
    -c, --reedit-message <COMMIT>
                          reuse and edit message from specified commit 
    -C, --reuse-message <COMMIT>
                          reuse message from specified commit
    -s, --signoff         add Signed-off-by:
    -t, --template <FILE>
                          use specified template file
    -e, --edit            force edit of commit

Commit contents options
    -a, --all             commit all changed files
    -i, --include         add specified files to index for commit
    --interactive         interactively add files
    -o, --only            commit only specified files
    -n, --no-verify       bypass pre-commit hook
    --amend               amend previous commit
    -u, --untracked-files[=<mode>]
                          show untracked files, optional modes: all, normal, no. (Default: all)
    --allow-empty         ok to record an empty change
    --cleanup <default>   how to strip spaces and #comments from message

# Tests were run but no plan was declared and done_testing() was not seen.
t/basic.t ............... 
Dubious, test returned 129 (wstat 33024, 0x8100)
All 2 subtests passed 
t/pod-coverage.t ........ skipped: Test::Pod::Coverage 1.04 required for testing POD coverage
t/pod.t ................. skipped: Test::Pod 1.14 required for testing POD
t/release-pod-syntax.t .. skipped: these tests are for release candidate testing

Test Summary Report
-------------------
t/basic.t             (Wstat: 33024 Tests: 2 Failed: 0)
  Non-zero exit status: 129
  Parse errors: No plan found in TAP output
Files=5, Tests=3, 11 wallclock secs ( 0.57 usr  0.76 sys +  2.54 cusr  6.35 csys = 10.22 CPU)
Result: FAIL
Failed 1/5 test programs. 0/3 subtests failed.
make: *** [test_dynamic] Error 255

Request for feature: testing switch

How would you feel about a way to have Git::Wrapper only print the command it would run, as opposed to actually doing it?

My use case: I'm working on a packaging tool at $work (currently implemented as a moderately thin wrapper around Dist::Zilla). At certain points, I want the tool to commit things to git automatically. Naturally, I want my tests to be able to verify that these commits is happening. There are of course a few options for doing this:

  1. Create a fake repo, do any commits there, clean it up afterwards. (I note that this is how Git::Wrapper itself is tested.) This doesn't work that well for me for a few reasons.
  2. Go ahead and do the commit and just remove the commit afterwards. This is how I'm currently doing it now, and it works, but it just seems ... dangerous. Plus, for safety's sake, I'm doing a git stash to make sure I don't blow anything away I can't get back, which means that every time I run my test suite, I end up littering my repo with stashes.
  3. Add something to Git::Wrapper that says, you know what, in this instance, don't really do the commit, just tell me what git command you're about to run (print it to STDERR or somesuch) and then I can check for that message and feel confident that the commit really would have taken place.

Obviously I'm angling for option # 3 here. :-)

Assuming you are amenable to such an option, what would be your preference for how to activate it? I see, again, 3 decent options:

  1. subclass (e.g. Test::Git::Wrapper) [not my favorite--most intrusive]
  2. package var (e.g. $Git::Wrapper::TEST_MODE = 1)
  3. environment var (e.g. $ENV{GIT_WRAPPER_TEST_MODE} = 1) [least intrusive]

If this sounds good to you, pick an option and let me know and I'll put together a pull request. From looking at the _cmd method, it should be pretty easy.

New git-binary test failing

@toddr, any ideas? I'm already chomp()ing the output and that doesn't seem to be making a difference. Also seems very specific to this one CPAN tester.

#   Failed test 'Wrapper runs what ever binary we tell it to'
#   at t/git_binary.t line 19.
#     Structures begin differing at:
#          $got->[0] = 'marco
'
#     $expected->[0] = 'marco'
# Looks like you failed 1 test of 5.
t/git_binary.t ............. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/5 subtests 

Failing test report -> http://www.cpantesters.org/cpan/report/ddf3e31a-6ce9-1014-bac9-c776d871b27e

[Question] How do you add non-hash parrameters?

I couldn't find this in the documentation, sorry.

How do I run something like this:

git pull --rebase=preserve origin master

In this case, I can handle the rebase=preserve because it's key/value, but the other two parameters, which I tend to use when wanting to pull data from only one ref, I have no idea how to write.

No way to get only one log entry

It's a very minor thing, but I can't simulate git log -n1 with Git::Wrapper. That is, if I do this:

my ($last_log) = $git->log({ max_count => 1 });

I get:

fatal: Option '--max-count' requires a value

I see what's going on here--your code sees a value of "1", decides it's a boolean switch, and buiilds the command line appropriately. But I'm not sure how to fix it. I even tried:

my ($last_log) = $git->log({ max_count => 1.0 });

thinking that would squeak me by the eq '1' test, but that didn't work either. Happily, the workaround is simple enough:

my ($last_log) = $git->log({ max_count => 2 });

which works fine. Technically, it's wasteful, since we're retrieving a log that we're just throwing away, but I sincerely doubt that's ever going to make any measurable performance difference.

Anyway, if you have a suggestion on how to fix it, I'd be glad to patch it, but I don't really see a clean way around it ATM. Maybe just give up and do a doco patch warning people this could be a problem ... ?

New hash-object test fails on older gits

The hash-object test added by 8f52f8c fails -- need to figure out when the 'no-filters' option was added to the hash_object subcmd and skip the test on git versions earlier than that, the same way we skip other stuff in a version based way (i.e., add a supports_hash_object_filters method a la supports_log_raw_dates and supports_status_porcelain).

Here's the error report from CPAN testers, 1.5.4.3 clearly fails but some Git changelog digging is in order.


Below is the error stack from stage 'make test':

PERL_DL_NONLAZY=1 /export/home/cpan/pit/thr/perl-5.12.2/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
# Testing Git::Wrapper 0.022
t/00-load.t ............. ok
t/author-err.t .......... skipped: these tests are for testing by the author
# Testing git version: 1.5.4.3
usage: git-hash-object [-t <type>] [-w] [--stdin] <file>...
# Tests were run but no plan was declared and done_testing() was not seen.
t/basic.t ............... 
Dubious, test returned 129 (wstat 33024, 0x8100)
All 21 subtests passed 
    (less 7 skipped subtests: 14 okay)
t/pod-coverage.t ........ skipped: Test::Pod::Coverage 1.04 required for testing POD coverage
t/pod.t ................. skipped: Test::Pod 1.14 required for testing POD
t/release-pod-syntax.t .. skipped: these tests are for release candidate testing

Test Summary Report
-------------------
t/basic.t             (Wstat: 33024 Tests: 21 Failed: 0)
  Non-zero exit status: 129
  Parse errors: No plan found in TAP output
Files=6, Tests=27,  6 wallclock secs ( 0.08 usr  0.06 sys +  0.47 cusr  0.84 csys =  1.45 CPU)
Result: FAIL
Failed 1/6 test programs. 0/27 subtests failed.
make: *** [test_dynamic] Error 255

timing issue on windows between add/commit in basic.t

The following thing happens on this line: https://github.com/genehack/Git-Wrapper/blob/master/t/basic.t#L225 I got the output by adding Devel::Confess and the STDOUT output to the error message.

$git->add('argument_testfile');
$git->commit({ $flag => $msg }); # here
ok 21 - argument test: long arg, no spaces in val
ok 22 - argument test: long arg, spaces in val
git exited non-zero but had no output to stderr, stdout: On branch master
Changes not staged for commit:
	modified:   argument_testfile

no changes added to commit
 at lib/Git/Wrapper.pm line 136.
	Git::Wrapper::RUN(Git::Wrapper=HASH(0x632fc54), "commit", HASH(0x63359b4)) called at lib/Git/Wrapper.pm line 65
	Git::Wrapper::AUTOLOAD(Git::Wrapper=HASH(0x632fc54), HASH(0x63359b4)) called at D:\cpan\Git-Wrapper\t\basic.t line 228
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 1 just after 22.

What happens here is that the add returns with success because windows has assured it of success but the write to the drive is still pending, and the commit then ends up seeing the index pre-write and fails with a "nothing to do" message.

I'm not entirely sure how to fix this. One way might be to just put a sleep at the end, another might be to try and get the add to only return when absolutely done.

Your thoughts?

log() result has no modifications()

To reproduce this, please clone the git repository at [email protected]:petdance/ack2.git. (At the time the latest revision was 06d47c8f.) Then in that checkout run

git log --name-only IsPathGroup.pm

This prints a single revision which affects that file. I would therefore expect to get back that revision from the log method, and moreover the revision would have a single modification which is for that file. But:

perl -MGit::Wrapper -E '$g = new Git::Wrapper("."); @l = $g->log({ raw => 1, follow => 1, date => "iso" }, "--", "IsPathGroup.pm"); foreach (@l) { @m = $_->modifications; say scalar @m }'

You will see that 0 is printed - so the revision found has no modifications.

If you can't reproduce this I can send a tarball of the git clone directory.

t/basic.t fails due to white space changes?

Testing against a pretty plain vanilla git on perl 5.24.1-RC2.

I'm still investigating the exact nature of the white space differences.

t/basic.t .. 
# Testing git version: 2.9.2
ok 1
ok 2
ok 3 - repo is dirty
ok 4 - repo is clean
ok 5
ok 6
ok 7 - one log entry
ok 8 - id
not ok 9 - message

#   Failed test 'message'
#   at t/basic.t line 77.
#          got: 'FIRST
# 
#         BODY
# '
#     expected: 'FIRST
# 
#   BODY
# '
ok 10 - threw Git::Wrapper::Exception
ok 11 - date
ok 12 - id
ok 13 - log(--oneline) dies
ok 14 - RUN(log --oneline) lives
ok 15 - one log entry
ok 16 - one raw log entry
ok 17
ok 18 - Attempt to commit interactively fails quickly
ok 19 - two log entries, one with empty commit message
ok 20 - using RUN('log','--format=%H') to get all 2 commit SHAs
ok 21 - argument test: long arg, no spaces in val
ok 22 - argument test: long arg, spaces in val
ok 23 - argument test: short arg, no spaces in val
ok 24 - argument test: short arg, spaces in val
ok 25 - new branch name is correct
ok 26 - passing content with -STDIN option
1..26
# Looks like you failed 1 test of 26.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/26 subtests 

Test Summary Report
-------------------
t/basic.t (Wstat: 256 Tests: 26 Failed: 1)
  Failed test:  9
  Non-zero exit status: 1
Files=1, Tests=26,  1 wallclock secs ( 0.03 usr  0.00 sys +  0.13 cusr  0.11 csys =  0.27 CPU)
Result: FAIL

Fails to install on CentOS 6 w/o git config file

Makefile.PL dies at line 14 when it runs git config --list on CentOS 6 and the user doesn't have a .gitconfig in their home directory directory. It dies with a misleading error message about "git seems broken; maybe check your HOME environment variable?"

If you run git config --list from the command line, it returns a value of 128 and the error string "fatal: error processing config file(s)" Git with CentOS 6.8 is 1.7.1 - and this appears to be an issue with this version of Git, but it would be nice to at least have a better error message when Git::Wrapper refuses to install.

basic.t hangs indefinitely

Running with git 1.8.2.1 and perl 5.16.3

The test hangs while executing the following line:

$git->commit({ message => "", 'allow-empty-message' => 1 });

pstree shows that the underlying git process has run interactively:

$ pstree -p 32148
prove(32148)───perl(32152)───git(32185)───editor(32186)───{editor}(32187)

$ ps -o args= 32185
git commit --allow-empty-message --message=

I assume this is caused by a change of behaviour in git, in this version the only way I've found to create an empty commit message is to use --file=/dev/null, no variation of the --message switch triggers the expected behaviour.

Test failure due to lack of git config

Below is the error stack from stage 'make test':

[MSG] [Sun Jul 17 17:26:01 2011] cp lib/Git/Wrapper.pm blib/lib/Git/Wrapper.pm
Manifying blib/man3/Git::Wrapper.3

[ERROR] [Sun Jul 17 17:26:02 2011] MAKE TEST failed: PERL_DL_NONLAZY=1 /home/cpan/pit/bare/perl-5.8.9/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
# Testing Git::Wrapper 0.015
t/00-load.t ............. ok

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident  <[email protected]> not allowed
t/basic.t ............... 
Dubious, test returned 2 (wstat 512, 0x200)
All 3 subtests passed 
# Tests were run but no plan was declared and done_testing() was not seen.
t/pod-coverage.t ........ skipped: Test::Pod::Coverage 1.04 required for testing POD coverage
t/pod.t ................. skipped: Test::Pod 1.14 required for testing POD
t/release-pod-syntax.t .. skipped: these tests are for release candidate testing

Test Summary Report
-------------------
t/basic.t             (Wstat: 512 Tests: 3 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
Files=5, Tests=4,  1 wallclock secs ( 0.03 usr  0.01 sys +  0.13 cusr  0.20 csys =  0.37 CPU)
Result: FAIL
*** Error code 255

Make clone more better

So, based on this:

15:39 (genehack) how about something like: ->clone( $repo , [ $path | %options ]); 
15:39 * perigrin nods
15:39 (perigrin) that would work
15:39 (perigrin) $options{prefix} = /tmp 
15:39 (genehack) i'm trying to think if there's anything in '%options' other than root_dir 
15:39 (perigrin) would *certainly* solve my problem.
15:39 (genehack) or prefix
15:39 (perigrin) well there could be 
15:39 (perigrin) bare => 1
15:39 (perigrin) would set --bare
15:39 (perigrin) etc.
15:40 (genehack) right, i need to review what options 'clone' can take

also add a 'humanish' filter to turn foo/bar/baz.git into baz; make that the default $path when it's not given (just like git clone)

New constructor fails with single Path::Class::Dir argument

I usually stringify my Path::Class objects when passing them to things that expect strings,
but I forgot, and got a bunch of failing test reports for smokers using the latest Git::Wrapper dev release:

Can't bless non-reference value at /home/src/perl/repoperls/installed-perls/perl/v5.17.8/165a/lib/site_perl/5.17.8/Git/Wrapper.pm line 49.

While the changes to new() are partly backward-compatible, they are not for any argument that previously stringified to a dir (instead the dir argument silently gets ignored).

I'm not sure how much code is out there that might pass instances of Path::Class::Dir (or any other similar classes) but you may wish to consider that.

A quick git-grep shows that Dist::Zilla::Plugin::Git passes objects extensively.

Would you consider swapping the new if logic to say if it's a HASH do the new style otherwise assume the first arg is a dir?

If you desire to deprecate the old behavior a warning could certainly be added.

What do you think?
I'd be happy to write up some tests if you'd like.

Failure during 'make test'

  CPAN.pm: Building G/GE/GENEHACK/Git-Wrapper-0.030.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Git::Wrapper
Writing MYMETA.yml and MYMETA.json
cp lib/Git/Wrapper/File/RawModification.pm blib/lib/Git/Wrapper/File/RawModification.pm
cp lib/Git/Wrapper.pm blib/lib/Git/Wrapper.pm
cp lib/Git/Wrapper/Statuses.pm blib/lib/Git/Wrapper/Statuses.pm
cp lib/Git/Wrapper/Log.pm blib/lib/Git/Wrapper/Log.pm
cp lib/Git/Wrapper/Exception.pm blib/lib/Git/Wrapper/Exception.pm
cp lib/Git/Wrapper/Status.pm blib/lib/Git/Wrapper/Status.pm
Manifying blib/man3/Git::Wrapper::Exception.3
Manifying blib/man3/Git::Wrapper::Log.3
Manifying blib/man3/Git::Wrapper.3
Manifying blib/man3/Git::Wrapper::File::RawModification.3
Manifying blib/man3/Git::Wrapper::Statuses.3
Manifying blib/man3/Git::Wrapper::Status.3
  GENEHACK/Git-Wrapper-0.030.tar.gz
  /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load.t ................ 6/6 # Testing Git::Wrapper 0.030
t/00-load.t ................ ok   
t/000-requires_external.t .. ok   
t/author-err.t ............. skipped: these tests are for testing by the author
t/basic.t .................. # Testing git version: 1.6.3.2
t/basic.t .................. ok    
t/git_binary.t ............. ok   
t/parse_args.t ............. ok    
t/path_class.t ............. # Testing git version: 1.6.3.2
t/path_class.t ............. 2/? fatal: '/tmp/FRA4lgN3mK/baz' is outside repository
# Tests were run but no plan was declared and done_testing() was not seen.
t/path_class.t ............. Dubious, test returned 128 (wstat 32768, 0x8000)
All 2 subtests passed 
t/release-pod-coverage.t ... skipped: these tests are for release candidate testing
t/release-pod-syntax.t ..... skipped: these tests are for release candidate testing

Test Summary Report
-------------------
t/path_class.t           (Wstat: 32768 Tests: 2 Failed: 0)
  Non-zero exit status: 128
  Parse errors: No plan found in TAP output
Files=9, Tests=62, 21 wallclock secs ( 0.24 usr  0.14 sys +  3.21 cusr  2.91 csys =  6.50 CPU)
Result: FAIL
Failed 1/9 test programs. 0/62 subtests failed.
make: *** [test_dynamic] Error 255
  GENEHACK/Git-Wrapper-0.030.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports GENEHACK/Git-Wrapper-0.030.tar.gz
Running make install
  make test had returned bad status, won't install without force
Failed during this command:
 GENEHACK/Git-Wrapper-0.030.tar.gz            : make_test NO
install
$ perl -V
Summary of my perl5 (revision 5 version 18 subversion 0) configuration:

  Platform:
    osname=darwin, osvers=8.11.0, archname=darwin-2level
    uname='darwin macintosh-9.local 8.11.0 darwin kernel version 8.11.0: wed oct 10 18:26:00 pdt 2007; root:xnu-792.24.17~1release_ppc power macintosh powerpc '
    config_args='-des'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include',
    optimize='-O3',
    cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build 5250)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
                        PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_LARGE_FILES
                        USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
  Built under darwin
  Compiled at May 18 2013 12:31:26
  %ENV:
    PERLBREW_BASHRC_VERSION="0.59"
    PERLBREW_HOME="/Users/jimk/.perlbrew"
    PERLBREW_MANPATH=""
    PERLBREW_PATH="/Users/jimk/perl5/perlbrew/bin"
    PERLBREW_ROOT="/Users/jimk/perl5/perlbrew"
    PERLBREW_VERSION="0.59"
  @INC:
    /usr/local/lib/perl5/site_perl/5.18.0/darwin-2level
    /usr/local/lib/perl5/site_perl/5.18.0
    /usr/local/lib/perl5/5.18.0/darwin-2level
    /usr/local/lib/perl5/5.18.0
    /usr/local/lib/perl5/site_perl/5.16.0
    /usr/local/lib/perl5/site_perl/5.14.2
    /usr/local/lib/perl5/site_perl/5.14.0
    /usr/local/lib/perl5/site_perl/5.12.0
    /usr/local/lib/perl5/site_perl/5.10.1
    /usr/local/lib/perl5/site_perl/5.10.0
    /usr/local/lib/perl5/site_perl/5.8.6
    /usr/local/lib/perl5/site_perl
    .

deadlocks can happen in IPC::Open3

This is largely system dependent, but because we write stdin before reading stdout/stderr in Git::Wrapper::RUN and read stdout before stderr, we can end up with deadlocks when pipe buffers fill up and we are blocked on another descriptor. Solving this with Open3 gets pretty icky with select() but there are several alternative modules to help with this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.