OSDN Git Service

git-core/git.git
11 years agoGit 1.7.11.6 v1.7.11.6
Junio C Hamano [Tue, 11 Sep 2012 18:18:48 +0000 (11:18 -0700)]
Git 1.7.11.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jc/maint-mergetool-style-fix' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 18:10:23 +0000 (11:10 -0700)]
Merge branch 'jc/maint-mergetool-style-fix' into maint-1.7.11

* jc/maint-mergetool-style-fix:
  mergetool: style fixes

11 years agoMerge branch 'sz/submodule-force-update' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 18:10:17 +0000 (11:10 -0700)]
Merge branch 'sz/submodule-force-update' into maint-1.7.11

* sz/submodule-force-update:
  Make 'git submodule update --force' always check out submodules.

11 years agoMerge branch 'ph/stash-rerere' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 18:10:12 +0000 (11:10 -0700)]
Merge branch 'ph/stash-rerere' into maint-1.7.11

* ph/stash-rerere:
  stash: invoke rerere in case of conflict
  test: git-stash conflict sets up rerere

11 years agoMerge branch 'jc/maint-sane-execvp-notdir' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 18:09:19 +0000 (11:09 -0700)]
Merge branch 'jc/maint-sane-execvp-notdir' into maint-1.7.11

* jc/maint-sane-execvp-notdir:
  sane_execvp(): ignore non-directory on $PATH

11 years agoMerge branch 'jc/maint-config-exit-status' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 18:09:09 +0000 (11:09 -0700)]
Merge branch 'jc/maint-config-exit-status' into maint-1.7.11

* jc/maint-config-exit-status:
  config: "git config baa" should exit with status 1

11 years agoMerge branch 'mh/maint-config-doc-proxy-command' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 18:09:01 +0000 (11:09 -0700)]
Merge branch 'mh/maint-config-doc-proxy-command' into maint-1.7.11

* mh/maint-config-doc-proxy-command:
  git-config doc: unconfuse an example
  git-config.txt: fix example

11 years agoMerge branch 'hv/submodule-path-unmatch' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 18:08:55 +0000 (11:08 -0700)]
Merge branch 'hv/submodule-path-unmatch' into maint-1.7.11

* hv/submodule-path-unmatch:
  Let submodule command exit with error status if path does not exist

11 years agoMerge branch 'mz/empty-rebase-test' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 18:08:48 +0000 (11:08 -0700)]
Merge branch 'mz/empty-rebase-test' into maint-1.7.11

* mz/empty-rebase-test:
  add tests for 'git rebase --keep-empty'

11 years agoMerge branch 'jk/docs-docbook-monospace-display' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 18:08:40 +0000 (11:08 -0700)]
Merge branch 'jk/docs-docbook-monospace-display' into maint-1.7.11

* jk/docs-docbook-monospace-display:
  docs: monospace listings in docbook output

11 years agoMerge branch 'ab/diff-write-incomplete-line' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 18:08:30 +0000 (11:08 -0700)]
Merge branch 'ab/diff-write-incomplete-line' into maint-1.7.11

* ab/diff-write-incomplete-line:
  Fix '\ No newline...' annotation in rewrite diffs

11 years agoMerge branch 'jc/maint-t7406-rev-parse-max-count-huh' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 18:08:18 +0000 (11:08 -0700)]
Merge branch 'jc/maint-t7406-rev-parse-max-count-huh' into maint-1.7.11

* jc/maint-t7406-rev-parse-max-count-huh:
  t7406: fix misleading "rev-parse --max-count=1 HEAD"

11 years agoMerge branch 'tr/void-diff-setup-done' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 17:53:40 +0000 (10:53 -0700)]
Merge branch 'tr/void-diff-setup-done' into maint-1.7.11

* tr/void-diff-setup-done:
  diff_setup_done(): return void

11 years agoMerge branch 'tr/merge-recursive-flush' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 17:53:31 +0000 (10:53 -0700)]
Merge branch 'tr/merge-recursive-flush' into maint-1.7.11

* tr/merge-recursive-flush:
  merge-recursive: eliminate flush_buffer() in favor of write_in_full()

11 years agoMerge branch 'nd/index-errno' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 17:53:21 +0000 (10:53 -0700)]
Merge branch 'nd/index-errno' into maint-1.7.11

* nd/index-errno:
  read_index_from: remove bogus errno assignments

11 years agoMerge branch 'pg/maint-apply-remove-unused-variable' into maint-1.7.11
Junio C Hamano [Tue, 11 Sep 2012 17:53:11 +0000 (10:53 -0700)]
Merge branch 'pg/maint-apply-remove-unused-variable' into maint-1.7.11

* pg/maint-apply-remove-unused-variable:
  apply: delete unused deflate_origlen from patch struct

11 years agoAlmost 1.7.11.6
Junio C Hamano [Mon, 10 Sep 2012 22:30:46 +0000 (15:30 -0700)]
Almost 1.7.11.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'mg/rebase-i-onto-reflog-in-full' into maint-1.7.11
Junio C Hamano [Mon, 10 Sep 2012 22:26:03 +0000 (15:26 -0700)]
Merge branch 'mg/rebase-i-onto-reflog-in-full' into maint-1.7.11

The reflog entries left by "git rebase" and "git rebase -i" were
inconsistent (the interactive one gave an abbreviated object name).

* mg/rebase-i-onto-reflog-in-full:
  rebase -i: use full onto sha1 in reflog

11 years agoMerge branch 'jc/maint-protect-sh-from-ifs' into maint-1.7.11
Junio C Hamano [Mon, 10 Sep 2012 22:25:45 +0000 (15:25 -0700)]
Merge branch 'jc/maint-protect-sh-from-ifs' into maint-1.7.11

When the user exports a non-default IFS without HT, scripts that
rely on being able to parse "ls-files -s | while read a b c..."
start to fail.  Protect them from such a misconfiguration.

* jc/maint-protect-sh-from-ifs:
  sh-setup: protect from exported IFS

