git
9 years agoMerge branch 'jk/test-asan'
Junio C Hamano [Mon, 22 Dec 2014 20:28:08 +0000 (12:28 -0800)] 
Merge branch 'jk/test-asan'

* jk/test-asan:
  t: support clang/gcc AddressSanitizer

9 years agoMerge branch 'ok/rebase-i-count-todo'
Junio C Hamano [Mon, 22 Dec 2014 20:28:06 +0000 (12:28 -0800)] 
Merge branch 'ok/rebase-i-count-todo'

* ok/rebase-i-count-todo:
  Show number of TODO items for interactive rebase

9 years agoMerge branch 'jk/read-packed-refs-without-path-max'
Junio C Hamano [Mon, 22 Dec 2014 20:28:04 +0000 (12:28 -0800)] 
Merge branch 'jk/read-packed-refs-without-path-max'

Git did not correctly read an overlong refname from a packed refs
file.

* jk/read-packed-refs-without-path-max:
  read_packed_refs: use skip_prefix instead of static array
  read_packed_refs: pass strbuf to parse_ref_line
  read_packed_refs: use a strbuf for reading lines

9 years agoMerge branch 'jk/always-allow-large-packets'
Junio C Hamano [Mon, 22 Dec 2014 20:28:02 +0000 (12:28 -0800)] 
Merge branch 'jk/always-allow-large-packets'

"git push" and "git fetch" did not communicate an overlong refname
correctly.

* jk/always-allow-large-packets:
  pkt-line: allow writing of LARGE_PACKET_MAX buffers

9 years agoMerge branch 'jk/colors'
Junio C Hamano [Mon, 22 Dec 2014 20:27:58 +0000 (12:27 -0800)] 
Merge branch 'jk/colors'

"diff-highlight" filter (in contrib/) allows its color output
to be customized via configuration variables.

* jk/colors:
  parse_color: drop COLOR_BACKGROUND macro
  diff-highlight: allow configurable colors
  parse_color: recognize "no$foo" to clear the $foo attribute
  parse_color: support 24-bit RGB values
  parse_color: refactor color storage

9 years agoMerge branch 'rw/apply-does-not-take-ignore-date'
Junio C Hamano [Mon, 22 Dec 2014 20:27:51 +0000 (12:27 -0800)] 
Merge branch 'rw/apply-does-not-take-ignore-date'

* rw/apply-does-not-take-ignore-date:
  git-am.txt: --ignore-date flag is not passed to git-apply

9 years agoMerge branch 'js/test-hashmap-squelch-gcc'
Junio C Hamano [Mon, 22 Dec 2014 20:27:46 +0000 (12:27 -0800)] 
Merge branch 'js/test-hashmap-squelch-gcc'

* js/test-hashmap-squelch-gcc:
  test-hashmap: squelch gcc compiler warning

9 years agoMerge branch 'js/fsck-tag-validation'
Junio C Hamano [Mon, 22 Dec 2014 20:27:41 +0000 (12:27 -0800)] 
Merge branch 'js/fsck-tag-validation'

New tag object format validation added in 2.2 showed garbage
after a tagname it reported in its error message.

* js/fsck-tag-validation:
  index-pack: terminate object buffers with NUL
  fsck: properly bound "invalid tag name" error message

9 years agoMerge branch 'po/doc-assume-unchanged'
Junio C Hamano [Mon, 22 Dec 2014 20:27:38 +0000 (12:27 -0800)] 
Merge branch 'po/doc-assume-unchanged'

Fixes long-standing misunderstanding of what assume-unchanged is
about.  Some text near what is removed by the bottom patch may also
have to be removed.

* po/doc-assume-unchanged:
  gitignore.txt: do not suggest assume-unchanged
  doc: make clear --assume-unchanged's user contract

9 years agoMerge branch 'mg/branch-d-m-f'
Junio C Hamano [Mon, 22 Dec 2014 20:27:36 +0000 (12:27 -0800)] 
Merge branch 'mg/branch-d-m-f'

"git branch -d" (delete) and "git branch -m" (move) learned to
honor "-f" (force) flag; unlike many other subcommands, the way to
force these have been with separate "-D/-M" options, which was
inconsistent.

* mg/branch-d-m-f:
  branch: allow -f with -m and -d
  t3200-branch: test -M

9 years agoMerge branch 'tb/t0027-eol-conversion'
Junio C Hamano [Mon, 22 Dec 2014 20:27:34 +0000 (12:27 -0800)] 
Merge branch 'tb/t0027-eol-conversion'

* tb/t0027-eol-conversion:
  t0027: check the eol conversion warnings

9 years agoMerge branch 'jk/for-each-reflog-ent-reverse'
Junio C Hamano [Mon, 22 Dec 2014 20:27:32 +0000 (12:27 -0800)] 
Merge branch 'jk/for-each-reflog-ent-reverse'

The code that reads the reflog from the newer to the older entries
did not handle an entry that crosses a boundary of block it uses to
read them correctly.

* jk/for-each-reflog-ent-reverse:
  for_each_reflog_ent_reverse: turn leftover check into assertion
  for_each_reflog_ent_reverse: fix newlines on block boundaries

9 years agoMerge branch 'sb/string-list'
Junio C Hamano [Mon, 22 Dec 2014 20:27:29 +0000 (12:27 -0800)] 
Merge branch 'sb/string-list'

API simplification.

* sb/string-list:
  string_list: remove string_list_insert_at_index() from its API
  mailmap: use higher level string list functions
  string_list: document string_list_(insert,lookup)

9 years agoMerge branch 'sv/doc-stripspace'
Junio C Hamano [Mon, 22 Dec 2014 20:27:27 +0000 (12:27 -0800)] 
Merge branch 'sv/doc-stripspace'

* sv/doc-stripspace:
  Documentation/git-stripspace: add synopsis for --comment-lines

9 years agoMerge branch 'rt/completion-tag'
Junio C Hamano [Mon, 22 Dec 2014 20:27:24 +0000 (12:27 -0800)] 
Merge branch 'rt/completion-tag'

* rt/completion-tag:
  completion: add git-tag options

