Commit Graph

2131 Commits

Author SHA1 Message Date
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
Tim Pope
9ea1f43a6a Delete temp files created computing :GBrowse line numbers 2022-06-18 00:33:00 -04:00
Tim Pope
763f42cab5 Simplify conditional around :GBrowse line number computation
This is solely to improve the readability of upcoming diffs.
2022-06-18 00:33:00 -04:00
Tim Pope
bef885fd00 Fix :GBrowse in :Git blame window 2022-06-18 00:33:00 -04:00
Tim Pope
1aefa1aed2 Cope gracefully with missing .git/index 2022-06-17 13:17:43 -04:00
Tim Pope
abe29d4891 Restore .git_dir on fugitive#repo()
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.
2022-06-17 13:17:43 -04:00
Tim Pope
9fadd7a778 Provide :Gdrop 2022-06-16 09:41:34 -04:00
Tim Pope
acee967384 Remove :Gcommit family of error stubs 2022-06-16 09:41:34 -04:00
Tim Pope
7dd76231e6 Extract helper to determine position in diff hunk
References: https://github.com/tpope/vim-fugitive/issues/1171
2022-06-16 09:29:01 -04:00
Tim Pope
6ae79e75a4 Handle quoted filenames in diff --git headers 2022-06-15 08:19:23 -04:00
Tim Pope
3f5975e906 Include "\ No newline at end of file" in status buffer 2022-06-14 14:15:47 -04:00
Tim Pope
d9059413e2 Fix inconsistent whitespace matching in regexps
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.
2022-06-14 13:20:17 -04:00
Tim Pope
0996bae836 Partially support ".git" files and symlinks without core.worktree
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
2022-06-13 12:15:48 -04:00
Tim Pope
d72fbcb0a4 Loosen autocommand patterns for fugitive:// URLs
Allow for potential upcoming changes to the format.
2022-06-13 10:09:36 -04:00
Tim Pope
d002715084 Optimize inline expansion for large diffs
Resolves: https://github.com/tpope/vim-fugitive/issues/2011
2022-06-13 10:09:36 -04:00
Tim Pope
0680c3ae3c Remove last vestiges of :Gread! 2022-06-13 07:13:34 -04:00
Tim Pope
8c63ac0f2f Fix error message on fugitive#repo().config() 2022-06-13 07:13:34 -04:00
Tim Pope
b42f95c0c2 DWIM for % and # in URL argument 2022-06-13 07:13:34 -04:00
Tim Pope
020802475c Add error stubs for old fugitive#repo() object
This is still used in the wild, so provide error messages to aid in
transitioning.
2022-06-12 12:47:36 -04:00
Tim Pope
535389b9a6 Improve performance of FugitiveStatusline()
Avoiding fugitive#Find() saves a millisecond or 2.  Not a big deal but
still worth avoiding given how often this function is called.
2022-06-11 09:32:50 -04:00
Tim Pope
d1d485cdef Leverage FugitiveActualDir() abstraction 2022-06-11 09:32:50 -04:00
Tim Pope
8378b329b8 Drop obsolete public functions 2022-06-07 05:40:49 -04:00
Tim Pope
92c73bb050 Set b:git_dir in FugitiveEditor buffers
This should make us a bit more robust in the face of things like
symlinks.
2022-06-07 05:40:49 -04:00
Tim Pope
1d6e601298 Extract helper to initialize b:git_dir 2022-06-07 05:40:49 -04:00