fix: disable diff detection for renames and copies (#3330)
* fix: disable diff detection for renames and copies * fix format
This commit is contained in:
parent
f4d66f4d5a
commit
d121e62763
|
@ -19,14 +19,17 @@ git clone git://127.0.0.1/repos/test-base.git /git/local/repos/test-base
|
||||||
cd /git/local/repos/test-base
|
cd /git/local/repos/test-base
|
||||||
git config --global user.email "you@example.com"
|
git config --global user.email "you@example.com"
|
||||||
git config --global user.name "Your Name"
|
git config --global user.name "Your Name"
|
||||||
echo "#test-base" > README.md
|
echo "#test-base" > README_TEMP.md
|
||||||
git add .
|
git add .
|
||||||
git commit -m "initial commit"
|
git commit -m "initial commit"
|
||||||
git commit --allow-empty -m "empty commit for tests"
|
git commit --allow-empty -m "empty commit for tests"
|
||||||
echo "#test-base :sparkles:" > README.md
|
echo "#test-base :sparkles:" > README_TEMP.md
|
||||||
git add .
|
git add .
|
||||||
git commit -m "add sparkles" -m "Change description:
|
git commit -m "add sparkles" -m "Change description:
|
||||||
- updates README.md to add sparkles to the title"
|
- updates README_TEMP.md to add sparkles to the title"
|
||||||
|
mv README_TEMP.md README.md
|
||||||
|
git add .
|
||||||
|
git commit -m "rename readme"
|
||||||
git push -u
|
git push -u
|
||||||
git log -1 --pretty=oneline
|
git log -1 --pretty=oneline
|
||||||
git config --global --unset user.email
|
git config --global --unset user.email
|
||||||
|
|
|
@ -11,14 +11,15 @@ describe('git-command-manager integration tests', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('tests getCommit', async () => {
|
it('tests getCommit', async () => {
|
||||||
const initialCommit = await git.getCommit('HEAD^^')
|
const initialCommit = await git.getCommit('HEAD^^^')
|
||||||
const emptyCommit = await git.getCommit('HEAD^')
|
const emptyCommit = await git.getCommit('HEAD^^')
|
||||||
|
const modifiedCommit = await git.getCommit('HEAD^')
|
||||||
const headCommit = await git.getCommit('HEAD')
|
const headCommit = await git.getCommit('HEAD')
|
||||||
|
|
||||||
expect(initialCommit.subject).toEqual('initial commit')
|
expect(initialCommit.subject).toEqual('initial commit')
|
||||||
expect(initialCommit.signed).toBeFalsy()
|
expect(initialCommit.signed).toBeFalsy()
|
||||||
expect(initialCommit.changes).toEqual([
|
expect(initialCommit.changes).toEqual([
|
||||||
{mode: '100644', status: 'A', path: 'README.md'}
|
{mode: '100644', status: 'A', path: 'README_TEMP.md'}
|
||||||
])
|
])
|
||||||
|
|
||||||
expect(emptyCommit.subject).toEqual('empty commit for tests')
|
expect(emptyCommit.subject).toEqual('empty commit for tests')
|
||||||
|
@ -27,11 +28,19 @@ describe('git-command-manager integration tests', () => {
|
||||||
expect(emptyCommit.signed).toBeFalsy()
|
expect(emptyCommit.signed).toBeFalsy()
|
||||||
expect(emptyCommit.changes).toEqual([])
|
expect(emptyCommit.changes).toEqual([])
|
||||||
|
|
||||||
expect(headCommit.subject).toEqual('add sparkles')
|
expect(modifiedCommit.subject).toEqual('add sparkles')
|
||||||
expect(headCommit.parents[0]).toEqual(emptyCommit.sha)
|
expect(modifiedCommit.parents[0]).toEqual(emptyCommit.sha)
|
||||||
|
expect(modifiedCommit.signed).toBeFalsy()
|
||||||
|
expect(modifiedCommit.changes).toEqual([
|
||||||
|
{mode: '100644', status: 'M', path: 'README_TEMP.md'}
|
||||||
|
])
|
||||||
|
|
||||||
|
expect(headCommit.subject).toEqual('rename readme')
|
||||||
|
expect(headCommit.parents[0]).toEqual(modifiedCommit.sha)
|
||||||
expect(headCommit.signed).toBeFalsy()
|
expect(headCommit.signed).toBeFalsy()
|
||||||
expect(headCommit.changes).toEqual([
|
expect(headCommit.changes).toEqual([
|
||||||
{mode: '100644', status: 'M', path: 'README.md'}
|
{mode: '100644', status: 'A', path: 'README.md'},
|
||||||
|
{mode: '100644', status: 'D', path: 'README_TEMP.md'}
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
1
dist/index.js
vendored
1
dist/index.js
vendored
|
@ -745,6 +745,7 @@ class GitCommandManager {
|
||||||
'show',
|
'show',
|
||||||
'--raw',
|
'--raw',
|
||||||
'--cc',
|
'--cc',
|
||||||
|
'--no-renames',
|
||||||
`--format=%H%n%T%n%P%n%G?%n%s%n%b%n${endOfBody}`,
|
`--format=%H%n%T%n%P%n%G?%n%s%n%b%n${endOfBody}`,
|
||||||
ref
|
ref
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -159,6 +159,7 @@ export class GitCommandManager {
|
||||||
'show',
|
'show',
|
||||||
'--raw',
|
'--raw',
|
||||||
'--cc',
|
'--cc',
|
||||||
|
'--no-renames',
|
||||||
`--format=%H%n%T%n%P%n%G?%n%s%n%b%n${endOfBody}`,
|
`--format=%H%n%T%n%P%n%G?%n%s%n%b%n${endOfBody}`,
|
||||||
ref
|
ref
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in a new issue