9 years agoMerge branch 'mg/doc-check-ignore-tracked-are-not-ignored'
Junio C Hamano [Mon, 22 Dec 2014 20:27:22 +0000 (12:27 -0800)] 
Merge branch 'mg/doc-check-ignore-tracked-are-not-ignored'

* mg/doc-check-ignore-tracked-are-not-ignored:
  check-ignore: clarify treatment of tracked files

9 years agoMerge branch 'jk/credential-quit'
Junio C Hamano [Mon, 22 Dec 2014 20:27:19 +0000 (12:27 -0800)] 
Merge branch 'jk/credential-quit'

Credential helpers are asked in turn until one of them give
positive response, which is cumbersome to turn off when you need to
run Git in an automated setting.  The credential helper interface
learned to allow a helper to say "stop, don't ask other helpers."
Also GIT_TERMINAL_PROMPT environment can be set to false to disable
our built-in prompt mechanism for passwords.

* jk/credential-quit:
  prompt: respect GIT_TERMINAL_PROMPT to disable terminal prompts
  credential: let helpers tell us to quit

9 years agoMerge branch 'dm/compat-s-ifmt-for-zos'
Junio C Hamano [Mon, 22 Dec 2014 20:27:16 +0000 (12:27 -0800)] 
Merge branch 'dm/compat-s-ifmt-for-zos'

Long overdue departure from the assumption that S_IFMT is shared by
everybody made in 2005.

* dm/compat-s-ifmt-for-zos:
  compat: convert modes to use portable file type values

9 years agoMerge branch 'ps/new-workdir-into-empty-directory'
Junio C Hamano [Mon, 22 Dec 2014 20:27:13 +0000 (12:27 -0800)] 
Merge branch 'ps/new-workdir-into-empty-directory'

"git new-workdir" (in contrib/) can be used to populate an empty
and existing directory now.

* ps/new-workdir-into-empty-directory:
  git-new-workdir: don't fail if the target directory is empty

9 years agoMerge branch 'nd/ls-tree-pathspec'
Junio C Hamano [Mon, 22 Dec 2014 20:27:12 +0000 (12:27 -0800)] 
Merge branch 'nd/ls-tree-pathspec'

"git ls-tree" does not support path selection based on negative
pathspecs, but did not error out when negative pathspecs are given.

* nd/ls-tree-pathspec:
  t3102: style modernization
  t3102: document that ls-tree does not yet support negated pathspec
  ls-tree: disable negative pathspec because it's not supported
  ls-tree: remove path filtering logic in show_tree
  tree.c: update read_tree_recursive callback to pass strbuf as base

9 years agoMerge branch 'jc/hook-cleanup'
Junio C Hamano [Mon, 22 Dec 2014 20:27:10 +0000 (12:27 -0800)] 
Merge branch 'jc/hook-cleanup'

Remove unused code.

* jc/hook-cleanup:
  run-command.c: retire unused run_hook_with_custom_index()

9 years agoMerge branch 'rt/for-each-ref-spell-tcl-as-Tcl'
Junio C Hamano [Mon, 22 Dec 2014 20:27:08 +0000 (12:27 -0800)] 
Merge branch 'rt/for-each-ref-spell-tcl-as-Tcl'

* rt/for-each-ref-spell-tcl-as-Tcl:
  for-each-ref: correct spelling of Tcl in option description

9 years agoMerge branch 'rj/t0050-passes'
Junio C Hamano [Mon, 22 Dec 2014 20:27:06 +0000 (12:27 -0800)] 
Merge branch 'rj/t0050-passes'

* rj/t0050-passes:
  t0050-*.sh: mark the rename (case change) test as passing

9 years agoMerge branch 'js/push-to-deploy'
Junio C Hamano [Mon, 22 Dec 2014 20:27:03 +0000 (12:27 -0800)] 
Merge branch 'js/push-to-deploy'

"git push" into a repository with a working tree normally refuses
to modify the branch that is checked out.  The command learned to
optionally do an equivalent of "git reset --hard" only when there
is no change to the working tree and the index instead, which would
be useful to "deploy" by pushing into a repository.

* js/push-to-deploy:
  t5516: more tests for receive.denyCurrentBranch=updateInstead
  receive-pack: add another option for receive.denyCurrentBranch

9 years agoMerge branch 'jc/exec-cmd-system-path-leak-fix'
Junio C Hamano [Mon, 22 Dec 2014 20:27:01 +0000 (12:27 -0800)] 
Merge branch 'jc/exec-cmd-system-path-leak-fix'

The function sometimes returned a non-freeable memory and some
other times returned a piece of memory that must be freed.

* jc/exec-cmd-system-path-leak-fix:
  system_path(): always return free'able memory to the caller

9 years agoMerge branch 'mh/find-uniq-abbrev'
Junio C Hamano [Mon, 22 Dec 2014 20:26:57 +0000 (12:26 -0800)] 
Merge branch 'mh/find-uniq-abbrev'

The code to abbreviate an object name to its short unique prefix
has been optimized when no abbreviation was requested.

* mh/find-uniq-abbrev:
  sha1_name: avoid unnecessary sha1 lookup in find_unique_abbrev

9 years agoMerge branch 'pb/send-email-te'
Junio C Hamano [Mon, 22 Dec 2014 20:26:53 +0000 (12:26 -0800)] 
Merge branch 'pb/send-email-te'

"git send-email" learned "--transfer-encoding" option to force
a non-fault Content-Transfer-Encoding header (e.g. base64).

* pb/send-email-te:
  git-send-email: add --transfer-encoding option
  git-send-email: delay creation of MIME headers

9 years agoMerge branch 'pb/am-message-id-footer'
Junio C Hamano [Mon, 22 Dec 2014 20:26:52 +0000 (12:26 -0800)] 
Merge branch 'pb/am-message-id-footer'

"git am" learned "--message-id" option to copy the message ID of
the incoming e-mail to the log message of resulting commit.

* pb/am-message-id-footer:
  git-am: add --message-id/--no-message-id
  git-mailinfo: add --message-id

9 years agoMerge branch 'mh/simplify-repack-without-refs'
Junio C Hamano [Mon, 22 Dec 2014 20:26:50 +0000 (12:26 -0800)] 
Merge branch 'mh/simplify-repack-without-refs'

"git remote update --prune" to drop many refs has been optimized.

