Commit Graph

87428 Commits

Author SHA1 Message Date
Johannes Schindelin
916a7eb4ef Add back the original, scripted interactive rebase backend
This simply copies the version as of v2.19.0-rc0 verbatim. As of now,
it is not hooked up (because it needs a couple more changes to work);
The next commit will use the scripted interactive rebase backend from
`git rebase` again when `rebase.useBuiltin=false`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-24 15:14:04 +02:00
Johannes Schindelin
01a1db34ff Merge 'builtin-rebase--am'
This patch teaches the builtin rebase to avoid the scripted --am backend
and call `git format-patch` and `git am` directly.

Meaning: apart from the --merge and the --preserve-merges backends, `git
rebase` is now implemented in pure C, with no need to ask the Unix shell
interpreter for help.

This brings us really close to a fully builtin `git rebase`: the
--preserve-merges mode is about to be deprecated (as soon as the
--rebase-merges mode has proven stable and robust enough), and there are
plans to scrap the `git-rebase--merge` backend in favor of teaching the
interactive rebase enough tricks to run the --merge mode, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-23 22:24:55 +02:00
Johannes Schindelin
fd476d8524 Merge 'pk/rebase-in-c-6-final'
This final patch flips the switch and makes the builtin rebase the
default. The old, Unix shell scripted version can still be called via

	git -c rebase.useBuiltin=false rebase [...]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-23 22:24:55 +02:00
Johannes Schindelin
6f0852448a Merge 'js/rebase-in-c-5.5-work-with-rebase-i-in-c'
This branch first merges the builtin interactive rebase, and then
teaches the builtin rebase to hand off interactive rebases to the
builtin backend correctly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-23 22:24:54 +02:00
Johannes Schindelin
e7888125d5 Merge 'pk/rebase-in-c-5-test'
This fifth batch of builtin rebase patches concludes the conversion: the
builtin rebase is now feature-complete.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-23 22:24:54 +02:00
Johannes Schindelin
2ac9cfd443 Merge 'pk/rebase-in-c-4-opts'
This wave of built rebase patches implements the remaining rebase
options in the builtin rebase.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-23 22:24:54 +02:00
Johannes Schindelin
a561e43182 Merge 'pk/rebase-in-c-3-acts'
This set of patches implements the actions (such as --continue, --skip,
etc) in the builtin rebase.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-23 22:24:54 +02:00
Johannes Schindelin
3a1ad745ef Merge 'pk/rebase-in-c-2-basic'
This is the second wave of patches to bring us closer to a builtin `git
rebase`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-23 22:24:54 +02:00
Johannes Schindelin
bb9ad9823e Merge 'pk/rebase-in-c'
This is the first batch of the patches that turn `git rebase` into
a builtin.

This not only helps performance on Windows, but *especially* makes
things more robust, as no MSYS2 Bash will be required to run this
command any longer.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-23 22:24:54 +02:00
Johannes Schindelin
824acb60e0 Merge 'ps/stash-in-c'
This merges the builtin stash.

Upstream Git did not integrate it into any stable integration branch
yet, but the performance improvements are substantial enough,
especially on Windows, that we really, really, really want to have it
early.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-23 22:24:52 +02:00
Johannes Schindelin
65ccba5c58 builtin rebase: call git am directly
While the scripted `git rebase` still has to rely on the
`git-rebase--am.sh` script to implement the glue between the `rebase`
and the `am` commands, we can go a more direct route in the builtin
rebase and avoid using a shell script altogether.

This reduces the chances of Git for Windows running into trouble due to
problems with the POSIX emulation layer (known as "MSYS2 runtime",
itself a derivative of the Cygwin runtime): when no shell script is
called, the POSIX emulation layer is avoided altogether.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-23 21:59:51 +02:00
Johannes Schindelin
17def452a9 fixup! tests: move test PNGs into t/diff-lib/ 2018-08-23 21:04:27 +02:00
Pratik Karki
73b2570068 rebase: default to using the builtin rebase
Now that the builtin rebase is feature-complete, we should use it by
default. Let's keep the legacy scripted version around for the time
being; Once the builtin rebase is well-tested enough, we can remove
`git-legacy-rebase.sh`.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-08-22 15:12:53 -07:00
Johannes Schindelin
5375bbbf57 builtin rebase: prepare for builtin rebase -i
It is no longer a shell script, so we need to call it in a different way
than the other backends.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-08-22 15:02:12 -07:00
Junio C Hamano
ae497a0445 Merge branch 'ag/rebase-i-in-c' into js/rebase-in-c-5.5-work-with-rebase-i-in-c
* ag/rebase-i-in-c:
  rebase -i: move rebase--helper modes to rebase--interactive
  rebase -i: remove git-rebase--interactive.sh
  rebase--interactive2: rewrite the submodes of interactive rebase in C
  rebase -i: implement the main part of interactive rebase as a builtin
  rebase -i: rewrite init_basic_state() in C
  rebase -i: rewrite write_basic_state() in C
  rebase -i: rewrite the rest of init_revisions_and_shortrevisions() in C
  rebase -i: implement the logic to initialize $revisions in C
  rebase -i: remove unused modes and functions
  rebase -i: rewrite complete_action() in C
  t3404: todo list with commented-out commands only aborts
  sequencer: change the way skip_unnecessary_picks() returns its result
  sequencer: refactor append_todo_help() to write its message to a buffer
  rebase -i: rewrite checkout_onto() in C
  rebase -i: rewrite setup_reflog_action() in C
  sequencer: add a new function to silence a command, except if it fails
  rebase -i: rewrite the edit-todo functionality in C
  editor: add a function to launch the sequence editor
  rebase -i: rewrite append_todo_help() in C
  sequencer: make three functions and an enum from sequencer.c public
2018-08-22 14:55:27 -07:00
Johannes Schindelin
52cf9500f7 squash! msvc: fix detect_msys_tty()
Fix author

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-22 22:26:17 +02:00
Johannes Schindelin
6a00f9c27a squash! msvc: provide a main() wrapper similar to mingw_main()
Fix author

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-22 22:25:58 +02:00
Johannes Schindelin
4b8e2b6112 squash! The stat() function should be independent of core.symlinks
Fix author

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-22 22:25:37 +02:00
Johannes Schindelin
b645067a62 squash! Win32: teach fscache and dirent about symlinks
Fix author

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-22 22:25:12 +02:00
Jameson Miller
f9c1a9c1a4 Merge pull request #1788 from gitster/bb/pedantic
Merge bb/pedantic to fix MSVC compile warnings
2018-08-21 18:21:46 +02:00
Jeff Hostetler
2f2ca44650 Merge pull request #1766 from jeffhostetler/gfw-msvc-bin-dir
find_vs_env.bat: Fix bin dir path used by msys
2018-08-21 18:21:44 +02:00
Pratik Karki
047fae141b CONTRIBUTING.md: add an extra example
This commit adds an extra example to submit an incrementing version
patch series to the mailing list which should be the continuation to
previous patch series.

This closes https://github.com/git-for-windows/git/pull/1745

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:44 +02:00
Jeff Hostetler
b75d84eef8 find_vs_env.bat: Fix bin dir path used by msys
Completely convert the pathname expoted in the %msvc_bin_dir_msys%
variable to MSYS format with forward slashes rather than a mixture
of forward and back slashes.

This solves an obscure problem observed by some developers:

    [...]
    http-push.c
        CC remote-curl.o
    remote-curl.c
        * new script parameters
        GEN git-instaweb
    sed: -e expression #7, char 155: invalid reference \2 on `s' command's RHS
    make: *** [Makefile:2023: git-instaweb] Error 1

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2018-08-21 18:21:38 +02:00
Johannes Schindelin
9720ad37dc Merge pull request #1679 from telezhnaya/win
vcxproj: change build logic
2018-08-21 18:21:38 +02:00
Olga Telezhnaia
f6e2aa33be vcxproj: change build logic
Add new condition to invoke vcpkg_install.bat: it's not enough to check
the presence of folder vcpkg. We need to check the presence of some
header files because this is one of the main goals of this script.
Previous build attempt could be aborted, so the folder will exist but
the project will not be built properly.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
2018-08-21 18:21:38 +02:00
Johannes Schindelin
ff22f8c1b6 Merge pull request #1645 from ZCube/master
Support windows container.
2018-08-21 18:21:37 +02:00
Johannes Schindelin
dc9551fc0d Merge branch 'ctrl-c'
This is part two of the Ctrl+C story, where part one is
https://github.com/git-for-windows/MSYS2-packages/commit/f4fda0f30aa.

Part one took care of extending the signal handling in the MSYS2 runtime
such that non-MSYS2 processes "receive" a SIGINT by injecting a remote
thread that runs kernel32!CtrlRoutine as if GenerateConsoleCtrlHandler()
had been called (but in contrast to the latter, only one process is
targeted at a time, not every process attached to the same Console) into
the process that needs to be interrupted as well as into all of the
spawned child processes.

Part two now takes care of removing the misguided "kill all spawned
children" atexit() handler, and it also installs a ConsoleCtrl handler
to run Git's SIGINT handlers, such as the one waiting for the pager to
exit.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:37 +02:00
Johannes Schindelin
f14fd6c8b0 mingw: Windows Docker volumes are *not* symbolic links
... even if they may look like them.

As looking up the target of the "symbolic link" (just to see whether it
starts with `/ContainerMappedDirectories/`) is pretty expensive, we
do it when we can be *really* sure that there is a possibility that this
might be the case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: JiSeop Moon <zcube@zcube.kr>
2018-08-21 18:21:37 +02:00
Johannes Schindelin
92fb216a39 Merge pull request #1548 from alejandro5042/master
Document how $HOME is set on Windows
2018-08-21 18:21:36 +02:00
Johannes Schindelin
71c8b14e75 mingw: really handle SIGINT
Previously, we did not install any handler for Ctrl+C, but now we really
want to because the MSYS2 runtime learned the trick to call the
ConsoleCtrlHandler when Ctrl+C was pressed.

With this, hitting Ctrl+C while `git log` is running will only terminate
the Git process, but not the pager. This finally matches the behavior on
Linux and on macOS.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:36 +02:00
JiSeop Moon
d0704be7c7 mingw: move the file_attr_to_st_mode() function definition
In preparation for making this function a bit more complicated (to allow
for special-casing the `ContainerMappedDirectories` in Windows
containers, which look like a symbolic link, but are not), let's move it
out of the header.

Signed-off-by: JiSeop Moon <zcube@zcube.kr>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:36 +02:00
JiSeop Moon
aed208fdd5 mingw: when running in a Windows container, try to rename() harder
It is a known issue that a rename() can fail with an "Access denied"
error at times, when copying followed by deleting the original file
works. Let's just fall back to that behavior.

Signed-off-by: JiSeop Moon <zcube@zcube.kr>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:36 +02:00
JiSeop Moon
07bd152fcd mingw: introduce code to detect whether we're inside a Windows container
This will come in handy in the next commit.

Signed-off-by: JiSeop Moon <zcube@zcube.kr>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:36 +02:00
Johannes Schindelin
e5cb776a31 Merge branch 'fix-unc-buffer-overflow'
This fixes `git status` in a Git worktree at the top of a file share.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:35 +02:00
Alejandro Barreto
16e3e06522 Document how $HOME is set on Windows
Git documentation refers to $HOME and $XDG_CONFIG_HOME often, but does not specify how or where these values come from on Windows where neither is set by default. The new documentation reflects the behavior of setup_windows_environment() in compat/mingw.c.

Signed-off-by: Alejandro Barreto <alejandro.barreto@ni.com>
2018-08-21 18:21:35 +02:00
Johannes Schindelin
2b8d56953d Merge pull request #1529 from derrickstolee/contributing
Rewrite CONTRIBUTING.md to be a guide for new developers on Windows
2018-08-21 18:21:35 +02:00
Johannes Schindelin
403fac7000 setup_git_directory(): handle UNC root paths correctly
When working in the root directory of a file share (this is only
possible in Git Bash and Powershell, but not in CMD), the current
directory is reported without a trailing slash.

This is different from Unix and standard Windows directories: both / and
C:\ are reported with a trailing slash as current directories.

If a Git worktree is located there, Git is not quite prepared for that:
while it does manage to find the .git directory/file, it returns as
length of the top-level directory's path *one more* than the length of
the current directory, and setup_git_directory_gently() would then
return an undefined string as prefix.

In practice, this undefined string usually points to NUL bytes, and does
not cause much harm. Under rare circumstances that are really involved
to reproduce (and not reliably so), the reported prefix could be a
suffix string of Git's exec path, though.

A careful analysis determined that this bug is unlikely to be
exploitable, therefore we mark this as a regular bug fix.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:35 +02:00
Johannes Schindelin
7ab8a76cd8 Merge pull request #1468 from atetubou/fscache_checkout_flush
checkout.c: enable fscache for checkout again
2018-08-21 18:21:34 +02:00
Derrick Stolee
9b7c2a1ebc CONTRIBUTING.md: add guide for first-time contributors
Getting started contributing to Git can be difficult on a Windows machine.
CONTRIBUTING.md contains a guide to getting started, including detailed
steps for setting up build tools, running tests, and submitting patches
to upstream.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
2018-08-21 18:21:34 +02:00
Johannes Schindelin
2a5476e8e0 Merge branch 'fix-terminal-prompt'
This fixes the issue identified in

	https://github.com/git-for-windows/git/issues/1498

