Commit graph

26117 commits

Author SHA1 Message Date
Junio C Hamano c6d72c4972 Revert clock-skew based attempt to optimize tag --contains traversal
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-14 11:02:06 -07:00
Dave Zarzycki 63a995b657 Do not log unless all connect() attempts fail
IPv6 hosts are often unreachable on the primarily IPv4 Internet and
therefore we shouldn't print an error if there are still other hosts we
can try to connect() to. This helps "git fetch --quiet" stay quiet.

Signed-off-by: Dave Zarzycki <zarzycki@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-14 09:19:03 -07:00
Martin von Zweigbergk 5960bc9d63 rebase: clarify "restore the original branch"
The description for 'git rebase --abort' currently says:

    Restore the original branch and abort the rebase operation.

The "restore" can be misinterpreted to imply that the original branch
was somehow in a broken state during the rebase operation. It is also
not completely clear what "the original branch" is --- is it the
branch that was checked out before the rebase operation was called or
is the the branch that is being rebased (it is the latter)? Although
both issues are made clear in the DESCRIPTION section, let us also
make the entry in the OPTIONS secion more clear.

Also remove the term "rebasing process" from the usage text, since the
user already knows that the text is about "git rebase".

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-13 22:03:12 -07:00
Junio C Hamano bf979c07c7 diff-lib: refactor run_diff_index() and do_diff_cache()
The latter is meant to be an API for internal callers that want to inspect
the resulting diff-queue, while the former is an implementation of "git
diff-index" command. Extract the common logic into a single helper
function and make them thin wrappers around it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-13 21:58:21 -07:00
Junio C Hamano fe549c21fc diff-lib: simplify do_diff_cache()
Since 34110cd (Make 'unpack_trees()' have a separate source and
destination index, 2008-03-06), we can run unpack_trees() without munging
the index at all, but do_diff_cache() tried ever so carefully to work
around the old behaviour of the function.

We can just tell unpack_trees() not to touch the original index and there
is no need to clean-up whatever the previous round has done.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-13 21:58:15 -07:00
Junio C Hamano ff00b682f2 reset [<commit>] paths...: do not mishandle unmerged paths
Because "diff --cached HEAD" showed an incorrect blob object name on the
LHS of the diff, we ended up updating the index entry with bogus value,
not what we read from the tree.

Noticed by John Nowak.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-13 21:39:18 -07:00
Junio C Hamano 55272570db Merge branch 'js/rebase-typo-branch-squelch-usage'
* js/rebase-typo-branch-squelch-usage:
  rebase: do not print lots of usage hints after an obvious error message
2011-07-13 14:31:38 -07:00
Junio C Hamano af52e6b06a Merge branch 'jn/doc-dashdash'
* jn/doc-dashdash:
  Documentation/i18n: quote double-dash for AsciiDoc
  Documentation: quote double-dash for AsciiDoc
2011-07-13 14:31:37 -07:00
Junio C Hamano 13ac90a478 Merge branch 'bc/submodule-foreach-stdin-fix-1.7.4'
* bc/submodule-foreach-stdin-fix-1.7.4:
  git-submodule.sh: preserve stdin for the command spawned by foreach
  t/t7407: demonstrate that the command called by 'submodule foreach' loses stdin

Conflicts:
	git-submodule.sh
2011-07-13 14:31:37 -07:00
Junio C Hamano 0e8a23bf1f Merge branch 'nk/ref-doc'
* nk/ref-doc:
  glossary: clarify description of HEAD
  glossary: update description of head and ref
  glossary: update description of "tag"
  git.txt: de-emphasize the implementation detail of a ref
  check-ref-format doc: de-emphasize the implementation detail of a ref
  git-remote.txt: avoid sounding as if loose refs are the only ones in the world
  git-remote.txt: fix wrong remote refspec
2011-07-13 14:31:37 -07:00
Junio C Hamano b57e58fc82 Merge branch 'fk/relink-upon-ldflags-update'
* fk/relink-upon-ldflags-update:
  Makefile: Track changes to LDFLAGS and relink when necessary
2011-07-13 14:31:37 -07:00
Junio C Hamano 182f228930 Merge branch 'jl/maint-fetch-recursive-fix'
* jl/maint-fetch-recursive-fix:
  fetch: Also fetch submodules in subdirectories in on-demand mode
