Commit Graph

42 Commits (main)

Author SHA1 Message Date
Nicolas Josef Zunker 1fabaa3cf8 README: clarify design rationale
Signed-off-by: Nicolas Josef Zunker <n.zunker@campus.tu-berlin.de>
1 year ago
Elijah Newren 52a9d7ed19 README.md: guide example-oriented learners to the examples
Signed-off-by: Elijah Newren <newren@gmail.com>
1 year ago
Elijah Newren 6d992c2272 README.md: tell windows user to read docs instead of taking random guesses
Windows users do not understand "just place the script into your $PATH",
but surprisingly decide that means they should take random guesses as to
what that means instead of reading the linked page that explains it in
more detail...and then complain that it was hard to figure out.

Make it clear that if they don't understand that statement, they also
should read the more detailed explanation page.

Signed-off-by: Elijah Newren <newren@gmail.com>
1 year ago
Elijah Newren 2878d8bc68 INSTALL.md: simplify instructions and suggest `python3 git-filter-repo`
Signed-off-by: Elijah Newren <newren@gmail.com>
2 years ago
Elijah Newren 240ef0bcc2 README.md: clarify simple instruction rules and antecedent of `it`
Signed-off-by: Elijah Newren <newren@gmail.com>
3 years ago
Elijah Newren 3f181531df README.md: link to external formatting of user manual
Some people don't like htmlpreview.github.io.  I once or twice saw a
case where it appeared to be affected by load limits.  Since external
sites are making the manual available, and it's unlikely there are too
many changes between the last release and the current manual, just link
to it as an alternative for folks.

Signed-off-by: Elijah Newren <newren@gmail.com>
3 years ago
Elijah Newren 7b3e714b94 filter-repo (README): remove outdated 2.28.0-not-yet-released comment
Signed-off-by: Elijah Newren <newren@gmail.com>
4 years ago
Elijah Newren cefeef1c0a filter-repo: use new --date-format=raw-permissive fast-import option
fast-import gained a new raw-permissive date format explictly for
allowing people to import repositories as-is.  Make use of the flag, and
stop rewriting the bogus timezone found in rails.git.

If users do not like these bogus times, they can of course write a
filter to fix them (or even make them bogus in a different way).  For
example:

    git filter-repo ... --commit-callback '
      if commit.author_date.endswith(b"+051800"):
        commit.author_date.replace(b"+051800", b"+0261")
    '

Signed-off-by: Elijah Newren <newren@gmail.com>
4 years ago
Elijah Newren 469a3e10f2 filter-repo (README): separate sections for different tools
Our showing of how to handle the simple example with different tools
combined three different tools into a single section which I think made
it slightly harder to read and follow.  It also concentrated almost
exclusively on filter-branch.  Provide a separate section for each tool,
and provide more details for BFG and fast-export/fast-import.

Signed-off-by: Elijah Newren <newren@gmail.com>
4 years ago
Elijah Newren 8ba3566119 filter-repo (README): link cheat sheets from usage section too
Signed-off-by: Elijah Newren <newren@gmail.com>
4 years ago
Elijah Newren 1e2d0e91cb Documentation: add more detailed explanation of safety checks and --force
I occasionally get people doing special things, or see people
recommending to others to just use --force.  Add some explanations
behind the safety checks so that those doing special things know when
it's okay, and to explain why it's a really bad idea to casually or
haphazardly recommend others use --force.

Signed-off-by: Elijah Newren <newren@gmail.com>
4 years ago
Elijah Newren 5c4637ff81 Documentation: add guides for people converting from filter-branch or BFG
Signed-off-by: Elijah Newren <newren@gmail.com>
4 years ago
Elijah Newren 4ea19c0bf8 filter-repo (README): streamline prerequisite wording a little bit
Signed-off-by: Elijah Newren <newren@gmail.com>
4 years ago
Elijah Newren bcd9964537 filter-repo (README): link to upstream docs
Signed-off-by: Elijah Newren <newren@gmail.com>
4 years ago
Elijah Newren e1d126a1ea Reference package managers in installation instructions
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren b3eb2cf461 filter-repo (README): add code of conduct and contributing guidelines
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 1762b99573 Explain how to use a python3 executable not named "python3"
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 5c35bb7a8d filter-repo (README): add sections on prerequisites and installation
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren ceb924ea8f filter-repo (README): add link to predecessor project
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 2fc5596455 filter-repo (README): add note about requiring a recent version of git
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren e0140bb2ad git-filter-repo.txt: minor updates to docs
A few changes:
  * Include notes about git-2.24.0 changes
  * Make it clearer that messing with the first parent could have
    negative side-effects if the file_changes aren't also updated.
  * Fix wrapping of a line that was too long.

