OSDN Git Service

git-core/git.git
7 years agoMerge branch 'js/mingw-isatty' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:11 +0000 (13:32 -0800)]
Merge branch 'js/mingw-isatty' into maint

An update to a topic that is already in 'master'.

* js/mingw-isatty:
  mingw: follow-up to "replace isatty() hack"

7 years agoMerge branch 'jk/coding-guidelines-update' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:11 +0000 (13:32 -0800)]
Merge branch 'jk/coding-guidelines-update' into maint

Developer doc update.

* jk/coding-guidelines-update:
  CodingGuidelines: clarify multi-line brace style

7 years agoMerge branch 'js/exec-path-coverity-workaround' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:10 +0000 (13:32 -0800)]
Merge branch 'js/exec-path-coverity-workaround' into maint

Code cleanup.

* js/exec-path-coverity-workaround:
  git_exec_path: do not return the result of getenv()
  git_exec_path: avoid Coverity warning about unfree()d result

7 years agoMerge branch 'ad/bisect-terms' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:10 +0000 (13:32 -0800)]
Merge branch 'ad/bisect-terms' into maint

Documentation fix.

* ad/bisect-terms:
  Documentation/bisect: improve on (bad|new) and (good|bad)

7 years agoMerge branch 'jk/grep-e-could-be-extended-beyond-posix' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:09 +0000 (13:32 -0800)]
Merge branch 'jk/grep-e-could-be-extended-beyond-posix' into maint

Tighten a test to avoid mistaking an extended ERE regexp engine as
a PRE regexp engine.

* jk/grep-e-could-be-extended-beyond-posix:
  t7810: avoid assumption about invalid regex syntax

7 years agoMerge branch 'km/branch-get-push-while-detached' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:08 +0000 (13:32 -0800)]
Merge branch 'km/branch-get-push-while-detached' into maint

"git <cmd> @{push}" on a detached HEAD used to segfault; it has
been corrected to error out with a message.

* km/branch-get-push-while-detached:
  branch_get_push: do not segfault when HEAD is detached

7 years agoMerge branch 'jk/rebase-i-squash-count-fix' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:07 +0000 (13:32 -0800)]
Merge branch 'jk/rebase-i-squash-count-fix' into maint

"git rebase -i" with a recent update started showing an incorrect
count when squashing more than 10 commits.

* jk/rebase-i-squash-count-fix:
  rebase--interactive: count squash commits above 10 correctly

7 years agoMerge branch 'jk/blame-fixes' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:07 +0000 (13:32 -0800)]
Merge branch 'jk/blame-fixes' into maint

"git blame --porcelain" misidentified the "previous" <commit, path>
pair (aka "source") when contents came from two or more files.

* jk/blame-fixes:
  blame: output porcelain "previous" header for each file
  blame: handle --no-abbrev
  blame: fix alignment with --abbrev=40

7 years agoMerge branch 'jk/archive-zip-userdiff-config' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:07 +0000 (13:32 -0800)]
Merge branch 'jk/archive-zip-userdiff-config' into maint

"git archive" did not read the standard configuration files, and
failed to notice a file that is marked as binary via the userdiff
driver configuration.

* jk/archive-zip-userdiff-config:
  archive-zip: load userdiff config

7 years agoMerge branch 'dt/disable-bitmap-in-auto-gc' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:06 +0000 (13:32 -0800)]
Merge branch 'dt/disable-bitmap-in-auto-gc' into maint

It is natural that "git gc --auto" may not attempt to pack
everything into a single pack, and there is no point in warning
when the user has configured the system to use the pack bitmap,
leading to disabling further "gc".

* dt/disable-bitmap-in-auto-gc:
  repack: die on incremental + write-bitmap-index
  auto gc: don't write bitmaps for incremental repacks

7 years agoMerge branch 'nd/config-misc-fixes' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:06 +0000 (13:32 -0800)]
Merge branch 'nd/config-misc-fixes' into maint

Leakage of lockfiles in the config subsystem has been fixed.