2011-07-13 14:31:37 -07:00
Junio C Hamano df9b29ce82 Merge branch 'jc/maint-cygwin-trust-executable-bit-default'
* jc/maint-cygwin-trust-executable-bit-default:
  cygwin: trust executable bit by default
2011-07-13 14:31:36 -07:00
Junio C Hamano 23f229d8cd Merge branch 'aw/rebase-i-p'
* aw/rebase-i-p:
  rebase -i -p: include non-first-parent commits in todo list
2011-07-13 14:31:36 -07:00
Junio C Hamano 551d75dbd8 Merge branch 'rj/config-cygwin'
* rj/config-cygwin:
  config.c: Make git_config() work correctly when called recursively
  t1301-*.sh: Fix the 'forced modes' test on cygwin
  help.c: Fix detection of custom merge strategy on cygwin
2011-07-13 14:31:36 -07:00
Junio C Hamano bc50897b90 Merge branch 'md/interix-update'
* md/interix-update:
  Update the Interix default build configuration.
2011-07-13 14:31:36 -07:00
Junio C Hamano d4c8c55fab Merge branch 'ln/gitweb-mime-types-split-at-blank'
* ln/gitweb-mime-types-split-at-blank:
  gitweb: allow space as delimiter in mime.types
2011-07-13 14:31:36 -07:00
Junio C Hamano 6389a79dd4 Merge branch 'jc/no-gitweb-test-without-cgi-etc'
* jc/no-gitweb-test-without-cgi-etc:
  t/gitweb-lib.sh: skip gitweb tests when perl dependencies are not met
2011-07-13 14:31:36 -07:00
Junio C Hamano ff968f03e6 Merge branch 'fg/submodule-keep-updating'
* fg/submodule-keep-updating:
  git-submodule.sh: clarify the "should we die now" logic
  submodule update: continue when a checkout fails
  git-sh-setup: add die_with_status

Conflicts:
	git-submodule.sh
2011-07-13 14:31:35 -07:00
Junio C Hamano 5f2e448370 Merge branch 'jc/legacy-loose-object'
* jc/legacy-loose-object:
  sha1_file.c: "legacy" is really the current format
2011-07-13 14:31:34 -07:00
Junio C Hamano 3b1d3664f5 Merge branch 'an/shallow-doc'
* an/shallow-doc:
  Document the underlying protocol used by shallow repositories and --depth commands.
  Fix documentation of fetch-pack that implies that the client can disconnect after sending wants.
2011-07-13 14:31:34 -07:00
Bert Wesarg cd8e3711bf Documentation: clearly specify what refs are honored by core.logAllRefUpdates
The documentation for logging updates in git-update-ref, doesn't make it
clear that only a specific subset of refs are honored by this variable.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-12 09:11:14 -07:00
Johannes Schindelin 7d092adc8f get_pwd_cwd(): Do not trust st_dev/st_ino blindly
10c4c88 (Allow add_path() to add non-existent directories to the path,
2008-07-21) introduced get_pwd_cwd() function in order to favor $PWD when
getenv("PWD") and getcwd() refer to the same directory but are different
strings (e.g. the former gives a nicer looking name via a symbolic link to
an uglier looking automounted path). The function tried to determine if
two directories are the same by running stat(2) on both and comparing
ino/dev fields.

Unfortunately, stat() does not fill any ino or dev fields in msysgit.  But
there is a telltale: both ino and dev are 0 when they are not filled
correctly, so let's be extra cautious.

This happens to fix a bug in "get-receive-pack working_directory/" when
the GIT_DIR would not be set correctly due to absolute_path(".")
returning the wrong value.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-11 10:52:38 -07:00
Junio C Hamano 1b4bb16b9e pack-objects: optimize "recency order"
This optimizes the "recency order" (see pack-heuristics.txt in
Documentation/technical/ directory) used to order objects within a
packfile in three ways:

 - Commits at the tip of tags are written together, in the hope that
   revision traversal done in incremental fetch (which starts by
   putting them in a revision queue marked as UNINTERESTING) will see a
   better locality of these objects;

 - In the original recency order, trees and blobs are intermixed. Write
   trees together before blobs, in the hope that this will improve
   locality when running pathspec-limited revision traversal, i.e.
   "git log paths...";

 - When writing blob objects out, write the whole family of blobs that use
   the same delta base object together, by starting from the root of the
   delta chain, and writing its immediate children in a width-first
   manner, in the hope that this will again improve locality when reading
   blobs that belong to the same path, which are likely to be deltified
   against each other.

I tried various workloads in the Linux kernel repositories (HEAD at
v3.0-rc6-71-g4dd1b49) packed with v1.7.6 and with this patch, counting how
large seeks are needed between adjacent accesses to objects in the pack,
and the result looks promising.  The history has 2072052 objects, weighing
some 490MiB.

 * Simple commit-only log.

   $ git log >/dev/null

   There are 254656 commits in total.

                                  v1.7.6  with patch
   Total number of access :      258,031     258,032
          0.0% percentile :           12          12
         10.0% percentile :          259         259
         20.0% percentile :          294         294
         30.0% percentile :          326         326
         40.0% percentile :          363         363
         50.0% percentile :          415         415
         60.0% percentile :          513         513
         70.0% percentile :          857         858
         80.0% percentile :       10,434      10,441
         90.0% percentile :       91,985      91,996
         95.0% percentile :      260,852     260,885
         99.0% percentile :    1,150,680   1,152,811
         99.9% percentile :    3,148,435   3,148,435
       Less than 2MiB seek:       99.70%      99.69%

   95% of the pack accesses look at data that is no further than 260kB
   from the previous location we accessed. The patch does not change the
   order of commit objects very much, and the result is very similar.

 * Pathspec-limited log.

   $ git log drivers/net >/dev/null

   The path is touched by 26551 commits and merges (among 254656 total).

                                  v1.7.6  with patch
   Total number of access :      559,511     558,663
          0.0% percentile :            0           0
         10.0% percentile :          182         167
         20.0% percentile :          259         233
         30.0% percentile :          357         304
         40.0% percentile :          714         485
         50.0% percentile :        5,046       3,976
         60.0% percentile :      688,671     443,578
         70.0% percentile :  319,574,732 110,370,100
         80.0% percentile :  361,647,599 123,707,229
         90.0% percentile :  393,195,669 128,947,636
         95.0% percentile :  405,496,875 131,609,321
         99.0% percentile :  412,942,470 133,078,115
         99.5% percentile :  413,172,266 133,163,349
         99.9% percentile :  413,354,356 133,240,445
       Less than 2MiB seek:       61.71%      62.87%

   With the current pack heuristics, more than 30% of accesses have to
   seek further than 300MB; the updated pack heuristics ensures that less
   than 0.1% of accesses have to seek further than 135MB. This is largely
   due to the fact that the updated heuristics does not mix blobs and
   trees together.

 * Blame.

   $ git blame drivers/net/ne.c >/dev/null

   The path is touched by 34 commits and merges.

                                  v1.7.6  with patch
   Total number of access :      178,147     178,166
          0.0% percentile :            0           0
         10.0% percentile :          142         139
         20.0% percentile :          222         194
         30.0% percentile :          373         300
         40.0% percentile :        1,168         837
         50.0% percentile :       11,248       7,334
         60.0% percentile :  305,121,284 106,850,130
         70.0% percentile :  361,427,854 123,709,715
         80.0% percentile :  388,127,343 128,171,047
         90.0% percentile :  399,987,762 130,200,707
         95.0% percentile :  408,230,673 132,174,308
         99.0% percentile :  412,947,017 133,181,160
         99.5% percentile :  413,312,798 133,220,425
         99.9% percentile :  413,352,366 133,269,051
       Less than 2MiB seek:       56.47%      56.83%

   The result is very similar to the pathspec-limited log above, which
   only looks at the tree objects.

 * Packing recent history.

   $ (git for-each-ref --format='^%(refname)' refs/tags; echo HEAD) |
     git pack-objects --revs --stdout >/dev/null

   This should pack data worth 71 commits.

                                  v1.7.6  with patch
   Total number of access :       11,511      11,514
          0.0% percentile :            0           0
         10.0% percentile :           48          47
         20.0% percentile :          134          98
         30.0% percentile :          332         178
         40.0% percentile :        1,386         293
         50.0% percentile :        8,030         478
         60.0% percentile :       33,676       1,195
         70.0% percentile :      147,268      26,216
         80.0% percentile :    9,178,662     464,598
         90.0% percentile :   67,922,665     965,782
         95.0% percentile :   87,773,251   1,226,102
         99.0% percentile :   98,011,763   1,932,377
         99.5% percentile :  100,074,427  33,642,128
         99.9% percentile :  105,336,398 275,772,650
       Less than 2MiB seek:       77.09%      99.04%

    The long-tail part of the result looks worse with the patch, but
    the change helps majority of the access. 99.04% of the accesses
    need less than 2MiB of seeking, compared to 77.09% with the current
    packing heuristics.

 * Index pack.

   $ git index-pack -v .git/objects/pack/pack*.pack

                                  v1.7.6  with patch
   Total number of access :    2,791,228   2,788,802
          0.0% percentile :            9           9
         10.0% percentile :          140          89
         20.0% percentile :          233         167
         30.0% percentile :          322         235
         40.0% percentile :          464         310
         50.0% percentile :          862         423
         60.0% percentile :        2,566         686
         70.0% percentile :       25,827       1,498
         80.0% percentile :    1,317,862       4,971
         90.0% percentile :   11,926,385     119,398
         95.0% percentile :   41,304,149     952,519
         99.0% percentile :  227,613,070   6,709,650
         99.5% percentile :  321,265,121  11,734,871
         99.9% percentile :  382,919,785  33,155,191
       Less than 2MiB seek:       81.73%      96.92%

   As the index-pack command already walks objects in the delta chain
   order, writing the blobs out in the delta chain order seems to
   drastically improve the locality of access.

