Commit Graph

2104 Commits

Author SHA1 Message Date
Tim Pope
2019e0e413 Support folding sections
Resolves: https://github.com/tpope/vim-fugitive/issues/2111
References: https://github.com/tpope/vim-fugitive/issues/1317
2023-02-05 18:40:33 -05:00
Tim Pope
2febbe1f00 Make statusline redraw less aggressive
Mainly trying to avoid tainting `:verbose set readonly?`.
2023-01-16 22:04:38 -05:00
Tim Pope
9b50074e44 Better error message when :GBrowse remote not found
Resolves: https://github.com/tpope/vim-fugitive/issues/2103
2023-01-16 22:04:38 -05:00
Tim Pope
9c5f675db5 Allow PTY for paginated shortlog, to prevent stdin read
This workaround only works where PTY jobs are supported.  The real fix
is to give an explicit argument: `:Git shortlog HEAD`.

Resolves: https://github.com/tpope/vim-fugitive/issues/2100
2023-01-11 20:22:15 -05:00
Tim Pope
99cdb88bc6 Improve horizontal scrolling performance of :Git blame
References: https://github.com/tpope/vim-sensible/pull/124
2022-12-30 00:44:37 -05:00
Maksim Odnoletkov
5b0b138483 Fix parsing of diff hunk headers with omitted length
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 @@
2022-12-02 06:51:11 -05:00
Eric Milford
49cc58573e Tighten match for commit under cursor
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.
2022-11-23 13:57:13 -05:00
Zhizhen He
23b9b9b2a3 Fix typo 2022-11-16 07:28:20 -05:00
Ernst Widerberg
362201bce5 Fix typo 2022-11-15 04:53:25 -05:00
Tim Pope
01f3e0af92 Account for escaping differences when expanding on win32
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
2022-11-01 00:04:08 -04:00
Tim Pope
09908d82ef Remove ~ and P maps from blame documentation
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
2022-10-31 15:28:49 -04:00
Tim Pope
dd8107cabf Avoid invalid glob during tab complete
Resolves: https://github.com/tpope/vim-fugitive/issues/2050
2022-09-04 05:38:13 -04:00
Tim Pope
b411b753f8 Add deprecation warning on editing .git/index 2022-08-17 10:20:51 -04:00
Tim Pope
9fcac5b380 Fix broken blame maps
This was accidentally mapping `0` or `1` instead.

Switch to :exe while we're at it.

