mohamicorp / stash-jenkins-postreceive-webhook

Webhook used to notify Jenkins when commits are made to Stash
Other
138 stars 98 forks source link

Pull Requests -- ambiguous argument #91

Closed quicksnap closed 9 years ago

quicksnap commented 9 years ago

Hello! I'm trying to get pull-requests build triggers set up, and I'm coming across this error in a multi-config Jenkins build:

commit notification 7b8a2bf931efc311f545b87694b33baa22992dc5
[EnvInject] - Loading node environment variables.
Building remotely on PF-PC-001 (windows) in workspace C:\jenkins\portfolio_native
 > C:\cygwin64\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > C:\cygwin64\bin\git.exe config remote.origin.url ssh://git@stash.extensis.com:7999/port/portfolio.git # timeout=10
Fetching upstream changes from ssh://git@stash.extensis.com:7999/port/portfolio.git
 > C:\cygwin64\bin\git.exe --version # timeout=10
using GIT_SSH to set credentials 
 > C:\cygwin64\bin\git.exe fetch --tags --progress ssh://git@stash.extensis.com:7999/port/portfolio.git +refs/heads/*:refs/remotes/origin/*
 > C:\cygwin64\bin\git.exe rev-parse "7b8a2bf931efc311f545b87694b33baa22992dc5^{commit}" # timeout=10
FATAL: Command "C:\cygwin64\bin\git.exe rev-parse "7b8a2bf931efc311f545b87694b33baa22992dc5^{commit}"" returned status code 128:
stdout: 7b8a2bf931efc311f545b87694b33baa22992dc5^{commit}

stderr: fatal: ambiguous argument '7b8a2bf931efc311f545b87694b33baa22992dc5^{commit}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Any ides on why this is occurring? Thanks much.. let me know if I can provide any details.

Thanks for your work on this plugin!

quicksnap commented 9 years ago

I'm able to replicate this in a Unix environment as well.

quicksnap commented 9 years ago

I believe the issue is resolved by me adding adjusting the refspec under the Job Config -> SCM -> Git Advanced refspec:

+refs/heads/*:refs/remotes/origin/* +refs/pull-requests/*:refs/remotes/origin/pull-requests/*

This fetches this missing commits in the pull-request.