Note that a half-a-gigabyte packfile comfortably fits in the buffer cache,
and you would unlikely to see much performance difference on a modern and
reasonably beefy machine with enough memory and local disks. Benchmarking
with cold cache (or over NFS) would be interesting.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-08 10:03:24 -07:00
Michael Schubert 823e0ded8a help_unknown_cmd: do not propose an "unknown" cmd
When executing an external shell script like `git foo` with a bad
shebang, e.g. "#!/usr/bin/not/existing", execvp returns 127 (ENOENT).

Since help_unknown_cmd proposes the use of all external commands similar
to the name of the "unknown" command, it suggests the just failed command
again. Stop it and give some advice to the user.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Schubert <mschub@elegosoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-08 08:59:44 -07:00
Junio C Hamano 5f44324d88 core: log offset pack data accesses happened
In a workload other than "git log" (without pathspec nor any option that
causes us to inspect trees and blobs), the recency pack order is said to
cause the access jump around quite a bit. Add a hook to allow us observe
how bad it is.

"git config core.logpackaccess /var/tmp/pal.txt" will give you the log
in the specified file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-06 19:09:29 -07:00
Junio C Hamano cf13f6ca40 Start 1.7.7 cycle
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-06 17:00:46 -07:00
Junio C Hamano 395f65d438 Merge branch 'maint'
* maint:
  docs: document --textconv diff option
2011-07-06 16:48:59 -07:00
Junio C Hamano 25d33546d4 Merge commit 'v1.7.6' into jc/checkout-reflog-fix
* commit 'v1.7.6': (3211 commits)
  Git 1.7.6
  completion: replace core.abbrevguard to core.abbrev
  Git 1.7.6-rc3
  Documentation: git diff --check respects core.whitespace
  gitweb: 'pickaxe' and 'grep' features requires 'search' to be enabled
  t7810: avoid unportable use of "echo"
  plug a few coverity-spotted leaks
  builtin/gc.c: add missing newline in message
  tests: link shell libraries into valgrind directory
  t/Makefile: pass test opts to valgrind target properly
  sh-i18n--envsubst.c: do not #include getopt.h
  Fix typo: existant->existent
  Git 1.7.6-rc2
  gitweb: do not misparse nonnumeric content tag files that contain a digit
  Git 1.7.6-rc1
  fetch: do not leak a refspec
  t3703: skip more tests using colons in file names on Windows
  gitweb: Fix usability of $prevent_xss
  gitweb: Move "Requirements" up in gitweb/INSTALL
  gitweb: Describe CSSMIN and JSMIN in gitweb/INSTALL
  ...