Resolves: https://github.com/tpope/vim-fugitive/issues/2031
2022-08-17 10:20:35 -04:00
Tim Pope
3485e22a0a Restore popular fugitive#repo() functions
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.
2022-08-02 13:48:01 -04:00
Tim Pope
66a921bbe3 Consistently handle missing command jobs across platforms
* 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
2022-07-28 08:52:00 -04:00
Tim Pope
23570688d2 Drop g:fugitive_legacy_quoting 2022-07-28 08:52:00 -04:00
Tim Pope
6955915af5 Account for ch_status() == 'fail'
References: https://github.com/tpope/vim-fugitive/issues/1815
2022-07-27 07:18:42 -04:00
Tim Pope
9a13fc87c4 Move status buffer to fugitive:// URL
Having already implemented this for better symlink support, we may as
well leverage it to phase out the "index" path leaky abstraction.
2022-07-22 01:45:41 -04:00
yut23
23b321b740 Fix backward navigation from the middle of a line
Ensure backward searches don't match the current line. This shows up
more in neovim, which sets 'nostartofline' by default.
2022-07-21 22:45:56 -04:00
yut23
4e11f9dabf Fix [c from the first hunk of a file
This makes the rest of the function operate on the previous file rather
than the file of the hunk under the cursor.
2022-07-21 22:45:56 -04:00
Tim Pope
d84582d5f7 Drop URL encoding workaround from :GBrowse API
No longer necessary as all known providers handle URL encoding
correctly.

References: https://github.com/cedarbaum/fugitive-azure-devops.vim/issues/3
2022-07-18 16:19:49 -04:00
Tim Pope
ff04324bff Don't use "~" for in-band signaling in :GBrowse API
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
2022-07-08 02:44:51 -04:00
Tim Pope
32b61c1665 URL encode "=" 2022-07-08 00:58:02 -04:00
Tim Pope
b8c5128f89 Fix automatic status reload when at fugitive:// URL 2022-07-08 00:47:00 -04:00
Tim Pope
f809dde0e7 Use URL encoding for Fugitive URLs
This makes them conform to whatever the RFC for URLs is.
2022-06-29 21:06:46 -04:00
Tim Pope
8fd6bad4a4 Handle URL-unsafe characters in :GBrowse API
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
2022-06-29 15:50:16 -04:00
Tim Pope
224b65ef58 URL decode FugitiveRemote().path and .user
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.
2022-06-29 14:20:57 -04:00
Tim Pope
f0acd25d45 Accept multiple arguments to :Gdrop, like :drop 2022-06-29 14:20:56 -04:00
Tim Pope
69ead802d7 Don't default :Gedit to cwd in empty window 2022-06-28 15:39:18 -04:00
Tim Pope
09dfed092a Use forward slashes for non-Fugitive URLs on win32
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).
2022-06-27 01:05:06 -04:00
Tim Pope
ecc5e8fa40 Tease apart :Gedit argument parsing and expansion 2022-06-26 21:38:01 -04:00
Tim Pope
c545a7d451 Correctly handle :Gedit + +SecondCommand 2022-06-26 21:38:01 -04:00
Tim Pope
47cbfc00cc Reject invalid URLs from GBrowse providers 2022-06-26 17:28:20 -04:00
Tim Pope
e80c460e48 Fix misc errors on Vim 7.4 2022-06-26 17:28:20 -04:00
Tim Pope
36b80c190c Remove inadvertent dict function flag 2022-06-26 16:59:59 -04:00
Tim Pope
87b3891c77 Encapsulate appending relative path to Fugitive URL
This gives us a central place to add URL encoding
2022-06-26 16:47:32 -04:00
Tim Pope
e7a33baccc Sync up win32 and UNIX fugitive:// regexps
Remove support for an optional second slash delimiter that was
accidentally committed in the previous win32 change.
2022-06-26 15:53:23 -04:00
Tim Pope
0bd3885169 Fix match of fugitive:////unchost/path// on win32 2022-06-26 15:41:23 -04:00
Tim Pope
9af6de1668 Use fugitive:///c:/ instead of fugitive://c:/ on win32
This avoids a bogus use of the host field in a standard URL and matches
how file:// URLs work.
2022-06-26 15:24:12 -04:00
Jaehwang Jung
00cc23868a Don't silence cmap 2022-06-25 14:55:04 -04:00
Tim Pope
33a7cdf213 Fix FugitiveExtractGitDir() with dict argument
Resolves: https://github.com/tpope/vim-fugitive/issues/2018
2022-06-24 17:00:33 -04:00
Tim Pope
80cd9c876e Move FugitiveParse() implementation into autoload file
Anticipating changes here, so let's try to avoid the dreaded "old plugin
file loads new autoload file" edge case burning us.
2022-06-23 18:09:40 -04:00
Tim Pope
8165eada59 Fix Projectionist root for .git/info/projections.json 2022-06-23 17:55:27 -04:00
Tim Pope
eac5ffd35b Don't reuse status window for :Gdrop 2022-06-23 14:41:20 -04:00
Tim Pope
aafbdf84cd Look for "fugitive_dir" as dictionary key
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.
2022-06-22 12:30:47 -04:00
Tim Pope
8b39d29d94 Rework ref handing in :GBrowse
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.
2022-06-19 09:42:26 -04:00
Tim Pope
3fd2c21ee0 DWIM for :GBrowse remote-name
Previously I had worried about the ambiguity this would produce, but
that can be resolved by calling `:GBrowse remote-name/HEAD`.
2022-06-18 23:05:27 -04:00
Tim Pope
a95f1c11ad Remove redundant URL escaping in :GBrowse
See b42f95c0c2.
2022-06-18 23:05:27 -04:00
Tim Pope
a337eb5114 Compute correct line numbers in blame buffer 2022-06-18 10:28:37 -04:00