gitweb.git
git-stash: fix pushing stash with pathspec from subdirPatrick Steinhardt Tue, 13 Jun 2017 11:38:34 +0000 (13:38 +0200)

git-stash: fix pushing stash with pathspec from subdir

The `git stash push` command recently gained the ability to get a
pathspec as its argument to only stash matching files. Calling this
command from a subdirectory does not work, though, as one of the first
things we do is changing to the top level directory without keeping
track of the prefix from which the command is being run.

Fix the shortcoming by storing the prefix previous to the call to
`cd_to_toplevel` and then subsequently using `git rev-parse --prefix` to
correctly resolve the pathspec. Add a test to catch future breakage of
this usecase.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: add git stash pushThomas Gummerer Tue, 16 May 2017 19:59:45 +0000 (20:59 +0100)

completion: add git stash push

When introducing git stash push in f5727e26e4 ("stash: introduce push
verb", 2017-02-19), I forgot to add it to the completion code. Add it
now.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: keep untracked files intact in stash -kThomas Gummerer Tue, 21 Mar 2017 22:12:19 +0000 (22:12 +0000)

stash: keep untracked files intact in stash -k

Currently when there are untracked changes in a file "one" and in a file
"two" in the repository and the user uses:

git stash push -k one

all changes in "two" are wiped out completely. That is clearly not the
intended result. Make sure that only the files given in the pathspec
are changed when git stash push -k <pathspec> is used.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: pass the pathspec argument to git resetThomas Gummerer Tue, 21 Mar 2017 22:12:18 +0000 (22:12 +0000)

stash: pass the pathspec argument to git reset

For "git stash -p --no-keep-index", the pathspec argument is currently
not passed to "git reset". This means that changes that are staged but
that are excluded from the pathspec still get unstaged by git stash -p.

Make sure that doesn't happen by passing the pathspec argument to the
git reset in question, bringing the behaviour in line with "git stash --
<pathspec>".

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: don't show internal implementation detailsThomas Gummerer Tue, 21 Mar 2017 22:12:17 +0000 (22:12 +0000)

stash: don't show internal implementation details

git stash push uses other git commands internally. Currently it only
passes the -q flag to those if the -q flag is passed to git stash. when
using 'git stash push -p -q --no-keep-index', it doesn't even pass the
flag on to the internal reset at all.

It really is enough for the user to know that the stash is created,
without bothering them with the internal details of what's happening.
Always pass the -q flag to the internal git clean and git reset
commands, to avoid unnecessary and potentially confusing output.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: allow pathspecs in the no verb formThomas Gummerer Tue, 28 Feb 2017 20:33:40 +0000 (20:33 +0000)

stash: allow pathspecs in the no verb form

Now that stash_push is used in the no verb form of stash, allow
specifying the command line for this form as well. Always use -- to
disambiguate pathspecs from other non-option arguments.

Also make git stash -p an alias for git stash push -p. This allows
users to use git stash -p <pathspec>.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: use stash_push for no verb formThomas Gummerer Tue, 28 Feb 2017 20:33:39 +0000 (20:33 +0000)

stash: use stash_push for no verb form

Now that we have stash_push, which accepts pathspec arguments, use
it instead of stash_save in git stash without any additional verbs.

Previously we allowed git stash -- -message, which is no longer allowed
after this patch. Messages starting with a hyphen was allowed since
3c2eb80f, ("stash: simplify defaulting to "save" and reject unknown
options"). However it was never the intent to allow that, but rather it
was allowed accidentally.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: teach 'push' (and 'create_stash') to honor pathspecThomas Gummerer Tue, 28 Feb 2017 20:33:38 +0000 (20:33 +0000)

stash: teach 'push' (and 'create_stash') to honor pathspec

While working on a repository, it's often helpful to stash the changes
of a single or multiple files, and leave others alone. Unfortunately
git currently offers no such option. git stash -p can be used to work
around this, but it's often impractical when there are a lot of changes
over multiple files.

Allow 'git stash push' to take pathspec to specify which paths to stash.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: refactor stash_createThomas Gummerer Sun, 19 Feb 2017 11:03:10 +0000 (11:03 +0000)

stash: refactor stash_create

Refactor the internal stash_create function to use a -m flag for
specifying the message and -u flag to indicate whether untracked files
should be added to the stash.

This makes it easier to pass a pathspec argument to stash_create in the
next patch.

The user interface for git stash create stays the same.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: add test for the create command line argumentsThomas Gummerer Sun, 19 Feb 2017 11:03:09 +0000 (11:03 +0000)

stash: add test for the create command line arguments

Currently there is no test showing the expected behaviour of git stash
create's command line arguments. Add a test for that to show the
current expected behaviour and to make sure future refactorings don't
break those expectations.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: introduce push verbThomas Gummerer Sun, 19 Feb 2017 11:03:08 +0000 (11:03 +0000)

stash: introduce push verb

Introduce a new git stash push verb in addition to git stash save. The
push verb is used to transition from the current command line arguments
to a more conventional way, in which the message is given as an argument
to the -m option.

This allows us to have pathspecs at the end of the command line
arguments like other Git commands do, so that the user can say which
subset of paths to stash (and leave others behind).

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/stash: remove mention of git reset -... Thomas Gummerer Sun, 12 Feb 2017 21:54:14 +0000 (21:54 +0000)

Documentation/stash: remove mention of git reset --hard

Don't mention git reset --hard in the documentation for git stash save.
It's an implementation detail that doesn't matter to the end user and
thus shouldn't be exposed to them. In addition it's not quite true for
git stash -p, and will not be true when a filename argument to limit the
stash to a few files is introduced.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Almost ready for 2.11.1Junio C Hamano Tue, 17 Jan 2017 22:48:44 +0000 (14:48 -0800)

Almost ready for 2.11.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'mm/gc-safety-doc' into maintJunio C Hamano Tue, 17 Jan 2017 23:19:11 +0000 (15:19 -0800)

Merge branch 'mm/gc-safety-doc' into maint

Doc update.

* mm/gc-safety-doc:
git-gc.txt: expand discussion of races with other processes

Merge branch 'mm/push-social-engineering-attack-doc... Junio C Hamano Tue, 17 Jan 2017 23:19:10 +0000 (15:19 -0800)

Merge branch 'mm/push-social-engineering-attack-doc' into maint

Doc update on fetching and pushing.

* mm/push-social-engineering-attack-doc:
doc: mention transfer data leaks in more places

Merge branch 'jt/fetch-no-redundant-tag-fetch-map'... Junio C Hamano Tue, 17 Jan 2017 23:19:09 +0000 (15:19 -0800)

Merge branch 'jt/fetch-no-redundant-tag-fetch-map' into maint

Code cleanup to avoid using redundant refspecs while fetching with
the --tags option.

* jt/fetch-no-redundant-tag-fetch-map:
fetch: do not redundantly calculate tag refmap

Merge branch 'ls/filter-process' into maintJunio C Hamano Tue, 17 Jan 2017 23:19:08 +0000 (15:19 -0800)

Merge branch 'ls/filter-process' into maint

Doc update.

* ls/filter-process:
t0021: fix flaky test
docs: warn about possible '=' in clean/smudge filter process values

Merge branch 'kh/tutorial-grammofix' into maintJunio C Hamano Tue, 17 Jan 2017 23:19:08 +0000 (15:19 -0800)

Merge branch 'kh/tutorial-grammofix' into maint

* kh/tutorial-grammofix:
doc: omit needless "for"
doc: make the intent of sentence clearer
doc: add verb in front of command to run
doc: add articles (grammar)

Merge branch 'lr/doc-fix-cet' into maintJunio C Hamano Tue, 17 Jan 2017 23:19:07 +0000 (15:19 -0800)

Merge branch 'lr/doc-fix-cet' into maint

* lr/doc-fix-cet:
date-formats.txt: Typo fix

Merge branch 'sb/t3600-cleanup' into maintJunio C Hamano Tue, 17 Jan 2017 23:19:06 +0000 (15:19 -0800)

Merge branch 'sb/t3600-cleanup' into maint

Code cleanup.

* sb/t3600-cleanup:
t3600: slightly modernize style
t3600: remove useless redirect

Merge branch 'jk/readme-gmane-is-no-more' into maintJunio C Hamano Tue, 17 Jan 2017 23:19:05 +0000 (15:19 -0800)

Merge branch 'jk/readme-gmane-is-no-more' into maint

* jk/readme-gmane-is-no-more:
README: replace gmane link with public-inbox

Merge branch 'sb/unpack-trees-grammofix' into maintJunio C Hamano Tue, 17 Jan 2017 23:19:05 +0000 (15:19 -0800)

Merge branch 'sb/unpack-trees-grammofix' into maint

* sb/unpack-trees-grammofix:
unpack-trees: fix grammar for untracked files in directories

Merge branch 'ls/t0021-fixup' into maintJunio C Hamano Tue, 17 Jan 2017 23:19:04 +0000 (15:19 -0800)

Merge branch 'ls/t0021-fixup' into maint

* ls/t0021-fixup:
t0021: minor filter process test cleanup

Merge branch 'ak/lazy-prereq-mktemp' into maintJunio C Hamano Tue, 17 Jan 2017 23:19:04 +0000 (15:19 -0800)

Merge branch 'ak/lazy-prereq-mktemp' into maint

Test code clean-up.

* ak/lazy-prereq-mktemp:
t7610: clean up foo.XXXXXX tmpdir

Merge branch 'nd/qsort-in-merge-recursive' into maintJunio C Hamano Tue, 17 Jan 2017 23:19:03 +0000 (15:19 -0800)

Merge branch 'nd/qsort-in-merge-recursive' into maint

Code simplification.

* nd/qsort-in-merge-recursive:
merge-recursive.c: use string_list_sort instead of qsort

Merge branch 'dt/smart-http-detect-server-going-away... Junio C Hamano Tue, 17 Jan 2017 23:19:03 +0000 (15:19 -0800)

Merge branch 'dt/smart-http-detect-server-going-away' into maint

When the http server gives an incomplete response to a smart-http
rpc call, it could lead to client waiting for a full response that
will never come. Teach the client side to notice this condition
and abort the transfer.

An improvement counterproposal has failed.
cf. <20161114194049.mktpsvgdhex2f4zv@sigill.intra.peff.net>

* dt/smart-http-detect-server-going-away:
upload-pack: optionally allow fetching any sha1
remote-curl: don't hang when a server dies before any output

Merge branch 'mk/mingw-winansi-ttyname-termination... Junio C Hamano Tue, 17 Jan 2017 23:19:03 +0000 (15:19 -0800)

Merge branch 'mk/mingw-winansi-ttyname-termination-fix' into maint

A potential but unlikely buffer overflow in Windows port has been
fixed.

* mk/mingw-winansi-ttyname-termination-fix:
mingw: consider that UNICODE_STRING::Length counts bytes

Merge branch 'gv/p4-multi-path-commit-fix' into maintJunio C Hamano Tue, 17 Jan 2017 23:19:02 +0000 (15:19 -0800)

Merge branch 'gv/p4-multi-path-commit-fix' into maint

"git p4" that tracks multile p4 paths imported a single changelist
that touches files in these multiple paths as one commit, followed
by many empty commits. This has been fixed.

* gv/p4-multi-path-commit-fix:
git-p4: fix multi-path changelist empty commits

Merge branch 'jk/difftool-in-subdir' into maintJunio C Hamano Tue, 17 Jan 2017 23:11:08 +0000 (15:11 -0800)

Merge branch 'jk/difftool-in-subdir' into maint

Even though an fix was attempted in Git 2.9.3 days, but running
"git difftool --dir-diff" from a subdirectory never worked. This
has been fixed.

* jk/difftool-in-subdir:
difftool: rename variables for consistency
difftool: chdir as early as possible
difftool: sanitize $workdir as early as possible
difftool: fix dir-diff index creation when in a subdirectory

Merge branch 'ld/p4-compare-dir-vs-symlink' into maintJunio C Hamano Tue, 17 Jan 2017 23:11:07 +0000 (15:11 -0800)

Merge branch 'ld/p4-compare-dir-vs-symlink' into maint

"git p4" misbehaved when swapping a directory and a symbolic link.

* ld/p4-compare-dir-vs-symlink:
git-p4: avoid crash adding symlinked directory

Merge branch 'jc/push-default-explicit' into maintJunio C Hamano Tue, 17 Jan 2017 23:11:07 +0000 (15:11 -0800)

Merge branch 'jc/push-default-explicit' into maint

A lazy "git push" without refspec did not internally use a fully
specified refspec to perform 'current', 'simple', or 'upstream'
push, causing unnecessary "ambiguous ref" errors.

* jc/push-default-explicit:
push: test pushing ambiguously named branches
push: do not use potentially ambiguous default refspec

Merge branch 'jt/mailinfo-fold-in-body-headers' into... Junio C Hamano Tue, 17 Jan 2017 23:11:06 +0000 (15:11 -0800)

Merge branch 'jt/mailinfo-fold-in-body-headers' into maint

Fix for NDEBUG builds.

* jt/mailinfo-fold-in-body-headers:
mailinfo.c: move side-effects outside of assert

Merge branch 'jk/index-pack-wo-repo-from-stdin' into... Junio C Hamano Tue, 17 Jan 2017 23:11:06 +0000 (15:11 -0800)

Merge branch 'jk/index-pack-wo-repo-from-stdin' into maint

"git index-pack --stdin" needs an access to an existing repository,
but "git index-pack file.pack" to generate an .idx file that
corresponds to a packfile does not.

* jk/index-pack-wo-repo-from-stdin:
index-pack: skip collision check when not in repository
t: use nongit() function where applicable
index-pack: complain when --stdin is used outside of a repo
t5000: extract nongit function to test-lib-functions.sh

Merge branch 'jk/parseopt-usage-msg-opt' into maintJunio C Hamano Tue, 17 Jan 2017 23:11:06 +0000 (15:11 -0800)

Merge branch 'jk/parseopt-usage-msg-opt' into maint

The function usage_msg_opt() has been updated to say "fatal:"
before the custom message programs give, when they want to die
with a message about wrong command line options followed by the
standard usage string.

* jk/parseopt-usage-msg-opt:
parse-options: print "fatal:" before usage_msg_opt()

Merge branch 'jk/quote-env-path-list-component' into... Junio C Hamano Tue, 17 Jan 2017 23:11:06 +0000 (15:11 -0800)

Merge branch 'jk/quote-env-path-list-component' into maint

A recent update to receive-pack to make it easier to drop garbage
objects made it clear that GIT_ALTERNATE_OBJECT_DIRECTORIES cannot
have a pathname with a colon in it (no surprise!), and this in turn
made it impossible to push into a repository at such a path. This
has been fixed by introducing a quoting mechanism used when
appending such a path to the colon-separated list.

* jk/quote-env-path-list-component:
t5615-alternate-env: double-quotes in file names do not work on Windows
t5547-push-quarantine: run the path separator test on Windows, too
tmp-objdir: quote paths we add to alternates
alternates: accept double-quoted paths

Merge branch 'nd/shallow-fixup' into maintJunio C Hamano Tue, 17 Jan 2017 23:11:05 +0000 (15:11 -0800)

Merge branch 'nd/shallow-fixup' into maint

Code cleanup in shallow boundary computation.

* nd/shallow-fixup:
shallow.c: remove useless code
shallow.c: bit manipulation tweaks
shallow.c: avoid theoretical pointer wrap-around
shallow.c: make paint_alloc slightly more robust
shallow.c: stop abusing COMMIT_SLAB_SIZE for paint_info's memory pools
shallow.c: rename fields in paint_info to better express their purposes

Merge branch 'sb/sequencer-abort-safety' into maintJunio C Hamano Tue, 17 Jan 2017 23:11:05 +0000 (15:11 -0800)

Merge branch 'sb/sequencer-abort-safety' into maint

Unlike "git am --abort", "git cherry-pick --abort" moved HEAD back
to where cherry-pick started while picking multiple changes, when
the cherry-pick stopped to ask for help from the user, and the user
did "git reset --hard" to a different commit in order to re-attempt
the operation.

* sb/sequencer-abort-safety:
Revert "sequencer: remove useless get_dir() function"
sequencer: remove useless get_dir() function
sequencer: make sequencer abort safer
t3510: test that cherry-pick --abort does not unsafely change HEAD
am: change safe_to_abort()'s not rewinding error into a warning
am: fix filename in safe_to_abort() error message

Merge branch 'da/mergetool-xxdiff-hotkey' into maintJunio C Hamano Tue, 17 Jan 2017 23:11:05 +0000 (15:11 -0800)

Merge branch 'da/mergetool-xxdiff-hotkey' into maint

The way to specify hotkeys to "xxdiff" that is used by "git
mergetool" has been modernized to match recent versions of xxdiff.

* da/mergetool-xxdiff-hotkey:
mergetools: fix xxdiff hotkeys

Merge branch 'jc/pull-rebase-ff' into maintJunio C Hamano Tue, 17 Jan 2017 23:11:04 +0000 (15:11 -0800)

Merge branch 'jc/pull-rebase-ff' into maint

"git pull --rebase", when there is no new commits on our side since
we forked from the upstream, should be able to fast-forward without
invoking "git rebase", but it didn't.

* jc/pull-rebase-ff:
pull: fast-forward "pull --rebase=true"

Merge branch 'js/normalize-path-copy-ceil' into maintJunio C Hamano Tue, 17 Jan 2017 23:11:03 +0000 (15:11 -0800)

Merge branch 'js/normalize-path-copy-ceil' into maint

A pathname that begins with "//" or "\\" on Windows is special but
path normalization logic was unaware of it.

* js/normalize-path-copy-ceil:
normalize_path_copy(): fix pushing to //server/share/dir on Windows

Merge branch 'ak/commit-only-allow-empty' into maintJunio C Hamano Tue, 17 Jan 2017 23:11:03 +0000 (15:11 -0800)

Merge branch 'ak/commit-only-allow-empty' into maint

"git commit --allow-empty --only" (no pathspec) with dirty index
ought to be an acceptable way to create a new commit that does not
change any paths, but it was forbidden, perhaps because nobody
needed it so far.

* ak/commit-only-allow-empty:
commit: remove 'Clever' message for --only --amend
commit: make --only --allow-empty work without paths

Merge branch 'da/difftool-dir-diff-fix' into maintJunio C Hamano Tue, 17 Jan 2017 22:49:30 +0000 (14:49 -0800)

Merge branch 'da/difftool-dir-diff-fix' into maint

"git difftool --dir-diff" had a minor regression when started from
a subdirectory, which has been fixed.

* da/difftool-dir-diff-fix:
difftool: fix dir-diff index creation when in a subdirectory

Merge branch 'jb/diff-no-index-no-abbrev' into maintJunio C Hamano Tue, 17 Jan 2017 22:49:30 +0000 (14:49 -0800)

Merge branch 'jb/diff-no-index-no-abbrev' into maint

"git diff --no-index" did not take "--no-abbrev" option.

* jb/diff-no-index-no-abbrev:
diff: handle --no-abbrev in no-index case

Merge branch 'jk/stash-disable-renames-internally'... Junio C Hamano Tue, 17 Jan 2017 22:49:30 +0000 (14:49 -0800)

Merge branch 'jk/stash-disable-renames-internally' into maint

When diff.renames configuration is on (and with Git 2.9 and later,
it is enabled by default, which made it worse), "git stash"
misbehaved if a file is removed and another file with a very
similar content is added.

* jk/stash-disable-renames-internally:
stash: prefer plumbing over git-diff

Merge branch 'jk/http-walker-limit-redirect' into maintJunio C Hamano Tue, 17 Jan 2017 22:49:29 +0000 (14:49 -0800)

Merge branch 'jk/http-walker-limit-redirect' into maint

Update the error messages from the dumb-http client when it fails
to obtain loose objects; we used to give sensible error message
only upon 404 but we now forbid unexpected redirects that needs to
be reported with something sensible.

* jk/http-walker-limit-redirect:
http-walker: complain about non-404 loose object errors
http: treat http-alternates like redirects
http: make redirects more obvious
remote-curl: rename shadowed options variable
http: always update the base URL for redirects
http: simplify update_url_from_redirect

Merge branch 'jc/renormalize-merge-kill-safer-crlf... Junio C Hamano Tue, 17 Jan 2017 22:49:28 +0000 (14:49 -0800)

Merge branch 'jc/renormalize-merge-kill-safer-crlf' into maint

Fix a corner case in merge-recursive regression that crept in
during 2.10 development cycle.

* jc/renormalize-merge-kill-safer-crlf:
convert: git cherry-pick -Xrenormalize did not work
merge-recursive: handle NULL in add_cacheinfo() correctly
cherry-pick: demonstrate a segmentation fault

Merge branch 'ls/p4-empty-file-on-lfs' into maintJunio C Hamano Tue, 17 Jan 2017 22:49:27 +0000 (14:49 -0800)

Merge branch 'ls/p4-empty-file-on-lfs' into maint

"git p4" LFS support was broken when LFS stores an empty blob.

* ls/p4-empty-file-on-lfs:
git-p4: fix empty file processing for large file system backend GitLFS

Merge branch 'da/mergetool-trust-exit-code' into maintJunio C Hamano Tue, 17 Jan 2017 22:49:27 +0000 (14:49 -0800)

Merge branch 'da/mergetool-trust-exit-code' into maint

mergetool.<tool>.trustExitCode configuration variable did not apply
to built-in tools, but now it does.

* da/mergetool-trust-exit-code:
mergetools/vimdiff: trust Vim's exit code
mergetool: honor mergetool.$tool.trustExitCode for built-in tools

Merge branch 'nd/worktree-list-fixup' into maintJunio C Hamano Tue, 17 Jan 2017 22:49:27 +0000 (14:49 -0800)

Merge branch 'nd/worktree-list-fixup' into maint

The output from "git worktree list" was made in readdir() order,
and was unstable.

* nd/worktree-list-fixup:
worktree list: keep the list sorted
worktree.c: get_worktrees() takes a new flag argument
get_worktrees() must return main worktree as first item even on error
worktree: reorder an if statement
worktree.c: zero new 'struct worktree' on allocation

Merge branch 'bw/push-dry-run' into maintJunio C Hamano Tue, 17 Jan 2017 22:49:27 +0000 (14:49 -0800)

Merge branch 'bw/push-dry-run' into maint

"git push --dry-run --recurse-submodule=on-demand" wasn't
"--dry-run" in the submodules.

* bw/push-dry-run:
push: fix --dry-run to not push submodules
push: --dry-run updates submodules when --recurse-submodules=on-demand

Merge branch 'hv/submodule-not-yet-pushed-fix' into... Junio C Hamano Tue, 17 Jan 2017 22:49:26 +0000 (14:49 -0800)

Merge branch 'hv/submodule-not-yet-pushed-fix' into maint

The code in "git push" to compute if any commit being pushed in the
superproject binds a commit in a submodule that hasn't been pushed
out was overly inefficient, making it unusable even for a small
project that does not have any submodule but have a reasonable
number of refs.

* hv/submodule-not-yet-pushed-fix:
submodule_needs_pushing(): explain the behaviour when we cannot answer
batch check whether submodule needs pushing into one call
serialize collection of refs that contain submodule changes
serialize collection of changed submodules

Merge branch 'dt/empty-submodule-in-merge' into maintJunio C Hamano Tue, 17 Jan 2017 22:49:26 +0000 (14:49 -0800)

Merge branch 'dt/empty-submodule-in-merge' into maint

An empty directory in a working tree that can simply be nuked used
to interfere while merging or cherry-picking a change to create a
submodule directory there, which has been fixed..

* dt/empty-submodule-in-merge:
submodules: allow empty working-tree dirs in merge/cherry-pick

Merge branch 'jk/rev-parse-symbolic-parents-fix' into... Junio C Hamano Tue, 17 Jan 2017 22:49:26 +0000 (14:49 -0800)

Merge branch 'jk/rev-parse-symbolic-parents-fix' into maint

"git rev-parse --symbolic" failed with a more recent notation like
"HEAD^-1" and "HEAD^!".

* jk/rev-parse-symbolic-parents-fix:
rev-parse: fix parent shorthands with --symbolic

Merge branch 'js/mingw-isatty' into maintJunio C Hamano Tue, 17 Jan 2017 22:49:25 +0000 (14:49 -0800)

Merge branch 'js/mingw-isatty' into maint

Update the isatty() emulation for Windows by updating the previous
hack that depended on internals of (older) MSVC runtime.

* js/mingw-isatty:
mingw: replace isatty() hack
mingw: fix colourization on Cygwin pseudo terminals
mingw: adjust is_console() to work with stdin
mingw: intercept isatty() to handle /dev/null as Git expects it

Merge branch 'bb/unicode-9.0' into maintJunio C Hamano Tue, 17 Jan 2017 22:49:25 +0000 (14:49 -0800)

Merge branch 'bb/unicode-9.0' into maint

The character width table has been updated to match Unicode 9.0

* bb/unicode-9.0:
unicode_width.h: update the width tables to Unicode 9.0
update_unicode.sh: remove the plane filter
update_unicode.sh: automatically download newer definition files
update_unicode.sh: pin the uniset repo to a known good commit
update_unicode.sh: remove an unnecessary subshell level
update_unicode.sh: move it into contrib/update-unicode

Merge branch 'ls/travis-update-p4-and-lfs' into maintJunio C Hamano Tue, 17 Jan 2017 22:49:24 +0000 (14:49 -0800)

Merge branch 'ls/travis-update-p4-and-lfs' into maint

The default Travis-CI configuration specifies newer P4 and GitLFS.

* ls/travis-update-p4-and-lfs:
travis-ci: update P4 to 16.2 and GitLFS to 1.5.2 in Linux build

mingw: replace isatty() hackJeff Hostetler Thu, 22 Dec 2016 17:09:23 +0000 (18:09 +0100)

mingw: replace isatty() hack

Git for Windows has carried a patch that depended on internals
of MSVC runtime, but it does not work correctly with recent MSVC
runtime. A replacement was written originally for compiling
with VC++. The patch in this message is a backport of that
replacement, and it also fixes the previous attempt to make
isatty() tell that /dev/null is *not* an interactive terminal.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Tested-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: fix colourization on Cygwin pseudo terminalsAlan Davies Thu, 22 Dec 2016 17:09:18 +0000 (18:09 +0100)

mingw: fix colourization on Cygwin pseudo terminals

Git only colours the output and uses pagination if isatty() returns 1.
MSYS2 and Cygwin emulate pseudo terminals via named pipes, meaning that
isatty() returns 0.

f7f90e0f4f (mingw: make isatty() recognize MSYS2's pseudo terminals
(/dev/pty*), 2016-04-27) fixed this for MSYS2 terminals, but not for
Cygwin.

The named pipes that Cygwin and MSYS2 use are very similar. MSYS2 PTY pipes
are called 'msys-*-pty*' and Cygwin uses 'cygwin-*-pty*'. This commit
modifies the existing check to allow both MSYS2 and Cygwin PTY pipes to be
identified as TTYs.

Note that pagination is still broken when running Git for Windows from
within Cygwin, as MSYS2's less.exe is spawned (and does not like to
interact with Cygwin's PTY).

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

Signed-off-by: Alan Davies <alan.n.davies@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: adjust is_console() to work with stdinJohannes Schindelin Thu, 22 Dec 2016 17:08:57 +0000 (18:08 +0100)

mingw: adjust is_console() to work with stdin

When determining whether a handle corresponds to a *real* Win32 Console
(as opposed to, say, a character device such as /dev/null), we use the
GetConsoleOutputBufferInfo() function as a tell-tale.

However, that does not work for *input* handles associated with a
console. Let's just use the GetConsoleMode() function for input handles,
and since it does not work on output handles fall back to the previous
method for those.

This patch prepares for using is_console() instead of my previous
misguided attempt in cbb3f3c9b1 (mingw: intercept isatty() to handle
/dev/null as Git expects it, 2016-12-11) that broke everything on
Windows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5615-alternate-env: double-quotes in file names do... Johannes Sixt Wed, 21 Dec 2016 21:33:43 +0000 (22:33 +0100)

t5615-alternate-env: double-quotes in file names do not work on Windows

Protect a recently added test case with !MINGW.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailinfo.c: move side-effects outside of assertKyle J. McKay Mon, 19 Dec 2016 23:13:00 +0000 (15:13 -0800)

mailinfo.c: move side-effects outside of assert

Since 6b4b013f18 (mailinfo: handle in-body header continuations,
2016-09-20, v2.11.0) mailinfo.c has contained new code with an
assert of the form:

assert(call_a_function(...))

The function in question, check_header, has side effects. This
means that when NDEBUG is defined during a release build the
function call is omitted entirely, the side effects do not
take place and tests (fortunately) start failing.

Since the only time that mi->inbody_header_accum is appended to is
in check_inbody_header, and appending onto a blank
mi->inbody_header_accum always happens when is_inbody_header is
true, this guarantees a prefix that causes check_header to always
return true.

Therefore replace the assert with an if !check_header + DIE
combination to reflect this.

Helped-by: Jonathan Tan <jonathantanmy@google.com>
Helped-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: consider that UNICODE_STRING::Length counts... Max Kirillov Mon, 19 Dec 2016 21:32:00 +0000 (23:32 +0200)

mingw: consider that UNICODE_STRING::Length counts bytes

UNICODE_STRING::Length field means size of buffer in bytes[1],
despite of buffer itself being array of wchar_t. Because of that
terminating zero is placed twice as far. Fix it.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa380518.aspx

Signed-off-by: Max Kirillov <max@max630.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: fix multi-path changelist empty commitsGeorge Vanburgh Sat, 17 Dec 2016 22:11:23 +0000 (22:11 +0000)

git-p4: fix multi-path changelist empty commits

When importing from multiple perforce paths - we may attempt to
import a changelist that contains files from two (or more) of these
depot paths. Currently, this results in multiple git commits - one
containing the changes, and the other(s) as empty commit(s). This
behavior was introduced in commit 1f90a64891 ("git-p4: reduce number
of server queries for fetches", 2015-12-19).

Reproduction Steps:

1. Have a git repo cloned from a perforce repo using multiple
depot paths (e.g. //depot/foo and //depot/bar).

2. Submit a single change to the perforce repo that makes changes
in both //depot/foo and //depot/bar.

3. Run "git p4 sync" to sync the change from #2.

Change is synced as multiple commits, one for each depot path that
was affected.

Using a set, instead of a list inside p4ChangesForPaths() ensures
that each changelist is unique to the returned list, and therefore
only a single commit is generated for each changelist.

Reported-by: James Farwell <jfarwell@vmware.com>
Signed-off-by: George Vanburgh <gvanburgh@bloomberg.net>
Reviewed-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: avoid crash adding symlinked directoryLuke Diamand Sat, 17 Dec 2016 01:00:40 +0000 (01:00 +0000)

git-p4: avoid crash adding symlinked directory

When submitting to P4, if git-p4 came across a symlinked
directory, then during the generation of the submit diff, it would
try to open it as a normal file and fail.

Spot symlinks (of any type) and output a description of the symlink
instead.

Add a test case.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0021: fix flaky testLars Schneider Sun, 18 Dec 2016 12:37:48 +0000 (13:37 +0100)

t0021: fix flaky test

t0021.15 creates files, adds them to the index, and commits them. All
this usually happens in a test run within the same second and Git cannot
know if the files have been changed between `add` and `commit`. Thus,
Git has to run the clean filter in both operations. Sometimes these
invocations spread over two different seconds and Git can infer that the
files were not changed between `add` and `commit` based on their
modification timestamp. The test would fail as it expects the filter
invocation. Remove this expectation to make the test stable.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

index-pack: skip collision check when not in repositoryJeff King Fri, 16 Dec 2016 21:43:22 +0000 (16:43 -0500)

index-pack: skip collision check when not in repository

You can run "git index-pack path/to/foo.pack" outside of a
repository to generate an index file, or just to verify the
contents. There's no point in doing a collision check, since
we obviously do not have any objects to collide with.

The current code will blindly look in .git/objects based on
the result of setup_git_env(). That effectively gives us the
right answer (since we won't find any objects), but it's a
waste of time, and it conflicts with our desire to
eventually get rid of the "fallback to .git" behavior of
setup_git_env().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

normalize_path_copy(): fix pushing to //server/share... Johannes Sixt Wed, 14 Dec 2016 19:37:38 +0000 (20:37 +0100)

normalize_path_copy(): fix pushing to //server/share/dir on Windows

normalize_path_copy() is not prepared to keep the double-slash of a
//server/share/dir kind of path, but treats it like a regular POSIX
style path and transforms it to /server/share/dir.

The bug manifests when 'git push //server/share/dir master' is run,
because tmp_objdir_add_as_alternate() uses the path in normalized
form when it registers the quarantine object database via
link_alt_odb_entries(). Needless to say that the directory cannot be
accessed using the wrongly normalized path.

Fix it by skipping all of the root part, not just a potential drive
prefix. offset_1st_component takes care of this, see the
implementation in compat/mingw.c::mingw_offset_1st_component().

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: use nongit() function where applicableJeff King Fri, 16 Dec 2016 02:31:59 +0000 (21:31 -0500)

t: use nongit() function where applicable

Many tests want to run a command outside of any git repo;
with the nongit() function this is now a one-liner. It saves
a few lines, but more importantly, it's immediately obvious
what the code is trying to accomplish.

This doesn't convert every such case in the test suite; it
just covers those that want to do a one-off command. Other
cases, such as the ones in t4035, are part of a larger
scheme of outside-repo files, and it's less confusing for
them to stay consistent with the surrounding tests.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

index-pack: complain when --stdin is used outside of... Jeff King Fri, 16 Dec 2016 02:30:59 +0000 (21:30 -0500)

index-pack: complain when --stdin is used outside of a repo

The index-pack builtin is marked as RUN_SETUP_GENTLY,
because it's perfectly fine to index a pack in the
filesystem outside of any repository. However, --stdin mode
will write the result to the object database, which does not
make sense outside of a repository. Doing so creates a bogus
".git" directory with nothing in it except the newly-created
pack and its index.

Instead, let's flag this as an error and abort.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5000: extract nongit function to test-lib-functions.shJeff King Fri, 16 Dec 2016 02:30:12 +0000 (21:30 -0500)

t5000: extract nongit function to test-lib-functions.sh

This function abstracts the idea of running a command
outside of any repository (which is slightly awkward to do
because even if you make a non-repo directory, git may keep
walking up outside of the trash directory). There are
several scripts that use the same technique, so let's make
the function available for everyone.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

README: replace gmane link with public-inboxJeff King Thu, 15 Dec 2016 14:17:19 +0000 (09:17 -0500)

README: replace gmane link with public-inbox

The general status and future of gmane is unclear at this
point, but certainly it does not seem to be carrying
gmane.comp.version-control.git at all anymore. Let's point
to public-inbox.org, which seems to be the favored archive
on the list these days (and which uses message-ids in its
URLs, making the links somewhat future-proof).

Reported-by: Chiel ten Brinke <ctenbrinke@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Revert "sequencer: remove useless get_dir() function"Junio C Hamano Wed, 14 Dec 2016 22:56:46 +0000 (14:56 -0800)

Revert "sequencer: remove useless get_dir() function"

This reverts commit 39784cd3620cc47415c9010ec58a9616f040125c.

The function had only one caller when the "remove useless" was
written, but another topic will soon make heavy use of it and more
importantly the function will return different paths depending on
the value in opts.

parse-options: print "fatal:" before usage_msg_opt()Jeff King Wed, 14 Dec 2016 15:10:10 +0000 (10:10 -0500)

parse-options: print "fatal:" before usage_msg_opt()

Programs may use usage_msg_opt() to print a brief message
followed by the program usage, and then exit. The message
isn't prefixed at all, though, so it doesn't match our usual
error output and is easy to overlook:

$ git clone 1 2 3
Too many arguments.

usage: git clone [<options>] [--] <repo> [<dir>]

-v, --verbose be more verbose
-q, --quiet be more quiet
--progress force progress reporting
-n, --no-checkout don't create a checkout
--bare create a bare repository
[...and so on for another 31 lines...]

It looks especially bad when the message starts with an
option, like:

$ git replace -e
-e needs exactly one argument

usage: git replace [-f] <object> <replacement>
or: git replace [-f] --edit <object>
[...etc...]

Let's put our usual "fatal:" prefix in front of it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

unicode_width.h: update the width tables to Unicode 9.0Beat Bolli Tue, 13 Dec 2016 23:31:44 +0000 (00:31 +0100)

unicode_width.h: update the width tables to Unicode 9.0

Rerunning update-unicode.sh that we fixed in the previous commits
produces these new tables.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

update_unicode.sh: remove the plane filterBeat Bolli Tue, 13 Dec 2016 23:31:43 +0000 (00:31 +0100)

update_unicode.sh: remove the plane filter

The uniset upstream has accepted my patches that eliminate the Unicode
plane offsets from the output in '--32' mode.

Remove the corresponding filter in update_unicode.sh.

This also fixes the issue that the plane offsets were not removed from
the second uniset call.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

update_unicode.sh: automatically download newer definit... Beat Bolli Tue, 13 Dec 2016 23:31:42 +0000 (00:31 +0100)

update_unicode.sh: automatically download newer definition files

Checking just for the unicode data files' existence is not sufficient;
we should also download them if a newer version exists on the Unicode
consortium's servers. Option -N of wget does this nicely for us.

Reviewed-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

update_unicode.sh: pin the uniset repo to a known good... Beat Bolli Tue, 13 Dec 2016 23:31:41 +0000 (00:31 +0100)

update_unicode.sh: pin the uniset repo to a known good commit

The uniset upstream has added more commits that for example change the
hexadecimal output in '--32' mode to decimal. Let's pin the repo to a
commit that still outputs the width tables in the format we want.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

update_unicode.sh: remove an unnecessary subshell levelBeat Bolli Tue, 13 Dec 2016 23:31:40 +0000 (00:31 +0100)

update_unicode.sh: remove an unnecessary subshell level

After the move into contrib/update-unicode, we no longer create the
unicode directory to have a clean working folder. Instead, the directory
of the script is used. This means that the subshell can be removed.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

update_unicode.sh: move it into contrib/update-unicodeBeat Bolli Tue, 13 Dec 2016 23:31:39 +0000 (00:31 +0100)

update_unicode.sh: move it into contrib/update-unicode

As it's used only by a tiny minority of the Git developer population,
this script does not belong into the main Git source directory.

Move it into contrib/ and adjust the paths to account for the new
location.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5547-push-quarantine: run the path separator test... Johannes Sixt Tue, 13 Dec 2016 19:09:31 +0000 (20:09 +0100)

t5547-push-quarantine: run the path separator test on Windows, too

To perform the test case on Windows in a way that corresponds to the
POSIX version, inject the semicolon in a directory name.

Typically, an absolute POSIX style path, such as the one in $PWD, is
translated into a Windows style path by bash when it invokes git.exe.
However, the presence of the semicolon suppresses this translation;
but the untranslated POSIX style path is useless for git.exe.
Therefore, instead of $PWD pass the Windows style path that $(pwd)
produces.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3600: slightly modernize styleStefan Beller Mon, 12 Dec 2016 23:54:55 +0000 (15:54 -0800)

t3600: slightly modernize style

Remove the space between redirection and file name.
Also remove unnecessary invocations of subshells, such as

(cd submod &&
echo X >untracked
) &&

as there is no point of having the shell for functional purposes.
In case of a single Git command use the `-C` option to let Git cd into
the directory.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tmp-objdir: quote paths we add to alternatesJeff King Mon, 12 Dec 2016 19:53:55 +0000 (14:53 -0500)

tmp-objdir: quote paths we add to alternates

Commit 722ff7f87 (receive-pack: quarantine objects until
pre-receive accepts, 2016-10-03) regressed pushes to
repositories with colon (or semi-colon in Windows in them)
because it adds the repository's main object directory to
GIT_ALTERNATE_OBJECT_DIRECTORIES. The receiver interprets
the colon as a delimiter, not as part of the path, and
index-pack is unable to find objects which it needs to
resolve deltas.

The previous commit introduced a quoting mechanism for the
alternates list; let's use it here to cover this case. We'll
avoid quoting when we can, though. This alternate setup is
also used when calling hooks, so it's possible that the user
may call older git implementations which don't understand
the quoting mechanism. By quoting only when necessary, this
setup will continue to work unless the user _also_ has a
repository whose path contains the delimiter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

alternates: accept double-quoted pathsJeff King Mon, 12 Dec 2016 19:52:22 +0000 (14:52 -0500)

alternates: accept double-quoted paths

We read lists of alternates from objects/info/alternates
files (delimited by newline), as well as from the
GIT_ALTERNATE_OBJECT_DIRECTORIES environment variable
(delimited by colon or semi-colon, depending on the
platform).

There's no mechanism for quoting the delimiters, so it's
impossible to specify an alternate path that contains a
colon in the environment, or one that contains a newline in
a file. We've lived with that restriction for ages because
both alternates and filenames with colons are relatively
rare, and it's only a problem when the two meet. But since
722ff7f87 (receive-pack: quarantine objects until
pre-receive accepts, 2016-10-03), which builds on the
alternates system, every push causes the receiver to set
GIT_ALTERNATE_OBJECT_DIRECTORIES internally.

It would be convenient to have some way to quote the
delimiter so that we can represent arbitrary paths.

The simplest thing would be an escape character before a
quoted delimiter (e.g., "\:" as a literal colon). But that
creates a backwards compatibility problem: any path which
uses that escape character is now broken, and we've just
shifted the problem. We could choose an unlikely escape
character (e.g., something from the non-printable ASCII
range), but that's awkward to use.

Instead, let's treat names as unquoted unless they begin
with a double-quote, in which case they are interpreted via
our usual C-stylke quoting rules. This also breaks
backwards-compatibility, but in a smaller way: it only
matters if your file has a double-quote as the very _first_
character in the path (whereas an escape character is a
problem anywhere in the path). It's also consistent with
many other parts of git, which accept either a bare pathname
or a double-quoted one, and the sender can choose to quote
or not as required.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jk/alt-odb-cleanup' into jk/quote-env... Junio C Hamano Mon, 12 Dec 2016 23:09:57 +0000 (15:09 -0800)

Merge branch 'jk/alt-odb-cleanup' into jk/quote-env-path-list-component

* jk/alt-odb-cleanup:
alternates: re-allow relative paths from environment

date-formats.txt: Typo fixLuis Ressel Mon, 12 Dec 2016 16:45:02 +0000 (17:45 +0100)

date-formats.txt: Typo fix

Last time I checked, I was living in the UTC+01:00 time zone. UTC+02:00
would be Central European _Summer_ Time.

Signed-off-by: Luis Ressel <aranea@aixah.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetools: fix xxdiff hotkeysDavid Aguilar Sat, 10 Dec 2016 02:14:21 +0000 (18:14 -0800)

mergetools: fix xxdiff hotkeys

xxdiff was using a mix of "Ctrl-<key>" and "Ctrl+<key>" hotkeys.
The dashed "-" form is not accepted by newer xxdiff versions.
Use the plus "+" form only.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

difftool: rename variables for consistencyDavid Aguilar Fri, 9 Dec 2016 08:58:48 +0000 (00:58 -0800)

difftool: rename variables for consistency

Always call the list of files @files.
Always call the worktree $worktree.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

difftool: chdir as early as possibleDavid Aguilar Fri, 9 Dec 2016 08:58:47 +0000 (00:58 -0800)

difftool: chdir as early as possible

Make difftool chdir to the top-level of the repository as soon as it can
so that we can simplify how paths are handled. Replace construction of
absolute paths via string concatenation with relative paths wherever
possible. The bulk of the code no longer needs to use absolute paths.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

difftool: sanitize $workdir as early as possibleDavid Aguilar Fri, 9 Dec 2016 08:58:46 +0000 (00:58 -0800)

difftool: sanitize $workdir as early as possible

The double-slash fixup on the $workdir variable was being
performed just-in-time to avoid double-slashes in symlink
targets, but the rest of the code was silently using paths with
embedded "//" in them.

A recent user-reported error message contained double-slashes.
Eliminate the issue by sanitizing inputs as soon as they arrive.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

difftool: fix dir-diff index creation when in a subdire... David Aguilar Wed, 7 Dec 2016 10:16:08 +0000 (02:16 -0800)

difftool: fix dir-diff index creation when in a subdirectory

9ec26e7977 (difftool: fix argument handling in subdirs, 2016-07-18)
corrected how path arguments are handled in a subdirectory, but
it introduced a regression in how entries outside of the
subdirectory are handled by dir-diff.

When preparing the right-side of the diff we only include the
changed paths in the temporary area.

The left side of the diff is constructed from a temporary
index that is built from the same set of changed files, but it
was being constructed from within the subdirectory. This is a
problem because the indexed paths are toplevel-relative, and
thus they were not getting added to the index.

Teach difftool to chdir to the toplevel of the repository before
preparing its temporary indexes. This ensures that all of the
toplevel-relative paths are valid.

Add test cases to more thoroughly exercise this scenario.

Reported-by: Frank Becker <fb@mooflu.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: intercept isatty() to handle /dev/null as Git... Johannes Schindelin Sun, 11 Dec 2016 11:16:57 +0000 (12:16 +0100)

mingw: intercept isatty() to handle /dev/null as Git expects it

When Git's source code calls isatty(), it really asks whether the
respective file descriptor is connected to an interactive terminal.

Windows' _isatty() function, however, determines whether the file
descriptor is associated with a character device. And NUL, Windows'
equivalent of /dev/null, is a character device.

Which means that for years, Git mistakenly detected an associated
interactive terminal when being run through the test suite, which
almost always redirects stdin, stdout and stderr to /dev/null.

This bug only became obvious, and painfully so, when the new
bisect--helper entered the `pu` branch and made the automatic build & test
time out because t6030 was waiting for an answer.

For details, see

https://msdn.microsoft.com/en-us/library/f4s0ddew.aspx

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: omit needless "for"Kristoffer Haugsbakk Fri, 9 Dec 2016 15:51:12 +0000 (16:51 +0100)

doc: omit needless "for"

What was intended was perhaps "... plumbing does for you" ("you" added), but
simply omitting the word "for" is more terse and gets the intended point across
just as well, if not more so.

I originally went with the approach of writing "for you", but Junio C
Hamano suggested this approach instead.

Signed-off-by: Kristoffer Haugsbakk <kristoffer.haugsbakk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: make the intent of sentence clearerKristoffer Haugsbakk Fri, 9 Dec 2016 15:51:11 +0000 (16:51 +0100)

doc: make the intent of sentence clearer

By adding the word "just", which might have been accidentally omitted.

Adding the word "just" makes it clear that the point is to *not* do an
octopus merge simply because you *can* do it. In other words, you
should have a reason for doing it beyond simply having two (seemingly)
independent commits that you need to merge into another branch, since
it's not always the best approach.

The previous sentence made it look more like it was trying to say that
you shouldn't do an octopus merge *because* you can do an octopus merge.
Although this interpretation doesn't make sense and the rest of the
paragraph makes the intended meaning clear, this adjustment should make
the intent of the sentence more immediately clear to the reader.

Signed-off-by: Kristoffer Haugsbakk <kristoffer.haugsbakk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: add verb in front of command to runKristoffer Haugsbakk Fri, 9 Dec 2016 15:51:10 +0000 (16:51 +0100)

doc: add verb in front of command to run

Instead of using the command 'git clone' as a verb, use "run" as the
verb indicating the action of executing the command 'git clone'.

Signed-off-by: Kristoffer Haugsbakk <kristoffer.haugsbakk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: add articles (grammar)Kristoffer Haugsbakk Fri, 9 Dec 2016 15:51:09 +0000 (16:51 +0100)

doc: add articles (grammar)

Add definite and indefinite articles in three places where they were
missing.

- Use "the" in front of a directory name
- Use "the" in front of "style of cooperation"
- Use an indefinite article in front of "CVS background"

Signed-off-by: Kristoffer Haugsbakk <kristoffer.haugsbakk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: remove useless get_dir() functionStephan Beyer Wed, 7 Dec 2016 21:51:33 +0000 (22:51 +0100)

sequencer: remove useless get_dir() function

This function is used only once, for the removal of the
directory. It is not used for the creation of the directory nor
anywhere else.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: make sequencer abort saferStephan Beyer Wed, 7 Dec 2016 21:51:32 +0000 (22:51 +0100)

sequencer: make sequencer abort safer

In contrast to "git am --abort", a sequencer abort did not check
whether the current HEAD is the one that is expected. This can lead
to loss of work (when not spotted and resolved using reflog before
the garbage collector chimes in).

This behavior is now changed by mimicking "git am --abort". The
abortion is done but HEAD is not changed when the current HEAD is
not the expected HEAD.

A new file "sequencer/abort-safety" is added to save the expected
HEAD.

The new behavior is only active when --abort is invoked on multiple
picks. The problem does not occur for the single-pick case because
it is handled differently.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3510: test that cherry-pick --abort does not unsafely... Stephan Beyer Wed, 7 Dec 2016 21:51:31 +0000 (22:51 +0100)

t3510: test that cherry-pick --abort does not unsafely change HEAD

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: remove 'Clever' message for --only --amendAndreas Krey Fri, 9 Dec 2016 04:10:21 +0000 (05:10 +0100)

commit: remove 'Clever' message for --only --amend

The behavior is now documented; more importantly, rewarding the user
with a "Wow, you are clever" praise afterwards is not an effective
way to advertise the feature--at that point the user already knows.

Signed-off-by: Andreas Krey <a.krey@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: handle --no-abbrev in no-index caseJack Bates Tue, 6 Dec 2016 16:56:14 +0000 (09:56 -0700)

diff: handle --no-abbrev in no-index case

There are two different places where the --no-abbrev option is parsed,
and two different places where SHA-1s are abbreviated. We normally parse
--no-abbrev with setup_revisions(), but in the no-index case, "git diff"
calls diff_opt_parse() directly, and diff_opt_parse() didn't handle
--no-abbrev until now. (It did handle --abbrev, however.) We normally
abbreviate SHA-1s with find_unique_abbrev(), but commit 4f03666 ("diff:
handle sha1 abbreviations outside of repository, 2016-10-20) recently
introduced a special case when you run "git diff" outside of a
repository.

setup_revisions() does also call diff_opt_parse(), but not for --abbrev
or --no-abbrev, which it handles itself. setup_revisions() sets
rev_info->abbrev, and later copies that to diff_options->abbrev. It
handles --no-abbrev by setting abbrev to zero. (This change doesn't
touch that.)

Setting abbrev to zero was broken in the outside-of-a-repository special
case, which until now resulted in a truly zero-length SHA-1, rather than
taking zero to mean do not abbreviate. The only way to trigger this bug,
however, was by running "git diff --raw" without either the --abbrev or
--no-abbrev options, because 1) without --raw it doesn't respect abbrev
(which is bizarre, but has been that way forever), 2) we silently clamp
--abbrev=0 to MINIMUM_ABBREV, and 3) --no-abbrev wasn't handled until
now.

The outside-of-a-repository case is one of three no-index cases. The
other two are when one of the files you're comparing is outside of the
repository you're in, and the --no-index option.

Signed-off-by: Jack Bates <jack@nottheoilrig.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>