2011-07-06 15:38:28 -07:00
Junio C Hamano 71ee7fd154 Merge commit 'v1.7.0' into jc/checkout-reflog-fix
* commit 'v1.7.0': (4188 commits)
  Git 1.7.0
  Fix typo in 1.6.6.2 release notes
  Re-fix check-ref-format documentation mark-up
  archive documentation: attributes are taken from the tree by default
  Documentation: minor fixes to RelNotes-1.7.0
  bash: support 'git am's new '--continue' option
  filter-branch: Fix error message for --prune-empty --commit-filter
  am: switch --resolved to --continue
  Update draft release notes to 1.7.0 one more time
  Git 1.6.6.2
  t8003: check exit code of command and error message separately
  check-ref-format documentation: fix enumeration mark-up
  Documentation: quote braces in {upstream} notation
  t3902: Protect against OS X normalization
  blame: prevent a segv when -L given start > EOF
  git-push: document all the status flags used in the output
  Fix parsing of imap.preformattedHTML and imap.sslverify
  git-add documentation: Fix shell quoting example
  Revert "pack-objects: fix pack generation when using pack_size_limit"
  archive: simplify archive format guessing
  ...
2011-07-06 15:38:18 -07:00
Junio C Hamano 4d9e42f8f1 Merge commit 'v1.6.0' into jc/checkout-reflog-fix
* commit 'v1.6.0': (2063 commits)
  GIT 1.6.0
  git-p4: chdir now properly sets PWD environment variable in msysGit
  Improve error output of git-rebase
  t9300: replace '!' with test_must_fail
  Git.pm: Make File::Spec and File::Temp requirement lazy
  Documentation: document the pager.* configuration setting
  git-stash: improve synopsis in help and manual page
  Makefile: building git in cygwin 1.7.0
  git-am: ignore --binary option
  bash-completion: Add non-command git help files to bash-completion
  Fix t3700 on filesystems which do not support question marks in names
  Utilise our new p4_read_pipe and p4_write_pipe wrappers
  Add p4 read_pipe and write_pipe wrappers
  bash completion: Add '--merge' long option for 'git log'
  bash completion: Add completion for 'git mergetool'
  git format-patch documentation: clarify what --cover-letter does
  bash completion: 'git apply' should use 'fix' not 'strip'
  t5304-prune: adjust file mtime based on system time rather than file mtime
  test-parse-options: use appropriate cast in length_callback
  Fix escaping of glob special characters in pathspecs
  ...

Conflicts:
	builtin-checkout.c
2011-07-06 15:37:42 -07:00
Junio C Hamano c5bcf1f9f6 checkout: do not write bogus reflog entry out
As resolve_ref() returns a static buffer that is local to the function,
the caller needs to be sure that it will not have any other calls to the
function before it uses the returned value, or store it away with a
strdup().  The code used old.path to record which branch it used to be on,
so that it can say between which branches the switch took place in the
reflog, but sometimes it failed to do so.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-06 15:15:02 -07:00
Martin von Zweigbergk 7791a1d9b9 Documentation: use [verse] for SYNOPSIS sections
The SYNOPSIS sections of most commands that span several lines already
use [verse] to retain line breaks. Most commands that don't span
several lines seem not to use [verse]. In the HTML output, [verse]
does not only preserve line breaks, but also makes the section
indented, which causes a slight inconsistency between commands that
use [verse] and those that don't. Use [verse] in all SYNOPSIS sections
for consistency.

Also remove the blank lines from git-fetch.txt and git-rebase.txt to
align with the other man pages. In the case of git-rebase.txt, which
already uses [verse], the blank line makes the [verse] not apply to
the last line, so removing the blank line also makes the formatting
within the document more consistent.

While at it, add single quotes to 'git cvsimport' for consistency with
other commands.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-06 14:26:26 -07:00
Jeff King d28790dc31 docs: document --textconv diff option
This has been there since textconv existed, but was never
documented. There is some overlap with what's in
gitattributes(5), but it's important to warn in both places
that textconv diffs probably can't be applied.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-06 11:10:11 -07:00
Junio C Hamano 6b445773b7 mergetool: check return value from read
The process may not even have the standard input open in which case it
will get stuck in an infinite loop to prompt and read nothing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-01 16:17:29 -07:00
Jeff King 188c35e36d git skew: a tool to find how big a clock skew exists in the history
> As you probably guessed from the specificity of the number, I wrote a
> short program to actually traverse and find the worst skew. It takes
> about 5 seconds to run (unsurprisingly, since it is doing the same full
> traversal that we end up doing in the above numbers). So we could
> "autoskew" by setting up the configuration on clone, and then
> periodically updating it as part of "git gc".

This patch doesn't implement auto-detection of skew, but is the program
I used to calculate, and would provide the basis for such
auto-detection. It would be interesting to see average skew numbers for
popular repositories. You can run it as "git skew --all".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-30 12:21:13 -07:00
Jakub Narebski e8c3531717 gitweb: Serve */*+xml 'blob_plain' as text/plain with $prevent_xss
Enhance usability of 'blob_plain' view protection against XSS attacks
(enabled by setting $prevent_xss to true) by serving contents inline
as safe 'text/plain' mimetype where possible, instead of serving with
"Content-Disposition: attachment" to make sure they don't run in
gitweb's security domain.

This patch broadens downgrading to 'text/plain' further, to any
*/*+xml mimetype.  This includes:

  application/xhtml+xml    (*.xhtml, *.xht)
  application/atom+xml     (*.atom)
  application/rss+xml      (*.rss)
  application/mathml+xm    (*.mathml)
  application/docbook+xml  (*.docbook)
  image/svg+xml            (*.svg, *.svgz)

Probably most useful is serving XHTML files as text/plain in
'blob_plain' view, directly viewable.

Because file with 'image/svg+xml' mimetype can be compressed SVGZ
file, we have to check if */*+xml really is text file, via '-T $fd'.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-30 11:26:48 -07:00
Jakub Narebski 86afbd02c8 gitweb: Serve text/* 'blob_plain' as text/plain with $prevent_xss
One of mechanism enabled by setting $prevent_xss to true is 'blob_plain'
view protection.  With XSS prevention on, blobs of all types except a
few known safe ones are served with "Content-Disposition: attachment" to
make sure they don't run in our security domain.

Instead of serving text/* type files, except text/plain (and including
text/html), as attachements, downgrade it to text/plain.  This way HTML
pages in 'blob_plain' (raw) view would be displayed in browser, but
safely as a source, and not asked to be saved.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-30 11:26:39 -07:00
Brandon Casey 4dca1aa650 git-submodule.sh: preserve stdin for the command spawned by foreach
The user-supplied command spawned by 'submodule foreach' loses its
connection to the original standard input.  Instead, it is connected to the
output of a pipe within the git-submodule script.  The user-supplied
command supplied to 'submodule foreach' is spawned within a while loop
which is being piped into.  Due to the way shells implement piping output
to a while loop, a subshell is created with its standard input attached to
the output of the pipe.  This results in all of the commands executed
within the while loop to have their stdins modified in the same way,
including the user-supplied command.

This can cause a problem if the command requires reading from stdin or if
it changes its behavior based on whether stdin is a tty or not.  For
example, this problem was noticed when trying to execute the following:

   git submodule foreach git shortlog --since=two.weeks.ago

which printed a message about entering the first submodule and produced no
further output and exited with a status of zero.  In this case, shortlog
detected that it was not connected to a tty, and since no revision was
supplied as an argument, it attempted to read the list of revisions from
standard input.  Instead, it slurped up the list of submodules that was
being piped to the enclosing while loop and caused that loop to end early
without processing the remaining submodules.

Work around this behavior by saving the original standard input file
descriptor before the while loop, and restoring it when spawning the
user-supplied command.

This fixes the tests in t7407.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-29 18:25:49 -07:00
Brandon Casey 91cd7e4b42 t/t7407: demonstrate that the command called by 'submodule foreach' loses stdin
The user-supplied command spawned by 'submodule foreach' loses its
connection to the original standard input.  Instead, it is connected to the
output of a pipe within the git-submodule script.  This can cause a problem
if the command requires reading from stdin or if it changes its behavior
based on whether stdin is a tty or not (e.g. git shortlog).  Demonstrate
this flaw.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-29 18:24:40 -07:00
Junio C Hamano 9901923cf0 Merge branch 'jc/streaming-filter' into next
* jc/streaming-filter:
  t0021: test application of both crlf and ident
  t0021-conversion.sh: fix NoTerminatingSymbolAtEOF test
  streaming: filter cascading
  streaming filter: ident filter
  Add LF-to-CRLF streaming conversion
  stream filter: add "no more input" to the filters
  Add streaming filter API
  convert.h: move declarations for conversion from cache.h
2011-06-29 17:09:28 -07:00
Junio C Hamano cce347da05 Merge branch 'jn/gitweb-js-blame' into next
* jn/gitweb-js-blame:
  gitweb.js: use setTimeout rather than setInterval in blame_incremental.js
  gitweb.js: No need for loop in blame_incremental's handleResponse()
  gitweb.js: No need for inProgress in blame_incremental.js
2011-06-29 17:09:27 -07:00
Junio C Hamano 4ed54610e5 Merge branch 'da/git-prefix-everywhere' into next
* da/git-prefix-everywhere:
  t/t7503-pre-commit-hook.sh: Add GIT_PREFIX tests
  git-mergetool--lib: Make vimdiff retain the current directory
  git: Remove handling for GIT_PREFIX
  setup: Provide GIT_PREFIX to built-ins
2011-06-29 17:09:27 -07:00
Junio C Hamano 55ac692661 Merge branch 'jc/streaming' into next
* jc/streaming:
  sha1_file: use the correct type (ssize_t, not size_t) for read-style function
  streaming: read loose objects incrementally
  sha1_file.c: expose helpers to read loose objects
  streaming: read non-delta incrementally from a pack
  streaming_write_entry(): support files with holes
  convert: CRLF_INPUT is a no-op in the output codepath
  streaming_write_entry(): use streaming API in write_entry()
  streaming: a new API to read from the object store
  write_entry(): separate two helper functions out
  unpack_object_header(): make it public
  sha1_object_info_extended(): hint about objects in delta-base cache
  sha1_object_info_extended(): expose a bit more info
  packed_object_info_detail(): do not return a string
2011-06-29 17:09:27 -07:00
Junio C Hamano 61f44720a9 Merge branch 'ab/i18n-scripts' into next
* ab/i18n-scripts: (48 commits)
  i18n: git-bisect bisect_next_check "You need to" message
  i18n: git-bisect [Y/n] messages
  i18n: git-bisect bisect_replay + $1 messages
  i18n: git-bisect bisect_reset + $1 messages
  i18n: git-bisect bisect_run + $@ messages
  i18n: git-bisect die + eval_gettext messages
  i18n: git-bisect die + gettext messages
  i18n: git-bisect echo + eval_gettext message
  i18n: git-bisect echo + gettext messages
  i18n: git-bisect gettext + echo message
  i18n: git-bisect add git-sh-i18n
  i18n: git-stash drop_stash say/die messages
  i18n: git-stash "unknown option" message
  i18n: git-stash die + eval_gettext $1 messages
  i18n: git-stash die + eval_gettext $* messages
  i18n: git-stash die + eval_gettext messages
  i18n: git-stash die + gettext messages
  i18n: git-stash say + gettext messages
  i18n: git-stash echo + gettext message
  i18n: git-stash add git-sh-i18n
  ...
2011-06-29 17:09:27 -07:00
Junio C Hamano 033c2dc436 Merge branch 'ef/maint-win-verify-path'
* ef/maint-win-verify-path:
  verify_dotfile(): do not assume '/' is the path seperator
  verify_path(): simplify check at the directory boundary
  verify_path: consider dos drive prefix
  real_path: do not assume '/' is the path seperator
  A Windows path starting with a backslash is absolute
2011-06-29 17:09:17 -07:00
Junio C Hamano 1fd7ef2e8f Merge branch 'js/i18n-windows'
* js/i18n-windows:
  Windows: teach getenv to do a case-sensitive search
  mingw.c: move definition of mingw_getenv down
  sh-i18n--envsubst: do not crash when no arguments are given
2011-06-29 17:03:13 -07:00
Junio C Hamano 1692d0c64a Merge branch 'rs/grep-color'
* rs/grep-color:
  grep: add --heading
  grep: add --break
  grep: fix coloring of hunk marks between files
2011-06-29 17:03:13 -07:00
Junio C Hamano b985f2aeca Merge branch 'jc/maint-1.7.3-checkout-describe'
* jc/maint-1.7.3-checkout-describe:
  checkout -b <name>: correctly detect existing branch
2011-06-29 17:03:12 -07:00
Junio C Hamano 187e902dd2 Merge branch 'db/http-cookies'
* db/http-cookies:
  http: pass http.cookiefile using CURLOPT_COOKIEFILE
2011-06-29 17:03:12 -07:00