* nd/config-misc-fixes:
  config.c: handle lock file in error case in git_config_rename_...
  config.c: rename label unlock_and_out
  config.c: handle error case for fstat() calls

7 years agoMerge branch 'jc/abbrev-autoscale-config' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:06 +0000 (13:32 -0800)]
Merge branch 'jc/abbrev-autoscale-config' into maint

Recent update to the default abbreviation length that auto-scales
lacked documentation update, which has been corrected.

* jc/abbrev-autoscale-config:
  config.abbrev: document the new default that auto-scales

7 years agoMerge branch 'mh/fast-import-notes-fix-new' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:05 +0000 (13:32 -0800)]
Merge branch 'mh/fast-import-notes-fix-new' into maint

"git fast-import" sometimes mishandled while rebalancing notes
tree, which has been fixed.

* mh/fast-import-notes-fix-new:
  fast-import: properly fanout notes when tree is imported

7 years agoMerge branch 'jc/compression-config' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:05 +0000 (13:32 -0800)]
Merge branch 'jc/compression-config' into maint

Compression setting for producing packfiles were spread across
three codepaths, one of which did not honor any configuration.
Unify these so that all of them honor core.compression and
pack.compression variables the same way.

* jc/compression-config:
  compression: unify pack.compression configuration parsing

7 years agoMerge branch 'ew/svn-fixes' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:05 +0000 (13:32 -0800)]
Merge branch 'ew/svn-fixes' into maint

Meant eventually for 'maint'.

* ew/svn-fixes:
  git-svn: document useLogAuthor and addAuthorFrom config keys
  git-svn: allow "0" in SVN path components

7 years agoMerge branch 'ls/travis-p4-on-macos' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:04 +0000 (13:32 -0800)]
Merge branch 'ls/travis-p4-on-macos' into maint

Update the definition of the MacOSX test environment used by
TravisCI.

* ls/travis-p4-on-macos:
  travis-ci: fix Perforce install on macOS

7 years agoMerge branch 'jk/make-tags-find-sources-tweak' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:04 +0000 (13:32 -0800)]
Merge branch 'jk/make-tags-find-sources-tweak' into maint

Update the procedure to generate "tags" for developer support.

* jk/make-tags-find-sources-tweak:
  Makefile: exclude contrib from FIND_SOURCE_FILES
  Makefile: match shell scripts in FIND_SOURCE_FILES
  Makefile: exclude test cruft from FIND_SOURCE_FILES
  Makefile: reformat FIND_SOURCE_FILES

7 years agoMerge branch 'jc/latin-1' into maint
Junio C Hamano [Tue, 31 Jan 2017 21:32:04 +0000 (13:32 -0800)]
Merge branch 'jc/latin-1' into maint

Some platforms no longer understand "latin-1" that is still seen in
the wild in e-mail headers; replace them with "iso-8859-1" that is
more widely known when conversion fails from/to it.

* jc/latin-1:
  utf8: accept "latin-1" as ISO-8859-1
  utf8: refactor code to decide fallback encoding

7 years agotravis-ci: fix Perforce install on macOS
Lars Schneider [Sun, 22 Jan 2017 22:55:50 +0000 (23:55 +0100)]
travis-ci: fix Perforce install on macOS

The `perforce` and `perforce-server` package were moved from brew [1][2]
to cask [3]. Teach TravisCI the new location.

Perforce updates their binaries without version bumps. That made the
brew install (legitimately!) fail due to checksum mismatches. The
workaround is not necessary anymore as Cask [4] allows to disable the
checksum test for individual formulas.

[1] https://github.com/Homebrew/homebrew-binary/commit/1394e42de04d07445f82f9512627e864ff4ca4c6
[2] https://github.com/Homebrew/homebrew-binary/commit/f8da22d6b8dbcfcfdb2dfa9ac1a5e5d8e05aac2b
[3] https://github.com/caskroom/homebrew-cask/pull/29180
[4] https://caskroom.github.io/

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomingw: follow-up to "replace isatty() hack"
Johannes Schindelin [Wed, 18 Jan 2017 12:14:35 +0000 (13:14 +0100)]
mingw: follow-up to "replace isatty() hack"

