git
9 years agoMerge branch 'jk/cherry-pick-docfix' into maint
Junio C Hamano [Tue, 21 Apr 2015 19:12:21 +0000 (12:12 -0700)] 
Merge branch 'jk/cherry-pick-docfix' into maint

* jk/cherry-pick-docfix:
  cherry-pick: fix docs describing handling of empty commits

9 years agoMerge branch 'iu/fix-parse-options-h-comment' into maint
Junio C Hamano [Tue, 21 Apr 2015 19:12:20 +0000 (12:12 -0700)] 
Merge branch 'iu/fix-parse-options-h-comment' into maint

* iu/fix-parse-options-h-comment:
  parse-options.h: OPTION_{BIT,SET_INT} do not store pointer to defval

9 years agoMerge branch 'jg/cguide-we-cannot-count' into maint
Junio C Hamano [Tue, 21 Apr 2015 19:12:19 +0000 (12:12 -0700)] 
Merge branch 'jg/cguide-we-cannot-count' into maint

* jg/cguide-we-cannot-count:
  CodingGuidelines: update 'rough' rule count

9 years agoMerge branch 'jk/pack-corruption-post-mortem' into maint
Junio C Hamano [Tue, 21 Apr 2015 19:12:18 +0000 (12:12 -0700)] 
Merge branch 'jk/pack-corruption-post-mortem' into maint

Documentation update.

* jk/pack-corruption-post-mortem:
  howto: document more tools for recovery corruption

9 years agoMerge branch 'jn/doc-fast-import-no-16-octopus-limit' into maint
Junio C Hamano [Tue, 21 Apr 2015 19:12:17 +0000 (12:12 -0700)] 
Merge branch 'jn/doc-fast-import-no-16-octopus-limit' into maint

Documentation update.

* jn/doc-fast-import-no-16-octopus-limit:
  fast-import doc: remove suggested 16-parent limit

9 years agoCodingGuidelines: update 'rough' rule count
Julian Gindi [Mon, 13 Apr 2015 12:54:14 +0000 (08:54 -0400)] 
CodingGuidelines: update 'rough' rule count

Changed inaccurate count of "rough rules" from three to the more
generic 'a few'.

Signed-off-by: Julian Gindi <juliangindi@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agohowto: document more tools for recovery corruption
Jeff King [Wed, 1 Apr 2015 21:08:56 +0000 (17:08 -0400)] 
howto: document more tools for recovery corruption

Long ago, I documented a corruption recovery I did and gave
some C code that I used to help find a flipped bit.  I had
to fix a similar case recently, and I ended up writing a few
more tools.  I hope nobody ever has to use these, but it
does not hurt to share them, just in case.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofast-import doc: remove suggested 16-parent limit
Jonathan Nieder [Tue, 31 Mar 2015 23:18:07 +0000 (16:18 -0700)] 
fast-import doc: remove suggested 16-parent limit

Merges with an absurd number of parents are still a bad idea because
they do not render well in tools like gitk, but if they are present
in the repository being imported into git then there's no need to
avoid reproducing them faithfully.

In olden times, before v1.6.0-rc0~194 (2008-06-27), git commit-tree
and higher-level tools built on top of it were limited to writing 16
parents for a commit.  Nowadays normal git operations are happy to
write more parents when asked, so the motivation for this note in the
fast-import documentation is gone and we can remove it.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoGit 2.3.5 v2.3.5
Junio C Hamano [Tue, 31 Mar 2015 21:57:10 +0000 (14:57 -0700)] 
Git 2.3.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'ss/pull-rebase-preserve' into maint
Junio C Hamano [Tue, 31 Mar 2015 21:54:11 +0000 (14:54 -0700)] 
Merge branch 'ss/pull-rebase-preserve' into maint

* ss/pull-rebase-preserve:
  docs: clarify what git-rebase's "-p" / "--preserve-merges" does
  docs: clarify "preserve" option wording for git-pull

9 years agoMerge branch 'jc/report-path-error-to-dir' into maint
Junio C Hamano [Tue, 31 Mar 2015 21:53:08 +0000 (14:53 -0700)] 
Merge branch 'jc/report-path-error-to-dir' into maint

Code clean-up.

* jc/report-path-error-to-dir:
  report_path_error(): move to dir.c

9 years agoMerge branch 'ph/push-doc-cas' into maint
Junio C Hamano [Tue, 31 Mar 2015 21:52:23 +0000 (14:52 -0700)] 
Merge branch 'ph/push-doc-cas' into maint

* ph/push-doc-cas:
  git-push.txt: clean up force-with-lease wording

9 years agocherry-pick: fix docs describing handling of empty commits
Jeff King [Tue, 31 Mar 2015 01:08:54 +0000 (21:08 -0400)] 
cherry-pick: fix docs describing handling of empty commits

Commit b27cfb0 (git-cherry-pick: Add keep-redundant-commits
option, 2012-04-20), added the --keep-redundant-commits
option, and switched the default behavior (without that
option) to silently ignore empty commits. Later, the second
half of that commit was reverted in ac2b0e8 (cherry-pick:
regression fix for empty commits, 2012-05-29), but the
documentation added for --keep-redundant-commits was never
updated to match. Let's do so now.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agodocs: clarify what git-rebase's "-p" / "--preserve-merges" does
Sebastian Schuberth [Mon, 30 Mar 2015 09:29:46 +0000 (11:29 +0200)] 
docs: clarify what git-rebase's "-p" / "--preserve-merges" does

Ignoring a merge can be read as ignoring the changes a merge commit
introduces altogether, as if the entire side branch the merge commit
merged was removed from the history.  But that is not what happens
if "-p" is not specified.  What happens is that the individual
commits a merge commit introduces are replayed in order, and only
any possible merge conflict resolutions or manual amendments to the
merge commit are ignored.

Get this straight in the docs.

Also, do not say that merge commits are *tried* to be recreated. As that is
true almost everywhere it is better left unsaid.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoparse-options.h: OPTION_{BIT,SET_INT} do not store pointer to defval
Ivan Ukhov [Sun, 29 Mar 2015 08:32:55 +0000 (10:32 +0200)] 
parse-options.h: OPTION_{BIT,SET_INT} do not store pointer to defval

When 20d1c652 (parse-options: remove unused OPT_SET_PTR, 2014-03-30)
removed OPT_SET_PTR, the comment in the header that describes what
the option did to defval field was left behind by mistake.  Remove
it.

Signed-off-by: Ivan Ukhov <ivan.ukhov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoPrepare for 2.3.5
Junio C Hamano [Sat, 28 Mar 2015 16:36:30 +0000 (09:36 -0700)] 
Prepare for 2.3.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'sg/completion-gitcomp-nl-for-refs' into maint
Junio C Hamano [Sat, 28 Mar 2015 16:33:15 +0000 (09:33 -0700)] 
Merge branch 'sg/completion-gitcomp-nl-for-refs' into maint

Code clean-up.

* sg/completion-gitcomp-nl-for-refs:
  completion: use __gitcomp_nl() for completing refs

9 years agoMerge branch 'jk/simplify-csum-file-sha1fd-check' into maint
Junio C Hamano [Sat, 28 Mar 2015 16:33:15 +0000 (09:33 -0700)] 
Merge branch 'jk/simplify-csum-file-sha1fd-check' into maint

Code simplification.

* jk/simplify-csum-file-sha1fd-check:
  sha1fd_check: die when we cannot open the file

9 years agoMerge branch 'tg/test-index-v4' into maint
Junio C Hamano [Sat, 28 Mar 2015 16:33:14 +0000 (09:33 -0700)] 
Merge branch 'tg/test-index-v4' into maint

A test fix.

* tg/test-index-v4:
  t1700: make test pass with index-v4

9 years agoMerge branch 'nd/doc-git-index-version' into maint
Junio C Hamano [Sat, 28 Mar 2015 16:33:13 +0000 (09:33 -0700)] 
Merge branch 'nd/doc-git-index-version' into maint

Doc clean-up.

* nd/doc-git-index-version:
  git.txt: list index versions in plain English

9 years agoMerge branch 'ct/prompt-untracked-fix' into maint
Junio C Hamano [Sat, 28 Mar 2015 16:33:12 +0000 (09:33 -0700)] 
Merge branch 'ct/prompt-untracked-fix' into maint

The prompt script (in contrib/) did not show the untracked sign
when working in a subdirectory without any untracked files.

* ct/prompt-untracked-fix:
  git prompt: use toplevel to find untracked files

9 years agoMerge branch 'ws/grep-quiet-no-pager' into maint
Junio C Hamano [Sat, 28 Mar 2015 16:33:11 +0000 (09:33 -0700)] 
Merge branch 'ws/grep-quiet-no-pager' into maint

Even though "git grep --quiet" is run merely to ask for the exit
status, we spawned the pager regardless.  Stop doing that.

* ws/grep-quiet-no-pager:
  grep: fix "--quiet" overwriting current output

9 years agoMerge branch 'jc/submitting-patches-mention-send-email' into maint
Junio C Hamano [Sat, 28 Mar 2015 16:33:10 +0000 (09:33 -0700)] 
Merge branch 'jc/submitting-patches-mention-send-email' into maint

Recommend format-patch and send-email for those who want to submit
patches to this project.

* jc/submitting-patches-mention-send-email:
  SubmittingPatches: encourage users to use format-patch and send-email

9 years agoMerge branch 'jk/cleanup-failed-clone' into maint
Junio C Hamano [Sat, 28 Mar 2015 16:33:09 +0000 (09:33 -0700)] 
Merge branch 'jk/cleanup-failed-clone' into maint

An failure early in the "git clone" that started creating the
working tree and repository could have resulted in some directories
and files left without getting cleaned up.

* jk/cleanup-failed-clone:
  clone: drop period from end of die_errno message
  clone: initialize atexit cleanup handler earlier

9 years agoMerge branch 'jk/fetch-pack' into maint
Junio C Hamano [Sat, 28 Mar 2015 16:33:08 +0000 (09:33 -0700)] 
Merge branch 'jk/fetch-pack' into maint

"git fetch" that fetches a commit using the allow-tip-sha1-in-want
extension could have failed to fetch all the requested refs.

* jk/fetch-pack:
  fetch-pack: remove dead assignment to ref->new_sha1
  fetch_refs_via_pack: free extra copy of refs
  filter_ref: make a copy of extra "sought" entries
  filter_ref: avoid overwriting ref->old_sha1 with garbage

9 years agoMerge branch 'tg/fix-check-order-with-split-index' into maint
Junio C Hamano [Sat, 28 Mar 2015 16:33:07 +0000 (09:33 -0700)] 
Merge branch 'tg/fix-check-order-with-split-index' into maint

The split-index mode introduced at v2.3.0-rc0~41 was broken in the
codepath to protect us against a broken reimplementation of Git
that writes an invalid index with duplicated index entries, etc.

* tg/fix-check-order-with-split-index:
  read-cache: fix reading of split index

9 years agoMerge branch 'jk/prune-with-corrupt-refs' into maint
Junio C Hamano [Sat, 28 Mar 2015 16:33:06 +0000 (09:33 -0700)] 
Merge branch 'jk/prune-with-corrupt-refs' into maint

"git prune" used to largely ignore broken refs when deciding which
objects are still being used, which could spread an existing small
damage and make it a larger one.

* jk/prune-with-corrupt-refs:
  refs.c: drop curate_packed_refs
  repack: turn on "ref paranoia" when doing a destructive repack
  prune: turn on ref_paranoia flag
  refs: introduce a "ref paranoia" flag
  t5312: test object deletion code paths in a corrupted repository

9 years ago2.3.2 release notes: typofix
Thomas Ackermann [Thu, 26 Mar 2015 20:29:47 +0000 (21:29 +0100)] 
2.3.2 release notes: typofix

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'jk/tag-h-column-is-a-listing-option' into maint
Junio C Hamano [Fri, 27 Mar 2015 20:00:23 +0000 (13:00 -0700)] 
Merge branch 'jk/tag-h-column-is-a-listing-option' into maint

"git tag -h" used to show the "--column" and "--sort" options
that are about listing in a wrong section.

* jk/tag-h-column-is-a-listing-option:
  tag: fix some mis-organized options in "-h" listing

9 years agoMerge branch 'jk/smart-http-hide-refs' into maint
Junio C Hamano [Fri, 27 Mar 2015 20:00:20 +0000 (13:00 -0700)] 
Merge branch 'jk/smart-http-hide-refs' into maint

The transfer.hiderefs support did not quite work for smart-http
transport.

* jk/smart-http-hide-refs:
  upload-pack: do not check NULL return of lookup_unknown_object
  upload-pack: fix transfer.hiderefs over smart-http

9 years agoMerge branch 'js/completion-ctags-pattern-substitution-fix' into maint
Junio C Hamano [Fri, 27 Mar 2015 20:00:17 +0000 (13:00 -0700)] 
Merge branch 'js/completion-ctags-pattern-substitution-fix' into maint

The code that reads from the ctags file in the completion script
(in contrib/) did not spell ${param/pattern/string} substitution
correctly, which happened to work with bash but not with zsh.

* js/completion-ctags-pattern-substitution-fix:
  contrib/completion: escape the forward slash in __git_match_ctag

9 years agoUpdate mailmap to spell out "Alexander Kuleshov"
Junio C Hamano [Fri, 27 Mar 2015 19:58:04 +0000 (12:58 -0700)] 
Update mailmap to spell out "Alexander Kuleshov"

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agodocs: clarify "preserve" option wording for git-pull
Sebastian Schuberth [Thu, 26 Mar 2015 20:11:21 +0000 (21:11 +0100)] 
docs: clarify "preserve" option wording for git-pull

