[
https://issues.apache.org/jira/browse/SCM-668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17962512#comment-17962512
]
ASF GitHub Bot commented on SCM-668:
------------------------------------
jira-importer opened a new issue, #881:
URL: https://github.com/apache/maven-scm/issues/881
**[Laurent
Prévost](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=prevole)**
opened
**[SCM-668](https://issues.apache.org/jira/browse/SCM-668?redirect=false)** and
commented
I am unable to use the plugin buildnumber-maven-plugin to get the revision
number with Git and SVN. After some investigations, I realized that the plugin
used the Maven-SCM-API and their providers.
The command issued by the plugin is
```
/bin/sh -c cd /tmp/temp/mytestingrepo && git rev-parse --verify --short=7
HEAD
```
I run this command directly in a shell with the following error
```
fatal: Not a git repository (or any of the parent directories): .git
```
When I modify the command like the following one, it works perfectly
```
/bin/sh -c "cd /tmp/temp/mytestingrepo && git rev-parse --verify --short=7
HEAD"
```
It seems that the command is not executed correctly on my environment where
the
```
/bin/sh -c "cd /tmp/temp/mytestingrepo
```
is executed and afterwards the command
```
git rev-parse --verify --short=7 HEAD
```
is done in the current directory. In the case of SVN 1.7 and Git, the .svn
or .git are not located in subdirectories where the second command is executed.
---
**Affects:** 1.7
> Unable to get revision number with Git and SVN 1.7
> --------------------------------------------------
>
> Key: SCM-668
> URL: https://issues.apache.org/jira/browse/SCM-668
> Project: Maven SCM (Moved to GitHub Issues)
> Issue Type: Bug
> Components: maven-scm-api
> Affects Versions: 1.7
> Environment: Mac OS X Snow Leopard
> Maven 2 and 3
> Maven SCM 1.7 and previous ones
> Multi modules project
> Reporter: Laurent Prévost
> Priority: Major
>
> I am unable to use the plugin buildnumber-maven-plugin to get the revision
> number with Git and SVN. After some investigations, I realized that the
> plugin used the Maven-SCM-API and their providers.
> The command issued by the plugin is
> {code}
> /bin/sh -c cd /tmp/temp/mytestingrepo && git rev-parse --verify --short=7 HEAD
> {code}
> I run this command directly in a shell with the following error
> {code}
> fatal: Not a git repository (or any of the parent directories): .git
> {code}
> When I modify the command like the following one, it works perfectly
> {code}
> /bin/sh -c "cd /tmp/temp/mytestingrepo && git rev-parse --verify --short=7
> HEAD"
> {code}
> It seems that the command is not executed correctly on my environment where
> the
> {code}
> /bin/sh -c "cd /tmp/temp/mytestingrepo
> {code}
> is executed and afterwards the command
> {code}
> git rev-parse --verify --short=7 HEAD
> {code}
> is done in the current directory. In the case of SVN 1.7 and Git, the .svn or
> .git are not located in subdirectories where the second command is executed.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)