The version of the "replace isatty() hack" that got merged a few
weeks ago did not actually reflect the latest iteration of the patch
series: v3 was sent out with these changes, as requested by the
reviewer Johannes Sixt:

- reworded the comment about "recycling handles"

- moved the reassignment of the `console` variable before the dup2()
  call so that it is valid at all times

- removed the "handle = INVALID_HANDLE_VALUE" assignment, as the local
  variable `handle` is not used afterwards anyway

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoAlmost ready for 2.11.1
Junio 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>
7 years agoMerge branch 'mm/gc-safety-doc' into maint
Junio 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

7 years agoMerge branch 'mm/push-social-engineering-attack-doc' into maint
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

7 years agoMerge branch 'jt/fetch-no-redundant-tag-fetch-map' into maint
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

7 years agoMerge branch 'ls/filter-process' into maint
Junio 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

7 years agoMerge branch 'kh/tutorial-grammofix' into maint
Junio 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)

7 years agoMerge branch 'lr/doc-fix-cet' into maint
Junio 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

7 years agoMerge branch 'sb/t3600-cleanup' into maint
Junio 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

7 years agoMerge branch 'jk/readme-gmane-is-no-more' into maint
Junio 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

7 years agoMerge branch 'sb/unpack-trees-grammofix' into maint
Junio 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

7 years agoMerge branch 'ls/t0021-fixup' into maint
Junio 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

7 years agoMerge branch 'ak/lazy-prereq-mktemp' into maint
Junio 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

7 years agoMerge branch 'nd/qsort-in-merge-recursive' into maint
Junio 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

7 years agoMerge branch 'dt/smart-http-detect-server-going-away' into maint
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

7 years agoMerge branch 'mk/mingw-winansi-ttyname-termination-fix' into maint
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

7 years agoMerge branch 'gv/p4-multi-path-commit-fix' into maint
Junio 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

7 years agoMerge branch 'jk/difftool-in-subdir' into maint
Junio 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

7 years agoMerge branch 'ld/p4-compare-dir-vs-symlink' into maint
Junio 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

7 years agoMerge branch 'jc/push-default-explicit' into maint
Junio 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

7 years agoMerge branch 'jt/mailinfo-fold-in-body-headers' into maint
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

7 years agoMerge branch 'jk/index-pack-wo-repo-from-stdin' into maint
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

7 years agoMerge branch 'jk/parseopt-usage-msg-opt' into maint
Junio 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()

7 years agoMerge branch 'jk/quote-env-path-list-component' into maint
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

7 years agoMerge branch 'nd/shallow-fixup' into maint
Junio 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

7 years agoMerge branch 'sb/sequencer-abort-safety' into maint
Junio 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

7 years agoMerge branch 'da/mergetool-xxdiff-hotkey' into maint
Junio 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

7 years agoMerge branch 'jc/pull-rebase-ff' into maint
Junio 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"

7 years agoMerge branch 'js/normalize-path-copy-ceil' into maint
Junio 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

7 years agoMerge branch 'ak/commit-only-allow-empty' into maint
Junio 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

7 years agoMerge branch 'da/difftool-dir-diff-fix' into maint
Junio 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

7 years agoMerge branch 'jb/diff-no-index-no-abbrev' into maint
Junio 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

7 years agoMerge branch 'jk/stash-disable-renames-internally' into maint
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

7 years agoMerge branch 'jk/http-walker-limit-redirect' into maint
Junio 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

7 years agoMerge branch 'jc/renormalize-merge-kill-safer-crlf' into maint
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

7 years agoMerge branch 'ls/p4-empty-file-on-lfs' into maint
Junio 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

7 years agoMerge branch 'da/mergetool-trust-exit-code' into maint
Junio 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

7 years agoMerge branch 'nd/worktree-list-fixup' into maint
Junio 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

7 years agoMerge branch 'bw/push-dry-run' into maint
Junio 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

7 years agoMerge branch 'hv/submodule-not-yet-pushed-fix' into maint
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

7 years agoMerge branch 'dt/empty-submodule-in-merge' into maint
Junio 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

7 years agoMerge branch 'jk/rev-parse-symbolic-parents-fix' into maint
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

7 years agoMerge branch 'js/mingw-isatty' into maint
Junio 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

7 years agoMerge branch 'bb/unicode-9.0' into maint
Junio 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

7 years agoMerge branch 'ls/travis-update-p4-and-lfs' into maint
Junio 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

7 years agoCodingGuidelines: clarify multi-line brace style
Jeff King [Tue, 17 Jan 2017 20:05:04 +0000 (15:05 -0500)]
CodingGuidelines: clarify multi-line brace style

There are some "gray areas" around when to omit braces from
a conditional or loop body. Since that seems to have
resulted in some arguments, let's be a little more clear
about our preferred style.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoDocumentation/bisect: improve on (bad|new) and (good|bad)
Christian Couder [Fri, 13 Jan 2017 14:44:05 +0000 (15:44 +0100)]
Documentation/bisect: improve on (bad|new) and (good|bad)

The following part of the description:

git bisect (bad|new) [<rev>]
git bisect (good|old) [<rev>...]

may be a bit confusing, as a reader may wonder if instead it should be:

git bisect (bad|good) [<rev>]
git bisect (old|new) [<rev>...]

Of course the difference between "[<rev>]" and "[<rev>...]" should hint
that there is a good reason for the way it is.

But we can further clarify and complete the description by adding
"<term-new>" and "<term-old>" to the "bad|new" and "good|old"
alternatives.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot7810: avoid assumption about invalid regex syntax
Jeff King [Wed, 11 Jan 2017 11:10:55 +0000 (06:10 -0500)]
t7810: avoid assumption about invalid regex syntax

A few of the tests want to check that "git grep -P -E" will
override -P with -E, and vice versa. To do so, we use a
regex with "\x{..}", which is valid in PCRE but not defined
by POSIX (for basic or extended regular expressions).

However, POSIX declares quite a lot of syntax, including
"\x", as "undefined". That leaves implementations free to
extend the standard if they choose. At least one, musl libc,
implements "\x" in the same way as PCRE.  Our tests check
that "-E" complains about "\x", which fails with musl.

We can fix this by finding some construct which behaves
reliably on both PCRE and POSIX, but differently in each
system.

One such construct is the use of backslash inside brackets.
In PCRE, "[\d]" interprets "\d" as it would outside the
brackets, matching a digit. Whereas in POSIX, the backslash
must be treated literally, and we match either it or a
literal "d".  Moreover, implementations are not free to
change this according to POSIX, so we should be able to rely
on it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit_exec_path: do not return the result of getenv()
Jeff King [Mon, 9 Jan 2017 06:00:12 +0000 (01:00 -0500)]
git_exec_path: do not return the result of getenv()

The result of getenv() is not guaranteed by POSIX to last
beyond another call to getenv(), or setenv(), etc.  We
should duplicate the string before returning to the caller
to avoid any surprises.

We already keep a cached pointer to avoid repeatedly leaking
the result of system_path(). We can use the same pointer
here to avoid allocating and leaking for each call.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit_exec_path: avoid Coverity warning about unfree()d result
Johannes Schindelin [Mon, 2 Jan 2017 16:22:33 +0000 (17:22 +0100)]
git_exec_path: avoid Coverity warning about unfree()d result

Technically, it is correct that git_exec_path() returns a possibly
malloc()ed string returned from system_path(), and it is sometimes
not allocated.  Cache the result in a static variable and make sure
that we call system_path() only once, which plugs a potential leak.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoblame: output porcelain "previous" header for each file
Jeff King [Fri, 6 Jan 2017 04:20:51 +0000 (23:20 -0500)]
blame: output porcelain "previous" header for each file

It's possible for content currently found in one file to
have originated in two separate files, each of which may
have been modified in some single older commit.  The
--porcelain output generates an incorrect "previous" header
in this case, whereas --line-porcelain gets it right.  The
problem is that the porcelain output tries to omit repeated
details of commits, and treats "previous" as a property of
the commit, when it is really a property of the blamed block
of lines.

Let's look at an example. In a case like this, you might see
this output from --line-porcelain:

  SOME_SHA1 1 1 1
  author ...
  committer ...
  previous SOME_SHA1^ file_one
  filename file_one
          ...some line content...
  SOME_SHA1 2 1 1
  author ...
  committer ...
  previous SOME_SHA1^ file_two
  filename file_two
          ...some different content....

The "filename" fields tell us that the two lines are from
two different files. But notice that the filename also
appears in the "previous" field, which tells us where to
start a re-blame. The second content line never appeared in
file_one at all, so we would obviously need to re-blame from
file_two (or possibly even some other file, if had just been
renamed to file_two in SOME_SHA1).

So far so good. Now here's what --porcelain looks like:

  SOME_SHA1 1 1 1
  author ...
  committer ...
  previous SOME_SHA1^ file_one
  filename file_one
          ...some line content...
  SOME_SHA1 2 1 1
  filename file_two
          ...some different content....

We've dropped the author and committer fields from the
second line, as they would just be repeats.  But we can't
omit "filename", because it depends on the actual block of
blamed lines, not just the commit. This is handled by
emit_porcelain_details(), which will show the filename
either if it is the first mention of the commit _or_ if the
commit has multiple paths in it.

But we don't give "previous" the same handling. It's written
inside emit_one_suspect_detail(), which bails early if we've
already seen that commit. And so the output above is wrong;
a reader would assume that the correct place to re-blame
line two is from file_one, but that's obviously nonsense.

Let's treat "previous" the same as "filename", and show it
fresh whenever we know we are in a confusing case like this.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoblame: handle --no-abbrev
Jeff King [Fri, 6 Jan 2017 04:18:08 +0000 (23:18 -0500)]
blame: handle --no-abbrev

You can already ask blame for full sha1s with "-l" or with
"--abbrev=40". But for consistency with other parts of Git,
we should support "--no-abbrev".

Worse, blame already accepts --no-abbrev, but it's totally
broken. When we see --no-abbrev, the abbrev variable is set
to 0, which is then used as a printf precision. For regular
sha1s, that means we print nothing at all (which is very
wrong). For boundary commits we decrement it to "-1", which
printf interprets as "no limit" (which is almost correct,
except it misses the 39-length magic explained in the
previous commit).

Let's detect --no-abbrev and behave as if --abbrev=40 was
given.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoblame: fix alignment with --abbrev=40
Jeff King [Fri, 6 Jan 2017 04:17:40 +0000 (23:17 -0500)]
blame: fix alignment with --abbrev=40

The blame command internally adds 1 to any requested sha1
abbreviation length, and then subtracts it when outputting a
boundary commit. This lets regular and boundary sha1s line
up visually, but it misses one corner case.

When the requested length is 40, we bump the value to 41.
But since we only have 40 characters, that's all we can show
(fortunately the truncation is done by a printf precision
field, so it never tries to read past the end of the
buffer).  So a normal sha1 shows 40 hex characters, and a
boundary sha1 shows "^" plus 40 hex characters. The result
is misaligned.

The "-l" option to show long sha1s gets around this by
skipping the "abbrev" variable entirely and just always
using GIT_SHA1_HEXSZ.  This avoids the "+1" issue, but it
does mean that boundary commits only have 39 characters
printed.  This is somewhat odd, but it does look good
visually: the results are aligned and left-justified. The
alternative would be to allocate an extra column that would
contain either an extra space or the "^" boundary marker.

As this is by definition the human-readable view, it's
probably not that big a deal either way (and of course
--porcelain, etc, correctly produce correct 40-hex sha1s).
But for consistency, this patch teaches --abbrev=40 to
produce the same output as "-l" (always left-aligned, with
40-hex for normal sha1s, and "^" plus 39-hex for
boundaries).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorebase--interactive: count squash commits above 10 correctly
Jeff King [Sat, 7 Jan 2017 08:23:19 +0000 (03:23 -0500)]
rebase--interactive: count squash commits above 10 correctly

We generate the squash commit message incrementally running
a sed script once for each commit. It parses "This is
a combination of <N> commits" from the first line of the
existing message, adds one to <N>, and uses the result as
the number of our current message.

Since f2d17068fd (i18n: rebase-interactive: mark comments of
squash for translation, 2016-06-17), the first line may be
localized, and sed uses a pretty liberal regex, looking for:

  /^#.*([0-9][0-9]*)/

The "[0-9][0-9]*" tries to match double digits, but it
doesn't quite work.  The first ".*" is greedy, so if you
have:

  This is a combination of 10 commits.

it will eat up "This is a combination of 1", leaving "0" to
match the first "[0-9]" digit, and then skipping the
optional match of "[0-9]*".

As a result, the count resets every 10 commits, and a
15-commit squash would end up as:

  # This is a combination of 5 commits.
  # This is the 1st commit message:
  ...
  # This is the commit message #2:
  ... and so on ..
  # This is the commit message #10:
  ...
  # This is the commit message #1:
  ...
  # This is the commit message #2:
  ... etc, up to 5 ...

We can fix this by making the ".*" less greedy. Instead of
depending on ".*?" working portably, we can just limit the
match to non-digit characters, which accomplishes the same
thing.

Reported-by: Brandon Tolsch <btolsch@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agobranch_get_push: do not segfault when HEAD is detached
Kyle Meyer [Sat, 7 Jan 2017 01:12:15 +0000 (20:12 -0500)]
branch_get_push: do not segfault when HEAD is detached

Move the detached HEAD check from branch_get_push_1() to
branch_get_push() to avoid setting branch->push_tracking_ref when
branch is NULL.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoarchive-zip: load userdiff config
Jeff King [Mon, 2 Jan 2017 22:25:09 +0000 (17:25 -0500)]
archive-zip: load userdiff config

Since 4aff646d17 (archive-zip: mark text files in archives,
2015-03-05), the zip archiver will look at the userdiff
driver to decide whether a file is text or binary. This
usually doesn't need to look any further than the attributes
themselves (e.g., "-diff", etc). But if the user defines a
custom driver like "diff=foo", we need to look at
"diff.foo.binary" in the config. Prior to this patch, we
didn't actually load it.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorepack: die on incremental + write-bitmap-index
David Turner [Wed, 28 Dec 2016 22:45:42 +0000 (17:45 -0500)]
repack: die on incremental + write-bitmap-index

The bitmap index only works for single packs, so requesting an
incremental repack with bitmap indexes makes no sense.

Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoauto gc: don't write bitmaps for incremental repacks
David Turner [Wed, 28 Dec 2016 22:45:41 +0000 (17:45 -0500)]
auto gc: don't write bitmaps for incremental repacks

When git gc --auto does an incremental repack of loose objects, we do
not expect to be able to write a bitmap; it is very likely that
objects in the new pack will have references to objects outside of the
pack.  So we shouldn't try to write a bitmap, because doing so will
likely issue a warning.

This warning was making its way into gc.log.  When the gc.log was
present, future auto gc runs would refuse to run.

Patch by Jeff King.
Bug report, test, and commit message by David Turner.

Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig.abbrev: document the new default that auto-scales
Junio C Hamano [Wed, 2 Nov 2016 01:34:07 +0000 (18:34 -0700)]
config.abbrev: document the new default that auto-scales

We somehow forgot to update the "default is 7" in the
documentation.  Also give a way to explicitly ask the auto-scaling
by setting config.abbrev to "auto".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig.c: handle lock file in error case in git_config_rename_...
Nguyễn Thái Ngọc Duy [Tue, 20 Dec 2016 09:48:36 +0000 (16:48 +0700)]
config.c: handle lock file in error case in git_config_rename_...

We could rely on atexit() to clean up everything, but let's be
explicit when we can. And it's good anyway because the function is
called the second time in the same process, we're in trouble.

