JuliaInterop / JavaCall.jl

Call Java from Julia
http://juliainterop.github.io/JavaCall.jl
Other
118 stars 53 forks source link

Git history removed? #141

Closed zot closed 3 years ago

zot commented 3 years ago

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

https://github.com/JuliaInterop/JavaCall.jl/blob/575f4514a1604c8c880667ee6e1398ecdf94647c/JProxies/src/proxy.jl#L1

Can you restore it?

zot commented 3 years ago

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

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

mkitti commented 3 years ago

The history is still there, https://github.com/JuliaInterop/JavaCall.jl/pull/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 commented 3 years ago

This seems to be where the log should follow through to the old location of the file. https://github.com/JuliaInterop/JavaCall.jl/commit/57aead902aaf48b8906e67cdbb96da3f8e1dae64

image

zot commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

Apparently GitHub doesn't support follow :-/ https://github.com/isaacs/github/issues/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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

aviks commented 3 years ago

Fixed by #142 . Thanks @zot !