11 years agoMerge branch 'bc/receive-pack-stdout-protection' into maint-1.7.11
Junio C Hamano [Mon, 10 Sep 2012 22:25:09 +0000 (15:25 -0700)]
Merge branch 'bc/receive-pack-stdout-protection' into maint-1.7.11

When "git push" triggered the automatic gc on the receiving end, a
message from "git prune" that said it was removing cruft leaked to
the standard output, breaking the communication protocol.

* bc/receive-pack-stdout-protection:
  receive-pack: do not leak output from auto-gc to standard output
  t/t5400: demonstrate breakage caused by informational message from prune

11 years agoMerge branch 'jk/maint-null-in-trees' into maint-1.7.11
Junio C Hamano [Mon, 10 Sep 2012 22:24:53 +0000 (15:24 -0700)]
Merge branch 'jk/maint-null-in-trees' into maint-1.7.11

"git diff" had a confusion between taking data from a path in the
working tree and taking data from an object that happens to have
name 0{40} recorded in a tree.

* jk/maint-null-in-trees:
  fsck: detect null sha1 in tree entries
  do not write null sha1s to on-disk index
  diff: do not use null sha1 as a sentinel value

11 years agoMerge branch 'tr/maint-send-email-2047' into maint-1.7.11
Junio C Hamano [Mon, 10 Sep 2012 22:24:40 +0000 (15:24 -0700)]
Merge branch 'tr/maint-send-email-2047' into maint-1.7.11

"git send-email" did not unquote encoded words that appear on the
header correctly, and lost "_" from strings.

* tr/maint-send-email-2047:
  send-email: improve RFC2047 quote parsing

11 years agoMerge branch 'mm/die-with-dashdash-help' into maint-1.7.11
Junio C Hamano [Mon, 10 Sep 2012 22:24:21 +0000 (15:24 -0700)]
Merge branch 'mm/die-with-dashdash-help' into maint-1.7.11

When the user gives an argument that can be taken as both a
revision name and a pathname without disambiguating with "--", we
used to give a help message "Use '--' to separate".  The message
has been clarified to show where that '--' goes on the command
line.

* mm/die-with-dashdash-help:
  setup: clarify error messages for file/revisions ambiguity

11 years agoMerge branch 'js/gitweb-path-info-unquote' into maint-1.7.11
Junio C Hamano [Mon, 10 Sep 2012 22:23:46 +0000 (15:23 -0700)]
Merge branch 'js/gitweb-path-info-unquote' into maint-1.7.11

"gitweb" when used with PATH_INFO failed to notice directories with
SP (and other characters that need URL-style quoting) in them.

* js/gitweb-path-info-unquote:
  gitweb: URL-decode $my_url/$my_uri when stripping PATH_INFO

11 years agoPrepare for 1.7.11.6
Junio C Hamano [Fri, 24 Aug 2012 19:33:31 +0000 (12:33 -0700)]
Prepare for 1.7.11.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'mv/pull-r-for-rebase' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:47 +0000 (12:05 -0700)]
Merge branch 'mv/pull-r-for-rebase' into maint-1.7.11

A minor documentation update.

* mv/pull-r-for-rebase:
  man: git pull -r is a short for --rebase

11 years agoMerge branch 'jc/maint-abbrev-option-cli' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:44 +0000 (12:05 -0700)]
Merge branch 'jc/maint-abbrev-option-cli' into maint-1.7.11

We did not document that many commands take unique prefix
abbreviations of long options (e.g. "--option" may be the only flag
that the command accepts that begin with "--opt", in which case you
can give "--opt") anywhere easy to find for new people.

* jc/maint-abbrev-option-cli:
  gitcli: describe abbreviation of long options

11 years agoMerge branch 'jc/maint-rev-list-topo-doc' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:40 +0000 (12:05 -0700)]
Merge branch 'jc/maint-rev-list-topo-doc' into maint-1.7.11

It was unclear what "--topo-order" was really about in the
documentation. It is not just about "children before parent", but
also about "don't mix lineages".

* jc/maint-rev-list-topo-doc:
  rev-list docs: clarify --topo-order description

11 years agoMerge branch 'hv/coding-guidelines' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:35 +0000 (12:05 -0700)]
Merge branch 'hv/coding-guidelines' into maint-1.7.11

In earlier days, "imitate the style in the neibouring code" was
sufficient to keep the coherent style, but over time some parts of
the codebase have drifted enough to make it ineffective.

* hv/coding-guidelines:
  Documentation/CodingGuidelines: spell out more shell guidelines

11 years agoMerge branch 'jc/tag-doc' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:30 +0000 (12:05 -0700)]
Merge branch 'jc/tag-doc' into maint-1.7.11