The "also" sounds as if "preserve" does a rebase as an additional
step that "true" would not do, but that is not the case.  Clarify
this by omitting "also", and rewording the sentence a bit.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit-push.txt: clean up force-with-lease wording
Phil Hord [Thu, 26 Mar 2015 15:15:09 +0000 (11:15 -0400)] 
git-push.txt: clean up force-with-lease wording

The help text for the --force-with-lease option to git-push
does not parse cleanly.  Clean up the wording and syntax to
be more sensible.  Also remove redundant information in the
"--force-with-lease alone" description.

Signed-off-by: Phil Hord <hordp@cisco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreport_path_error(): move to dir.c
Junio C Hamano [Tue, 24 Mar 2015 21:12:10 +0000 (14:12 -0700)] 
report_path_error(): move to dir.c

The expected call sequence is for the caller to use match_pathspec()
repeatedly on a set of pathspecs, accumulating the "hits" in a
separate array, and then call this function to diagnose a pathspec
that never matched anything, as that can indicate a typo from the
command line, e.g. "git commit Maekfile".

Many builtin commands use this function from builtin/ls-files.c,
which is not a very healthy arrangement.  ls-files might have been
the first command to feel the need for such a helper, but the need
is shared by everybody who uses the "match and then report" pattern.

Move it to dir.c where match_pathspec() is defined.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit.txt: list index versions in plain English
Nguyễn Thái Ngọc Duy [Tue, 24 Mar 2015 00:28:33 +0000 (07:28 +0700)] 
git.txt: list index versions in plain English

At the first look, a user may think the default version is "23". Even
with UNIX background, there's no reference anywhere close that may
indicate this is glob or regex.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoGit 2.3.4 v2.3.4
Junio C Hamano [Mon, 23 Mar 2015 18:27:27 +0000 (11:27 -0700)] 
Git 2.3.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'rs/use-isxdigit' into maint
Junio C Hamano [Mon, 23 Mar 2015 18:23:41 +0000 (11:23 -0700)] 
Merge branch 'rs/use-isxdigit' into maint

Code cleanup.

* rs/use-isxdigit:
  use isxdigit() for checking if a character is a hexadecimal digit

9 years agoMerge branch 'rs/deflate-init-cleanup' into maint
Junio C Hamano [Mon, 23 Mar 2015 18:23:37 +0000 (11:23 -0700)] 
Merge branch 'rs/deflate-init-cleanup' into maint

Code simplification.

* rs/deflate-init-cleanup:
  zlib: initialize git_zstream in git_deflate_init{,_gzip,_raw}

9 years agoMerge branch 'ak/git-done-help-cleanup' into maint
Junio C Hamano [Mon, 23 Mar 2015 18:23:35 +0000 (11:23 -0700)] 
Merge branch 'ak/git-done-help-cleanup' into maint

Code simplification.

* ak/git-done-help-cleanup:
  git: make was_alias and done_help non-static

9 years agoMerge branch 'sg/completion-remote' into maint
Junio C Hamano [Mon, 23 Mar 2015 18:23:33 +0000 (11:23 -0700)] 
Merge branch 'sg/completion-remote' into maint

Code simplification.

* sg/completion-remote:
  completion: simplify __git_remotes()
  completion: add a test for __git_remotes() helper function

9 years agoMerge branch 'mg/doc-status-color-slot' into maint
Junio C Hamano [Mon, 23 Mar 2015 18:23:30 +0000 (11:23 -0700)] 
Merge branch 'mg/doc-status-color-slot' into maint

Documentation fixes.

* mg/doc-status-color-slot:
  config,completion: add color.status.unmerged

9 years agoMerge branch 'jc/decorate-leaky-separator-color' into maint
Junio C Hamano [Mon, 23 Mar 2015 18:23:28 +0000 (11:23 -0700)] 
Merge branch 'jc/decorate-leaky-separator-color' into maint

"git log --decorate" did not reset colors correctly around the
branch names.

* jc/decorate-leaky-separator-color:
  log --decorate: do not leak "commit" color into the next item
  Documentation/config.txt: simplify boolean description in the syntax section
  Documentation/config.txt: describe 'color' value type in the "Values" section
  Documentation/config.txt: have a separate "Values" section
  Documentation/config.txt: describe the structure first and then meaning
  Documentation/config.txt: explain multi-valued variables once
  Documentation/config.txt: avoid unnecessary negation

9 years agoMerge branch 'kn/git-cd-to-empty' into maint
Junio C Hamano [Mon, 23 Mar 2015 18:23:25 +0000 (11:23 -0700)] 
Merge branch 'kn/git-cd-to-empty' into maint

"git -C '' subcmd" refused to work in the current directory, unlike
"cd ''" which silently behaves as a no-op.

* kn/git-cd-to-empty:
  git: treat "git -C '<path>'" as a no-op when <path> is empty

9 years agoMerge branch 'km/imap-send-libcurl-options' into maint
Junio C Hamano [Mon, 23 Mar 2015 18:23:22 +0000 (11:23 -0700)] 
Merge branch 'km/imap-send-libcurl-options' into maint

"git imap-send" learned to optionally talk with an IMAP server via
libcURL; because there is no other option when Git is built with
NO_OPENSSL option, use that codepath by default under such
configuration.

* km/imap-send-libcurl-options:
  imap-send: use cURL automatically when NO_OPENSSL defined

9 years agoMerge branch 'mg/verify-commit' into maint
Junio C Hamano [Mon, 23 Mar 2015 18:23:19 +0000 (11:23 -0700)] 
Merge branch 'mg/verify-commit' into maint

Workarounds for certain build of GPG that triggered false breakage
in a test.

* mg/verify-commit:
  t7510: do not fail when gpg warns about insecure memory

9 years agoMerge branch 'es/rebase-i-count-todo' into maint
Junio C Hamano [Mon, 23 Mar 2015 18:23:17 +0000 (11:23 -0700)] 
Merge branch 'es/rebase-i-count-todo' into maint

"git rebase -i" recently started to include the number of
commits in the insn sheet to be processed, but on a platform
that prepends leading whitespaces to "wc -l" output, the numbers
are shown with extra whitespaces that aren't necessary.

* es/rebase-i-count-todo:
  rebase-interactive: re-word "item count" comment
  rebase-interactive: suppress whitespace preceding item count

9 years agoMerge branch 'tb/connect-ipv6-parse-fix' into maint
Junio C Hamano [Mon, 23 Mar 2015 18:23:12 +0000 (11:23 -0700)] 
Merge branch 'tb/connect-ipv6-parse-fix' into maint

We did not parse username followed by literal IPv6 address in SSH
transport URLs, e.g. ssh://user@[2001:db8::1]:22/repo.git
correctly.

* tb/connect-ipv6-parse-fix:
  t5500: show user name and host in diag-url
  t5601: add more test cases for IPV6
  connect.c: allow ssh://user@[2001:db8::1]/repo.git

9 years agocompletion: use __gitcomp_nl() for completing refs
SZEDER Gábor [Sun, 22 Mar 2015 12:03:11 +0000 (13:03 +0100)] 
completion: use __gitcomp_nl() for completing refs

We do that almost everywhere, because it's faster for large number of
refs, see a31e62629 (completion: optimize refs completion, 2011-10-15).
These were the last two places where we still used __gitcomp() for
completing refs.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoread-cache: fix reading of split index
Thomas Gummerer [Fri, 20 Mar 2015 21:43:14 +0000 (22:43 +0100)] 
read-cache: fix reading of split index

The split index extension uses ewah bitmaps to mark index entries as
deleted, instead of removing them from the index directly.  This can
result in an on-disk index, in which entries of stage #0 and higher
stages appear, which are removed later when the index bases are merged.

15999d0 read_index_from(): catch out of order entries when reading an
index file introduces a check which checks if the entries are in order
after each index entry is read in do_read_index.  This check may however
fail when a split index is read.

Fix this by moving checking the index after we know there is no split
index or after the split index bases are successfully merged instead.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agorefs.c: drop curate_packed_refs
Jeff King [Fri, 20 Mar 2015 18:43:17 +0000 (14:43 -0400)] 
refs.c: drop curate_packed_refs

When we delete a ref, we have to rewrite the entire
packed-refs file. We take this opportunity to "curate" the
packed-refs file and drop any entries that are crufty or
broken.

Dropping broken entries (e.g., with bogus names, or ones
that point to missing objects) is actively a bad idea, as it
means that we lose any notion that the data was there in the
first place. Aside from the general hackiness that we might
lose any information about ref "foo" while deleting an
unrelated ref "bar", this may seriously hamper any attempts
by the user at recovering from the corruption in "foo".

They will lose the sha1 and name of "foo"; the exact pointer
may still be useful even if they recover missing objects
from a different copy of the repository. But worse, once the
ref is gone, there is no trace of the corruption. A
follow-up "git prune" may delete objects, even though it
would otherwise bail when seeing corruption.

We could just drop the "broken" bits from
curate_packed_refs, and continue to drop the "crufty" bits:
refs whose loose counterpart exists in the filesystem. This
is not wrong to do, and it does have the advantage that we
may write out a slightly smaller packed-refs file. But it
has two disadvantages:

  1. It is a potential source of races or mistakes with
     respect to these refs that are otherwise unrelated to
     the operation. To my knowledge, there aren't any active
     problems in this area, but it seems like an unnecessary
     risk.

  2. We have to spend time looking up the matching loose
     refs for every item in the packed-refs file. If you
     have a large number of packed refs that do not change,
     that outweighs the benefit from writing out a smaller
     packed-refs file (it doesn't get smaller, and you do a
     bunch of directory traversal to find that out).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agorepack: turn on "ref paranoia" when doing a destructive repack
Jeff King [Fri, 20 Mar 2015 18:43:13 +0000 (14:43 -0400)] 
repack: turn on "ref paranoia" when doing a destructive repack

If we are repacking with "-ad", we will drop any unreachable
objects. Likewise, using "-Ad --unpack-unreachable=<time>"
will drop any old, unreachable objects. In these cases, we
want to make sure the reachability we compute with "--all"
is complete. We can do this by passing GIT_REF_PARANOIA=1 in
the environment to pack-objects.

Note that "-Ad" is safe already, because it only loosens
unreachable objects. It is up to "git prune" to avoid
deleting them.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoprune: turn on ref_paranoia flag
Jeff King [Fri, 20 Mar 2015 18:43:09 +0000 (14:43 -0400)] 
prune: turn on ref_paranoia flag

Prune should know about broken objects at the tips of refs,
so that we can feed them to our traversal rather than
ignoring them. It's better for us to abort the operation on
the broken object than it is to start deleting objects with
an incomplete view of the reachability namespace.

Note that for missing objects, aborting is the best we can
do. For a badly-named ref, we technically could use its sha1
as a reachability tip. However, the iteration code just
feeds us a null sha1, so there would be a reasonable amount
of code involved to pass down our wishes. It's not really
worth trying to do better, because this is a case that
should happen extremely rarely, and the message we provide:

  fatal: unable to parse object: refs/heads/bogus:name

is probably enough to point the user in the right direction.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agorefs: introduce a "ref paranoia" flag
Jeff King [Fri, 20 Mar 2015 18:43:06 +0000 (14:43 -0400)] 
refs: introduce a "ref paranoia" flag

Most operations that iterate over refs are happy to ignore
broken cruft. However, some operations should be performed
with knowledge of these broken refs, because it is better
for the operation to choke on a missing object than it is to
silently pretend that the ref did not exist (e.g., if we are
computing the set of reachable tips in order to prune
objects).

These processes could just call for_each_rawref, except that
ref iteration is often hidden behind other interfaces. For
instance, for a destructive "repack -ad", we would have to
inform "pack-objects" that we are destructive, and then it
would in turn have to tell the revision code that our
"--all" should include broken refs.

It's much simpler to just set a global for "dangerous"
operations that includes broken refs in all iterations.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot5312: test object deletion code paths in a corrupted repository
Jeff King [Fri, 20 Mar 2015 18:43:02 +0000 (14:43 -0400)] 
t5312: test object deletion code paths in a corrupted repository

When we are doing a destructive operation like "git prune",
we want to be extra careful that the set of reachable tips
we compute is valid. If there is any corruption or oddity,
we are better off aborting the operation and letting the
user figure things out rather than plowing ahead and
possibly deleting some data that cannot be recovered.

The tests here include:

  1. Pruning objects mentioned only be refs with invalid
     names. This used to abort prior to d0f810f (refs.c:
     allow listing and deleting badly named refs,
     2014-09-03), but since then we silently ignore the tip.

     Likewise, we test repacking that can drop objects
     (either "-ad", which drops anything unreachable,
     or "-Ad --unpack-unreachable=<time>", which tries to
     optimize out a loose object write that would be
     directly pruned).

  2. Pruning objects when some refs point to missing
     objects. We don't know whether any dangling objects
     would have been reachable from the missing objects. We
     are better to keep them around, as they are better than
     nothing for helping the user recover history.

  3. Packed refs that point to missing objects can sometimes
     be dropped. By itself, this is more of an annoyance
     (you do not have the object anyway; even if you can
     recover it from elsewhere, all you are losing is a
     placeholder for your state at the time of corruption).
     But coupled with (2), if we drop the ref and then go
     on to prune, we may lose unrecoverable objects.

