7dd76231e6 made the comma and the second
number required in a line range. But they can be omitted, for example:
* Adding a single line file:
@@ -0,0 +1 @@
* Modifying a single line file:
@@ -1 +1 @@
Using `coo` to open a branch under the cursor that started with 4+ hex
digits (e.g., 1111-feat) would fail with the error `fatal: invalid
reference: 1111.`
This happened because the prior regex would consider these branch names
as commits when determining whether to treat what was under the cursor
as a branch or commit.
This changes the regex to use a negative look-ahead to further tighten
the match for a commit and require that a match on 4+ hex digits also
not end with a non-hex digit.
Resolves#2085.
The core issue here is that on UNIX, fnameescape() always doubles
backslashes, while on Windows, it leaves them be. But it's a lot more
complicated than that, because Vim also avoids escaping other
characters, to minimize ambiguity. This can mostly be compensated for
by removing the corresponding characters from s:fnameescape, including
backslash itself. I'm a little worried that removing backslash will
have other implications, so keep an eye out for regressions here.
One character we can't remove is "!", because we need a way to escape
our own "the commit owning the current file" syntax. As a long term
strategy to address this, I'm introducing new !% and !# variations to
replace it. This is a bit on the ugly side, so I'm going to hold off on
committing to it as a documented interface until I've had more time to
muse on alternatives.
See also 6356bbc4a7, wherein I fixed a bug
with the exact same description. This suggests a change in Vim prompted
this new variation, but then again, there's no proof that I actually
tested my fix on Windows.
Resolves: https://github.com/tpope/vim-fugitive/issues/2071
These maps are not nearly as useful as they seem. Let's avoid tempting
newcomers to use them. I recommend to instead use <CR>, which shows the
change in context.
References: https://github.com/tpope/vim-fugitive/issues/2070
I'm quite eager to kill the "chomp" functions, as they're the last use
of system(). However, the successor, FugitiveExecute(), is only a year
old, and isn't a drop-in replacement. So let's bring them back for
awhile to avoid the need for a massive conditional to give backwards
compatibility.
The rest are pretty benign to support, so I guess they can stick around
until the band-aid is officially ripped off.
* On UNIX, jobs proceed normally, and exit with status 122.
* On Windows, jobs fail early, and no callbacks run.
* On Neovim, an exception is thrown.
Normalize the second and third cases to behave like the first, as that
was my assumed behavior during the initial implementation.
References: https://github.com/tpope/vim-fugitive/issues/1815
I figured "~" was unlikely to have legitimate uses, but it turns out
sourcehut uses it to prefix usernames in all of its URLs. Let's go with
a control character instead.
Resolves: https://github.com/tpope/vim-fugitive/issues/2021
Of the 8 :GBrowse providers listed in the README, 7 make no attempt to
handle URL encoding. So it makes sense for Fugitive to take
responsibility for this. By transposing "%" and "~" in API parameters
and then reversing the process on the generated URL, we can accommodate
both usages. This is transitional and will later be ditched in favor of
straightforward URL encoding.
References: https://github.com/cedarbaum/fugitive-azure-devops.vim/issues/3
This is technically backwards incompatible, but I've never seen a remote
with URL encoding in practice. (Also I don't think anyone is actually
using this function.) One can use .pathname if they need the encoded
version.
Might do this for everything but let's start here. I initially went
with backslashes for URLs because that's how Vim on win32 normalizes
buffer names, and figured it might simplify things like equality checks.
But Vim itself breaks in some places. Editing a `file://` URL doesn't
work if backslashes are in use, and Vim unescapes incorrectly when
constructing <q-args> (see 6356bbc4a7).
Work trees and submodules have two things that could be called the Git
dir: the directory itself, and the ".git" at the root of the work tree.
Introduce "fugitive_dir" as our name for the one we consider canonical.
This is still a garbage fire, but at least now the use of `.git/refs/`
paths has been relegated to the public interface. This also fixes a lot
of quirks, and hopefully doesn't introduce too many new ones.