This function should not affect the successful case because after
commit_lock_file() is called, rollback_lock_file() becomes no-op,
as long as it is initialized.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomingw: replace isatty() hack
Jeff 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>
7 years agomingw: fix colourization on Cygwin pseudo terminals
Alan 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>
7 years agomingw: adjust is_console() to work with stdin
Johannes 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>
7 years agot5615-alternate-env: double-quotes in file names do not work on Windows
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>
7 years agofast-import: properly fanout notes when tree is imported
Mike Hommey [Tue, 20 Dec 2016 21:04:48 +0000 (06:04 +0900)]
fast-import: properly fanout notes when tree is imported

In typical uses of fast-import, trees are inherited from a parent
commit. In that case, the tree_entry for the branch looks like:

  .versions[1].sha1 = $some_sha1
  .tree = <tree structure loaded from $some_sha1>

However, when trees are imported, rather than inherited, that is not the
case. One can import a tree with a filemodify command, replacing the
root tree object.

e.g.
  "M 040000 $some_sha1 \n"

In this case, the tree_entry for the branch looks like:

  .versions[1].sha1 = $some_sha1
  .tree = NULL

When adding new notes with the notemodify command, do_change_note_fanout
is called to get a notes count, and to do so, it loops over the
tree_entry->tree, but doesn't do anything when the tree is NULL.

In the latter case above, it means do_change_note_fanout thinks the tree
contains no notes, and new notes are added with no fanout.

Interestingly, do_change_note_fanout does check whether subdirectories
have a NULL .tree, in which case it uses load_tree(). Which means the
right behaviour happens when using the filemodify command to import
subdirectories.

This change makes do_change_note_fanount call load_tree() whenever the
tree_entry it is given has no tree loaded, making all cases handled
equally.

Signed-off-by: Mike Hommey <mh@glandium.org>
Reviewed-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig.c: rename label unlock_and_out
Nguyễn Thái Ngọc Duy [Tue, 20 Dec 2016 09:48:35 +0000 (16:48 +0700)]
config.c: rename label unlock_and_out

There are two ways to unlock a file: commit, or revert. Rename it to
commit_and_out to avoid confusion.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig.c: handle error case for fstat() calls
Nguyễn Thái Ngọc Duy [Mon, 19 Dec 2016 09:21:55 +0000 (16:21 +0700)]
config.c: handle error case for fstat() calls

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomailinfo.c: move side-effects outside of assert
Kyle 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>
7 years agomingw: consider that UNICODE_STRING::Length counts bytes
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>
7 years agogit-p4: fix multi-path changelist empty commits
George 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>
7 years agogit-p4: avoid crash adding symlinked directory
Luke 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>
7 years agot0021: fix flaky test
Lars 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>
7 years agoindex-pack: skip collision check when not in repository
Jeff 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>
7 years agonormalize_path_copy(): fix pushing to //server/share/dir on Windows
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>
7 years agot: use nongit() function where applicable
Jeff 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>
7 years agoindex-pack: complain when --stdin is used outside of a repo
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>
7 years agot5000: extract nongit function to test-lib-functions.sh
Jeff 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>
7 years agoREADME: replace gmane link with public-inbox
Jeff 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>
7 years agoRevert "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.

7 years agoparse-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>
7 years agoMakefile: exclude contrib from FIND_SOURCE_FILES
Jeff King [Wed, 14 Dec 2016 14:32:35 +0000 (09:32 -0500)]
Makefile: exclude contrib from FIND_SOURCE_FILES

When you're working on the git project, you're unlikely to
care about random bits in contrib/ (e.g., you would not want
to jump to the copy of xmalloc in the wincred credential
helper). Nobody has really complained because there are
relatively few C files in contrib.

Now that we're matching shell scripts, too, we get quite a
few more hits, especially in the obsolete contrib/examples
directory. Looking for usage() should turn up the one in
git-sh-setup, not in some long-dead version of git-clone.

Let's just exclude all of contrib. Any specific projects
there which are big enough to want tags can generate them
separately.

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