Note that we use test_might_fail for some of the operations.
In some cases, it would be appropriate to abort the
operation, and in others, it might be acceptable to continue
but taking the information into account. The tests don't
care either way, and check only for data loss.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot1700: make test pass with index-v4
Thomas Gummerer [Fri, 20 Mar 2015 18:20:30 +0000 (19:20 +0100)] 
t1700: make test pass with index-v4

The different index versions have different sha-1 checksums.  Those
checksums are checked in t1700, which makes it fail when the test suite
is run with TEST_GIT_INDEX_VERSION=4.  Fix it.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofetch-pack: remove dead assignment to ref->new_sha1
Jeff King [Thu, 19 Mar 2015 20:39:36 +0000 (16:39 -0400)] 
fetch-pack: remove dead assignment to ref->new_sha1

In everything_local(), we used to assign the current ref's value
found in ref->old_sha1 to ref->new_sha1 when we already have all the
necessary objects to complete the history leading to that
commit.  This copying was broken at 49bb805e (Do not ask for
objects known to be complete., 2005-10-19) and ever since we
instead stuffed a random bytes in ref->new_sha1 here.  No
code complained or failed due to this breakage.

It turns out that no code path that comes after this
assignment even looks at ref->new_sha1 at all.

 - The only caller of everything_local(), do_fetch_pack(),
   returns this list of refs, whose element has bogus
   new_sha1 values, to its caller.  It does not look at the
   elements itself, but does pass them to find_common, which
   looks only at the name and old_sha1 fields.

 - The only caller of do_fetch_pack(), fetch_pack(), returns this
   list to its caller.  It does not look at the elements nor act on
   them.

 - One of the two callers of fetch_pack() is cmd_fetch_pack(), the
   top-level that implements "git fetch-pack".  The only thing it
   looks at in the elements of the returned ref list is the old_sha1
   and name fields.

 - The other caller of fetch_pack() is fetch_refs_via_pack() in the
   transport layer, which is a helper that implements "git fetch".
   It only cares about whether the returned list is empty (i.e.
   failed to fetch anything).

Just drop the bogus assignment, that is not even necessary.  The
remote-tracking refs are updated based on a different list and not
using the ref list being manipulated by this code path; the caller
do_fetch_pack() created a copy of that real ref list and passed the
copy down to this function, and modifying the elements here does not
affect anything.

Noticed-by: Kyle J. McKay <mackyle@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofetch_refs_via_pack: free extra copy of refs
Jeff King [Thu, 19 Mar 2015 20:38:35 +0000 (16:38 -0400)] 
fetch_refs_via_pack: free extra copy of refs

When fetch_refs_via_pack calls fetch_pack(), we pass a
list of refs to fetch, and the function returns either a
copy of that list, with the fetched items filled in, or
NULL. We check the return value to see whether the fetch was
successful, but do not otherwise look at the copy, and
simply leak it at the end of the function.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofilter_ref: make a copy of extra "sought" entries
Jeff King [Thu, 19 Mar 2015 20:37:09 +0000 (16:37 -0400)] 
filter_ref: make a copy of extra "sought" entries

If the server supports allow_tip_sha1_in_want, we add any
unmatched raw-sha1 entries in our "sought" list of refs to
the list of refs we will ask the other side for. We do so by
inserting the original "struct ref" directly into our list,
rather than making a copy. This has several problems.

The most minor problem is that one cannot ever free the
resulting list; it contains structs that are copies of the
remote refs (made earlier by fetch_pack) along with sought
refs that are referenced elsewhere.

But more importantly that we set the ref->next pointer to
NULL, chopping off the remainder of any existing list that
the ref was a part of. We get the set of "sought" refs in
an array rather than a linked list, but that array is often
in turn generated from a list.  The test modification in
t5516 demonstrates this. Rather than fetching just an exact
sha1, we fetch that sha1 plus another ref:

  - we build a linked list of refs to fetch when do_fetch
    calls get_ref_map; the exact sha1 is first, followed by
    the named ref ("refs/heads/extra" in this case).

  - we pass that linked list to transport_fetch_ref, which
    squashes it into an array of pointers

  - that array goes to fetch_pack, which calls filter_ref.
    There we generate the want list from a mix of what the
    remote side has advertised, and the "sought" entry for
    the exact sha1. We set the sought entry's "next" pointer
    to NULL.

  - after we return from transport_fetch_refs, we then try
    to update the refs by following the linked list. But our
    list is now truncated, and we do not update
    refs/heads/extra at all.

We can fix this by making a copy of the ref. There's nothing
that fetch_pack does to it that must be reflected in the
original "sought" list (and indeed, if that were the case we
would have a serious bug, because it is only exact-sha1
entries which are treated this way).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofilter_ref: avoid overwriting ref->old_sha1 with garbage
Jeff King [Thu, 19 Mar 2015 20:34:51 +0000 (16:34 -0400)] 
filter_ref: avoid overwriting ref->old_sha1 with garbage

If the server supports allow_tip_sha1_in_want, then
fetch-pack's filter_refs function tries to check whether a
ref is a request for a straight sha1 by running:

  if (get_sha1_hex(ref->name, ref->old_sha1))
  ...

I.e., we are using get_sha1_hex to ask "is this ref name a
sha1?". If it is true, then the contents of ref->old_sha1
will end up unchanged. But if it is false, then get_sha1_hex
makes no guarantees about what it has written. With a ref
name like "abcdefoo", we would overwrite 3 bytes of
ref->old_sha1 before realizing that it was not a sha1.

This is likely not a problem in practice, as anything in
refs->name (besides a sha1) will start with "refs/", meaning
that we would notice on the first character that there is a
problem. Still, we are making assumptions about the state
left in the output when get_sha1_hex returns an error (e.g.,
it could start from the end of the string, or error check
the values only once they were placed in the output). It's
better to be defensive.

We could just check that we have exactly 40 characters of
sha1. But let's be even more careful and make sure that we
have a 40-char hex refname that matches what is in old_sha1.
This is perhaps overly defensive, but spells out our
assumptions clearly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoclone: drop period from end of die_errno message
Jeff King [Wed, 18 Mar 2015 19:02:01 +0000 (15:02 -0400)] 
clone: drop period from end of die_errno message

We do not usually end our errors with a full stop, but it
looks especially bad when you use die_errno, which adds a
colon, like:

  fatal: could not create work tree dir 'foo'.: No such file or directory

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoclone: initialize atexit cleanup handler earlier
Jeff King [Wed, 18 Mar 2015 18:55:32 +0000 (14:55 -0400)] 
clone: initialize atexit cleanup handler earlier

If clone fails, we generally try to clean up any directories
we've created. We do this by installing an atexit handler,
so that we don't have to manually trigger cleanup. However,
since we install this after touching the filesystem, any
errors between our initial mkdir() and our atexit() call
will result in us leaving a crufty directory around.

