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

Git history removed? #141

Closed
zot opened this issue Apr 10, 2021 · 10 comments
Closed

Git history removed? #141

zot opened this issue Apr 10, 2021 · 10 comments

Comments

@zot
Copy link
Contributor

zot commented Apr 10, 2021

Guys, somehow the history of my authorship of the JProxy code got removed from the files.

# See documentation for JProxy for infomation

Can you restore it?

@zot
Copy link
Contributor Author

zot commented Apr 11, 2021

For reference, here's the last commit from my forked repo that was merged here:

https://github.com/JuliaInterop/JavaCall.jl/tree/e7e8700eca9a48b7e47f55ee57a25a479de1ad5b

@mkitti
Copy link
Member

mkitti commented Apr 11, 2021

The history is still there, #91 :
image

The problem is that Github seems to be having trouble following the changes from the file moves and is not assigning the history to where the file currently is.

We could use a README.md in in the JProxies folder. Could you write up something there?

@mkitti
Copy link
Member

mkitti commented Apr 11, 2021

This seems to be where the log should follow through to the old location of the file. 57aead9

image

@zot
Copy link
Contributor Author

zot commented Apr 11, 2021

I think maybe someone didn't use git mv when they moved the file:

image

I will see if I can repair the file histories.

@zot
Copy link
Contributor Author

zot commented Apr 11, 2021

I sort of (?) repaired the history here: https://github.com/zot/JavaCall.jl/tree/repair-zot

git log --follow shows the history properly in my branch but GitHub does not.

On the current master branch, git log --follow does not show the history (of course, neither does GitHub :) ).

I will submit an issue to GitHub about producing the same history that git log --follow does and see what they say.

Here is my script to create the repair-zot branch:

#!/bin/sh
TMPDIR=$(mktemp -d /tmp/JavaCall.jl-XXXX)
echo USING TMPDIR: $TMPDIR
git clone git@github.com:zot/JavaCall.jl.git $TMPDIR
cd $TMPDIR
git branch repair-zot-src 13aa29d619d1e92b28e270806d582522ceff446a
git checkout repair-zot-src
mkdir -p REPAIR CLONE
# Clone doc/index.md, src/gen.jl, and src/proxy.jl -- see https://stackoverflow.com/a/44036771/1026782
git mv doc/index.md CLONE
git commit -m "Clone index.md"
SAVED=`git rev-parse HEAD`
git reset --hard HEAD^
git mv doc/index.md src/gen.jl src/proxy.jl REPAIR
git commit -m "Move JProxy files"
git merge --no-edit $SAVED
git commit -a -m "merge renames"
git mv CLONE/index.md doc
git commit -m "restore history for index.md"

git branch repair-zot master
git checkout repair-zot

git merge --no-edit repair-zot-src
git commit -a -m "Restore history for JProxy files: stage 1"
git rm JProxies/src/gen.jl JProxies/src/proxy.jl JProxies/doc/index.md
git commit -m "Restore history for JProxy files: stage 2"
mkdir -p JProxies/src JProxies/doc
git mv REPAIR/*.jl JProxies/src
git mv REPAIR/*.md JProxies/doc
git commit -m "Restore history for JProxy files: stage 3"

git cherry-pick -m 1 --strategy recursive -X theirs 57aead9
git cherry-pick --strategy recursive -X theirs 001d4ee
git cherry-pick --strategy recursive -X theirs 9801641

@zot
Copy link
Contributor Author

zot commented Apr 11, 2021

Apparently GitHub doesn't support follow :-/ isaacs/github#900

But at least in the repair-zot, branch the history is actually salvageable with the command line and it will suddenly appear on GitHub one day when they get around to it.

I'm pretty sure git log --follow doesn't show the history for these files because you renamed them and changed them in the same commit. If you rename them in an isolated commit, Git can track the hash of the file. If you rename it and change it before committing, it has a lot of trouble with that.

Looks like my script still need a little work, so I'm not ready to request any merges yet though :)

@zot
Copy link
Contributor Author

zot commented Apr 11, 2021

We could use a README.md in in the JProxies folder. Could you write up something there?

I think your idea about the README.md is best since it seems like GitHub won't show the history anyway. I'll propose a README.md for you...

@zot
Copy link
Contributor Author

zot commented Apr 11, 2021

I've dealt with problems like this before at work (and also caused them by renaming and modifying in the same commit). We were using Eclipse, though, and it handles file renaming much better than GitHub. :(

@zot
Copy link
Contributor Author

zot commented Apr 11, 2021

OK, I made a pull request for the readme, please let me know what you think!

@aviks
Copy link
Collaborator

aviks commented Apr 12, 2021

Fixed by #142 . Thanks @zot !

@aviks aviks closed this as completed Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants