Commit Graph

1171 Commits

Author SHA1 Message Date
Tim Pope
239089f6e7 Silently ignore trees in s:BlobTemp() 2021-08-11 12:49:37 -04:00
Tim Pope
f11b80022f Use jobs for calls to git update-index
This is our only use of Git that requires writing to stdin, so
shoehorning that behavior onto s:StdoutToFile() frees us from worrying
about that when designing a more general purpose API.
2021-08-11 10:59:54 -04:00
Tim Pope
56561e47a6 Use jobs to capture stdout to file 2021-08-11 04:46:07 -04:00
Tim Pope
8e4a677c7f Fix command preparation when no arguments, only flags 2021-08-10 03:10:03 -04:00
Tim Pope
35872c5dca Make prepare functions idempotent
This is limited to the single argument case so as not to interfere with
using an old command result to seed the Git dir for a new command.
2021-08-10 02:35:52 -04:00
Tim Pope
b20e4145c7 Convert exec path to Vim path before accessing via filesystem 2021-08-10 02:35:52 -04:00
Tim Pope
d1970112f4 Rename #Prepare to #ShellCommand
Shell commands are on their way out.  Let's start reclaiming this verb.
2021-08-10 00:35:17 -04:00
Tim Pope
371a5062d3 Separate out flags when parsing Git arguments
This will enable us to construct an execution result dictionary similar
to FugitiveResult().
2021-08-10 00:25:49 -04:00
Tim Pope
4adf054a3f Fix fugitive#writefile() when staging new file 2021-08-08 22:45:10 -04:00
Tim Pope
19e7604839 Use Git paths when passing temp files to hash-object 2021-08-08 22:36:30 -04:00
Tim Pope
b8ba07f7d8 Improve flexibility of public API argument order
This allows tomfoolery like FugitiveConfig(dir)->FugitiveConfigGet(key).
I'm not sure I want to officially endorse this usage, but if nothing
else it makes interactive debugging a bit more fluid.
2021-08-08 00:48:27 -04:00
Tim Pope
55382eb722 Fix usage of index() 2021-08-07 16:19:02 -04:00
Tim Pope
2ee6a48d0b Apply insteadOf to raw remote URLs in addition to remote names
This also retools FugitiveRemoteUrl() argument handling to be a bit more
flexible.
2021-08-07 15:51:07 -04:00
Tim Pope
8def00c247 Homogenize calls to private exec helpers
Replace calls of the form f(dir, arg1, arg2) with f([dir, arg1, arg2]).
2021-08-07 15:51:07 -04:00
Tim Pope
8082606fd0 Fix direct usage of fnameescape()
I plan to lower the minimum Vim version back to 7.0 before shipping 3.4,
which means we can't assume the presence of fnameescape().
2021-08-07 15:51:07 -04:00
Tim Pope
2dc08dfe35 Rename and relocate s:TempCmd() 2021-08-06 22:00:55 -04:00
Tim Pope
a25d4d6961 Fix read command output into buffer with guioptions=! 2021-08-06 21:35:43 -04:00
Tim Pope
2d0f51679c Accept git_dir dict key in FugitivePrepare() 2021-08-06 21:35:43 -04:00
Tim Pope
99e65ce049 Fix error message generation in s:ReplaceCmd() 2021-08-06 21:35:43 -04:00
Tim Pope
ebc828ef7c Minimize use of combined stdout and stderr
Combined stdout and stderr is what system() gives us, so the plugin was
built around it.  But getting the same from jobs is annoying, so let's
eliminate all unnecessary uses of it.
2021-08-06 17:57:57 -04:00
Tim Pope
dc579a0dfb Don't trust git --version with nonzero exit status
This prevents parsing `zsh:1: command not found: git` as version "1:".

