Skip to content

Commit 1662525

Browse files
committed
Ensure that there is at most one top-level header
It is a no-no to have multiple top-level headers in the same file, see https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md025.md Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 221daed commit 1662525

26 files changed

+133
-101
lines changed

content/32-bit-issues.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ title: "32 bit issues"
33
aliases:
44
- "32-bit-issues"
55
---
6-
# What is the problem with running Git for Windows in 32-bit mode?
6+
# 32-bit issues
7+
8+
## What is the problem with running Git for Windows in 32-bit mode?
79

810
Note that typically, there is no problem because the solution described [here](#adjusting-msys-20dlls-address-range-manually) is executed preventively upon installation of Git for Windows.
911

@@ -13,7 +15,7 @@ The simplest solution to fix that problem if it rears its ugly head at all is to
1315

1416
The second-simplest solution is to [reinstall Git for Windows](#reinstall-git-for-windows).
1517

16-
# Background
18+
## Background
1719

1820
Git for Windows is not just a version of Git compiled and packaged for yet another Operating System. Many parts of Git are written in script languages (e.g. POSIX shell or Perl) and therefore Git for Windows has to bundle such script interpreters as well. In particular `bash.exe` (which is used by Git for Windows to execute POSIX shell scripts) expects a POSIX environment which is not available on Windows. The Git for Windows project uses [MSYS2](https://msys2.github.io/) (essentially a [portable](https://en.wikipedia.org/wiki/Portable_application) version of [Cygwin](https://cygwin.com/)) to provide the POSIX emulation layer.
1921

@@ -35,7 +37,7 @@ When there is already a `.dll` interfering with MSYS2's runtime's hard-coded add
3537
865 [main] sh.exe" 17588 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
3638
```
3739

38-
# Solutions
40+
## Solutions
3941

4042
There are several ways how to get out of this problem:
4143

@@ -75,7 +77,7 @@ usr\bin\dash.exe -c 'cd / && /usr/bin/dash.exe /usr/bin/rebaseall'
7577

7678
These commands need to be executed in the top-level directory, and the address (0x67000000) might need to be adjusted.
7779

78-
# What's with this `Cwd.dll` problem?
80+
## What's with this `Cwd.dll` problem?
7981

8082
Under some circumstances, `/usr/bin/rebaseall` seems not to rebase the Perl `.dll` files "enough", and the symptom is something like this:
8183

@@ -89,4 +91,4 @@ A work-around that appears to help in most of those cases is to call
8991
/usr/bin/rebase -b 0x63070000 /usr/lib/perl5/core_perl/auto/*/{*,*/*}.dll
9092
```
9193

92-
Your mileage may vary: it might be necessary to play with the base address a bit.
94+
Your mileage may vary: it might be necessary to play with the base address a bit.

content/building-git.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ title: "Building Git"
33
aliases:
44
- "Building-Git"
55
---
6+
# Building Git on Windows
7+
68
We build Git for Windows using an [MSYS2](https://msys2.github.io/) based *Git for Windows SDK*. This SDK can be installed via the [SDK installer](https://gitforwindows.org/#download-sdk)
79

8-
# Installing a build environment
10+
## Installing a build environment
911

1012
1. Just run the [SDK installer](https://gitforwindows.org/#download-sdk).
1113

12-
# Build Git
14+
## Build Git
1315

1416
1. An initial `git clone` and `make` should have already occurred when running the [SDK installer](https://gitforwindows.org/#download-sdk).
1517

@@ -33,7 +35,7 @@ Once the SDK built Git, it is *very* easy to build another revision of Git, such
3335
4. check out the revision that was just fetched: `git checkout FETCH_HEAD`,
3436
5. continue as [above](https://github.com/git-for-windows/git/wiki/Building-Git#build-git) either by `make install` or `make test`.
3537

36-
# Updating to the newest Git for Windows version
38+
## Updating to the newest Git for Windows version
3739

3840
```bash
3941
cd /usr/src/git

content/building-msys2-runtime.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ aliases:
77

88
1. Download and run the [Git for Windows SDK installer](https://gitforwindows.org/#download-sdk).
99

10-
# Building msys2-runtime
10+
## Building msys2-runtime
1111

1212
2. Open the Git for Windows SDK MSys shell by double-clicking the `msys2_shell.cmd` script in the install folder (by default `C:\git-sdk-<arch>`).
1313

1414
3. From the MSys shell do: `sdk build msys2-runtime`
1515

1616
This last step may take a while, so please be patient!
1717

18-
# Rebuilding the msys2-runtime
18+
## Rebuilding the msys2-runtime
1919

2020
When there are bugs in the msys2-runtime (e.g. problems with the POSIX-to-Windows path mangling), you need to rebuild the `msys-2.0.dll`, possibly frequently.
2121

2222
To rebuild the `msys-2.0.dll` -- assuming that you have built it already as described above -- you first need to start an *MSys* shell by double-clicking the `msys2_shell.cmd` script in your Git SDK's top-level directory. Then call `cd /usr/src/MSYS2-packages/msys2-runtime/src/msys2-runtime/winsup/cygwin`. Now you can modify the source code to your heart's content. It is actually a local clone of https://github.com/git-for-windows/msys2-runtime; you probably want to add your own fork as a remote.
2323

2424
To actually build the `msys-2.0.dll`, switch to `src/build-<arch>-pc-msys/<arch>-pc-msys/winsup/cygwin` and type `make`. This will generate an `msys0.dll` file in that directory. This is the new `msys-2.0.dll`, but you cannot simply copy it into `/usr/bin/` because it is in use by the current `mintty` as well as by the current Bash. To update, you need to close all programs using the msys2-runtime (including all of the terminal windows), then copy the `msys0.dll` file, replacing the existing `/usr/bin/msys-2.0.dll`, either using Explorer, `cmd.exe` or a separate Git SDK (for example, when debugging the 64-bit msys2-runtime, a 32-bit Git SDK comes in real handy). You will **want** to make a backup copy of the old `msys-2.0.dll`...
2525

26-
# Related: building/rebuilding Bash
26+
## Related: building/rebuilding Bash
2727

28-
The process to rebuild the `Bash` is very similar to the `msys2-runtime` one; You will just need to work in the `src/bash-<version>/` subdirectory of `/usr/src/MSYS2-packages/bash/` (both the sources and the generated `bash.exe` live there). Bash also requires all Bash instances to be exited before the executable is replaced by the new one. And like with the msys2-runtime, you will **want** to make a backup copy of the old `bash.exe`.
28+
The process to rebuild the `Bash` is very similar to the `msys2-runtime` one; You will just need to work in the `src/bash-<version>/` subdirectory of `/usr/src/MSYS2-packages/bash/` (both the sources and the generated `bash.exe` live there). Bash also requires all Bash instances to be exited before the executable is replaced by the new one. And like with the msys2-runtime, you will **want** to make a backup copy of the old `bash.exe`.

content/compiling-git-with-visual-studio.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ title: "Compiling Git with Visual Studio"
33
aliases:
44
- "Compiling-Git-with-Visual-Studio"
55
---
6+
# Compiling Git with Visual Studio
7+
68
Please note: this page describes how to compile Git's source code in Visual Studio 2015 or later.
79

8-
# Checking out `vs/main`
10+
## Checking out `vs/main`
911

1012
> [!WARNING]
1113
> The `vs/main` branch and `git.sln` is deprecated. The current approach is to open the `git` folder in VS directly, refer to the [README of the `vs/main` branch](https://github.com/git-for-windows/git/tree/vs/main).
@@ -16,7 +18,7 @@ However, as of Git for Windows v2.11.0, a much more convenient way is available:
1618

1719
Simply open the `git.sln` file and build the solution. DO NOT upgrade Build Tools to v141 - it will not work. If you are using VS 2017 or later, you need to install Build Tools v140 manually.
1820

19-
# Running the tests
21+
## Running the tests
2022

2123
When building Git in Visual Studio, you do not actually need a full-blown Git for Windows SDK. Simply install Git for Windows, make sure that the entire solution was built, open a Git Bash and run the tests in the `t/` subdirectory.
2224

@@ -43,6 +45,6 @@ prove --timer --jobs 15 ./t[0-9]*.sh
4345
```
4446

4547

46-
# Browsing the code
48+
## Browsing the code
4749

48-
You can also use the Sourcetrail code browser (now open source) in conjunction with Visual Studio, see [Sourcetrail code viewer](https://github.com/git-for-windows/git/wiki/Sourcetrail-code-viewer-and-linkage-to-Visual-Studio,-for-Git) page.
50+
You can also use the Sourcetrail code browser (now open source) in conjunction with Visual Studio, see [Sourcetrail code viewer](https://github.com/git-for-windows/git/wiki/Sourcetrail-code-viewer-and-linkage-to-Visual-Studio,-for-Git) page.

content/contact.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ title: "Contact"
33
aliases:
44
- "Contact"
55
---
6+
# How to contact the Git for Windows project
7+
68
Please state the nature of your medical emergency.
79

8-
# I found a bug!
10+
## I found a bug!
911

1012
Please follow [our guide lines](https://github.com/git-for-windows/git/wiki/Issue-reporting-guidelines) on reporting bugs.
1113

12-
# I have a question!
14+
## I have a question!
1315

1416
We have [GitHub Discussions](https://github.com/git-for-windows/git/discussions/). If, for some reason or other, you prefer a mailing list, use [the Git mailing list](mailto:git@vger.kernel.org). It is actually a Google Group which can be used as if it were a forum, too.
1517

content/debugging-git.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ GDB (since version 10.1) can use the [Pygments](https://pygments.org/) Python li
116116
pacman -Syy mingw-w64-x86_64-python-pygments
117117
~~~
118118

119-
# Debugging with GDB in Emacs
119+
## Debugging with GDB in Emacs
120120

121121
First, install `emacs` and run it:
122122

content/diagnosing-performance-issues.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,31 @@ title: "Diagnosing performance issues"
33
aliases:
44
- "Diagnosing-performance-issues"
55
---
6+
# How to diagnose when Git for Windows is slow
7+
68
Under certain circumstances, Git can become very slow on Windows. Here are a couple of hints to figure out why.
79

8-
# Identify specific Git commands' performance issues
10+
## Identify specific Git commands' performance issues
911

1012
If the problem lies with a specific Git command, the most straight-forward way to investigate is to use profiling tools.
1113

1214
The canonical profiling tool in GCC's tool set is [`gprof`](https://sourceware.org/binutils/docs/gprof/). However, the MINGW version of the GCC tools offered by MSYS2 has been known to produce empty output on occasion.
1315

1416
An more convenient alternative is to use [Visual Studio's Performance Profiler](https://github.com/git-for-windows/git/wiki/Performance-profiling-with-Visual-Studio) (which is available in the free-of-cost Community version) which offers a powerful graphical user interface.
1517

16-
# Trace executions in the Bash startup
18+
## Trace executions in the Bash startup
1719

1820
When starting Git Bash is already slow, edit the file `<GIT_HOME>/etc/profile` and insert a `set -x` somewhere at the top. This command will tell Bash to echo the commands it is executing so that you can find out which commands are slow and investigate more closely in that direction.
1921

20-
# Activate Git's own tracing
22+
## Activate Git's own tracing
2123

2224
Git often executes subcommands, hence it is possible that you run a certain Git command but the tardiness stems from a *different* Git command. To find out which commands Git executes internally, set the environment variable `GIT_TRACE` like so:
2325

2426
```bash
2527
GIT_TRACE=1 git stash
2628
```
2729

28-
# Redirecting output to a file
30+
## Redirecting output to a file
2931

3032
Sometimes the output is too verbose – or the command-line window flashes and closes too quickly to read – to make direct diagnosing of the output practical. In this case, simply redirect the entire output of the Bash to a file, like so:
3133

@@ -35,18 +37,18 @@ exec > "$HOME"/Desktop/debug.txt 2>&1
3537

3638
After diagnosing the problem, you *will* want to remove the redirection, otherwise you will not be able to interact normally with the Bash.
3739

38-
# Enable the filesystem cache
40+
## Enable the filesystem cache
3941

4042
Windows' filesystem layer is inherently different from Linux' (for which Git's filesystem access is optimized). As a workaround, Git for Windows offers a filesystem cache which accelerates operations in many cases, after an initial "warm-up". This workaround can be activated in the installer, on the last wizard page, or you can activate the filesystem cache per-repository:
4143

4244
```bash
4345
git config core.fscache true
4446
```
4547

46-
# Avoid inspecting large working trees' modification times
48+
## Avoid inspecting large working trees' modification times
4749

4850
When working with large working trees, Git's (frequent) checking whether files were modified since Git's internal index was last updated can lead to substantial lags. In such a case, it can make sense to switch off this check, but it comes at a price: it requires discipline on the developer's side to keep track which files were changed *and `git add` them explicitly for the next commit* (the output of `git status` will *no longer* identify modified files). You can disable the check per-repository thusly:
4951

5052
```bash
5153
git config core.ignoreStat true
52-
```
54+
```

content/file-names-branch-names-path-quotation-executable-bit-and-file-modes-core-filemode.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ Likewise Windows will not be able to check out both an upper case and lower case
1717

1818
Windows also cannot checkout files which contain special characters, such as colon(:) etc. This can cause cross system management issues.
1919

20-
# Path Quotation
20+
## Path Quotation
2121

2222
Spaces in filenames is common in Windows, but rare in Linux. Linux has, like Windows, multiple path quoting mechanisms. In addition Linux can accept any character in any filename, including 'special' characters. This means that the path conversion between Windows and Git is imperfect and dependant on the particular command structure and 'terminal' in use.
2323

2424
Many Git commands do not report errors in the way that maybe expected by Windows users - some will simply ignore invalid options and paths, leaving the unfamiliar user wondering what happened. The `git config` is one area where this may happen, especially as there can be quoting confusion (single, double, or none) between bash, cmd, and powershell. (e.g. see [thread](https://public-inbox.org/git/d9330ba54fbda54a92a9f4d9320836d88ce9a6e6.camel@mad-scientist.net/))
2525

26-
# Executable and Mode Bits
26+
## Executable and Mode Bits
2727

2828
Linux attaches a mode word to each file, with bits that indicate if the file is executable, readable, writable, and other ownership aspects (`chmod`). This does not map well to Windows semantics, especially for the executable bit. The existing mode bits are retained in the repository tree meta data, which is then held locally in the index.
2929

3030
Users may need to directly manipulate the mode bits where necessary - the [stackoverflow page](https://stackoverflow.com/a/38285462/717355) shows how to use the `--chmod` option while adding or updating files.
3131

32-
# core.FileMode
32+
## core.FileMode
3333

3434
The core.FileMode configuration records, for the locally cloned repository, the local file system semantics (i.e. is it case sensitive / case preserving or not). DO NOT change this, unless it is actually set wrong. Git will trust this setting and mis-setting it may cause unexpected effects and damage - Don't do it, the internet, as ever, is probably wrong.
3535

@@ -38,6 +38,6 @@ From https://git-scm.com/docs/git-config#git-config-corefileMode
3838
3939
> Some filesystems lose the executable bit when a file that is marked as executable is checked out, or checks out a non-executable file with executable bit on. git-clone[1] or git-init[1] probe the filesystem to see if it handles the executable bit correctly and this variable is automatically set as necessary.
4040
41-
# Windows Drive (C:) paths vs Bash rooted (/) paths
41+
## Windows Drive (C:) paths vs Bash rooted (/) paths
4242

4343
In the Git for Windows bash, the classic `C:` drive letter is replaced by the the implicit `/c/` directory path. This conversion is commonly used in the `git config` paths that need to be absolute.

content/git-cannot-create-a-file-or-directory-with-a-long-path.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ title: "Git cannot create a file or directory with a long path"
33
aliases:
44
- "Git-cannot-create-a-file-or-directory-with-a-long-path"
55
---
6-
# The problem
6+
# Git for Windows vs long paths
7+
8+
## The problem
79

810
Windows does not properly support files and directories longer than 260 characters. This applies to Windows Explorer, `cmd.exe` and many other applications (including many IDEs as well as bash, perl and tcl that come with Git for Windows).
911

10-
# Opt-In configuration
12+
## Opt-In configuration
1113

1214
For this reason, long paths support in Git for Windows is disabled by default.
1315

@@ -17,12 +19,12 @@ That being said, long paths support for C-based git commands can be enabled by s
1719
git config core.longpaths true
1820
```
1921

20-
# Technical background
22+
## Technical background
2123

2224
The root cause of the technical limitation of 260 chars lies deeply within the Win32 API.
2325
Microsoft's online article [Naming Files, Paths, and Namespaces](http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath) describes the reasons.
2426
Git's source code itself does not have the limitation, it is Windows-only.
2527

26-
# Implementation details
28+
## Implementation details
2729

2830
Originally [introduced into Git for Windows 1.9.0](https://github.com/msysgit/git/pull/122), the idea to overcome the length limitation is to convert them into UNC paths (i.e. network paths of the form `\\?\...`). Such paths are accepted by many of the Win32 API's functions accepting UTF-16 strings (many functions in the Win32 API are available as ASCII and UTF-16 functions, marked by an `A` and a `W` suffix, respectively) and are allowed to have a length up to 32,767 wide characters. See e.g. [this commit](https://github.com/git-for-windows/git/commit/38b94fe15fb60e3871a166eec8cfd4265fee727f) for more details.

content/git-wrapper.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ title: "Git wrapper"
33
aliases:
44
- "Git-wrapper"
55
---
6+
# What _is_ the "Git wrapper"?
7+
68
One of the more confusing aspects of Git for Windows is that its main entry points (`<Git>\git-bash.exe`, `<Git>\cmd\git.exe`, `<Git>\bin\bash.exe`, where `<Git>` is the location into which Git was installed, typically `C:\Program Files\Git`) are _not_ the actual binaries implementing the functionality.
79

810
All of these executables are variants of the ["Git wrapper"](https://github.com/git-for-windows/MINGW-packages/blob/main/mingw-w64-git/git-wrapper.c). Its only purpose is to set a couple of environment variables and then spawn the _actual_ program. For example, `Git/bin/bash.exe` will set `MSYSTEM` and `PATH` and spawn `Git/usr/bin/bash.exe`.
911

10-
# Why is this needed?
12+
## Why is this needed?
1113

1214
The actual programs, e.g. `bash.exe` or `git.exe`, live in `<Git>\usr\bin` and `<Git>\mingw64\bin` (or `<Git>\mingw32\bin` in 32-bit setups), and the issue is that either links dynamically to some `.dll` files (e.g. `msys-2.0.dll`). So if we were to add those directories to the `PATH` variable, 3rd-party software that links _to the same_ `.dll` files would quite possibly be broken (or Git's own programs). Even worse, some of the other `.dll` files present in those folders are in much more widespread use, e.g. OpenSSL. This has been the cause for quite a few tickets in the past, and the `<Git>\cmd` directory was added to help this, at first having Batch scripts for `git`, `git-gui` and `gitk`, and later those were turned into Visual Basic scripts, but eventually we just bit the bullet and turned them into real executables because we needed more control than scripts allowed us (e.g. to prevent ugly console windows from "flashing").
1315

14-
# What environment variables are overridden by the Git wrapper?
16+
## What environment variables are overridden by the Git wrapper?
1517

1618
- **`PATH`**
1719

@@ -31,6 +33,6 @@ The actual programs, e.g. `bash.exe` or `git.exe`, live in `<Git>\usr\bin` and `
3133

3234
For full information, read the source code of [the `setup_environment()` function of the Git wrapper](https://github.com/git-for-windows/MINGW-packages/blob/0a7407a39c3015cc7a3c296d8a0db38439c65eed/mingw-w64-git/git-wrapper.c#L116-L200).
3335

34-
# Avoiding the Git wrapper
36+
## Avoiding the Git wrapper
3537

36-
Especially when running scripts that call Git tens of thousands of times, the start-up cost for the Git wrapper might be noticed, and users might want to side-step it. To address this desire, starting with https://github.com/git-for-windows/git/pull/2506 Git for Windows supports the use case the hard-coded absolute path to `<Git>\mingw64\bin\git.exe` is used to launch Git, without the need to add it to the `PATH`.
38+
Especially when running scripts that call Git tens of thousands of times, the start-up cost for the Git wrapper might be noticed, and users might want to side-step it. To address this desire, starting with https://github.com/git-for-windows/git/pull/2506 Git for Windows supports the use case the hard-coded absolute path to `<Git>\mingw64\bin\git.exe` is used to launch Git, without the need to add it to the `PATH`.

0 commit comments

Comments
 (0)