Also, update the README.md:
  * Note the upstream improvements made in (not yet released) git-2.24.0

Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren b5b0cf4230 filter-repo (README): restructure and update
Since we now have a separate user manual and it does not make sense to
duplicate information in multiple places, restructure the README:
  * Refer to the actual manual early on
  * Limit the README to mostly be about why I wrote it and why folks
    might want to consider it instead of existing tools
  * Include a new section on upstream improvements, especially since it
    looks like inclusion of git-filter-repo in git.git is unlikely.

Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 65f0ecaef7 filter-repo: updates and minor fixes in option help and README
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 89f9fbbb6d filter-repo: partial repo filtering considerations
Fix a few issues and add a token testcase for partial repo filtering.
Add a note about how I think this is not a particularly interesting or
core usecase for filter-repo, even if I have put some good effort into
the fast-export side to ensure it worked.  If there is a core usecase
that can be addressed without causing usability problems (particularly
the "don't mix old and new history" edict for normal rewrites), then
I'll be happy to add more testcases, document it better, etc.

Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren ece8a74df9 filter-repo (README): add instructions on parent rewriting
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 9744c57106 filter-repo: change --path-rename to work on matches instead of prefixes
Using an exact path (file or directory) for --path-rename instead of a
prefix removes an ugly caveat from the documentation, makes it operate
similarly to --path, and will make it easier to reuse common code when I
add the --paths-from-file option.  Switch over, and replace the
startswith() check by a call to filename_matches().

Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren a475dce65e filter-repo (README): add a section with information about limitations
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 6e7d36edc1 filter-repo (README): add a section with information about internals
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 955c6cf79a filter-repo (README): link to examples of library usage
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren d94c8ea4c2 filter-repo (README): include callback examples
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren a451261f81 filter-repo (README): include user-and-email-based filtering examples
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren c3d7fe8feb filter-repo (README): include refname-based filtering examples
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren b04ba30e46 filter-repo (README): include content-based filtering examples
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 15c7bb52f1 filter-repo (README): include path-based filtering examples
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 09d54a26b6 filter-repo (README): add a "big picture" overview to rewriting in general
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 128c2a22ae filter-repo (README): separate background information more clearly
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 23db0417c8 filter-repo (README): wording fixes, clarifications, and improvements
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 1fa8c2c70b filter-repo: add --replace-refs option
This adds the ability to automatically add new replacement refs for each
rewritten commit (as well as delete or update replacement refs that
existed before the run).  This will allow users to use either new or old
commit hashes to reference commits locally, though old commit hashes
will need to be unabbreviated.  The only requirement for this to work,
is that the person who does the rewrite also needs to push the replace
refs up where other users can grab them, and users who want to use them
need to modify their fetch refspecs to grab the replace refs.

However, other tools external to git may not understand replace refs...

Tools like Gerrit and GitHub apparently do not yet natively understand
replace refs.  Trying to view "commits" by the replacement ref will
yield various forms of "Not Found" in each tool.  One has to instead try
to view it as a branch with an odd name (including "refs/replace/"), and
often branches are accessed via a different URL style than commits so it
becomes very non-obvious to users how to access the info associated with
an old commit hash.

  * In Gerrit, instead of being able to search on the sha1sum or use a
    pre-defined URL to search and auto-redirect to the appropriate code
    review with
      https://gerrit.SITE.COM/#/q/${OLD_SHA1SUM},n,z
    one instead has to have a special plugin and go to a URL like
      https://gerrit.SITE.COM/plugins/gitiles/ORG/REPO/+/refs/replace/${OLD_SHA1SUM}
    but then the user isn't shown the actual code review and will need
    to guess which link to click on to get to it (and it'll only be
    there if the user included a Change-Id in the commit message).
  * In GitHub, instead of being able to go to a URL like
      https://github.SITE.COM/ORG/REPO/commit/${OLD_SHA1SUM}
    one instead has to navigate based on branch using
      https://github.SITE.COM/ORG/REPO/tree/refs/replace/${OLD_SHA1SUM}
    but that will show a listing of commits instead of information about
    a specific commit; the user has to manually click on the first commit
    to get to the desired location.

For now, providing replace refs at least allows users to access
information locally using old IDs; perhaps in time as other external
tools will gain a better understanding of how to use replace refs, the
barrier to history rewrites will decrease enough that big projects that
really need it (e.g. those that have committed many sins by commiting
stupidly large useless binary blobs) can at least seriously contemplate
the undertaking.  History rewrites will always have some drawbacks and
pain associated with them, as they should, but when warranted it's nice
to have transition plans that are more smooth than a massive flag day.

Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 2ddbe10034 filter-repo (README): split empty pruning into two sections
Keeping empty pruning as a single section likely makes users only think
about pruning of non-merge commits which become empty.  Since merge
commits can lose parents or become degenerate, it is worth creating a
second section for this; besides, that matches the separate options we
provide to users to control the features.

Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 697b9256f5 filter-repo: fix handling of topological changes
Due to pruning of empty commits, merge commits can become degenerate
(same commit serving as both parents, or one parent is an ancestor of
one of the others).  While we usually want to allow such degenerate
merge commits to themselves be pruned (assuming they add no additional
file changes), we do not want to prune them if the merge commit in the
original repository had the same degenerate topology.  So, we need to
keep track of the ancestry graph of the original repository as well and
include it in the logic about whether to allow merge commits to be
pruned.

Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 911f234e3d filter-repo: update README.md
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago
Elijah Newren 5f55960dfe filter-repo: add README.md explaing new filter-repo tool
Signed-off-by: Elijah Newren <newren@gmail.com>
5 years ago