Bug: `git-filter-branch −−subdirectory−filter` fails on Darwin, others?
- From
- Geoff Nixon <geoff@geoff.codes>
- Date
- May 11, 2016, 13:47 UTC
- Message-ID
- <154a01265c2.c271895e226206.8641058706319152212@geoff.codes>
May 11, 2016 Geoff Nixon geoff@geoff.codes
To Whom It May Concern:
I believe I have found a bug in git. On Mac OS X (at least 10.9 through 10.11), and versions of git from the current HEAD down through at least 1.8.x, `git filter-branch −−subdirectory−filter ...` fails. Using, e.g., the following example (from the docs for git-filter-branch), `git filter-branch --subdirectory-filter foodir -- --all`, and using the git repository as the example repository, `git filter-branch --subdirectory-filter Documentation -- --all`, the "error message" one receives is "fatal: bad revision '−−subdirectory−filter'".
I have tried to find and eliminate the bug myself, but despite my efforts it has proved elusive. Here is what I can tell you:
- It is apparently Darwin specific, or at least, I cannot reproduce on Linux
- It applies across a wide swath of versions of git and Mac OS X.
- Debugging is a challenge, because the code is pretty wack sauce,
- I.e., I don't understand how it `s
Doesn't matter which version of the OS or which version of git, at least going back to 10.9 and 1.8, I believe.
- There is some extremely strange magic going on here, i.e.,
- I don't understand how it sources `git-sh-setup` on line 90, while still in $PWD
- It begins with a heredoc of fuctions which are then immediately,
- `eval`'d, for no apparent reason.
- There's way to many uses of `eval` to follow, many of them needless, and it resets its own positional arguments to the result of the expansion of command substitution in places, withought saving the original parameters
- It possibly seems to be expanding '-' to an octal sequence at some point?
- Exporting PS4 to 'WTF: $LINENO ' and setting `-x` is practically of no use, except that the last line before it fails appears to be `git rev-parse --no-flags --revs-only --symbolic-full-name --default HEAD $'�\210\222�\210\222subdirectory�\210\222filter` (including the octal sequences and bad-unicode character, those are not email artifacts)Thank you for you time and consideration.
Yours,
Geoff Nixon