Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove --first-parent from git commands to show file history from merged in repositories #437

Closed
Daemeron opened this issue Jun 28, 2018 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Daemeron
Copy link

Output:

getBlameForLine('/Users/xxx/Source/yyy', '/Users/xxx/Source/yyy/shop/src/components/pages/checkout/confirmation/Expanded.tsx', 'undefined', 148)
getBlameForFile[Cached(blame)]('/Users/xxx/Source/yyy', '/Users/xxx/Source/yyy/shop/src/components/pages/checkout/confirmation/Expanded.tsx', 'undefined')
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy')
Running(/Users/xxx/Source/yyy): git ls-files shop/src/components/pages/checkout/confirmation/Expanded.tsx
GitExplorer[view=repository].refreshNode(gitlens:repository:active)
Completed(/Users/xxx/Source/yyy): git ls-files shop/src/components/pages/checkout/confirmation/Expanded.tsx Completed in 34 ms
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy') = true
HistoryExplorer.refresh reason='active-editor-changed'
getStatusForFile('/Users/xxx/Source/yyy', '/Users/xxx/Source/yyy/shop/src/components/pages/checkout/confirmation/Expanded.tsx')
Running(/Users/xxx/Source/yyy): git -c color.status=false status --porcelain=v2 shop/src/components/pages/checkout/confirmation/Expanded.tsx
Completed(/Users/xxx/Source/yyy): git -c color.status=false status --porcelain=v2 shop/src/components/pages/checkout/confirmation/Expanded.tsx Completed in 27 ms
getLogForFile[Not Cached(log:follow)]('/Users/xxx/Source/yyy', '/Users/xxx/Source/yyy/shop/src/components/pages/checkout/confirmation/Expanded.tsx', undefined, undefined, undefined, false)
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy')
Running(/Users/xxx/Source/yyy): git ls-files shop/src/components/pages/checkout/confirmation/Expanded.tsx
Add log cache for '/users/xxx/source/yyy/shop/src/components/pages/checkout/confirmation/expanded.tsx:log:follow'
Completed(/Users/xxx/Source/yyy): git ls-files shop/src/components/pages/checkout/confirmation/Expanded.tsx Completed in 18 ms
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy') = true
Running(/Users/xxx/Source/yyy): git log --name-status -M --format=%x3c%x2ff%x3e%n%x3cr%x3e %H%n%x3ca%x3e %an%n%x3ce%x3e %ae%n%x3cd%x3e %at%n%x3cp%x3e %P%n%x3cs%x3e%n%B%n%x3c%x2fs%x3e%n%x3cf%x3e -n200 --follow -m --first-parent -- shop/src/components/pages/checkout/confirmation/Expanded.tsx
Completed(/Users/xxx/Source/yyy): git log --name-status -M --format=%x3c%x2ff%x3e%n%x3cr%x3e %H%n%x3ca%x3e %an%n%x3ce%x3e %ae%n%x3cd%x3e %at%n%x3cp%x3e %P%n%x3cs%x3e%n%B%n%x3c%x2fs%x3e%n%x3cf%x3e -n200 --follow -m --first-parent -- shop/src/components/pages/checkout/confirmation/Expanded.tsx Completed in 283 ms
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy')
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy') = true
Keyboard.beginScope 0
getLogForFile[Cached(log:follow)]('/Users/xxx/Source/yyy', '/Users/xxx/Source/yyy/shop/src/components/pages/checkout/confirmation/Expanded.tsx', 'undefined', undefined, undefined, true, false)
getBranch('/Users/xxx/Source/yyy')
Running(/Users/xxx/Source/yyy): git rev-parse --abbrev-ref --symbolic-full-name @ @{u}
Completed(/Users/xxx/Source/yyy): git rev-parse --abbrev-ref --symbolic-full-name @ @{u} Completed in 23 ms
getRemotes('/Users/xxx/Source/yyy')
Keyboard.beginScope 1
KeyboardScope.dispose 2 0
KeyboardScope.dispose 1 0
ResultsExplorer.refreshNode()
  • GitLens Version: 8.4.1
  • VSCode Version: 1.24.1 (24f62626b222e9a8313213fb64b10d741a326288)
  • OS Version: MacOS 10.13.5 (17F77)

Steps to Reproduce:

  1. Follow 2 repository merge scenario
# Note: If using ssh you need to enable extended globbbing in the following way and use ^ to negate the pattern

git clone git@server.com:old-project.git
git clone git@server.com:new-project.git

# If you want the old project to be a subdirectory of the new project, add this: !(old-project) is a bashism that says “everything but old-project”. If your project is called the girl, then you move “everything but the girl”.
cd old-project
mkdir old-project
git mv !(old-project) old-project
# Note: If using ssh you need to enable extended globbbing in the following way and use ^ to negate the pattern
setopt extendedglob
git mv ^old-project old-project
# or 
git mv ^(old-project|something-else) old-project
# commit the move
git commit -a -S -m “Moving old project into its own subdirectory”

# Now comes the merging part. What we’re doing is add a remote to the old project, and merge everything into the new one. Since git doesn’t allow merges without a common history, we’ll have to force it using the allow-unrelated-histories option. And since we love well-maintained projects, we’re doing everything in a branch we’ll merge after a code review is done.
cd ../new-project
git remote add old-project ../old-project
git fetch old-project
git checkout -b feature/merge-old-project
git merge -S --allow-unrelated-histories old-project/master
git push origin feature/merge-old-project
git remote rm old-project
  1. Try to see file history for new old project files. Only merge commit will be shown in the ui. This is because in order to see sub-tree merged repository history fully, git commands need --follow flag. Logs show that it is added but soon after another flag is added --first-parent which returns command to default behavior.
@eamodio eamodio self-assigned this Jul 17, 2018
@eamodio eamodio added the bug Something isn't working label Jul 17, 2018
@eamodio eamodio added this to the Soon™ milestone Jul 17, 2018
@Daemeron
Copy link
Author

@eamodio Thank you! 👍

@eamodio eamodio removed this from the Soon™ milestone Jul 19, 2019
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants