Commit Graph

81059 Commits

Author SHA1 Message Date
James J. Raden
bb5a2dfee9 gitk: make the "list references" default window width wider
When using remotes (with git-flow especially), the remote reference names
are almost always wordwrapped in the "list references" window because it's
somewhat narrow by default. It's possible to resize it with a mouse,
but it's annoying to have to do this every time, especially on Windows 10,
where the window border seems to be only one (1) pixel wide, thus making
the grabbing of the window border tricky.

Signed-off-by: James J. Raden <james.raden@gmail.com>
2018-02-16 21:39:24 +01:00
Johannes Schindelin
c1537b9a4d gitk: fix arrow keys in input fields with Tcl/Tk >= 8.6
Tcl/Tk 8.6 introduced new events for the cursor left/right keys and
apparently changed the behavior of the previous event.

Let's work around that by using the new events when we are running with
Tcl/Tk 8.6 or later.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-16 21:39:24 +01:00
Sebastian Schuberth
179b70cdf3 gitk: Use an external icon file on Windows
Git for Windows now ships with the new Git icon from git-scm.com. Use that
icon file if it exists instead of the old procedurally drawn one.

This patch was sent upstream but so far no decision on its inclusion was
made, so commit it to our fork.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2018-02-16 21:39:24 +01:00
Chris West (Faux)
d888f06856 gitk: fix another invocation with an overly long command-line
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2018-02-16 21:39:24 +01:00
Johannes Schindelin
50b4a9685a gitk: work around the command line limit on Windows
On Windows, there are dramatic problems when a command line grows
beyond PATH_MAX, which is restricted to 8191 characters on XP and
later (according to http://support.microsoft.com/kb/830473).

Work around this by just cutting off the command line at that length
(actually, at a space boundary) in the hope that only negative
refs are chucked: gitk will then do unnecessary work, but that is
still better than flashing the gitk window and exiting with exit
status 5 (which no Windows user is able to make sense of).

The first fix caused Tcl to fail to compile the regexp, see msysGit issue
427. Here is another fix without using regexp, and using a more relaxed
command line length limit to fix the original issue 387.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-16 21:39:23 +01:00
Karsten Blees
440fea9fc3 gitk: Unicode file name support
Assumes file names in git tree objects are UTF-8 encoded.

On most unix systems, the system encoding (and thus the TCL system
encoding) will be UTF-8, so file names will be displayed correctly.

On Windows, it is impossible to set the system encoding to UTF-8.
Changing the TCL system encoding (via 'encoding system ...', e.g. in the
startup code) is explicitly discouraged by the TCL docs.

Change gitk functions dealing with file names to always convert
from and to UTF-8.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-16 21:39:23 +01:00
Johannes Schindelin
a511ce0613 Start the merging-rebase to v2.16.2
This commit starts the rebase of f09c80b45d to 86aabcca24
2018-02-16 21:39:10 +01:00
Johannes Schindelin
64b1c47b81 fixup! mingw: spawned processes need to inherit only standard handles
Let's make the code even more resilient: when `CreateProcess()` fails
with an ERROR_INVALID_PARAMETER on Windows 7, and we tried to restrict
handle inheritance, just fall back silently to inheriting all file
handles.

This is still not ideal, but at least it will avoid bug reports from
Windows 7 users. If we encounter problems on that Operating System
version which could potentially be solved by restricting the file handle
inheritance, we ("we" as in: "contributors with access to Windows 7" can
still try to come back and make the code work better on Windows 7.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-16 21:22:01 +01:00
Junio C Hamano
ffa9524972 Git 2.16.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.16.2
2018-02-15 15:21:23 -08:00
Junio C Hamano
c93150cfb0 Merge branch 'ab/doc-cat-file-e-still-shows-errors' into maint
Doc update.

* ab/doc-cat-file-e-still-shows-errors:
  cat-file doc: document that -e will return some output
2018-02-15 15:18:15 -08:00
Junio C Hamano
d4e528ef6a Merge branch 'as/read-tree-prefix-doc-fix' into maint
Doc update.

* as/read-tree-prefix-doc-fix:
  doc/read-tree: remove obsolete remark
2018-02-15 15:18:14 -08:00
Junio C Hamano
2409e1035c Merge branch 'nd/add-i-ignore-submodules' into maint
"git add -p" was taught to ignore local changes to submodules as
they do not interfere with the partial addition of regular changes
anyway.

* nd/add-i-ignore-submodules:
  add--interactive: ignore submodule changes except HEAD
2018-02-15 15:18:13 -08:00
Junio C Hamano
984c8337de Merge branch 'tg/stash-with-pathspec-fix' into maint
"git stash -- <pathspec>" incorrectly blew away untracked files in
the directory that matched the pathspec, which has been corrected.

* tg/stash-with-pathspec-fix:
  stash: don't delete untracked files that match pathspec
2018-02-15 15:18:13 -08:00
Junio C Hamano
1363914a6a Merge branch 'jk/abort-clone-with-existing-dest' into maint
"git clone $there $here" is allowed even when here directory exists
as long as it is an empty directory, but the command incorrectly
removed it upon a failure of the operation.

* jk/abort-clone-with-existing-dest:
  clone: do not clean up directories we didn't create
  clone: factor out dir_exists() helper
  t5600: modernize style
  t5600: fix outdated comment about unborn HEAD
2018-02-15 15:18:13 -08:00
Junio C Hamano
ff19620f81 Merge branch 'jc/merge-symlink-ours-theirs' into maint
"git merge -Xours/-Xtheirs" learned to use our/their version when
resolving a conflicting updates to a symbolic link.

* jc/merge-symlink-ours-theirs:
  merge: teach -Xours/-Xtheirs to symbolic link merge
2018-02-15 15:18:12 -08:00
Junio C Hamano
e17cec27d1 Merge branch 'rs/lose-leak-pending' into maint
API clean-up around revision traversal.

* rs/lose-leak-pending:
  commit: remove unused function clear_commit_marks_for_object_array()
  revision: remove the unused flag leak_pending
  checkout: avoid using the rev_info flag leak_pending
  bundle: avoid using the rev_info flag leak_pending
  bisect: avoid using the rev_info flag leak_pending
  object: add clear_commit_marks_all()
  ref-filter: use clear_commit_marks_many() in do_merge_filter()
  commit: use clear_commit_marks_many() in remove_redundant()
  commit: avoid allocation in clear_commit_marks_many()
2018-02-15 15:18:11 -08:00
Junio C Hamano
04afcc2201 Merge branch 'jm/svn-pushmergeinfo-fix' into maint
"git svn dcommit" did not take into account the fact that a
svn+ssh:// URL with a username@ (typically used for pushing) refers
to the same SVN repository without the username@ and failed when
svn.pushmergeinfo option is set.

* jm/svn-pushmergeinfo-fix:
  git-svn: fix svn.pushmergeinfo handling of svn+ssh usernames.
2018-02-15 15:18:11 -08:00
Junio C Hamano
468dc22e00 Merge branch 'dk/describe-all-output-fix' into maint
An old regression in "git describe --all $annotated_tag^0" has been
fixed.

* dk/describe-all-output-fix:
  describe: prepend "tags/" when describing tags with embedded name
2018-02-15 15:18:10 -08:00
Junio C Hamano
af38deeb47 Merge branch 'ab/perf-grep-threads' into maint
More perf tests for threaded grep

* ab/perf-grep-threads:
  perf: amend the grep tests to test grep.threads
2018-02-15 15:18:09 -08:00
Johannes Schindelin
d1a7b3b9ef 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-02-12 17:23:42 +01:00
Johannes Schindelin
ef6d451bbf Merge branch 'inherit-only-stdhandles-fixup'
Some more changes to fix a real bug affecting TortoiseGit users, and to
make the code a bit more robust in general.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-07 18:20:35 +01:00
Johannes Schindelin
8b533f0b02 fixup! mingw: spawned processes need to inherit only standard handles
Let's make the code a little more robust: when `CreateProcess()` fails
and we tried to restrict handle inheritance, and when that failure was
*still* not anticipated by the current code, warn loudly but fall back
to not restricting the handle inheritance.

Use an environment variable to avoid warning more than once per Git
operation, because it would get very annoying if a simple `git fetch`
reported the same type of warning about six times.

This should avoid blocking users if there are still bugs left, but still
give us the benefit of proper bug reports.

While at it, reformat the CreateProcess() call to conform to Git's
conventions.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-07 18:06:14 +01:00
Johannes Schindelin
8a71352f38 fixup! mingw: spawned processes need to inherit only standard handles
The conditional fall-back when file handle inheritance restricting
failed will always need to pass bInheritHandles = TRUE.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-07 16:40:05 +01:00
Johannes Schindelin
664ca487bb reorder-before! mingw: spawned processes need to inherit only standard handles
This patch should logically come before the patch which tries to limit
the list of file handles to be inherited by spawned processes, to avoid
introducing a regression before resolving it.

mingw: work around incorrect standard handles

For some reason, when being called via TortoiseGit the standard handles,
or at least what is returned by _get_osfhandle(0) for standard input,
can take on the value (HANDLE)-2 (which is not a legal value, according
to the documentation).

Even if this value is not documented anywhere, CreateProcess() seems to
work fine without complaints if hStdInput set to this value.

In contrast, the upcoming code to restrict which file handles get
inherited by spawned processes would result in `ERROR_INVALID_PARAMETER`
when including such handle values in the list.

To help this, special-case the value (HANDLE)-2 returned by
_get_osfhandle() and replace it with INVALID_HANDLE_VALUE, which will
hopefully let the handle inheritance restriction work even when called
from TortoiseGit.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-07 16:37:30 +01:00
Johannes Schindelin
dc364ab06b fixup! mingw: spawned processes need to inherit only standard handles
On Windows 7 and older, the API to restrict which file handles get
to be inherited by a spawned process is a bit peculiar. For example,
when launching `git ls-remote https://...` in a Git Bash, everything
works as expected. But when launching that in a Git CMD,
CreateProcessW() will fail (with an ERROR_NO_SYSTEM_RESOURCES) if even
one of the standard handles are marked to be inherited specifically.

Apparently, it has something to do with handles' file types and with
cmd.exe setting up its standard handles in a specific way.

Rather than trying to guess correctly under which circumstances we
should, or should not, list those standard handles, let's just work
around this by detecting that particular error and simply trying to call
CreateProcessW() again, this time without any special thread attribute
list to restrict which handles get to be inherited by the spawned
process.

This means that we potentially run into more locking problems on Windows
7 and older than we would like, but it is still better than to deny Git
to spawn any child processes.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-05 21:31:34 +01:00
Johannes Schindelin
60d8d6eae3 fixup! add support for disabling SSL revocation checks in cURL
This maintainer thought that it was discussed that you cannot `strcmp()`
blindly without checking for NULL first, but subsequently forgot to
check that the fix had made it into the final version of the PR... :-(

The problem is that this crashes any fetch/push/clone/ls-remote
operation *unless* http.sslBackend is specified explicitly.

This probably fixes the root cause behind
https://github.com/git-for-windows/git/issues/1474.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-05 20:20:05 +01:00
Johannes Schindelin
a7e57c20cf fixup! mingw: spawned processes need to inherit only standard handles
Use a more elegant way to de-duplicate the list of handles, suggested by
Jeff Hostetler.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-02 17:35:44 +01:00
Johannes Schindelin
e78e3c8ee9 squash! mingw: spawned processes need to inherit only standard handles
We need to make sure that the list of handles to inherit does not
contain duplicates; Otherwise CreateProcessW() would fail with
ERROR_INVALID_ARGUMENT.

While at it, stop setting errno to ENOENT unless it really is the
correct value.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-02 16:40:39 +01:00
Johannes Schindelin
3016f0c4bc Merge pull request #1450 from shiftkey/schannel-norevoke-support
adding http.schannel.checkRevoke support
2018-01-31 23:40:33 +01:00
Johannes Schindelin
576ff26eec 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-01-31 21:01:17 +01:00
Johannes Schindelin
cf2f73537c mingw: spawned processes need to inherit only standard handles
By default, CreateProcess() does not inherit any open file handles,
unless the bInheritHandles parameter is set to TRUE. Which we do need to
set because we need to pass in stdin/stdout/stderr to talk to the child
processes. Sadly, this means that all file handles (unless marked via
O_NOINHERIT) are inherited.

This lead to problems in GVFS Git, where a long-running read-object hook
is used to hydrate missing objects, and depending on the circumstances,
might only be called *after* Git opened a file handle.

Ideally, we would not open files without O_NOINHERIT unless *really*
necessary (i.e. when we want to pass the opened file handle as standard
handle into a child process), but apparently it is all-too-easy to
introduce incorrect open() calls: this happened, and prevented updating
a file after the read-object hook was started because the hook still
held a handle on said file.

Happily, there is a solution: as described in the "Old New Thing"
https://blogs.msdn.microsoft.com/oldnewthing/20111216-00/?p=8873 there
is a way, starting with Windows Vista, that lets us define precisely
which handles should be inherited by the child process.

And since we bumped the minimum Windows version for use with Git for
Windows to Vista with v2.10.1 (i.e. a *long* time ago), we can use this
method. So let's do exactly that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-31 20:39:07 +01:00
Johannes Schindelin
31a5d68e4e mingw: bump the minimum Windows version to Vista
Quite some time ago, a last plea to the XP users out there who want to
see Windows XP support in Git for Windows, asking them to get engaged
and help, vanished into the depths of the universe.

It is time to codify the ascent by the "silent majority" of XP users,
and mark the minimum Windows version required for Git for Windows as
Windows Vista.

This, incidentally, lets us use quite a few nice new APIs.

This also means that we no longer need the inet_pton() and inet_ntop()
emulation, and we no longer need to do the PROC_ADDR dance with the
`CreateSymbolicLinkW()` function, either.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-31 20:39:05 +01:00
Johannes Schindelin
5d8647e3b6 mingw: set _WIN32_WINNT explicitly for Git for Windows
Previously, we only ever declared a target Windows version if compiling
with Visual C.

Which meant that we were relying on the MinGW headers to guess which
Windows version we want to target...

Let's be explicit about it, in particular because we actually want to
bump the target Windows version to Vista (which we will do in the next
commit).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-31 20:39:04 +01:00
Johannes Schindelin
6ea71ff39a compat/poll: prepare for targeting Windows Vista
Windows Vista (and later) actually have a working poll(), but we still
cannot use it because it only works on sockets.

So let's detect when we are targeting Windows Vista and undefine those
constants, and define `pollfd` so that we can declare our own pollfd
struct.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-31 20:39:02 +01:00
Johannes Schindelin
d600862a04 mingw: demonstrate that all file handles are inherited by child processes
When spawning child processes, we really should be careful which file
handles we let them inherit.

This is doubly important on Windows, where we cannot rename, delete, or
modify files if there is still a file handle open.

Sadly, we have to guard this test inside #ifdef WIN32: we need to use
the value of the HANDLE directly, and that concept does not exist on
Linux/Unix.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-31 20:39:01 +01:00
Brendan Forster
3fdedea6b8 add support for disabling SSL revocation checks in cURL
This adds support for a new http.schannel.checkRevoke config value.

This config value is only used if http.sslBackend is set to "schannel",
which forces cURL to use the Windows Certificate Store when validating
server certificates associated with a remote server.

This config value should only be set to "false" if you are in an
environment where revocation checks are blocked by the network, with
no alternative options.

This is only supported in cURL 7.44 or later.

Signed-off-by: Brendan Forster <github@brendanforster.com>
2018-01-24 15:42:01 +11:00
Johannes Schindelin
1a4ee4d5d8 fixup! checkout.c: enable fscache for checkout_entry
The recently introduced speedup of `git checkout` sadly introduced a
regression: after writing a file, the cached stat data is obviously
incorrect, yet we still used it!

This patch simply reverts the original speedup (as opposed to try to
hotfix it as https://github.com/git-for-windows/git/pull/1443 tries to
do), and marks it as a fixup commit so that the next merging-rebase will
drop the patch.

We will most likely want to speed up this code path, though, but may
find a better way, e.g. by invalidating the cached data cleverly. (This
will be a *little* tricky, though, as readdir() uses the data, and we
must ensure that we do not pull it under readdir()'s rag when
invalidating it, and we also must avoid re-caching for every written
file, as that would be *even* slower than fscache=false.)

This fixes https://github.com/git-for-windows/git/issues/1438 and
https://github.com/git-for-windows/git/issues/1442

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-22 14:28:01 +01:00
Johannes Schindelin
e76e5c4b13 fixup! reset.c: enable fscache
The recent speedup to `git reset` sadly broke things, as the cached stat
data is no longer accurate after writing the file(s). And that is exactly
what `git reset` does: writing the file(s).

This patch is identical to the one provided in
https://github.com/git-for-windows/git/pull/1445 but added a bit more
detailed information, as well as marking it as a fixup so that the next
merging-rebase will drop the patch altogether.

This fixes https://github.com/git-for-windows/git/issues/1437 and
https://github.com/git-for-windows/git/issues/1440.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-22 14:24:42 +01:00
Kim Gybels
ac9ec91052 packed_ref_cache: don't use mmap() for small files
Take a hint from commit ea68b0ce9f (hash-object: don't use mmap() for
small files, 2010-02-21) and use read() instead of mmap() for small
packed-refs files.

This also fixes https://github.com/git-for-windows/git/issues/1410
(where xmmap() returns NULL for zero length[1], for which munmap() later
fails).

Alternatively, we could simply check for NULL before munmap(), or
introduce xmunmap() that could be used together with xmmap(). However,
always setting snapshot->buf to a valid pointer, by relying on
xmalloc(0)'s fallback to 1-byte allocation, makes using snapshots
easier.

[1] Logic introduced in commit 9130ac1e19 (Better error messages for
    corrupt databases, 2007-01-11)

This was cherry-picked from upstream's `pu` branch so that the fix is
included in Git for Windows v2.16.0.

Signed-off-by: Kim Gybels <kgybels@infogroep.be>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-22 13:06:50 +01:00
Johannes Schindelin
a2484b88fa Merge pull request #1427 from atetubou/reset_fscache
reset.c: enable fscache
2018-01-22 13:06:50 +01:00
Takuto Ikuta
d70ae2566b reset.c: enable fscache
In git reset --hard, unpack-trees() is called with oneway_merge().
oneway_merge calls lstat for each files in a repository.
It is bottleneck of git reset --hard, especially in large repository.

This patch improves time by using fscache.
In chromium repository, time of git reset --hard is changed like below.
I took 3 times stats in the repository.

master:
TotalSeconds: 21.0337971
TotalSeconds: 20.0046612
TotalSeconds: 20.6501752
Avg: 20.5628778333333

this patch:
TotalSeconds: 4.8552376
TotalSeconds: 4.8722343
TotalSeconds: 4.9268245
Avg: 4.88476546666667

Signed-off-by: Takuto Ikuta <tikuta@chromium.org>
2018-01-22 13:06:50 +01:00
Johannes Schindelin
6863db106a Merge pull request #1426 from atetubou/fetch_pack
fetch-pack.c: enable fscache for stats under .git/objects
2018-01-22 13:06:49 +01:00
Johannes Schindelin
53aec6dcc9 Merge branch 'no-ahead-behind-v5'
Especially in huge code bases with fast-moving `master`, it can be
prohibitively expensive to calculate whether an upstream branch of
a local branch is ahead, behind or diverged.

This topic branch introduces a set of flags to avoid that computation
when we're not even interested in it to begin with.

This merge commit takes the feature early, therefore it is marked
experimental.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-22 13:06:49 +01:00
Takuto Ikuta
40caa6cdea fetch-pack.c: enable fscache for stats under .git/objects
When I do git fetch, git call file stats under .git/objects for each
refs. This takes time when there are many refs.

By enabling fscache, git takes file stats by directory traversing and that
improved the speed of fetch-pack for repository having large number of
refs.

In my windows workstation, this improves the time of `git fetch` for
chromium repository like below. I took stats 3 times.

* With this patch
TotalSeconds: 9.9825165
TotalSeconds: 9.1862075
TotalSeconds: 10.1956256
Avg: 9.78811653333333

* Without this patch
TotalSeconds: 15.8406702
TotalSeconds: 15.6248053
TotalSeconds: 15.2085938
Avg: 15.5580231

Signed-off-by: Takuto Ikuta <tikuta@chromium.org>
2018-01-22 13:06:49 +01:00
Johannes Schindelin
cd816a2806 Merge pull request #1421 from isaac-s/fix-clone-removing-dest
When dest dir is specified and clone breaks for any reason, don't remove the dest dir
2018-01-22 13:06:49 +01:00
Jeff Hostetler
341ce9c5f7 status: support --no-ahead-behind in long format
Teach long (normal) status format to respect the --no-ahead-behind
parameter and skip the possibly expensive ahead/behind computation
between the branch and the upstream.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-22 13:06:49 +01:00
Jeff Hostetler
85e687820e status: update short status to respect --no-ahead-behind
Teach "git status --short --branch" to respect "--no-ahead-behind"
parameter to skip computing ahead/behind counts for the branch and
its upstream and just report '[different]'.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-22 13:06:49 +01:00
Johannes Schindelin
5cb81db6f8 Merge pull request #1419 from atetubou/enable_fscache
checkout.c: enable fscache for checkout_entry
2018-01-22 13:06:48 +01:00
Jeff King
93b7de161a clone: do not clean up directories we didn't create
Once upon a time, git-clone would refuse to write into a
directory that it did not itself create. The cleanup
routines for a failed clone could therefore just remove the
git and worktree dirs completely.

In 55892d2398 (Allow cloning to an existing empty directory,
2009-01-11), we learned to write into an existing directory.
Which means that doing:

  mkdir foo
  git clone will-fail foo

ends up deleting foo. This isn't a huge catastrophe, since
by definition foo must be empty. But it's somewhat
confusing; we should leave the filesystem as we found it.

Because we know that the only directory we'll write into is
an empty one, we can handle this case by just passing the
KEEP_TOPLEVEL flag to our recursive delete (if we could
write into populated directories, we'd have to keep track of
what we wrote and what we did not).

Note that we need to handle the work-tree and git-dir
separately, though, as only one might exist (and the new
tests in t5600 cover all cases).

Reported-by: Stephan Janssen <sjanssen@you-get.com>
2018-01-22 13:06:48 +01:00
Jeff Hostetler
0605465381 status: add --[no-]ahead-behind to status and commit for V2 format.
Teach "git status" and "git commit" to accept "--no-ahead-behind"
and "--ahead-behind" arguments to request quick or full ahead/behind
reporting.

When "--no-ahead-behind" is given, the existing porcelain V2 line
"branch.ab +x -y" is replaced with a new "branch.ab +? -?" line.
This indicates that the branch and its upstream are or are not equal
without the expense of computing the full ahead/behind values.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-01-22 13:06:48 +01:00