* mh/simplify-repack-without-refs:
  sort_string_list(): rename to string_list_sort()
  prune_remote(): iterate using for_each_string_list_item()
  prune_remote(): rename local variable
  repack_without_refs(): make the refnames argument a string_list
  prune_remote(): sort delete_refs_list references en masse
  prune_remote(): initialize both delete_refs lists in a single loop
  prune_remote(): exit early if there are no stale references

9 years agoMerge branch 'dw/shell-basename-dashdash-before-stripping-leading-dash-from-login'
Junio C Hamano [Mon, 22 Dec 2014 20:26:48 +0000 (12:26 -0800)] 
Merge branch 'dw/shell-basename-dashdash-before-stripping-leading-dash-from-login'

* dw/shell-basename-dashdash-before-stripping-leading-dash-from-login:
  git-sh-setup.sh: use dashdash with basename call

9 years agoMerge branch 'rj/no-xopen-source-for-cygwin'
Junio C Hamano [Mon, 22 Dec 2014 20:26:45 +0000 (12:26 -0800)] 
Merge branch 'rj/no-xopen-source-for-cygwin'

Avoid compilation warnings on recent gcc toolchain on Cygwin.

* rj/no-xopen-source-for-cygwin:
  git-compat-util.h: don't define _XOPEN_SOURCE on cygwin

9 years agoMerge branch 'js/t5000-dont-copy-bin-sh'
Junio C Hamano [Mon, 22 Dec 2014 20:26:43 +0000 (12:26 -0800)] 
Merge branch 'js/t5000-dont-copy-bin-sh'

* js/t5000-dont-copy-bin-sh:
  t5000 on Windows: do not mistake "sh.exe" as "sh"

9 years agoMerge branch 'jc/refer-to-t-readme-from-submitting-patches'
Junio C Hamano [Mon, 22 Dec 2014 20:26:38 +0000 (12:26 -0800)] 
Merge branch 'jc/refer-to-t-readme-from-submitting-patches'

* jc/refer-to-t-readme-from-submitting-patches:
  t/README: justify why "! grep foo" is sufficient
  SubmittingPatches: refer to t/README for tests

9 years agoMerge branch 'tb/config-core-filemode-check-on-broken-fs'
Junio C Hamano [Mon, 22 Dec 2014 20:26:33 +0000 (12:26 -0800)] 
Merge branch 'tb/config-core-filemode-check-on-broken-fs'

Some filesystems assign filemodes in a strange way, fooling then
automatic "filemode trustability" check done during a new
repository creation.

* tb/config-core-filemode-check-on-broken-fs:
  init-db: improve the filemode trustability check

9 years agoMerge branch 'mg/add-ignore-errors'
Junio C Hamano [Mon, 22 Dec 2014 20:26:30 +0000 (12:26 -0800)] 
Merge branch 'mg/add-ignore-errors'

"git add --ignore-errors ..." did not ignore an error to
give a file that did not exist.

* mg/add-ignore-errors:
  add: ignore only ignored files

9 years agoMerge branch 'jk/lock-ref-sha1-basic-return-errors'
Junio C Hamano [Mon, 22 Dec 2014 20:26:27 +0000 (12:26 -0800)] 
Merge branch 'jk/lock-ref-sha1-basic-return-errors'

Correct an API anomaly.

* jk/lock-ref-sha1-basic-return-errors:
  lock_ref_sha1_basic: do not die on locking errors

9 years agoMerge branch 'cc/interpret-trailers-more'
Junio C Hamano [Mon, 22 Dec 2014 20:26:23 +0000 (12:26 -0800)] 
Merge branch 'cc/interpret-trailers-more'

"git interpret-trailers" learned to properly handle the
"Conflicts:" block at the end.

* cc/interpret-trailers-more:
  trailer: add test with an old style conflict block
  trailer: reuse ignore_non_trailer() to ignore conflict lines
  commit: make ignore_non_trailer() non static
  merge & sequencer: turn "Conflicts:" hint into a comment
  builtin/commit.c: extract ignore_non_trailer() helper function
  merge & sequencer: unify codepaths that write "Conflicts:" hint
  builtin/merge.c: drop a parameter that is never used

9 years agoSync with v2.2.1
Junio C Hamano [Thu, 18 Dec 2014 20:30:53 +0000 (12:30 -0800)] 
Sync with v2.2.1

* maint:
  Git 2.2.1
  Git 2.1.4
  Git 2.0.5
  Git 1.9.5
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index

9 years agoGit 2.2.1 v2.2.1
Junio C Hamano [Wed, 17 Dec 2014 19:49:34 +0000 (11:49 -0800)] 
Git 2.2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with v2.1.4
Junio C Hamano [Wed, 17 Dec 2014 19:46:57 +0000 (11:46 -0800)] 
Sync with v2.1.4

* maint-2.1:
  Git 2.1.4
  Git 2.0.5
  Git 1.9.5
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index

9 years agoGit 2.1.4 v2.1.4
Junio C Hamano [Wed, 17 Dec 2014 19:44:59 +0000 (11:44 -0800)] 
Git 2.1.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with v2.0.5
Junio C Hamano [Wed, 17 Dec 2014 19:42:28 +0000 (11:42 -0800)] 
Sync with v2.0.5

* maint-2.0:
  Git 2.0.5
  Git 1.9.5
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index

9 years agoGit 2.0.5 v2.0.5
Junio C Hamano [Wed, 17 Dec 2014 19:30:46 +0000 (11:30 -0800)] 
Git 2.0.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with v1.9.5
Junio C Hamano [Wed, 17 Dec 2014 19:28:02 +0000 (11:28 -0800)] 
Sync with v1.9.5

* maint-1.9:
  Git 1.9.5
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index

9 years agoGit 1.9.5 v1.9.5
Junio C Hamano [Wed, 17 Dec 2014 19:22:32 +0000 (11:22 -0800)] 
Git 1.9.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with v1.8.5.6
Junio C Hamano [Wed, 17 Dec 2014 19:20:31 +0000 (11:20 -0800)] 
Sync with v1.8.5.6

* maint-1.8.5:
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index

