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.
This will enable functions like FugitiveFind() to use fugitive#repo() as
the optional second parameter, which should make transitioning to the
new API a bit easier to do incrementally.
The \s and \S atoms consider space and tabs to be the only valid
whitespace characters, while the [:space:] character class also includes
control characters like newline and form feed.
This is not and can never be 100% perfect. There's no way to work back
from a file like info/exclude COMMIT_EDITMSG to the work tree. So
core.worktree continues to be recommended.
References: https://github.com/tpope/vim-fugitive/issues/1920
Move "Unpushed" sections above "Unpulled".
Show commits that are unpushed anywhere when no upstream is set.
Provide czs map as :Git stash push --staged.
Support the MSYS Vim bundled with Git for Windows.
Turn remaining deprecated commands (:Gbrowse, etc.) into error stubs.
* Don't attempt to handle relative paths, as there's no guarantee the
current working directory is the one Vim was started with. In
practice, the only relative path I've seen is `.git/index`, which is
already the default and thus harmless to ignore.
* Cache the result of FugitiveVimPath(), to allow for slow
implementations.
This is intended to free up FugitiveGitDir() to refer to the ".git" file
in that work tree and submodule repositories use. I wish I had better
names for these two. Settling for "Actual" as that at least has a
pleasing 6 letter symmetry with "Common".
FugitiveVimPath() is intended to potentially convert between UNIX and
Windows paths in mixed environments. Let's separate uses that require
that from those that simply normalize slashes.
The `:p` flag resolves symlinks, so the resolve() call is a no-op, and
the subsequent conditional is always false. It also appears to be no
longer necessary, though I'd have to do a bit more digging to figure out
why.
The 2 slash version slots the drive letter into the host field, which
I'm worried will cause problems when the URLs are used non-opaquely, for
example, with an LSP. Let's start transitioning to the convention used
by file:// URLs.
Using $GIT_DIR/index for the summary buffer has 2 problems:
* It requires a BufReadCmd for all files named "index", necessitating
special handling for false positives.
* It forces us to resolve ".git" files and symlinks, decoupling us from
the worktree and thus forcing us to depend on `core.worktree`. Git
always sets this when necessary, but users and third-party tooling
sometimes do not.
Using a fugitive:// URL for the buffer solves both.
This is a large, breaking change, so let's leave $GIT_DIR/index as the
default for now.