* Bug: `git-filter-branch −−subdirectory−filter` fails on Darwin, others?
@ 2016-05-11 13:47 Geoff Nixon
2016-05-11 14:08 ` Jeff King
0 siblings, 1 reply; 3+ messages in thread
From: Geoff Nixon @ 2016-05-11 13:47 UTC (permalink / raw)
To: git@vger.kernel.org; +Cc: geoff@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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bug: `git-filter-branch −−subdirectory−filter` fails on Darwin, others?
2016-05-11 13:47 Bug: `git-filter-branch −−subdirectory−filter` fails on Darwin, others? Geoff Nixon
@ 2016-05-11 14:08 ` Jeff King
2016-05-11 14:47 ` Geoff Nixon
0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2016-05-11 14:08 UTC (permalink / raw)
To: Geoff Nixon; +Cc: git@vger.kernel.org
On Wed, May 11, 2016 at 06:47:20AM -0700, Geoff Nixon wrote:
> 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 just double-checked, and it works fine for me in a simple test:
git init
mkdir subdir
for i in 1 2 3 4 5; do
echo $i >base-$i
echo $i >subdir/sub-$i
git add .
git commit -m $i
done
git filter-branch --subdirectory-filter subdir -- --all
That's on:
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.9.5
BuildVersion: 13F34
However, I notice the error message you show has non-ascii dashes when
it prints "--subdirectory-filter". That matches what you said below:
> - 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)
Are you sure that you are invoking filter-branch with regular ascii
dashes, and not Unicode "minus-sign" (U+2212)?
I seem to recall this coming up once before related to OS X, but I can't
seem to find it in the archive. And I don't recall if it was related to
the terminal, a keyboard setting, or something else.
-Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bug: `git-filter-branch −−subdirectory−filter` fails on Darwin, others?
2016-05-11 14:08 ` Jeff King
@ 2016-05-11 14:47 ` Geoff Nixon
0 siblings, 0 replies; 3+ messages in thread
From: Geoff Nixon @ 2016-05-11 14:47 UTC (permalink / raw)
To: Jeff King; +Cc: git@vger.kernel.org
---- On Wed, 11 May 2016 07:08:02 -0700 Jeff King <peff@peff.net> wrote ----
> On Wed, May 11, 2016 at 06:47:20AM -0700, Geoff Nixon wrote:
>
> > 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)
>
> Are you sure that you are invoking filter-branch with regular ascii
> dashes, and not Unicode "minus-sign" (U+2212)?
>
> I seem to recall this coming up once before related to OS X, but I can't
> seem to find it in the archive. And I don't recall if it was related to
> the terminal, a keyboard setting, or something else.
That was it. I'm an idiot.
I sometimes use `man -t` to generate postscript for lengthy man pages so I can "page through" outside my terminal.
It appears that for reasons unknown this converts all "-"s to "−"s. I must have copy-pasted the example.
Then I kept using my shell history completion, never typing it out again.
Sorry for wasting your time, thanks for helping me figure this out.
-Geoff
>
> -Peff
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-11 14:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-11 13:47 Bug: `git-filter-branch −−subdirectory−filter` fails on Darwin, others? Geoff Nixon
2016-05-11 14:08 ` Jeff King
2016-05-11 14:47 ` Geoff Nixon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).