We can fix this by moving our atexit() call earlier. It's OK
to do it before the junk_work_tree variable is set, because
remove_junk makes sure the variable is initialized. This
means we "activate" the handler by assigning to the
junk_work_tree variable, which we now bump down to just
after we call mkdir(). We probably do not want to do it
before, because a plausible reason for mkdir() to fail is
EEXIST (i.e., we are racing with another "git init"), and we
would not want to remove their work.

OTOH, this is probably not that big a deal; we will allow
cloning into an empty directory (and skip the mkdir), which
is already racy (i.e., one clone may see the other's empty
dir and start writing into it). Still, it does not hurt to
err on the side of caution here.

Note that writing into junk_work_tree and junk_git_dir after
installing the handler is also technically racy, as we call
our handler on an async signal.  Depending on the platform,
we could see a sheared write to the variables. Traditionally
we have not worried about this, and indeed we already do
this later in the function. If we want to address that, it
can come as a separate topic.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosha1fd_check: die when we cannot open the file
Jeff King [Wed, 18 Mar 2015 06:30:12 +0000 (02:30 -0400)] 
sha1fd_check: die when we cannot open the file

Right now we return a NULL "struct sha1file" if we encounter
an error. However, the sole caller (write_idx_file) does not
check the return value, and will segfault if we hit this
case.

One option would be to handle the error in the caller.
However, there's really nothing for it to do but die. This
code path is hit during "git index-pack --verify"; after we
verify the packfile, we check that the ".idx" we would
generate from it is byte-wise identical to what is on disk.
We hit the error (and segfault) if we can't open the .idx
file (a likely cause of this is that somebody else ran "git
repack -ad" while we were verifying). Since we can't
complete the requested verification, we really have no
choice but to die.

Furthermore, the rest of the sha1fd_* functions simply die
on errors. So if were to open the file successfully, for
example, and then hit a read error, sha1write would call
die() for us. So pushing the die() down into sha1fd_check
keeps the interface consistent.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogrep: fix "--quiet" overwriting current output
Wilhelm Schuermann [Wed, 18 Mar 2015 18:00:13 +0000 (19:00 +0100)] 
grep: fix "--quiet" overwriting current output

When grep is called with the --quiet option, the pager is initialized
despite not being used.  When the pager is "less", anything output by
previous commands and not ended with a newline is overwritten:

    $ echo -n aaa; echo bbb
    aaabbb
    $ echo -n aaa; git grep -q foo; echo bbb
    bbb

This can be worked around, for example, by making sure STDOUT is not a
TTY or more directly by setting git's pager to "cat":

    $ echo -n aaa; git grep -q foo > /dev/null; echo bbb
    aaabbb
    $ echo -n aaa; PAGER=cat git grep -q foo; echo bbb
    aaabbb

But prevent calling the pager in the first place, which would also
save an unnecessary fork().

Signed-off-by: Wilhelm Schuermann <wimschuermann@googlemail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSubmittingPatches: encourage users to use format-patch and send-email
Junio C Hamano [Fri, 13 Mar 2015 07:02:15 +0000 (00:02 -0700)] 
SubmittingPatches: encourage users to use format-patch and send-email

In step "(4) Sending your patches", we instruct users to do an
inline patch, avoid breaking whitespaces, avoid attachments, use
[PATCH v2] for second round, etc., all of which format-patch and
send-email combo know how to do well.

The need was identified by, and the text is based on the work by
Cody Taylor.

Suggested-by: Cody Taylor <cody.taylor@maternityneighborhood.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit prompt: use toplevel to find untracked files
Cody A Taylor [Fri, 13 Mar 2015 02:24:50 +0000 (19:24 -0700)] 
git prompt: use toplevel to find untracked files

The __git_ps1() prompt function would not show an untracked state
when all the untracked files are outside the current working
directory.

Signed-off-by: Cody A Taylor <codemister99@yahoo.com>
Helped-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agocontrib/completion: escape the forward slash in __git_match_ctag
John Szakmeister [Sat, 14 Mar 2015 13:40:39 +0000 (09:40 -0400)] 
contrib/completion: escape the forward slash in __git_match_ctag

The current definition results in an incorrect expansion of the term under zsh.
For instance "/^${1////\\/}/" under zsh with the argument "hi" results in:
    /^/\/h/\/i/

This results in an output similar to this when trying to complete `git grep
chartab` under zsh:

    :: git grep chartabawk: cmd. line:1: /^/\/c/\/h/\/a/\/r/\/t/\/a/\/b/ { print $1 }
    awk: cmd. line:1:    ^ backslash not last character on line
    awk: cmd. line:1: /^/\/c/\/h/\/a/\/r/\/t/\/a/\/b/ { print $1 }
    awk: cmd. line:1:    ^ syntax error

Leaving the prompt in a goofy state until the user hits a key.

Escaping the literal / in the parameter expansion (using "/^${1//\//\\/}/")
results in:
    /^chartab/

allowing the completion to work correctly.

This formulation also works under bash.

Signed-off-by: John Szakmeister <john@szakmeister.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoGit 2.3.3 v2.3.3
Junio C Hamano [Sat, 14 Mar 2015 05:57:25 +0000 (22:57 -0700)] 
Git 2.3.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'mr/doc-clean-f-f' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:56:12 +0000 (22:56 -0700)] 
Merge branch 'mr/doc-clean-f-f' into maint

Documentation update.

* mr/doc-clean-f-f:
  Documentation/git-clean.txt: document that -f may need to be given twice

9 years agoMerge branch 'ak/t5516-typofix' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:56:11 +0000 (22:56 -0700)] 
Merge branch 'ak/t5516-typofix' into maint

* ak/t5516-typofix:
  t5516: correct misspelled pushInsteadOf

9 years agoMerge branch 'jc/diff-test-updates' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:56:09 +0000 (22:56 -0700)] 
Merge branch 'jc/diff-test-updates' into maint

Test clean-up.

* jc/diff-test-updates:
  test_ln_s_add: refresh stat info of fake symbolic links
  t4008: modernise style
  t/diff-lib: check exact object names in compare_diff_raw
  tests: do not borrow from COPYING and README from the real source
  t4010: correct expected object names
  t9300: correct expected object names
  t4008: correct stale comments

9 years agoMerge branch 'jk/diffcore-rename-duplicate' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:56:08 +0000 (22:56 -0700)] 
Merge branch 'jk/diffcore-rename-duplicate' into maint

A corrupt input to "git diff -M" can cause us to segfault.

* jk/diffcore-rename-duplicate:
  diffcore-rename: avoid processing duplicate destinations
  diffcore-rename: split locate_rename_dst into two functions

9 years agoMerge branch 'bw/kwset-use-unsigned' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:56:07 +0000 (22:56 -0700)] 
Merge branch 'bw/kwset-use-unsigned' into maint