Our documentation used to assume having files in .git/refs/*
directories was the only to have branches and tags, but that is not
true for quite some time.

* jc/tag-doc:
  Documentation: do not mention .git/refs/* directories

11 years agoMerge branch 'mk/test-seq' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:24 +0000 (12:05 -0700)]
Merge branch 'mk/test-seq' into maint-1.7.11

Add a compatibility/utility function to the test framework.

* mk/test-seq:
  tests: Introduce test_seq

11 years agoMerge branch 'lp/no-cmd-http-fetch' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:19 +0000 (12:05 -0700)]
Merge branch 'lp/no-cmd-http-fetch' into maint-1.7.11

* lp/no-cmd-http-fetch:
  builtin.h: remove unused cmd_<foo> declarations

11 years agoMerge branch 'bw/maint-1.7.9-solaris-getpass' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:11 +0000 (12:05 -0700)]
Merge branch 'bw/maint-1.7.9-solaris-getpass' into maint-1.7.11

* bw/maint-1.7.9-solaris-getpass:
  Enable HAVE_DEV_TTY for Solaris
  terminal: seek when switching between reading and writing

11 years agoMerge branch 'jk/maint-commit-check-committer-early' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:08 +0000 (12:05 -0700)]
Merge branch 'jk/maint-commit-check-committer-early' into maint-1.7.11

* jk/maint-commit-check-committer-early:
  commit: check committer identity more strictly

11 years agoMake 'git submodule update --force' always check out submodules.
Stefan Zager [Wed, 25 Jul 2012 17:41:54 +0000 (10:41 -0700)]
Make 'git submodule update --force' always check out submodules.

Currently, it will only do a checkout if the sha1 registered in the containing
repository doesn't match the HEAD of the submodule, regardless of whether the
submodule is dirty.  As discussed on the mailing list, the '--force' flag is a
strong indicator that the state of the submodule is suspect, and should be reset
to HEAD.

Signed-off-by: Stefan Zager <szager@google.com>
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomergetool: style fixes
Junio C Hamano [Thu, 23 Aug 2012 05:33:15 +0000 (22:33 -0700)]
mergetool: style fixes

This script is one of the sizeable ones that tempted people to copy
its "neibouring style" in their new code, but was littered with
styles incompatible with our style guide.

 - use one tab, not four spaces, per indent level;

 - long lines can be wrapped after '|', '&&', or '||' for
   readability.

 - structures like "if .. then .. else .. fi", "while .. do .. done"
   are split into lines in such a way that does not require
   unnecessary semicolon.

 - case, esac and case-arms align at the same column.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMake the ciabot scripts completely self-configuring in the normal case.
Eric S. Raymond [Thu, 23 Aug 2012 05:21:53 +0000 (01:21 -0400)]
Make the ciabot scripts completely self-configuring in the normal case.

Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoImproved documentation for the ciabot scripts.
Eric S. Raymond [Thu, 23 Aug 2012 04:10:53 +0000 (00:10 -0400)]
Improved documentation for the ciabot scripts.

Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocontrib/ciabot: Get ciabot configuration from git variables
Eric S. Raymond [Wed, 22 Aug 2012 10:52:30 +0000 (06:52 -0400)]
contrib/ciabot: Get ciabot configuration from git variables

These changes remove all need to modify the ciabot scripts for installation.
Instead, per-project configuration can be dome via variables in a [ciabot]
section of the config file.

Also, correct for the new server address.

Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-config doc: unconfuse an example
Junio C Hamano [Sat, 18 Aug 2012 23:35:09 +0000 (16:35 -0700)]
git-config doc: unconfuse an example

One fictitious command "proxy-command" is enclosed inside a double
quote pair, while another fictitious command "default-proxy" is not
in the example, but the quoting does not change anything in the pair
of examples.  Remove the quotes to avoid unnecessary confusion.

Noticed by Michael Haggerty.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-config.txt: fix example
Michael Haggerty [Sat, 18 Aug 2012 17:32:10 +0000 (19:32 +0200)]
git-config.txt: fix example

The "--add" option is required to add a new value to a multivalued
configuration entry.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agostash: invoke rerere in case of conflict
Phil Hord [Tue, 10 Jul 2012 22:52:28 +0000 (18:52 -0400)]
stash: invoke rerere in case of conflict

"stash apply" directly calls a backend merge function which does not
automatically invoke rerere.  This confuses mergetool when leftover
rerere state is left behind from previous merges.

Invoke rerere explicitly when we encounter a conflict during stash
apply.  This turns the test introduced by the previous commit to
succeed.

Signed-off-by: Phil Hord <hordp@cisco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agotest: git-stash conflict sets up rerere
Phil Hord [Tue, 10 Jul 2012 22:52:27 +0000 (18:52 -0400)]
test: git-stash conflict sets up rerere

Add a test to make sure that a conflicted "stash apply" invokes
rerere to record the conflicts and resolve the the files it can
(the current code doesn't, so the test is marked as failing).

Without correct state recorded for rerere, mergetool may be
confused, causing it to think no files have conflicts even though
they do.  This condition is not verified by this test since a
subsequent commit will change the behavior to enable rerere for
stash conflicts.

Also, the next test expected us to finish up with a reset, which is
impossible to do if we fail (as we must) and it's an unreasonable
expectation anyway.  Begin the next test with a reset of its own
instead.

Signed-off-by: Phil Hord <hordp@cisco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoman: git pull -r is a short for --rebase
Miklos Vajna [Thu, 16 Aug 2012 09:50:18 +0000 (11:50 +0200)]
man: git pull -r is a short for --rebase

Letting the "--rebase" option squat on the short-and-sweet single
letter option "-r" was an unintended accident and was not even
documented, but the short option seems to be already used in the
wild. Let's document it so that other options that begin with "r"
would not be tempted to steal it.

Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogitcli: describe abbreviation of long options
Junio C Hamano [Fri, 17 Aug 2012 06:16:22 +0000 (23:16 -0700)]
gitcli: describe abbreviation of long options

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoGit 1.7.11.5 v1.7.11.5
Junio C Hamano [Wed, 15 Aug 2012 20:39:53 +0000 (13:39 -0700)]
Git 1.7.11.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'rj/maint-grep-remove-redundant-test' into maint
Junio C Hamano [Wed, 15 Aug 2012 20:37:20 +0000 (13:37 -0700)]
Merge branch 'rj/maint-grep-remove-redundant-test' into maint

* rj/maint-grep-remove-redundant-test:
  t7810-*.sh: Remove redundant test

11 years agoMerge branch 'hv/link-alt-odb-entry' into maint
Junio C Hamano [Wed, 15 Aug 2012 20:36:47 +0000 (13:36 -0700)]
Merge branch 'hv/link-alt-odb-entry' into maint

* hv/link-alt-odb-entry:
  link_alt_odb_entry: fix read over array bounds reported by valgrind

11 years agorev-list docs: clarify --topo-order description
Junio C Hamano [Wed, 15 Aug 2012 20:02:48 +0000 (13:02 -0700)]
rev-list docs: clarify --topo-order description

It was unclear what "--topo-order" was really about in the
documentation.  It is not just about "children before parent", but
also about "don't mix lineages".

Reword the description for both "--date-order" and "--topo-order",
and add an illustration to it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogitweb: URL-decode $my_url/$my_uri when stripping PATH_INFO
Jay Soffian [Thu, 9 Aug 2012 02:29:26 +0000 (22:29 -0400)]
gitweb: URL-decode $my_url/$my_uri when stripping PATH_INFO

When gitweb is used as a DirectoryIndex, it attempts to strip
PATH_INFO on its own, as $cgi->url() fails to do so.

However, it fails to account for the fact that PATH_INFO has
already been URL-decoded by the web server, but the value
returned by $cgi->url() has not been. This causes the stripping
to fail whenever the URL contains encoded characters.

To see this in action, setup gitweb as a DirectoryIndex and
then use it on a repository with a directory containing a
space in the name. Navigate to tree view, examine the gitweb
generated html and you'll see a link such as:

  <a href="/test.git/tree/HEAD:/directory with spaces">directory with spaces</a>

When clicked on, the browser will URL-encode this link, giving
a $cgi->url() of the form:

   /test.git/tree/HEAD:/directory%20with%20spaces

While PATH_INFO is:

   /test.git/tree/HEAD:/directory with spaces

Fix this by calling unescape() on both $my_url and $my_uri before
stripping PATH_INFO from them.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoDocumentation/CodingGuidelines: spell out more shell guidelines
Heiko Voigt [Wed, 15 Aug 2012 17:06:01 +0000 (19:06 +0200)]
Documentation/CodingGuidelines: spell out more shell guidelines

In earlier days, "imitate the style in the neibouring code" was
sufficient to keep the coherent style, but over time some parts of
the codebase have drifted enough to make it ineffective.

Spell some of the guidelines out.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoLet submodule command exit with error status if path does not exist
Heiko Voigt [Tue, 14 Aug 2012 20:35:27 +0000 (22:35 +0200)]
Let submodule command exit with error status if path does not exist

Various subcommands of the "git submodule" command exited with 0
status even though the path given by the user did not exist.

The reason behind that was that they all pipe the output of
module_list into the while loop which then does the action on the
paths specified by the commandline. Since the exit code of the
command on the upstream side of the pipe is ignored by the shell,
the status code of "ls-files --error-unmatch" nor "module_list" was
not propagated.

In case ls-files returns with an error code, we write a special
string that is not possible in non error situations, and no other
output, so that the downstream can detect the error and die with an
error code.

The error message that there is an unmatched pathspec comes through
stderr directly from ls-files. So the user still gets a hint whats going
on.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorebase -i: use full onto sha1 in reflog
Michael J Gruber [Fri, 10 Aug 2012 06:51:19 +0000 (08:51 +0200)]
rebase -i: use full onto sha1 in reflog

'git rebase' uses the full onto sha1 for the reflog message whereas 'git
rebase -i' uses the short sha1. This is not only inconsistent, but can
lead to problems when the reflog is inspected at a later time at which
that abbreviation may have become ambiguous.

Make 'rebase -i' use the full onto sha1, as well.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoadd tests for 'git rebase --keep-empty'
Martin von Zweigbergk [Thu, 9 Aug 2012 15:39:51 +0000 (08:39 -0700)]
add tests for 'git rebase --keep-empty'

Add test cases for 'git rebase --keep-empty' with and without an
"empty" commit already in upstream. The empty commit that is about to
be rebased should be kept in both cases.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosh-setup: protect from exported IFS
Junio C Hamano [Wed, 8 Aug 2012 19:08:17 +0000 (12:08 -0700)]
sh-setup: protect from exported IFS

Many scripted Porcelains rely on being able to split words at the
default $IFS characters, i.e. SP, HT and LF.  If the user exports a
non-default IFS to the environment, what they read from plumbing
commands such as ls-files that use HT to delimit fields may not be
split in the way we expect.

Protect outselves by resetting it, just like we do so against CDPATH
exported to the environment.

Noticed by Andrew Dranse <adranse@oanda.com>.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodocs: monospace listings in docbook output
Jeff King [Tue, 7 Aug 2012 20:07:38 +0000 (16:07 -0400)]
docs: monospace listings in docbook output

When asciidoc converts a listing block like:

----------------------
$ git log --merge
----------------------

it marks it to be displayed in a monospace font. This works
fine when generating HTML output. However, when generating
docbook output, we override the expansion of a listingblock
to work around bugs in some versions of the docbook
toolchain. Our override did not mark the listingblock with
the "monospaced" class.

The main output that uses docbook as an intermediate format
is the manpages. We didn't notice any issue there because
the monospaced class seems to be ignored when generating
roff from the docbook manpages.

However, when generating texinfo to make info pages, docbook
does respect this class. The resulting texinfo output
properly uses "@example" blocks to display the listing in
this case. Besides possibly looking prettier in some texinfo
backends,  one important effect is that the monospace font
suppresses texinfo's expansion of "--" and "---" into
en-dashes and em-dashes.  With the current code, the example
above ends up looking like "git log -merge", which is
confusing and wrong.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoreceive-pack: do not leak output from auto-gc to standard output
Junio C Hamano [Tue, 7 Aug 2012 05:31:10 +0000 (22:31 -0700)]
receive-pack: do not leak output from auto-gc to standard output

The standard output channel of receive-pack is a structured protocol
channel, and subprocesses must never be allowed to leak anything
into it by writing to their standard output.

Use RUN_COMMAND_STDOUT_TO_STDERR option to run_command_v_opt() just
like we do when running hooks to prevent output from "gc" leaking to
the standard output.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot/t5400: demonstrate breakage caused by informational message from prune
Brandon Casey [Tue, 7 Aug 2012 05:01:48 +0000 (22:01 -0700)]
t/t5400: demonstrate breakage caused by informational message from prune

When receive-pack triggers 'git gc --auto' and 'git prune' is called to
remove a stale temporary object, 'git prune' prints an informational
message to stdout about the file that it will remove.  Since this message
is written to stdout, it is sent back over the transport channel to the git
client which tries to interpret it as part of the pack protocol and then
promptly terminates with a complaint about a protocol error.

Introduce a test which exercises the auto-gc functionality of receive-pack
and demonstrates this breakage.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoEnable HAVE_DEV_TTY for Solaris
Ben Walton [Tue, 7 Aug 2012 03:07:42 +0000 (23:07 -0400)]
Enable HAVE_DEV_TTY for Solaris

Now that git_terminal_prompt can cleanly interact with /dev/tty on
Solaris, enable HAVE_DEV_TTY so that this code path is used for
credential reading instead of relying on the crippled getpass().

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoterminal: seek when switching between reading and writing
Jeff King [Tue, 7 Aug 2012 04:10:26 +0000 (00:10 -0400)]
terminal: seek when switching between reading and writing

When a stdio stream is opened in update mode (e.g., "w+"),
the C standard forbids switching between reading or writing
without an intervening positioning function. Many
implementations are lenient about this, but Solaris libc
will flush the recently-read contents to the output buffer.
In this instance, that meant writing the non-echoed password
that the user just typed to the terminal.

Fix it by inserting a no-op fseek between the read and
write.

The opposite direction (writing followed by reading) is also
disallowed, but our intervening fflush is an acceptable
positioning function for that alternative.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoPrepare for 1.7.11.5
Junio C Hamano [Mon, 6 Aug 2012 22:51:58 +0000 (15:51 -0700)]
Prepare for 1.7.11.5

Hopefully that will be the final 1.7.11.x maintenance release.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jn/block-sha1' into maint
Junio C Hamano [Mon, 6 Aug 2012 22:40:00 +0000 (15:40 -0700)]
Merge branch 'jn/block-sha1' into maint

* jn/block-sha1:
  Makefile: BLK_SHA1 does not require fast htonl() and unaligned loads
  block-sha1: put expanded macro parameters in parentheses
  block-sha1: avoid pointer conversion that violates alignment constraints

11 years agoMerge branch 'jn/make-assembly-in-right-directory' into maint
Junio C Hamano [Mon, 6 Aug 2012 22:39:38 +0000 (15:39 -0700)]
Merge branch 'jn/make-assembly-in-right-directory' into maint

* jn/make-assembly-in-right-directory:
  Makefile: fix location of listing produced by "make subdir/foo.s"

11 years agoMerge branch 'ms/daemon-doc-typo' into maint
Junio C Hamano [Mon, 6 Aug 2012 22:39:16 +0000 (15:39 -0700)]
Merge branch 'ms/daemon-doc-typo' into maint

* ms/daemon-doc-typo:
  Documentation/git-daemon: add missing word

11 years agoMerge branch 'lm/git-blame-el' into maint
Junio C Hamano [Mon, 6 Aug 2012 22:37:54 +0000 (15:37 -0700)]
Merge branch 'lm/git-blame-el' into maint

* lm/git-blame-el:
  git-blame.el: Do not use bare 0 to mean (point-min)
  git-blame.el: Use with-current-buffer where appropriate
  git-blame.el: Do not use goto-line in lisp code

11 years agoMerge branch 'rs/ipv6-ssh-url' into maint
Junio C Hamano [Mon, 6 Aug 2012 22:37:43 +0000 (15:37 -0700)]
Merge branch 'rs/ipv6-ssh-url' into maint

* rs/ipv6-ssh-url:
  git: Wrong parsing of ssh urls with IPv6 literals ignores port

11 years agoMerge branch 'rs/git-blame-mapcar-mapc' into maint
Junio C Hamano [Mon, 6 Aug 2012 22:37:28 +0000 (15:37 -0700)]
Merge branch 'rs/git-blame-mapcar-mapc' into maint

* rs/git-blame-mapcar-mapc:
  git-blame.el: use mapc instead of mapcar

11 years agoMerge branch 'rr/doc-commit' into maint
Junio C Hamano [Mon, 6 Aug 2012 22:37:09 +0000 (15:37 -0700)]
Merge branch 'rr/doc-commit' into maint

* rr/doc-commit:
  commit: document a couple of options

11 years agodoc: A few minor copy edits.
Štěpán Němec [Sat, 14 Jul 2012 22:20:36 +0000 (00:20 +0200)]
doc: A few minor copy edits.

- (glossary) the quotes around the Wikipedia URL prevented its
  linkification in frontends that support it; remove them

- (manual) newer version (SHA-1) == following, older == preceding, not
  the other way around

- trivial typo and wording fixes

Signed-off-by: Štěpán Němec <stepnem@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jk/maint-checkout-orphan-check-fix' into maint
Junio C Hamano [Mon, 6 Aug 2012 22:31:16 +0000 (15:31 -0700)]
Merge branch 'jk/maint-checkout-orphan-check-fix' into maint

* jk/maint-checkout-orphan-check-fix:
  checkout: don't confuse ref and object flags

11 years agoMerge branch 'mh/maint-revisions-doc' into maint
Junio C Hamano [Mon, 6 Aug 2012 22:30:57 +0000 (15:30 -0700)]
Merge branch 'mh/maint-revisions-doc' into maint

* mh/maint-revisions-doc:
  Enumerate revision range specifiers in the documentation
  Make <refname> documentation more consistent.

11 years agoMerge branch 'jc/mergetool-tool-help' into maint
Junio C Hamano [Mon, 6 Aug 2012 22:30:18 +0000 (15:30 -0700)]
Merge branch 'jc/mergetool-tool-help' into maint

* jc/mergetool-tool-help:
  mergetool: support --tool-help option like difftool does

11 years agoDocumentation: do not mention .git/refs/* directories
Junio C Hamano [Mon, 6 Aug 2012 20:36:47 +0000 (13:36 -0700)]
Documentation: do not mention .git/refs/* directories

It is an implementation detail that a new tag is created by adding a
file in the .git/refs/tags directory.  The only thing the user needs
to know is that a "git tag" creates a ref in the refs/tags namespace,
and without "-f", it does not overwrite an existing tag.

Inspired by a report from 乙酸鋰 <ch3cooli@gmail.com>; I think I
caught all the existing mention in Documentation/ directory in the
tip of 1.7.9.X maintenance track, but we may have added new ones
since then.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoread_index_from: remove bogus errno assignments
Nguyễn Thái Ngọc Duy [Mon, 6 Aug 2012 11:27:09 +0000 (18:27 +0700)]
read_index_from: remove bogus errno assignments

These assignments comes from the very first commit e83c516 (Initial
revision of "git", the information manager from hell - 2005-04-07).
Back then we did not die() when errors happened so correct errno was
required.

Since 5d1a5c0 ([PATCH] Better error reporting for "git status" -
2005-10-01), read_index_from() learned to die rather than just return
-1 and these assignments became irrelevant. Remove them.

While at it, move die_errno() next to xmmap() call because it's the
mmap's error code that we care about. Otherwise if close(fd); fails,
it could overwrite mmap's errno.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoapply: delete unused deflate_origlen from patch struct
Paul Gortmaker [Thu, 2 Aug 2012 22:25:30 +0000 (18:25 -0400)]
apply: delete unused deflate_origlen from patch struct

It hasn't been used since 2006, as of commit 3cd4f5e8

    "git-apply --binary: clean up and prepare for --reverse"

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoFix '\ No newline...' annotation in rewrite diffs
Adam Butcher [Sat, 4 Aug 2012 21:07:35 +0000 (21:07 +0000)]
Fix '\ No newline...' annotation in rewrite diffs

When a file that ends with an incomplete line is expressed as a
complete rewrite with the -B option, git diff incorrectly
appends the incomplete line indicator "\ No newline at end of
file" after such a line, rather than writing it on a line of its
own (the output codepath for normal output without -B does not
have this problem).  Add a LF after the incomplete line before
writing the "\ No newline ..." out to fix this.

Add a couple of tests to confirm that the indicator comment is
generated on its own line in both plain diff and rewrite mode.

Signed-off-by: Adam Butcher <dev.lists@jessamine.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agotests: Introduce test_seq
Michał Kiedrowicz [Fri, 3 Aug 2012 22:21:04 +0000 (00:21 +0200)]
tests: Introduce test_seq

Jeff King wrote:

The seq command is GNU-ism, and is missing at least in older BSD
releases and their derivatives, not to mention antique
commercial Unixes.

We already purged it in b3431bc (Don't use seq in tests, not
everyone has it, 2007-05-02), but a few new instances have crept
in. They went unnoticed because they are in scripts that are not
run by default.

Replace them with test_seq that is implemented with a Perl snippet
(proposed by Jeff).  This is better than inlining this snippet
everywhere it's needed because it's easier to read and it's easier
to change the implementation (e.g. to C) if we ever decide to remove
Perl from the test suite.

Note that test_seq is not a complete replacement for seq(1).  It
just has what we need now, in addition that it makes it possible for
us to do something like "test_seq a m" if we wanted to in the
future.

There are also many places that do `for i in 1 2 3 ...` but I'm not sure
if it's worth converting them to test_seq.  That would introduce running
more processes of Perl.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomerge-recursive: eliminate flush_buffer() in favor of write_in_full()
Thomas Rast [Fri, 3 Aug 2012 12:16:25 +0000 (14:16 +0200)]
merge-recursive: eliminate flush_buffer() in favor of write_in_full()

flush_buffer() is a thin wrapper around write_in_full() with two very
confusing properties:

* It runs a loop to handle short reads, ensuring that we write
  everything.  But that is precisely what write_in_full() does!

* It checks for a return value of 0 from write_in_full(), which cannot
  happen: it returns this value only if count=0, but flush_buffer()
  will never call write_in_full() in this case.

Remove it.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodiff_setup_done(): return void
Thomas Rast [Fri, 3 Aug 2012 12:16:24 +0000 (14:16 +0200)]
diff_setup_done(): return void

diff_setup_done() has historically returned an error code, but lost
the last nonzero return in 943d5b7 (allow diff.renamelimit to be set
regardless of -M/-C, 2006-08-09).  The callers were in a pretty
confused state: some actually checked for the return code, and some
did not.

Let it return void, and patch all callers to take this into account.
This conveniently also gets rid of a handful of different(!) error
messages that could never be triggered anyway.

Note that the function can still die().

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosetup: clarify error messages for file/revisions ambiguity
Matthieu Moy [Fri, 3 Aug 2012 08:21:20 +0000 (10:21 +0200)]
setup: clarify error messages for file/revisions ambiguity

The previous "Use '--' to separate filenames from revisions" may sound
obvious for an old-time Unix user, but does not make it clear how to use
this '--'. In addition to mentionning this '--', give an idea of what the
new command should look like.

Ideally, we could provide cut-and-paste ready commands based on the
command that just failed, but we have no easy access to argv[] in this
place of the code.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosend-email: improve RFC2047 quote parsing
Thomas Rast [Mon, 30 Jul 2012 19:25:40 +0000 (21:25 +0200)]
send-email: improve RFC2047 quote parsing

The RFC2047 unquoting, used to parse email addresses in From and Cc
headers, is broken in several ways:

* It erroneously substitutes ' ' for '_' in *the whole* header, even
  outside the quoted field. [Noticed by Christoph.]

* It is too liberal in its matching, and happily matches the start
  of one quoted chunk against the end of another, or even just
  something that looks like such an end. [Noticed by Junio.]

* It fundamentally cannot cope with encodings that are not a
  superset of ASCII, nor several (incompatible) encodings in the
  same header.

This patch fixes the first two by doing a more careful decoding of
the outer quoting (e.g. "=AB" to represent an octet whose value is
0xAB).  Fixing the fundamental issues is left for a future, more
intrusive, patch.

Noticed-by: Christoph Miebach <christoph.miebach@web.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosane_execvp(): ignore non-directory on $PATH
Junio C Hamano [Tue, 31 Jul 2012 19:51:30 +0000 (12:51 -0700)]
sane_execvp(): ignore non-directory on $PATH

When you have a non-directory on your PATH, a funny thing happens:

$ PATH=$PATH:/bin/sh git foo
fatal: cannot exec 'git-foo': Not a directory?

Worse yet, as real commands always take precedence over aliases,
this behaviour interacts rather badly with them:

$ PATH=$PATH:/bin/sh git -c alias.foo=show git foo -s
fatal: cannot exec 'git-foo': Not a directory?

This is because an ENOTDIR error from the underlying execvp(2) is
reported back to the caller of our sane_execvp() wrapper as-is.

Translating it to ENOENT, just like the case where we _might_ have
the command in an unreadable directory, fixes it.  Without an alias,
we would get

git: 'foo' is not a git command. See 'git --help'.

and we use the 'foo' alias when it is available, of course.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoGit 1.7.11.4 v1.7.11.4
Junio C Hamano [Mon, 30 Jul 2012 20:09:25 +0000 (13:09 -0700)]
Git 1.7.11.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jk/maint-commit-document-editmsg' into maint
Junio C Hamano [Mon, 30 Jul 2012 20:05:36 +0000 (13:05 -0700)]
Merge branch 'jk/maint-commit-document-editmsg' into maint

"$GIT_DIR/COMMIT_EDITMSG" file that is used to hold the commit log
message user edits was not documented.

* jk/maint-commit-document-editmsg:
  commit: document the temporary commit message file

11 years agoMerge branch 'jk/maint-advise-vaddf' into maint
Junio C Hamano [Mon, 30 Jul 2012 20:05:25 +0000 (13:05 -0700)]
Merge branch 'jk/maint-advise-vaddf' into maint

The advise() function did not use varargs correctly to format
its message.

* jk/maint-advise-vaddf:
  advice: pass varargs to strbuf_vaddf, not strbuf_addf

11 years agoMerge branch 'kk/maint-commit-tree' into maint
Junio C Hamano [Mon, 30 Jul 2012 20:05:13 +0000 (13:05 -0700)]
Merge branch 'kk/maint-commit-tree' into maint

"git commit-tree" learned a more natural "-p <parent> <tree>" order
of arguments long time ago, but recently forgot it by mistake.

* kk/maint-commit-tree:
  Revert "git-commit-tree(1): update synopsis"
  commit-tree: resurrect command line parsing updates

11 years agoMerge branch 'jv/maint-no-ext-diff' into maint
Junio C Hamano [Mon, 30 Jul 2012 20:04:59 +0000 (13:04 -0700)]
Merge branch 'jv/maint-no-ext-diff' into maint

"git diff --no-ext-diff" did not output anything for a typechange
filepair when GIT_EXTERNAL_DIFF is in effect.

* jv/maint-no-ext-diff:
  diff: test precedence of external diff drivers
  diff: correctly disable external_diff with --no-ext-diff

11 years agoMerge branch 'pg/maint-1.7.9-am-where-is-patch' into maint
Junio C Hamano [Mon, 30 Jul 2012 20:04:39 +0000 (13:04 -0700)]
Merge branch 'pg/maint-1.7.9-am-where-is-patch' into maint

When "git am" failed, old timers knew to check .git/rebase-apply/patch
to see what went wrong, but we never told the users about it.

* pg/maint-1.7.9-am-where-is-patch:
  am: indicate where a failed patch is to be found

11 years agoMerge branch 'jl/maint-1.7.10-recurse-submodules-with-symlink' into maint
Junio C Hamano [Mon, 30 Jul 2012 20:04:18 +0000 (13:04 -0700)]
Merge branch 'jl/maint-1.7.10-recurse-submodules-with-symlink' into maint

When "git submodule add" clones a submodule repository, it can get
confused where to store the resulting submodule repository in the
superproject's .git/ directory when there is a symbolic link in the
path to the current directory.

* jl/maint-1.7.10-recurse-submodules-with-symlink:
  submodules: don't stumble over symbolic links when cloning recursively

11 years agoMerge branch 'jc/maint-filter-branch-epoch-date' into maint
Junio C Hamano [Mon, 30 Jul 2012 20:03:40 +0000 (13:03 -0700)]
Merge branch 'jc/maint-filter-branch-epoch-date' into maint

In 1.7.9 era, we taught "git rebase" about the raw timestamp format
but we did not teach the same trick to "filter-branch", which rolled
a similar logic on its own.

* jc/maint-filter-branch-epoch-date:
  t7003: add test to filter a branch with a commit at epoch
  date.c: Fix off by one error in object-header date parsing
  filter-branch: do not forget the '@' prefix to force git-timestamp

11 years agot7406: fix misleading "rev-parse --max-count=1 HEAD"
Junio C Hamano [Mon, 30 Jul 2012 17:51:52 +0000 (10:51 -0700)]
t7406: fix misleading "rev-parse --max-count=1 HEAD"

The test happened to use "rev-parse --max-count=1 HEAD" consistently
to prepare the expected output and the actual output, so the
comparison between them gave us a correct success/failure because
both output had irrelevant "--max-count=1" in it.

But that is not an excuse to keep it broken.  Replace it a more
meaningful construct "rev-parse --verify HEAD".

Noticed by Daniel Graña while working on his submodule tests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoconfig: "git config baa" should exit with status 1
Junio C Hamano [Sun, 29 Jul 2012 20:43:21 +0000 (13:43 -0700)]
config: "git config baa" should exit with status 1

We instead failed with an undocumented exit status 255.
Also define a "catch-all" status and document it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot7810-*.sh: Remove redundant test
Ramsay Jones [Sat, 28 Jul 2012 18:50:49 +0000 (19:50 +0100)]
t7810-*.sh: Remove redundant test

Since commit bbc09c22 ("grep: rip out support for external grep",
12-01-2010), test number 60 ("grep -C1 hunk mark between files") is
essentially the same as test number 59.

Test 59 was intended to verify the behaviour of git-grep resulting
from multiple invocations of an external grep. As part of the test,
it creates and adds 1024 files to the index, which is now wasted
effort.

Remove test 59, since it is now redundant.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agolink_alt_odb_entry: fix read over array bounds reported by valgrind
Heiko Voigt [Sat, 28 Jul 2012 15:46:36 +0000 (17:46 +0200)]
link_alt_odb_entry: fix read over array bounds reported by valgrind

pfxlen can be longer than the path in objdir when relative_base
contains the path to gits object directory.  Here we are interested
in checking if ent->base[] (the part that corresponds to .git/objects)
is the same string as objdir, and the code NUL-terminated ent->base[]
to

LEADING PATH\0XX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\0

in preparation for these "duplicate check" step (before we return
from the function, the first NUL is turned into '/' so that we can
fill XX when probing for loose objects).  All we need to do is to
compare the string with the path to our object directory.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agofsck: detect null sha1 in tree entries
Jeff King [Sat, 28 Jul 2012 15:06:29 +0000 (11:06 -0400)]
fsck: detect null sha1 in tree entries

Short of somebody happening to beat the 1 in 2^160 odds of
actually generating content that hashes to the null sha1, we
should never see this value in a tree entry. So let's have
fsck warn if it it seen.

As in the previous commit, we test both blob and submodule
entries to future-proof the test suite against the
implementation depending on connectivity to notice the
error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodo not write null sha1s to on-disk index
Jeff King [Sat, 28 Jul 2012 15:05:24 +0000 (11:05 -0400)]
do not write null sha1s to on-disk index

We should never need to write the null sha1 into an index
entry (short of the 1 in 2^160 chance that somebody actually
has content that hashes to it). If we attempt to do so, it
is much more likely that it is a bug, since we use the null
sha1 as a sentinel value to mean "not valid".

The presence of null sha1s in the index (which can come
from, among other things, "update-index --cacheinfo", or by
reading a corrupted tree) can cause problems for later
readers, because they cannot distinguish the literal null
sha1 from its use a sentinel value.  For example, "git
diff-files" on such an entry would make it appear as if it
is stat-dirty, and until recently, the diff code assumed
such an entry meant that we should be diffing a working tree
file rather than a blob.

Ideally, we would stop such entries from entering even our
in-core index. However, we do sometimes legitimately add
entries with null sha1s in order to represent these sentinel
situations; simply forbidding them in add_index_entry breaks
a lot of the existing code. However, we can at least make
sure that our in-core sentinel representation never makes it
to disk.

To be thorough, we will test an attempt to add both a blob
and a submodule entry. In the former case, we might run into
problems anyway because we will be missing the blob object.
But in the latter case, we do not enforce connectivity
across gitlink entries, making this our only point of
enforcement. The current implementation does not care which
type of entry we are seeing, but testing both cases helps
future-proof the test suite in case that changes.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodiff: do not use null sha1 as a sentinel value
Jeff King [Sat, 28 Jul 2012 15:03:01 +0000 (11:03 -0400)]
diff: do not use null sha1 as a sentinel value

The diff code represents paths using the diff_filespec
struct. This struct has a sha1 to represent the sha1 of the
content at that path, as well as a sha1_valid member which
indicates whether its sha1 field is actually useful. If
sha1_valid is not true, then the filespec represents a
working tree file (e.g., for the no-index case, or for when
the index is not up-to-date).

The diff_filespec is only used internally, though. At the
interfaces to the diff subsystem, callers feed the sha1
directly, and we create a diff_filespec from it. It's at
that point that we look at the sha1 and decide whether it is
valid or not; callers may pass the null sha1 as a sentinel
value to indicate that it is not.

We should not typically see the null sha1 coming from any
other source (e.g., in the index itself, or from a tree).
However, a corrupt tree might have a null sha1, which would
cause "diff --patch" to accidentally diff the working tree
version of a file instead of treating it as a blob.

This patch extends the edges of the diff interface to accept
a "sha1_valid" flag whenever we accept a sha1, and to use
that flag when creating a filespec. In some cases, this
means passing the flag through several layers, making the
code change larger than would be desirable.

One alternative would be to simply die() upon seeing
corrupted trees with null sha1s. However, this fix more
directly addresses the problem (while bogus sha1s in a tree
are probably a bad thing, it is really the sentinel
confusion sending us down the wrong code path that is what
makes it devastating). And it means that git is more capable
of examining and debugging these corrupted trees. For
example, you can still "diff --raw" such a tree to find out
when the bogus entry was introduced; you just cannot do a
"--patch" diff (just as you could not with any other
corrupted tree, as we do not have any content to diff).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocheckout: don't confuse ref and object flags
Jeff King [Wed, 25 Jul 2012 21:57:30 +0000 (17:57 -0400)]
checkout: don't confuse ref and object flags

When we are leaving a detached HEAD, we do a revision traversal to
check whether we are orphaning any commits, marking the commit we're
leaving as the start of the traversal, and all existing refs as
uninteresting.

Prior to commit 468224e5, we did so by calling for_each_ref, and
feeding each resulting refname to setup_revisions.  Commit 468224e5
refactored this to simply mark the pending objects, saving an extra
lookup.

However, it confused the "flags" parameter to the each_ref_fn
clalback, which is about the flags we found while looking up the ref
with the object flag.  Because REF_ISSYMREF ("this ref is a symbolic
ref, e.g. refs/remotes/origin/HEAD") happens to be the same bit
pattern as SEEN ("we have picked this object up from the pending
list and moved it to revs.commits list"), we incorrectly reported
that a commit previously at the detached HEAD will become
unreachable if the only ref that can reach the commit happens to be
pointed at by a symbolic ref.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoEnumerate revision range specifiers in the documentation
Junio C Hamano [Tue, 24 Jul 2012 22:03:50 +0000 (15:03 -0700)]
Enumerate revision range specifiers in the documentation

It was a bit hard to learn how <rev>^@, <rev>^! and various other
forms of range specifiers are used, because they were discussed
mostly in the prose part of the documentation, unlike various forms
of extended SHA-1 expressions that are listed in an enumerated list.

Also add a few more examples showing use of <rev>, <rev>..<rev> and
<rev>^! forms, stolen from a patch by Max Horn.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocommit: document the temporary commit message file
Jeff King [Mon, 23 Jul 2012 21:13:12 +0000 (17:13 -0400)]
commit: document the temporary commit message file

We do not document COMMIT_EDITMSG at all, but users may want
to know about it for two reasons:

  1. They may want to tell their editor to configure itself
     for formatting a commit message.

  2. If a commit is aborted by an error, the user may want
     to recover the commit message they typed.

Let's put a note in git-commit(1).

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