9 years agoGit 1.8.5.6 v1.8.5.6
Junio C Hamano [Wed, 17 Dec 2014 19:18:45 +0000 (11:18 -0800)] 
Git 1.8.5.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'dotgit-case-maint-1.8.5' into maint-1.8.5
Junio C Hamano [Wed, 17 Dec 2014 19:11:15 +0000 (11:11 -0800)] 
Merge branch 'dotgit-case-maint-1.8.5' into maint-1.8.5

* dotgit-case-maint-1.8.5:
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index

9 years agofsck: complain about NTFS ".git" aliases in trees
Johannes Schindelin [Wed, 10 Dec 2014 21:28:27 +0000 (22:28 +0100)] 
fsck: complain about NTFS ".git" aliases in trees

Now that the index can block pathnames that can be mistaken
to mean ".git" on NTFS and FAT32, it would be helpful for
fsck to notice such problematic paths. This lets servers
which use receive.fsckObjects block them before the damage
spreads.

Note that the fsck check is always on, even for systems
without core.protectNTFS set. This is technically more
restrictive than we need to be, as a set of users on ext4
could happily use these odd filenames without caring about
NTFS.

However, on balance, it's helpful for all servers to block
these (because the paths can be used for mischief, and
servers which bother to fsck would want to stop the spread
whether they are on NTFS themselves or not), and hardly
anybody will be affected (because the blocked names are
variants of .git or git~1, meaning mischief is almost
certainly what the tree author had in mind).

Ideally these would be controlled by a separate
"fsck.protectNTFS" flag. However, it would be much nicer to
be able to enable/disable _any_ fsck flag individually, and
any scheme we choose should match such a system. Given the
likelihood of anybody using such a path in practice, it is
not unreasonable to wait until such a system materializes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoread-cache: optionally disallow NTFS .git variants
Johannes Schindelin [Tue, 16 Dec 2014 22:46:59 +0000 (23:46 +0100)] 
read-cache: optionally disallow NTFS .git variants

The point of disallowing ".git" in the index is that we
would never want to accidentally overwrite files in the
repository directory. But this means we need to respect the
filesystem's idea of when two paths are equal. The prior
commit added a helper to make such a comparison for NTFS
and FAT32; let's use it in verify_path().

We make this check optional for two reasons:

  1. It restricts the set of allowable filenames, which is
     unnecessary for people who are not on NTFS nor FAT32.
     In practice this probably doesn't matter, though, as
     the restricted names are rather obscure and almost
     certainly would never come up in practice.

  2. It has a minor performance penalty for every path we
     insert into the index.

This patch ties the check to the core.protectNTFS config
option. Though this is expected to be most useful on Windows,
we allow it to be set everywhere, as NTFS may be mounted on
other platforms. The variable does default to on for Windows,
though.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agopath: add is_ntfs_dotgit() helper
Johannes Schindelin [Tue, 16 Dec 2014 22:31:03 +0000 (23:31 +0100)] 
path: add is_ntfs_dotgit() helper

We do not allow paths with a ".git" component to be added to
the index, as that would mean repository contents could
overwrite our repository files. However, asking "is this
path the same as .git" is not as simple as strcmp() on some
filesystems.

On NTFS (and FAT32), there exist so-called "short names" for
backwards-compatibility: 8.3 compliant names that refer to the same files
as their long names. As ".git" is not an 8.3 compliant name, a short name
is generated automatically, typically "git~1".

Depending on the Windows version, any combination of trailing spaces and
periods are ignored, too, so that both "git~1." and ".git." still refer
to the Git directory. The reason is that 8.3 stores file names shorter
than 8 characters with trailing spaces. So literally, it does not matter
for the short name whether it is padded with spaces or whether it is
shorter than 8 characters, it is considered to be the exact same.

The period is the separator between file name and file extension, and
again, an empty extension consists just of spaces in 8.3 format. So
technically, we would need only take care of the equivalent of this
regex:
        (\.git {0,4}|git~1 {0,3})\. {0,3}

However, there are indications that at least some Windows versions might
be more lenient and accept arbitrary combinations of trailing spaces and
periods and strip them out. So we're playing it real safe here. Besides,
there can be little doubt about the intention behind using file names
matching even the more lenient pattern specified above, therefore we
should be fine with disallowing such patterns.

Extra care is taken to catch names such as '.\\.git\\booh' because the
backslash is marked as a directory separator only on Windows, and we want
to use this new helper function also in fsck on other platforms.

A big thank you goes to Ed Thomson and an unnamed Microsoft engineer for
the detailed analysis performed to come up with the corresponding fixes
for libgit2.

This commit adds a function to detect whether a given file name can refer
to the Git directory by mistake.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofsck: complain about HFS+ ".git" aliases in trees
Jeff King [Mon, 15 Dec 2014 23:21:57 +0000 (18:21 -0500)] 
fsck: complain about HFS+ ".git" aliases in trees

Now that the index can block pathnames that case-fold to
".git" on HFS+, it would be helpful for fsck to notice such
problematic paths. This lets servers which use
receive.fsckObjects block them before the damage spreads.

Note that the fsck check is always on, even for systems
without core.protectHFS set. This is technically more
restrictive than we need to be, as a set of users on ext4
could happily use these odd filenames without caring about
HFS+.

However, on balance, it's helpful for all servers to block
these (because the paths can be used for mischief, and
servers which bother to fsck would want to stop the spread
whether they are on HFS+ themselves or not), and hardly
anybody will be affected (because the blocked names are
variants of .git with invisible Unicode code-points mixed
in, meaning mischief is almost certainly what the tree
author had in mind).

Ideally these would be controlled by a separate
"fsck.protectHFS" flag. However, it would be much nicer to
be able to enable/disable _any_ fsck flag individually, and
any scheme we choose should match such a system. Given the
likelihood of anybody using such a path in practice, it is
not unreasonable to wait until such a system materializes.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoread-cache: optionally disallow HFS+ .git variants
Jeff King [Mon, 15 Dec 2014 23:15:20 +0000 (18:15 -0500)] 
read-cache: optionally disallow HFS+ .git variants

The point of disallowing ".git" in the index is that we
would never want to accidentally overwrite files in the
repository directory. But this means we need to respect the
filesystem's idea of when two paths are equal. The prior
commit added a helper to make such a comparison for HFS+;
let's use it in verify_path.