The borrowed code in kwset API did not follow our usual convention
to use "unsigned char" to store values that range from 0-255.

* bw/kwset-use-unsigned:
  kwset: use unsigned char to store values with high-bit set

9 years agoMerge branch 'nd/grep-exclude-standard-help-fix' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:56:06 +0000 (22:56 -0700)] 
Merge branch 'nd/grep-exclude-standard-help-fix' into maint

Description given by "grep -h" for its --exclude-standard option
was phrased poorly.

* nd/grep-exclude-standard-help-fix:
  grep: correct help string for --exclude-standard

9 years agoMerge branch 'mg/doc-remote-tags-or-not' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:56:05 +0000 (22:56 -0700)] 
Merge branch 'mg/doc-remote-tags-or-not' into maint

"git remote add" mentioned "--tags" and "--no-tags" and was not
clear that fetch from the remote in the future will use the default
behaviour when neither is given to override it.

* mg/doc-remote-tags-or-not:
  git-remote.txt: describe behavior without --tags and --no-tags

9 years agoMerge branch 'mk/diff-shortstat-dirstat-fix' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:56:04 +0000 (22:56 -0700)] 
Merge branch 'mk/diff-shortstat-dirstat-fix' into maint

"git diff --shortstat --dirstat=changes" showed a dirstat based on
lines that was never asked by the end user in addition to the
dirstat that the user asked for.

* mk/diff-shortstat-dirstat-fix:
  diff --shortstat --dirstat: remove duplicate output

9 years agoMerge branch 'ms/submodule-update-config-doc' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:56:03 +0000 (22:56 -0700)] 
Merge branch 'ms/submodule-update-config-doc' into maint

The interaction between "git submodule update" and the
submodule.*.update configuration was not clearly documented.

* ms/submodule-update-config-doc:
  submodule: improve documentation of update subcommand

9 years agoMerge branch 'jc/apply-beyond-symlink' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:56:02 +0000 (22:56 -0700)] 
Merge branch 'jc/apply-beyond-symlink' into maint

"git apply" was not very careful about reading from, removing,
updating and creating paths outside the working tree (under
--index/--cached) or the current directory (when used as a
replacement for GNU patch).

* jc/apply-beyond-symlink:
  apply: do not touch a file beyond a symbolic link
  apply: do not read from beyond a symbolic link
  apply: do not read from the filesystem under --index
  apply: reject input that touches outside the working area

9 years agoMerge branch 'rs/daemon-interpolate' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:56:00 +0000 (22:56 -0700)] 
Merge branch 'rs/daemon-interpolate' into maint

"git daemon" looked up the hostname even when "%CH" and "%IP"
interpolations are not requested, which was unnecessary.

* rs/daemon-interpolate:
  daemon: use callback to build interpolated path
  daemon: look up client-supplied hostname lazily

9 years agoMerge branch 'jk/daemon-interpolate' into maint
Junio C Hamano [Sat, 14 Mar 2015 05:55:59 +0000 (22:55 -0700)] 
Merge branch 'jk/daemon-interpolate' into maint

The "interpolated-path" option of "git daemon" inserted any string
client declared on the "host=" capability request without checking.
Sanitize and limit %H and %CH to a saner and a valid DNS name.

* jk/daemon-interpolate:
  daemon: sanitize incoming virtual hostname
  t5570: test git-daemon's --interpolated-path option
  git_connect: let user override virtual-host we send to daemon

9 years agoupload-pack: do not check NULL return of lookup_unknown_object
Jeff King [Fri, 13 Mar 2015 04:42:25 +0000 (00:42 -0400)] 
upload-pack: do not check NULL return of lookup_unknown_object

We check whether the return value of lookup_unknown_object
is NULL, but some code paths dereference it before our
check. This turns out not to be capable of causing a
segfault, though. The lookup_unknown_object function will
never return NULL, since the whole point is to allocate an
object struct if it does not find an existing one. So the
code here is not wrong, it is just confusing. Let's just
drop the NULL check.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoupload-pack: fix transfer.hiderefs over smart-http
Jeff King [Fri, 13 Mar 2015 04:42:12 +0000 (00:42 -0400)] 
upload-pack: fix transfer.hiderefs over smart-http

When upload-pack advertises the refs (either for a normal,
non-stateless request, or for the initial contact in a
stateless one), we call for_each_ref with the send_ref
function as its callback. send_ref, in turn, calls
mark_our_ref, which checks whether the ref is hidden, and
sets OUR_REF or HIDDEN_REF on the object as appropriate.  If
it is hidden, mark_our_ref also returns "1" to signal
send_ref that the ref should not be advertised.

If we are not advertising refs, (i.e., the follow-up
invocation by an http client to send its "want" lines), we
use mark_our_ref directly as a callback to for_each_ref. Its
marking does the right thing, but when it then returns "1"
to for_each_ref, the latter interprets this as an error and
stops iterating. As a result, we skip marking all of the
refs that come lexicographically after it. Any "want" lines
from the client asking for those objects will fail, as they
were not properly marked with OUR_REF.

To solve this, we introduce a wrapper callback around
mark_our_ref which always returns 0 (even if the ref is
hidden, we want to keep iterating). We also tweak the
signature of mark_our_ref to exclude unnecessary parameters
that were present only to conform to the callback interface.
This should make it less likely for somebody to accidentally
use it as a callback in the future.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agotag: fix some mis-organized options in "-h" listing
Jeff King [Thu, 12 Mar 2015 18:15:09 +0000 (14:15 -0400)] 
tag: fix some mis-organized options in "-h" listing

Running "git tag -h" currently prints:

  [...]
  Tag creation options
      [...]
      --column[=<style>]    show tag list in columns
      --sort <type>         sort tags

  Tag listing options
      --contains <commit>   print only tags that contain the commit
      --points-at <object>  print only tags of the object

The "--column" and "--sort" options should go under the "Tag listing" group.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agouse isxdigit() for checking if a character is a hexadecimal digit
René Scharfe [Mon, 9 Mar 2015 22:46:54 +0000 (23:46 +0100)] 
use isxdigit() for checking if a character is a hexadecimal digit

Use the standard function isxdigit() to make the intent clearer and
avoid using magic constants.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoconfig,completion: add color.status.unmerged
Michael J Gruber [Tue, 10 Mar 2015 16:11:09 +0000 (17:11 +0100)] 
config,completion: add color.status.unmerged

Reported-by: "Mladen B." <mladen074@gmail.com>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot7510: do not fail when gpg warns about insecure memory
Kyle J. McKay [Mon, 9 Mar 2015 20:03:01 +0000 (13:03 -0700)] 
t7510: do not fail when gpg warns about insecure memory

Depending on how gpg was built, it may issue the following
message to stderr when run:

  Warning: using insecure memory!

