Fix many regressions with git-svn and add missing unit tests.
Review Request #12652 — Created Sept. 28, 2022 and submitted
Turns out
git-svn
support hasn't worked out of the box in many years,
which shows how rarely people are using it anymore. The work formerly
done to add smart remote and ancestor branch detection failed if
explicit parents and tracking branches weren't provided.The reason is that a
git-svn
remote is fake. There's a reference, and
it's in the.git/config
file, but it doesn't exist as a proper remote.
Because of this, all remote-related checks failed.On top of that, diff building failed due to Python string issues and
just some bad logic that didn't catch many operations.This change fixes all that. We now handle the fake
git-svn
remote when
attempting to determine remotes and tracking branches.Our ancestor detection no longer breaks when the common ancestor is the
first commit in the repository (which can occur for new repositories
here).Diff building now uses the proper string types, and brings some fixes
over from the recentgit-p4
diff building fixes to ensure proper diffs
when there are spaces in filenames or files are deleted.
Renames/moves/copies don't work, but there's a lot wrong with this in
Subversion diffs anyway.
Unit tests pass.
Manually tested with a fresh new local git-svn clone. Verified I was
able to generate working diffs from added, deleted, and edited changes
to files.
Summary | ID |
---|---|
68de33d0ca81fad7546023cbffc3dc53ab4c41a3 |