where Git would not fall back to reading credentials from a Win32
Console when the credentials could not be read from the terminal via the
Bash hack (that is necessary to support running in a MinTTY).

Tested in a Powershell window.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:34 +02:00
Derrick Stolee
4676d56dd6 CODE_OF_CONDUCT: Rename CONTRIBUTING.md to CODE_OF_CONDUCT.md
The current CONTRIBUTING.md file is actually a code of conduct. This is
a valuable document, but is misnamed. A following patch will replace
CONTRIBUTING.md with a guide to contributing to Git using a Windows machine.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
2018-08-21 18:21:34 +02:00
Johannes Schindelin
eb0f389e0b Merge branch 'fix-vcxproj-generation'
We ran out of GUIDs in the script generating Visual Studio project
files. This topic branch fixes that issue once and for all, by
generating the GUIDs.

For extra goodness, we now generate GUIDs that are not random, but are
generated from the SHA-256 checksums of the target file of the project.
That way, the project<->GUID mapping is stable.

This fixes https://github.com/git-for-windows/git/issues/1507

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:33 +02:00
Johannes Schindelin
730a16c529 mingw (git_terminal_prompt): turn on echo explictly
It turns out that when running in a Powershell window, we need to turn
on ENABLE_ECHO_INPUT because the default would be *not* to echo
anything.

This also ensures that we use the input mode where all input is read
until the user hits the Return key.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:32 +02:00
Johannes Schindelin
1bb3440a02 .github: Add configuration for the Sentiment Bot
The sentiment bot will help detect when things get too heated.
Hopefully.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:32 +02:00
Johannes Schindelin
974fbaf1b3 buildsystems(Vcproj): auto-generate GUIDs
We ran out GUIDs. Again. But there is no need to: we can generate them
semi-randomly from the target file name of the project.

Note: the Vcproj generator is probably only interesting for historical
reasons; nevertheless, the Vcxproj generator in the Git for Windows
project is based on the Vcproj generator and it is better to backport
the fix than to let Vcproj have the hard-coded list of GUIDs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:32 +02:00
Johannes Schindelin
b32b4ca5cc mingw (git_terminal_prompt): do fall back to CONIN$/CONOUT$ method
To support Git Bash running in a MinTTY, we use a dirty trick to access
the MSYS2 pseudo terminal: we execute a Bash snippet that accesses
/dev/tty.

The idea was to fall back to writing to/reading from CONOUT$/CONIN$ if
that Bash call failed because Bash was not found.

However, we should fall back even in other error conditions, because we
have not successfully read the user input. Let's make it so.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:32 +02:00
Johannes Schindelin
368d18f20c buildsystems(vcxproj): auto-generate GUIDs
We ran out GUIDs. Again. But there is no need to: we can generate them
semi-randomly from the target file name of the project.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:32 +02:00
Johannes Schindelin
a22b6b5d13 mingw (git_terminal_prompt): work around BusyBox & WSL issues
When trying to query the user directly via /dev/tty, both WSL's bash and
BusyBox' bash emulation seem to have problems printing the value that
they just read. The bash just stops in those instances, does not even
execute any commands after the echo command.

Let's just work around this by running the Bash snippet only in MSYS2's
Bash: its `SHELL` variable has the `.exe` suffix, and neither WSL's nor
BusyBox' bash set the `SHELL` variable to a path with that suffix. In
the latter case, we simply exit with code 127 (indicating that the
command was not found) and fall back to the CONIN$/CONOUT$ method
quietly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:32 +02:00
Johannes Schindelin
4409c16ca3 add --edit: truncate the patch file
If there is already a .git/ADD_EDIT.patch file, we fail to truncate it
properly, which could result in very funny errors.

Let's just truncate it and not worry about it too much.

Reported by J Wyman.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:31 +02:00
Johannes Schindelin
182294f75e Merge branch 'inherit-only-stdhandles'
When spawning child processes, we do want them to inherit the standard
handles so that we can talk to them. We do *not* want them to inherit
any other handle, as that would hold a lock to the respective files
(preventing them from being renamed, modified or deleted), and the child
process would not know how to access that handle anyway.

Happily, there is an API to make that happen. It is supported in Windows
Vista and later, which is exactly what we promise to support in Git for
Windows for the time being.

This also means that we lift, at long last, the target Windows version
from Windows XP to Windows Vista.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-08-21 18:21:31 +02:00