References: https://github.com/tpope/vim-fugitive/issues/1801
2021-08-06 17:28:33 -04:00
Tim Pope
e9f913ff8a Fix error message for system() failure with argument list 2021-08-05 17:29:02 -04:00
Tim Pope
3a5d8c8770 Tighten check for PowerShell to match Vim's behavior
Vim only checks for the lowercase "powershell", so we should do the
same.
2021-08-05 17:27:41 -04:00
Tim Pope
1da2c02421 Add Vim version constraint to new PowerShell support
Closes https://github.com/tpope/vim-fugitive/issues/1807
2021-08-05 16:29:40 -04:00
Tim Pope
24fd3d9599 Eliminate use of ":write !"
This is a prerequisite of eliminating the use of the shell in favor of
direct execution via jobs.
2021-08-03 11:45:25 -04:00
Tim Pope
058ffa406d Fix determining Git version with custom Git command
Resolves: https://github.com/tpope/vim-fugitive/issues/1801
2021-07-29 08:25:05 -04:00
Tim Pope
11aee0ba82 Fix incorrect readfile() arguments 2021-07-28 15:53:56 -04:00
Tim Pope
c417518819 Use absolute path to /usr/bin/env
Based on the prevalence of /usr/bin/env shebangs, I trust it is safe to
hard code this.  Or at least, it's safer than trusting the user not to
create a script called env.
2021-07-27 15:35:35 -04:00
Tim Pope
93f25f6883 Fix omitted Git dir argument
This shouldn't matter in this context since it's designed only to
provoke an error message, but fix it anyways so it stops setting off
mental alarm bells.
2021-07-27 15:35:35 -04:00
Tim Pope
a41329ab7c Get remote URL with config rather than shelling out 2021-07-27 15:35:35 -04:00
Tim Pope
5f87622277 Add methods to config object
Do not rely on these.  The FugitiveConfigGet() family of functions
remains official, for now.
2021-07-26 12:04:52 -04:00
Tim Pope
6bacc1039c Decouple s:SystemError() from Git
Treat lists not as Git arguments but a generic argument list, to enable
avoiding the shell once this becomes job backed.
2021-07-26 12:04:52 -04:00
Tim Pope
af5ba43aa3 Reference plugin file as canonical API documentation 2021-07-26 07:09:30 -04:00
Mike Williams
75b2a9a8da Improve PowerShell support with recent Vim
References: https://github.com/tpope/vim-fugitive/pull/1783
2021-07-24 07:28:07 -04:00
Dmytro Meleshko
a7c54990f0 Don't execute autocmds during :GBrowse with range 2021-07-21 18:23:26 -04:00
Tim Pope
de6495ae84 Better support for ssh config
* Respect User and Port in addition to Hostname.
* Support globs and negations in addition to literal host matching.
* Parse global config file in addition to user config file.
* Handle Include declarations.

References: https://github.com/tpope/vim-rhubarb/issues/65
2021-07-17 18:52:27 -04:00
Tim Pope
58516a13c6 Support expanding ## as argument list
Closes https://github.com/tpope/vim-fugitive/issues/1792
2021-07-16 18:38:00 -04:00
Tim Pope
b5316d0e96 Avoid stepping on status window in :Gclog/:Gllog
Closes https://github.com/tpope/vim-fugitive/issues/1790
2021-07-12 15:49:14 -04:00
Tim Pope
e9f93be356 Generalize :GBrowse - to all temp buffers 2021-07-12 15:49:14 -04:00
Tim Pope
fd5b553029 Tighten loose regexp 2021-07-12 15:49:14 -04:00
Tim Pope
78d41a014e Don't abbreviate :vertical
Change the :Gvdiffsplit definition so that we're consistent with <mods>.
And make everything else consistent with that.
2021-07-10 17:49:17 -04:00
Tim Pope
957d962e06 Error when core.worktree expected but missing 2021-07-09 12:52:20 -04:00
Tim Pope
f920245d6b Avoid spurious window resizing in :Gdiffsplit
Closes https://github.com/tpope/vim-fugitive/issues/1787
2021-07-09 12:52:20 -04:00
Elias Norrby
5551853f34 Fix ternary expression in s:NullError
Only the leading part was removed in ae6f84a.

Fixes #1785
2021-07-08 08:59:46 -04:00
Tim Pope
b498607aa7 Don't assume FugitiveGitDir() is actual directory
This is currently a valid assumption, but it boxes us in.  Instead use
fugitive#Find('.git/'), which is guaranteed to return a path to an
actual directory.

Also use fugitive#Find('.git/refs/..') to determine the common
directory.
2021-07-05 16:45:54 -04:00
Tim Pope
d11c90ad66 Save filenames from rename rather than splitting on " -> " 2021-07-04 10:36:49 -04:00
Tim Pope
ca03f1d069 Fix write in index with guioptions=! 2021-07-04 10:36:49 -04:00
Tim Pope
ae6f84adf3 Handle empty items when null splitting
This correctly handles the case of multiple consecutive nulls (which I
don't think Git every produces in practice) and also the case of a bogus
newline at the end (which seems to happen with PowerShell).

References https://github.com/tpope/vim-fugitive/pull/1783
2021-07-04 10:36:49 -04:00
Tim Pope
8e0a8abf08 Don't capture trailing count as part of section header
We don't need this, and it gets in the way.
2021-07-03 06:00:36 -04:00
Tim Pope
ca0ff578ad Move config getter implementation into autoload file 2021-07-03 06:00:36 -04:00