We make this check optional for two reasons:

  1. It restricts the set of allowable filenames, which is
     unnecessary for people who are not on HFS+. In practice
     this probably doesn't matter, though, as the restricted
     names are rather obscure and almost certainly would
     never come up in practice.

  2. It has a minor performance penalty for every path we
     insert into the index.

This patch ties the check to the core.protectHFS config
option. Though this is expected to be most useful on OS X,
we allow it to be set everywhere, as HFS+ may be mounted on
other platforms. The variable does default to on for OS X,
though.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoutf8: add is_hfs_dotgit() helper
Jeff King [Mon, 15 Dec 2014 22:56:59 +0000 (17:56 -0500)] 
utf8: add is_hfs_dotgit() helper

We do not allow paths with a ".git" component to be added to
the index, as that would mean repository contents could
overwrite our repository files. However, asking "is this
path the same as .git" is not as simple as strcmp() on some
filesystems.

HFS+'s case-folding does more than just fold uppercase into
lowercase (which we already handle with strcasecmp). It may
also skip past certain "ignored" Unicode code points, so
that (for example) ".gi\u200ct" is mapped ot ".git".

The full list of folds can be found in the tables at:

  https://www.opensource.apple.com/source/xnu/xnu-1504.15.3/bsd/hfs/hfscommon/Unicode/UCStringCompareData.h

Implementing a full "is this path the same as that path"
comparison would require us importing the whole set of
tables.  However, what we want to do is much simpler: we
only care about checking ".git". We know that 'G' is the
only thing that folds to 'g', and so on, so we really only
need to deal with the set of ignored code points, which is
much smaller.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofsck: notice .git case-insensitively
Jeff King [Mon, 24 Nov 2014 18:40:44 +0000 (13:40 -0500)] 
fsck: notice .git case-insensitively

We complain about ".git" in a tree because it cannot be
loaded into the index or checked out. Since we now also
reject ".GIT" case-insensitively, fsck should notice the
same, so that errors do not propagate.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot1450: refactor ".", "..", and ".git" fsck tests
Jeff King [Mon, 24 Nov 2014 18:40:11 +0000 (13:40 -0500)] 
t1450: refactor ".", "..", and ".git" fsck tests

We check that fsck notices and complains about confusing
paths in trees. However, there are a few shortcomings:

  1. We check only for these paths as file entries, not as
     intermediate paths (so ".git" and not ".git/foo").

  2. We check "." and ".." together, so it is possible that
     we notice only one and not the other.

  3. We repeat a lot of boilerplate.

Let's use some loops to be more thorough in our testing, and
still end up with shorter code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoverify_dotfile(): reject .git case-insensitively
Jeff King [Mon, 24 Nov 2014 18:39:12 +0000 (13:39 -0500)] 
verify_dotfile(): reject .git case-insensitively

We do not allow ".git" to enter into the index as a path
component, because checking out the result to the working
tree may causes confusion for subsequent git commands.
However, on case-insensitive file systems, ".Git" or ".GIT"
is the same. We should catch and prevent those, too.

Note that technically we could allow this for repos on
case-sensitive filesystems. But there's not much point. It's
unlikely that anybody cares, and it creates a repository
that is unexpectedly non-portable to other systems.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoread-tree: add tests for confusing paths like ".." and ".git"
Jeff King [Mon, 24 Nov 2014 18:37:56 +0000 (13:37 -0500)] 
read-tree: add tests for confusing paths like ".." and ".git"

We should prevent nonsense paths from entering the index in
the first place, as they can cause confusing results if they
are ever checked out into the working tree. We already do
so, but we never tested it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agounpack-trees: propagate errors adding entries to the index
Jeff King [Mon, 24 Nov 2014 18:36:51 +0000 (13:36 -0500)] 
unpack-trees: propagate errors adding entries to the index

When unpack_trees tries to write an entry to the index,
add_index_entry may report an error to stderr, but we ignore
its return value. This leads to us returning a successful
exit code for an operation that partially failed. Let's make
sure to propagate this code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSecond batch for 2.3 cycle
Junio C Hamano [Fri, 12 Dec 2014 22:37:33 +0000 (14:37 -0800)] 
Second batch for 2.3 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'jk/pack-bitmap'
Junio C Hamano [Fri, 12 Dec 2014 22:31:41 +0000 (14:31 -0800)] 
Merge branch 'jk/pack-bitmap'

* jk/pack-bitmap:
  pack-bitmap: do not use gcc packed attribute

9 years agoMerge branch 'jk/push-simple'
Junio C Hamano [Fri, 12 Dec 2014 22:31:40 +0000 (14:31 -0800)] 
Merge branch 'jk/push-simple'

Git 2.0 was supposed to make the "simple" mode for the default of
"git push", but it didn't.

* jk/push-simple:
  push: truly use "simple" as default, not "upstream"

9 years agoMerge branch 'da/difftool-mergetool-simplify-reporting-status'
Junio C Hamano [Fri, 12 Dec 2014 22:31:39 +0000 (14:31 -0800)] 
Merge branch 'da/difftool-mergetool-simplify-reporting-status'

Code simplification.

* da/difftool-mergetool-simplify-reporting-status:
  mergetools: stop setting $status in merge_cmd()
  mergetool: simplify conditionals
  difftool--helper: add explicit exit statement
  mergetool--lib: remove use of $status global
  mergetool--lib: remove no-op assignment to $status from setup_user_tool

9 years agoMerge branch 'jk/colors-fix'
Junio C Hamano [Fri, 12 Dec 2014 22:31:38 +0000 (14:31 -0800)] 
Merge branch 'jk/colors-fix'

* jk/colors-fix:
  t4026: test "normal" color
  config: fix parsing of "git config --get-color some.key -1"
  docs: describe ANSI 256-color mode

9 years agoMerge branch 'rt/push-recurse-submodule-usage-string'
Junio C Hamano [Fri, 12 Dec 2014 22:31:38 +0000 (14:31 -0800)] 
Merge branch 'rt/push-recurse-submodule-usage-string'

* rt/push-recurse-submodule-usage-string:
  builtin/push.c: fix description of --recurse-submodules option

9 years agoMerge branch 'jk/rebuild-perl-scripts-with-no-perl-seting-change'
Junio C Hamano [Fri, 12 Dec 2014 22:31:36 +0000 (14:31 -0800)] 
Merge branch 'jk/rebuild-perl-scripts-with-no-perl-seting-change'