When the test is collecting gpg output it is therefore not
enough to just match on a "gpg: " prefix it must also match
on a "Warning: " prefix wherever it needs to match lines
that have been produced by gpg.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Acked-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoimap-send: use cURL automatically when NO_OPENSSL defined
Kyle J. McKay [Sun, 8 Mar 2015 05:13:55 +0000 (21:13 -0800)] 
imap-send: use cURL automatically when NO_OPENSSL defined

If both USE_CURL_FOR_IMAP_SEND and NO_OPENSSL are defined do
not force the user to add --curl to get a working git imap-send
command.

Instead automatically select --curl and warn and ignore the
--no-curl option.  And while we're in there, correct the
warning message when --curl is requested but not supported.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit: treat "git -C '<path>'" as a no-op when <path> is empty
Karthik Nayak [Fri, 6 Mar 2015 11:18:08 +0000 (16:48 +0530)] 
git: treat "git -C '<path>'" as a no-op when <path> is empty

'git -C ""' unhelpfully dies with error "Cannot change to ''",
whereas the shell treats `cd ""' as a no-op.  Taking the shell's
behavior as a precedent, teach git to treat `-C ""' as a no-op, as
well.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoGit 2.3.2 v2.3.2
Junio C Hamano [Fri, 6 Mar 2015 22:58:14 +0000 (14:58 -0800)] 
Git 2.3.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'rj/no-xopen-source-for-cygwin' into maint
Junio C Hamano [Fri, 6 Mar 2015 22:57:58 +0000 (14:57 -0800)] 
Merge branch 'rj/no-xopen-source-for-cygwin' into maint

Code cleanups.

* rj/no-xopen-source-for-cygwin:
  git-compat-util.h: remove redundant code

9 years agoMerge branch 'rs/simple-cleanups' into maint
Junio C Hamano [Fri, 6 Mar 2015 22:57:57 +0000 (14:57 -0800)] 
Merge branch 'rs/simple-cleanups' into maint

Code cleanups.

* rs/simple-cleanups:
  sha1_name: use strlcpy() to copy strings
  pretty: use starts_with() to check for a prefix
  for-each-ref: use skip_prefix() to avoid duplicate string comparison
  connect: use strcmp() for string comparison

9 years agoMerge branch 'mm/am-c-doc' into maint
Junio C Hamano [Fri, 6 Mar 2015 22:57:56 +0000 (14:57 -0800)] 
Merge branch 'mm/am-c-doc' into maint

The configuration variable 'mailinfo.scissors' was hard to
discover in the documentation.

* mm/am-c-doc:
  Documentation/git-am.txt: mention mailinfo.scissors config variable
  Documentation/config.txt: document mailinfo.scissors

9 years agoMerge branch 'ew/svn-maint-fixes' into maint
Junio C Hamano [Fri, 6 Mar 2015 22:57:55 +0000 (14:57 -0800)] 
Merge branch 'ew/svn-maint-fixes' into maint

Correct a breakage to git-svn around v2.2 era that triggers
premature closing of FileHandle.

* ew/svn-maint-fixes:
  Git::SVN::*: avoid premature FileHandle closure
  git-svn: fix localtime=true on non-glibc environments

9 years agoMerge branch 'km/send-email-getopt-long-workarounds' into maint
Junio C Hamano [Fri, 6 Mar 2015 22:57:54 +0000 (14:57 -0800)] 
Merge branch 'km/send-email-getopt-long-workarounds' into maint

Even though we officially haven't dropped Perl 5.8 support, the
Getopt::Long package that came with it does not support "--no-"
prefix to negate a boolean option; manually add support to help
people with older Getopt::Long package.

* km/send-email-getopt-long-workarounds:
  git-send-email.perl: support no- prefix with older GetOptions

9 years agocompletion: simplify __git_remotes()
SZEDER Gábor [Wed, 4 Mar 2015 14:10:29 +0000 (15:10 +0100)] 
completion: simplify __git_remotes()

The __git_remotes() helper function lists the remotes from the config
file by processing the output of a 'git config' query.  A simple 'git
remote' produces the exact same output, so run that instead.

Remotes under '$GIT_DIR/remotes' are still listed by running 'ls -1',
because 'git remote' unfortunately ignores them.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agocompletion: add a test for __git_remotes() helper function
SZEDER Gábor [Wed, 4 Mar 2015 14:10:28 +0000 (15:10 +0100)] 
completion: add a test for __git_remotes() helper function

The test checks that both remotes under '$GIT_DIR/remotes' and remotes
in the config file are listed.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agorebase-interactive: re-word "item count" comment
Eric Sunshine [Wed, 4 Mar 2015 07:53:05 +0000 (02:53 -0500)] 
rebase-interactive: re-word "item count" comment

97f05f43 (Show number of TODO items for interactive rebase, 2014-12-10)
taught rebase-interactive to display an item count in the instruction
list comments:

    # Rebase 46640c6..5568fd5 onto 46640c6 (4 TODO item(s))
    #
    # Commands:
    # p, pick = use commit
    # ...

However, with the exception of the --edit-todo option, "TODO" is a
one-off term, never presented to the user by rebase-interactive in
any other context. The item count is in fact the number of commands
("pick", "edit", etc.) remaining on the instruction sheet, and the
comment immediately following it talks about "Commands". Consequently,
replace "(# TODO item(s))" with the more accurate and meaningful
"(# command(s))".

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agorebase-interactive: suppress whitespace preceding item count
Eric Sunshine [Wed, 4 Mar 2015 07:53:04 +0000 (02:53 -0500)] 
rebase-interactive: suppress whitespace preceding item count

97f05f43 (Show number of TODO items for interactive rebase, 2014-12-10)
taught rebase-interactive to compute an item count with 'wc -l' and
display it in the instruction list comments:

    # Rebase 46640c6..5568fd5 onto 46640c6 (4 TODO item(s))

On Mac OS X, however, it renders as:

    # Rebase 46640c6..5568fd5 onto 46640c6 (       4 TODO item(s))

since 'wc -l' indents its output with leading spaces. Fix this.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit: make was_alias and done_help non-static
Alexander Kuleshov [Mon, 2 Mar 2015 12:02:37 +0000 (18:02 +0600)] 
git: make was_alias and done_help non-static

'was_alias' variable does not need to store it's value on each
iteration in the loop; this variable gets assigned the result
of run_argv() every time in the loop before being used.

'done_help' variable does not need to be static variable too if
we move it out the loop.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agozlib: initialize git_zstream in git_deflate_init{,_gzip,_raw}
René Scharfe [Thu, 5 Mar 2015 22:49:46 +0000 (23:49 +0100)] 
zlib: initialize git_zstream in git_deflate_init{,_gzip,_raw}

Clear the git_zstream variable at the start of git_deflate_init() etc.
so that callers don't have to do that.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>