The build procedure did not bother fixing perl and python scripts
when NO_PERL and NO_PYTHON build-time configuration changed.

* jk/rebuild-perl-scripts-with-no-perl-seting-change:
  Makefile: have python scripts depend on NO_PYTHON setting
  Makefile: simplify by using SCRIPT_{PERL,SH}_GEN macros
  Makefile: have perl scripts depend on NO_PERL setting

9 years agoMerge branch 'jk/no-perl-tests'
Junio C Hamano [Fri, 12 Dec 2014 22:31:36 +0000 (14:31 -0800)] 
Merge branch 'jk/no-perl-tests'

Some tests that depend on perl lacked PERL prerequisite to protect
them, breaking build with NO_PERL configuration.

* jk/no-perl-tests:
  t960[34]: mark cvsimport tests as requiring perl
  t0090: mark add-interactive test with PERL prerequisite

9 years agoMerge branch 'sv/typofix-apply-error-message'
Junio C Hamano [Fri, 12 Dec 2014 22:31:35 +0000 (14:31 -0800)] 
Merge branch 'sv/typofix-apply-error-message'

* sv/typofix-apply-error-message:
  apply: fix typo in an error message

9 years agoMerge branch 'po/everyday-doc'
Junio C Hamano [Fri, 12 Dec 2014 22:31:34 +0000 (14:31 -0800)] 
Merge branch 'po/everyday-doc'

* po/everyday-doc:
  Documentation: change "gitlink" typo in git-push

9 years agoMerge branch 'mh/config-copy-string-from-git-path'
Junio C Hamano [Fri, 12 Dec 2014 22:31:33 +0000 (14:31 -0800)] 
Merge branch 'mh/config-copy-string-from-git-path'

* mh/config-copy-string-from-git-path:
  cmd_config(): make a copy of path obtained from git_path()

9 years agoMerge branch 'jc/unpack-trees-plug-leak'
Junio C Hamano [Fri, 12 Dec 2014 22:31:33 +0000 (14:31 -0800)] 
Merge branch 'jc/unpack-trees-plug-leak'

* jc/unpack-trees-plug-leak:
  unpack_trees: plug leakage of o->result

9 years agot: support clang/gcc AddressSanitizer
Jeff King [Mon, 8 Dec 2014 07:47:06 +0000 (02:47 -0500)] 
t: support clang/gcc AddressSanitizer

When git is compiled with "-fsanitize=address" (using clang
or gcc >= 4.8), all invocations of git will check for buffer
overflows. This is similar to running with valgrind, except
that it is more thorough (because of the compiler support,
function-local buffers can be checked, too) and runs much
faster (making it much less painful to run the whole test
suite with the checks turned on).

Unlike valgrind, the magic happens at compile-time, so we
don't need the same infrastructure in the test suite that we
did to support --valgrind. But there are two things we can
help with:

  1. On some platforms, the leak-detector is on by default,
     and causes every invocation of "git init" (and thus
     every test script) to fail. Since running git with
     the leak detector is pointless, let's shut it off
     automatically in the tests, unless the user has already
     configured it.

  2. When apache runs a CGI, it clears the environment of
     unknown variables. This means that the $ASAN_OPTIONS
     config doesn't make it to git-http-backend, and it
     dies due to the leak detector. Let's mark the variable
     as OK for apache to pass.

With these two changes, running

    make CC=clang CFLAGS=-fsanitize=address test

works out of the box.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoShow number of TODO items for interactive rebase
Onno Kortmann [Wed, 10 Dec 2014 18:16:44 +0000 (19:16 +0100)] 
Show number of TODO items for interactive rebase

During 'rebase -i', one wrong edit in a long rebase session
might inadvertently drop commits/items. This change shows
the total number of TODO items in the comments after the
list. After performing the rebase edit, total item counts
can be compared to make sure that no changes have been lost
in the edit.

Signed-off-by: Onno Kortmann <onno@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agopkt-line: allow writing of LARGE_PACKET_MAX buffers
Jeff King [Wed, 10 Dec 2014 09:47:02 +0000 (04:47 -0500)] 
pkt-line: allow writing of LARGE_PACKET_MAX buffers

When we send out pkt-lines with refnames, we use a static
1000-byte buffer. This means that the maximum size of a ref
over the git protocol is around 950 bytes (the exact size
depends on the protocol line being written, but figure on a sha1
plus some boilerplate).

This is enough for any sane workflow, but occasionally odd
things happen (e.g., a bug may create a ref "foo/foo/foo/..."
accidentally).  With the current code, you cannot even use
"push" to delete such a ref from a remote.

Let's switch to using a strbuf, with a hard-limit of
LARGE_PACKET_MAX (which is specified by the protocol).  This
matches the size of the readers, as of 74543a0 (pkt-line:
provide a LARGE_PACKET_MAX static buffer, 2013-02-20).
Versions of git older than that will complain about our
large packets, but it's really no worse than the current
behavior. Right now the sender barfs with "impossibly long
line" trying to send the packet, and afterwards the reader
will barf with "protocol error: bad line length %d", which
is arguably better anyway.

Note that we're not really _solving_ the problem here, but
just bumping the limits. In theory, the length of a ref is
unbounded, and pkt-line can only represent sizes up to
65531 bytes. So we are just bumping the limit, not removing
it.  But hopefully 64K should be enough for anyone.

As a bonus, by using a strbuf for the formatting we can
eliminate an unnecessary copy in format_buf_write.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoread_packed_refs: use skip_prefix instead of static array
Jeff King [Wed, 10 Dec 2014 10:40:36 +0000 (05:40 -0500)] 
read_packed_refs: use skip_prefix instead of static array

We want to recognize the packed-refs header and skip to the
"traits" part of the line. We currently do it by feeding
sizeof() a static const array to strncmp. However, it's a
bit simpler to just skip_prefix, which expresses the
intention more directly, and without remembering to account
for the NUL-terminator in each sizeof() call.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoread_packed_refs: pass strbuf to parse_ref_line
Jeff King [Wed, 10 Dec 2014 10:40:19 +0000 (05:40 -0500)] 
read_packed_refs: pass strbuf to parse_ref_line

Now that we have a strbuf in read_packed_refs, we can pass
it straight to the line parser, which saves us an extra
strlen.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoread_packed_refs: use a strbuf for reading lines
Jeff King [Wed, 10 Dec 2014 10:40:07 +0000 (05:40 -0500)] 
read_packed_refs: use a strbuf for reading lines

Current code uses a fixed PATH_MAX-sized buffer for reading
packed-refs lines. This is a reasonable guess, in the sense
that git generally cannot work with refs larger than
PATH_MAX.  However, there are a few cases where it is not
great:

  1. Some systems may have a low value of PATH_MAX, but can
     actually handle larger paths in practice. Fixing this
     code path probably isn't enough to make them work
     completely with long refs, but it is a step in the
     right direction.

  2. We use fgets, which will happily give us half a line on
     the first read, and then the rest of the line on the
     second. This is probably OK in practice, because our
     refline parser is careful enough to look for the
     trailing newline on the first line. The second line may
     look like a peeled line to us, but since "^" is illegal
     in refnames, it is not likely to come up.

     Still, it does not hurt to be more careful.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agobranch: allow -f with -m and -d
Michael J Gruber [Mon, 8 Dec 2014 16:28:45 +0000 (17:28 +0100)] 
branch: allow -f with -m and -d

-f/--force is the standard way to force an action, and is used by branch
for the recreation of existing branches, but not for deleting unmerged
branches nor for renaming to an existing branch.

Make "-m -f" equivalent to "-M" and "-d -f" equivalent to" -D", i.e.
allow -f/--force to be used with -m/-d also.

For the list modes, "-f" is simply ignored.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoparse_color: drop COLOR_BACKGROUND macro
Jeff King [Tue, 9 Dec 2014 21:01:26 +0000 (16:01 -0500)] 
parse_color: drop COLOR_BACKGROUND macro

Commit 695d95d (parse_color: refactor color storage,
2014-11-20) introduced two macros, COLOR_FOREGROUND and
COLOR_BACKGROUND. The latter conflicts with a system macro
defined on Windows, breaking compilation there.

The simplest solution is to just get rid of these macros
entirely. They are constants that are only used in one place
(since the whole point of 695d95d was to avoid repeating
ourselves). Their main function is to make the magic
character constants more readable, but we can do the same
thing with a comment.

Reported-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit-am.txt: --ignore-date flag is not passed to git-apply
Ronald Wampler [Tue, 9 Dec 2014 17:28:18 +0000 (12:28 -0500)] 
git-am.txt: --ignore-date flag is not passed to git-apply

Signed-off-by: Ronald Wampler <rdwampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogitignore.txt: do not suggest assume-unchanged
Michael J Gruber [Tue, 9 Dec 2014 11:13:00 +0000 (12:13 +0100)] 
gitignore.txt: do not suggest assume-unchanged

git-update-index --assume-unchanged was never meant to ignore changes
to tracked files (only to spare some stats). So do not suggest it
as a means to achieve that.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agodoc: make clear --assume-unchanged's user contract
Philip Oakley [Sat, 6 Dec 2014 15:04:30 +0000 (15:04 +0000)] 
doc: make clear --assume-unchanged's user contract

Many users misunderstand the --assume-unchanged contract, believing
it means Git won't look at the flagged file.

Be explicit that the --assume-unchanged contract is by the user that
they will NOT change the file so that Git does not need to look (and
expend, for example, lstat(2) cycles)

Mentioning "Git stops checking" does not help the reader, as it is
only one possible consequence of what that assumption allows Git to
do, but

   (1) there are things other than "stop checking" that Git can do
       based on that assumption; and
   (2) Git is not obliged to stop checking; it merely is allowed to.

Also, this is a single flag bit, correct the plural to singular, and
the verb, accordingly.

Drop the stale and incorrect information about "poor-man's ignore",
which is not what this flag bit is about at all.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agotest-hashmap: squelch gcc compiler warning
Johannes Schindelin [Tue, 9 Dec 2014 09:48:36 +0000 (10:48 +0100)] 
test-hashmap: squelch gcc compiler warning

At least on this developer's MacOSX (Snow Leopard, gcc-4.2.1), GCC
prints a warning that 'hash' may be used uninitialized when
compiling test-hashmap that 'hash' may be used uninitialized (but
GCC 4.6.3 on this developer's Ubuntu server does not report this
problem).

The old compiler is wrong, of course, as the switch (method & 3)
statement already handles all the possible cases, but that does not
help in a scenario where it is hard or impossible to upgrade to a
newer compiler (e.g. being stuck on an older MacOSX and having to
rely on Xcode).

So let's just initialize the variable and be done with it, it is
hardly a crucial part of the code because it is only used by the
test suite and invisible to the end users.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoindex-pack: terminate object buffers with NUL
Duy Nguyen [Mon, 8 Dec 2014 14:17:55 +0000 (15:17 +0100)] 
index-pack: terminate object buffers with NUL

We have some tricky checks in fsck that rely on a side effect of
require_end_of_header(), and would otherwise easily run outside
non-NUL-terminated buffers. This is a bit brittle, so let's make sure
that only NUL-terminated buffers are passed around to begin with.

Jeff "Peff" King contributed the detailed analysis which call paths are
involved and pointed out that we also have to patch the get_data()
function in unpack-objects.c, which is what Johannes "Dscho" Schindelin
implemented.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Analyzed-by: Jeff King <peff@peff.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofsck: properly bound "invalid tag name" error message
Jeff King [Mon, 8 Dec 2014 05:48:13 +0000 (00:48 -0500)] 
fsck: properly bound "invalid tag name" error message

When we detect an invalid tag-name header in a tag object,
like, "tag foo bar\n", we feed the pointer starting at "foo
bar" to a printf "%s" formatter. This shows the name, as we
want, but then it keeps printing the rest of the tag buffer,
rather than stopping at the end of the line.

Our tests did not notice because they look only for the
matching line, but the bug is that we print much more than
we wanted to. So we also adjust the test to be more exact.

Note that when fscking tags with "index-pack --strict", this
is even worse. index-pack does not add a trailing
NUL-terminator after the object, so we may actually read
past the buffer and print uninitialized memory. Running
t5302 with valgrind does notice the bug for that reason.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot0027: check the eol conversion warnings
Torsten Bögershausen [Sun, 30 Nov 2014 20:15:52 +0000 (21:15 +0100)] 
t0027: check the eol conversion warnings

Depending on the file content, eol parameters and .gitattributes
"git add" may give a warning when the eol of a file will change when
the file is checked out again.

There are 2 different warnings, either "CRLF will be replaced..." or
"LF will be replaced...".  Let t0027 check for these warnings by
adding new parameters to create_file_in_repo(), which tells what
warnings are expected.

When a file has eol=lf or eol=crlf in .gitattributes, it is handled
as text and should be normalized.  Add tests for these cases that
were not covered.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoFirst batch for 2.3 cycle
Junio C Hamano [Fri, 5 Dec 2014 20:03:57 +0000 (12:03 -0800)] 
First batch for 2.3 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'mh/config-flip-xbit-back-after-checking'
Junio C Hamano [Fri, 5 Dec 2014 19:43:10 +0000 (11:43 -0800)] 
Merge branch 'mh/config-flip-xbit-back-after-checking'

* mh/config-flip-xbit-back-after-checking:
  create_default_files(): don't set u+x bit on $GIT_DIR/config

9 years agoMerge branch 'jk/gitweb-with-newer-cgi-multi-param'
Junio C Hamano [Fri, 5 Dec 2014 19:42:55 +0000 (11:42 -0800)] 
Merge branch 'jk/gitweb-with-newer-cgi-multi-param'

* jk/gitweb-with-newer-cgi-multi-param:
  gitweb: hack around CGI's list-context param() handling

9 years agoMerge branch 'rs/receive-pack-use-labs'
Junio C Hamano [Fri, 5 Dec 2014 19:42:53 +0000 (11:42 -0800)] 
Merge branch 'rs/receive-pack-use-labs'

* rs/receive-pack-use-labs:
  use labs() for variables of type long instead of abs()

9 years agoMerge branch 'rs/maint-config-use-labs'
Junio C Hamano [Fri, 5 Dec 2014 19:42:50 +0000 (11:42 -0800)] 
Merge branch 'rs/maint-config-use-labs'

* rs/maint-config-use-labs:
  use labs() for variables of type long instead of abs()

9 years agoMerge branch 'js/windows-open-eisdir-error'
Junio C Hamano [Fri, 5 Dec 2014 19:42:35 +0000 (11:42 -0800)] 
Merge branch 'js/windows-open-eisdir-error'

* js/windows-open-eisdir-error:
  Windows: correct detection of EISDIR in mingw_open()

9 years agoMerge branch 'jh/empty-notes'
Junio C Hamano [Fri, 5 Dec 2014 19:42:28 +0000 (11:42 -0800)] 
Merge branch 'jh/empty-notes'

A request to store an empty note via "git notes" meant to remove
note from the object but with --allow-empty we will store a (surprise!)
note that is empty.  In the longer run, we might want to deprecate
the somewhat unintuitive "emptying means deletion" behaviour.

* jh/empty-notes:
  t3301: modernize style
  notes: empty notes should be shown by 'git log'
  builtin/notes: add --allow-empty, to allow storing empty notes
  builtin/notes: split create_note() to clarify add vs. remove logic
  builtin/notes: simplify early exit code in add()
  builtin/notes: refactor note file path into struct note_data
  builtin/notes: improve naming
  t3301: verify that 'git notes' removes empty notes by default
  builtin/notes: fix premature failure when trying to add the empty blob

9 years agoMerge branch 'sv/get-builtin'
Junio C Hamano [Fri, 5 Dec 2014 19:42:26 +0000 (11:42 -0800)] 
Merge branch 'sv/get-builtin'

* sv/get-builtin:
  builtin: move builtin retrieval to get_builtin()

9 years agoMerge branch 'jk/checkout-from-tree'
Junio C Hamano [Fri, 5 Dec 2014 19:41:33 +0000 (11:41 -0800)] 
Merge branch 'jk/checkout-from-tree'

"git checkout $treeish $path", when $path in the index and the
working tree already matched what is in $treeish at the $path,
still overwrote the $path unnecessarily.

* jk/checkout-from-tree:
  checkout $tree: do not throw away unchanged index entries

9 years agoMerge branch 'tq/git-ssh-command'
Junio C Hamano [Fri, 5 Dec 2014 19:39:25 +0000 (11:39 -0800)] 
Merge branch 'tq/git-ssh-command'

Allow passing extra set of arguments when ssh is invoked to create
an encrypted & authenticated connection by introducing a new environment
variable GIT_SSH_COMMAND, whose contents is interpreted by shells.

This is not possible with existing GIT_SSH mechanism whose
invocation bypasses shells, which was designed more to match what
other programs with similar variables did, not necessarily to be
more useful.

* tq/git-ssh-command:
  git_connect: set ssh shell command in GIT_SSH_COMMAND

9 years agoMerge branch 'rs/env-array-in-child-process'
Junio C Hamano [Fri, 5 Dec 2014 19:39:21 +0000 (11:39 -0800)] 
Merge branch 'rs/env-array-in-child-process'

* rs/env-array-in-child-process:
  use args member of struct child_process

9 years agoMerge branch 'maint' of git://github.com/git-l10n/git-po into maint
Junio C Hamano [Fri, 5 Dec 2014 19:38:24 +0000 (11:38 -0800)] 
Merge branch 'maint' of git://github.com/git-l10n/git-po into maint

* 'maint' of git://github.com/git-l10n/git-po:
  l10n: de.po: fix typos

9 years agoStart post 2.2 cycle
Junio C Hamano [Fri, 5 Dec 2014 19:38:19 +0000 (11:38 -0800)] 
Start post 2.2 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofor_each_reflog_ent_reverse: turn leftover check into assertion
Jeff King [Fri, 5 Dec 2014 01:32:44 +0000 (20:32 -0500)] 
for_each_reflog_ent_reverse: turn leftover check into assertion

Our loop should always process all lines, even if we hit the
beginning of the file. We have a conditional after the loop
ends to double-check that there is nothing left and to
process it. But this should never happen, and is a sign of a
logic bug in the loop. Let's turn it into a BUG assertion.

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