1
0
mirror of https://github.com/git/git.git synced 2024-10-21 02:18:14 +02:00
Commit Graph

25720 Commits

Author SHA1 Message Date
Jeff King
8b8a53744f pretty: add pp_commit_easy function for simple callers
Many callers don't actually care about the pretty print
context at all; let's just give them a simple way of
pretty-printing a commit without having to create a context
struct.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 15:47:20 -07:00
Brandon Casey
f5799e05c0 git-submodule.sh: separate parens by a space to avoid confusing some shells
Some shells interpret '(( ))' according to the rules for arithmetic
expansion.  This may not follow POSIX, but is prevalent in commonly used
shells.  Bash does not have a problem with this particular instance of
'((', likely because it is not followed by a '))', but the public domain
ksh does, and so does ksh on IRIX 6.5.

So, add a space between the parenthesis to avoid confusing these shells.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 15:04:05 -07:00
Brandon Casey
7a45c31396 Documentation/technical/api-diff.txt: correct name of diff_unmerge()
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 14:50:24 -07:00
Jeff King
5b38456ec7 mailinfo: always clean up rfc822 header folding
Without the "-k" option, mailinfo will convert a folded
subject header like:

  Subject: this is a
    subject that doesn't
    fit on one line

into a single line. With "-k", however, we assumed that
these newlines were significant and represented something
that the sending side would want us to preserve.

For messages created by format-patch, this assumption was
broken by a1f6baa (format-patch: wrap long header lines,
2011-02-23).  For messages sent by arbitrary MUAs, this was
probably never a good assumption to make, as they may have
been folding subjects in accordance with rfc822's line
length recommendations all along.

This patch now joins folded lines with a single whitespace
character. This treats header folding purely as a syntactic
feature of the transport mechanism, not as something that
format-patch is trying to tell us about the original
subject.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 14:13:38 -07:00
Jeff King
00ebc97748 t: test subject handling in format-patch / am pipeline
Commit a1f6baa (format-patch: wrap long header lines,
2011-02-23) changed format-patch's behavior with respect to
long header lines, but made no accompanying changes to the
receiving side. It was thought that "git am" would handle
these folded subjects fine, but there is a regression when
using "am -k".

Let's add a test documenting this. While we're at it, let's
give more complete test coverage to document what should be
happening in each case. We test three types of subjects:
a short one, one long enough to require wrapping, and a
multiline subject. For each, we test these three
combinations:

  format-patch | am
  format-patch -k | am
  format-patch -k | am -k

We don't bother testing "format-patch | am -k", which is
nonsense (you will be adding in [PATCH] cruft to each
subject).

This reveals the regression above (long subjects have
linebreaks introduced via "format-patch -k | am -k"),
as well as an existing non-optimal behavior (multiline
subjects are not preserved using "-k").

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 14:11:59 -07:00
Jeff King
56d7c27af1 read_in_full: always report errors
The read_in_full function repeatedly calls read() to fill a
buffer. If the first read() returns an error, we notify the
caller by returning the error. However, if we read some data
and then get an error on a subsequent read, we simply return
the amount of data that we did read, and the caller is
unaware of the error.

This makes the tradeoff that seeing the partial data is more
important than the fact that an error occurred. In practice,
this is generally not the case; we care more if an error
occurred, and should throw away any partial data.

I audited the current callers. In most cases, this will make
no difference at all, as they do:

  if (read_in_full(fd, buf, size) != size)
	  error("short read");

However, it will help in a few cases:

  1. In sha1_file.c:index_stream, we would fail to notice
     errors in the incoming stream.

  2. When reading symbolic refs in resolve_ref, we would
     fail to notice errors and potentially use a truncated
     ref name.

  3. In various places, we will get much better error
     messages. For example, callers of safe_read would
     erroneously print "the remote end hung up unexpectedly"
     instead of showing the read error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 13:54:18 -07:00
Jeff King
3eafdc961f remote: allow "-t" with fetch mirrors
Commit 13fc2c1 (remote: disallow some nonsensical option
combinations, 2011-03-30) made it impossible to use "remote
add -t foo --mirror". The argument was that specifying
specific branches is useless because:

  1. Push mirrors do not want a refspec at all.

  2. The point of fetch mirroring is to use a broad refspec
     like "refs/*", but using "-t" overrides that.

Point (1) is valid; "-t" with push mirrors is useless. But
point (2) ignored another side effect of using --mirror: it
fetches the refs directly into the refs/ namespace as they
are found upstream, instead of placing them in a
separate-remote layout.

So 13fc2c1 was overly constrictive, and disallowed
reasonable specific-branch mirroring, like:

  git remote add -t heads/foo -t heads/bar --mirror=fetch

which makes the local "foo" and "bar" branches direct
mirrors of the remote, but does not fetch anything else.

This patch restores the original behavior, but only for
fetch mirrors.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 11:38:18 -07:00
Jeff King
b1905aeac5 read_gitfile_gently: use ssize_t to hold read result
Otherwise, a negative error return becomes a very large read
value. We catch this in practice because we compare the
expected and actual numbers of bytes (and you are not likely
to be reading (size_t)-1 bytes), but this makes the
correctness a little more obvious.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 11:25:13 -07:00
Jim Meyering
5dd564895e remove tests of always-false condition
* fsck.c (fsck_error_function): Don't test obj->sha1 == 0.
It can never be true, since that sha1 member is an array.
* transport.c (set_upstreams): Likewise for ref->new_sha1.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 11:24:24 -07:00
Jim Meyering
a9930e359c plug a DIR buffer leak in rerere.c
Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 11:20:48 -07:00
Jim Meyering
5743350f69 rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
If we reach EOF after the SHA1-then-TAB, yet before the NUL that
terminates each file name, we would fill the file name buffer with \255
bytes resulting from the repeatedly-failing fgetc (returns EOF/-1) and
ultimately complain about "filename too long", because no NUL was
encountered.

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 11:07:52 -07:00
Junio C Hamano
665b051b90 Update 1.7.6 draft release notes
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 10:41:33 -07:00
Junio C Hamano
7eacc2bc29 Merge branch 'jn/userdiff-perl-updates'
* jn/userdiff-perl-updates:
  userdiff/perl: tighten BEGIN/END block pattern to reject here-doc delimiters
  tests: make test_expect_code quieter on success
  userdiff/perl: catch sub with brace on second line
  userdiff/perl: match full line of POD headers
  userdiff/perl: anchor "sub" and "package" patterns on the left
  t4018 (funcname patterns): minor cleanups
  t4018 (funcname patterns): make configuration easier to track
  t4018 (funcname patterns): make .gitattributes state easier to track
2011-05-26 10:32:25 -07:00
Junio C Hamano
8784e4ddde Merge branch 'rg/no-gecos-in-pwent'
* rg/no-gecos-in-pwent:
  ident: add NO_GECOS_IN_PWENT for systems without pw_gecos in struct passwd

Conflicts:
	Makefile
2011-05-26 10:32:19 -07:00
Junio C Hamano
ce5e95383d Merge branch 'jk/fetch-mark-complete-optimization'
* jk/fetch-mark-complete-optimization:
  fetch: avoid repeated commits in mark_complete
2011-05-26 10:32:11 -07:00
Junio C Hamano
a6f3f178bd Merge branch 'jn/gitweb-js'
* jn/gitweb-js:
  gitweb: Make JavaScript ability to adjust timezones configurable
  gitweb.js: Add UI for selecting common timezone to display dates
  gitweb: JavaScript ability to adjust time based on timezone
  gitweb: Unify the way long timestamp is displayed
  gitweb: Refactor generating of long dates into format_timestamp_html
  gitweb.js: Provide getElementsByClassName method (if it not exists)
  gitweb.js: Introduce code to handle cookies from JavaScript
  gitweb.js: Extract and improve datetime handling
  gitweb.js: Provide default values for padding in padLeftStr and padLeft
  gitweb.js: Update and improve comments in JavaScript files
  gitweb: Split JavaScript for maintability, combining on build
2011-05-26 10:31:57 -07:00
Junio C Hamano
229e72dd6a Merge branch 'jn/ctags-more'
* jn/ctags-more:
  gitweb: Optional grouping of projects by category
  gitweb: Modularized git_get_project_description to be more generic
  gitweb: Split git_project_list_body in two functions
2011-05-26 10:31:53 -07:00
Junio C Hamano
0a2a5d889d Merge branch 'jc/require-work-tree-exists'
* jc/require-work-tree-exists:
  require-work-tree wants more than what its name says
2011-05-26 10:31:47 -07:00
Junio C Hamano
1dcfb2ac65 Sync with 1.7.5.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 10:30:28 -07:00
Junio C Hamano
3c3e0b3c41 Git 1.7.5.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.7.5.3
2011-05-26 10:29:29 -07:00
Junio C Hamano
5a6d82d086 Merge branch 'maint-1.7.4' into maint
* maint-1.7.4:
2011-05-26 10:29:24 -07:00
Junio C Hamano
bac9c06ba0 Merge branch 'jk/git-connection-deadlock-fix' into maint-1.7.4
* jk/git-connection-deadlock-fix:
  test core.gitproxy configuration
  send-pack: avoid deadlock on git:// push with failed pack-objects
  connect: let callers know if connection is a socket
  connect: treat generic proxy processes like ssh processes

Conflicts:
	connect.c
2011-05-26 10:28:10 -07:00
Junio C Hamano
34df9fe36a Merge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix' into maint-1.7.4
* js/maint-send-pack-stateless-rpc-deadlock-fix:
  sideband_demux(): fix decl-after-stmt
  send-pack: unbreak push over stateless rpc
  send-pack: avoid deadlock when pack-object dies early
2011-05-26 10:27:55 -07:00
Junio C Hamano
420147290d Merge branch 'jk/maint-upload-pack-shallow' into maint-1.7.4
* jk/maint-upload-pack-shallow:
  upload-pack: start pack-objects before async rev-list
2011-05-26 10:27:29 -07:00
Junio C Hamano
d9ac3e41c3 Merge branch 'jm/maint-diff-words-with-sbe' into maint
* jm/maint-diff-words-with-sbe:
  do not read beyond end of malloc'd buffer
2011-05-26 09:43:00 -07:00
Junio C Hamano
05318994e7 Merge branch 'kk/maint-prefix-in-config-mak' into maint
* kk/maint-prefix-in-config-mak:
  Honor $(prefix) set in config.mak* when defining ETC_GIT*
  Revert "Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir"
  Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir
2011-05-26 09:42:12 -07:00
Junio C Hamano
5f8937db39 Merge branch 'mg/diff-uiconfig-doc' into maint
* mg/diff-uiconfig-doc:
  config.txt,diff-options.txt: porcelain vs. plumbing for color.diff
2011-05-26 09:41:11 -07:00
Junio C Hamano
b73f3d2c7d Merge branch 'ft/gitweb-tar-with-gzip-n' into maint
* ft/gitweb-tar-with-gzip-n:
  gitweb: supply '-n' to gzip for identical output
2011-05-26 09:40:50 -07:00
Junio C Hamano
7eacaeffd7 Merge branch 'ss/doc-svn' into maint
* ss/doc-svn:
  remove noise and inaccuracies from git-svn docs
2011-05-26 09:39:40 -07:00
Junio C Hamano
63c11eb4ed Merge branch 'jn/format-patch-doc' into maint
* jn/format-patch-doc:
  Documentation/format-patch: suggest Toggle Word Wrap add-on for Thunderbird
  Documentation: publicize hints for sending patches with GMail
  Documentation: publicize KMail hints for sending patches inline
  Documentation: hints for sending patches inline with Thunderbird
  Documentation: explain how to check for patch corruption
2011-05-26 09:39:33 -07:00
Junio C Hamano
ea8ec091fa Merge branch 'jc/maint-pathspec-stdin-and-cmdline' into maint
* jc/maint-pathspec-stdin-and-cmdline:
  setup_revisions(): take pathspec from command line and --stdin correctly
2011-05-26 09:38:44 -07:00
Junio C Hamano
0e66f8722c Merge branch 'jk/cherry-pick-root-with-resolve' into maint
* jk/cherry-pick-root-with-resolve:
  t3503: test cherry picking and reverting root commits
  revert: allow reverting a root commit
  cherry-pick: handle root commits with external strategies
2011-05-26 09:37:41 -07:00
Junio C Hamano
93446aa760 Merge branch 'rg/copy-gecos-username' into maint
* rg/copy-gecos-username:
  copy_gecos: fix not adding nlen to len when processing "&"
2011-05-26 09:37:04 -07:00
Junio C Hamano
9e0ec12728 Merge branch 'fc/completion-zsh' into maint
* fc/completion-zsh:
  git-completion: fix regression in zsh support
2011-05-26 09:36:33 -07:00
Junio C Hamano
5590fe762f Merge branch 'jk/git-connection-deadlock-fix' into maint
* jk/git-connection-deadlock-fix:
  test core.gitproxy configuration
  send-pack: avoid deadlock on git:// push with failed pack-objects
  connect: let callers know if connection is a socket
  connect: treat generic proxy processes like ssh processes

Conflicts:
	connect.c
2011-05-26 09:33:25 -07:00
Junio C Hamano
f09937de96 Merge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix' into maint
* js/maint-send-pack-stateless-rpc-deadlock-fix:
  sideband_demux(): fix decl-after-stmt
  send-pack: unbreak push over stateless rpc
  send-pack: avoid deadlock when pack-object dies early
2011-05-26 09:32:14 -07:00
Junio C Hamano
a02cf90144 compat/fnmatch/fnmatch.c: give a fall-back definition for NULL
Somebody tried to compile fnmatch.c compatibility file on Interix and got
an error because no header included in the file on that platform defined
NULL.  It usually comes from stddef.h and indirectly from other headers
like string.h, unistd.h, stdio.h, stdlib.h, etc., but with the way we
compile this file from our Makefile, inclusion of the header files that
are expected to define NULL in fnmatch.c do not happen because they are
protected with "#ifdef STDC_HEADERS", etc. which we do not pass.

As the least-impact workaround, give a fall-back definition when none of
the headers define NULL.

Noticed-by: Markus Duft <mduft@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 09:25:47 -07:00
Junio C Hamano
46bf76ac31 Merge branch 'svn-fe-maint' of git://repo.or.cz/git/jrn into maint
* 'svn-fe-maint' of git://repo.or.cz/git/jrn:
  Revert "t0081 (line-buffer): add buffering tests"
2011-05-26 08:52:11 -07:00
Junio C Hamano
5cfe4256d9 Merge branch 'jc/bigfile'
* jc/bigfile:
  Bigfile: teach "git add" to send a large file straight to a pack
  index_fd(): split into two helper functions
  index_fd(): turn write_object and format_check arguments into one flag
2011-05-25 16:23:26 -07:00
Junio C Hamano
84da3e21dc Merge branch 'js/log-abbrev-commit-config'
* js/log-abbrev-commit-config:
  Add log.abbrevCommit config variable
  "git log -h": typofix misspelled 'suppress'
2011-05-25 16:23:22 -07:00
Junio C Hamano
6741c2e64a Merge branch 'maint'
* maint:
  init/clone: remove short option -L and document --separate-git-dir
2011-05-25 15:25:44 -07:00
Jens Lehmann
ea5070c91f Teach read-tree the -n|--dry-run option
The option can be used to check if read-tree with the same set of other
options like "-m" and "-u" would succeed without actually changing either
the index or the working tree.

The relevant tests in the t10?? range were extended to do a read-tree -n
before the real read-tree to make sure neither the index nor any local
files were changed with -n and the same exit code as without -n is
returned. The helper functions added for that purpose reside in the new
t/lib-read-tree.sh file.

The only exception is #13 in t1004 ("unlinking an un-unlink-able
symlink"). As this is an issue of wrong directory permissions it is not
detected with -n.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-25 15:04:25 -07:00
Jens Lehmann
2c9078d05b unpack-trees: add the dry_run flag to unpack_trees_options
Until now there was no way to test if unpack_trees() with update=1 would
succeed without really updating the work tree. The reason for that is that
setting update to 0 does skip the tests for new files and deactivates the
sparse handling, thereby making that unsuitable as a dry run.

Add the new dry_run flag to struct unpack_trees_options unpack_trees().
Setting that together with the update flag will check if the work tree
update would be successful without doing it for real.

The only class of problems that is not detected at the moment are file
system conditions like ENOSPC or missing permissions. Also the index
entries of updated files are not as they would be after a real checkout
because lstat() isn't run as the files aren't updated for real.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-25 14:32:02 -07:00
Junio C Hamano
a6253d1077 userformat_find_requirements(): find requirement for the correct format
This function was introduced in 5b16360 (pretty: Initialize notes if %N is
used, 2010-04-13) to check what kind of information the "log --format=..."
user format string wants. The function can be passed a NULL instead of a
format string to ask it to check user_format variable kept by an earlier
call to save_user_format().

But it unconditionally checked user_format and not the string it was
given.  The only caller introduced by the change passes NULL, which
kept the bug unnoticed, until a new GCC noticed that there is an
assignment to fmt that is never used.

Noticed-by: Chris Wilson's compiler
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Jeff King <peff@peff.net>
2011-05-25 13:08:10 -07:00
Jakub Narebski
f612a71cc9 gitweb: Refactor reading and parsing config file into read_config_file
Beside being obvious reduction of duplicated code, this is enables us
to easily call site-wide config file in per-installation config file.

The actual update to documentation is left for next commit, because of
possible exclusive alternative (possible other next commit) of always
reading system-wide config file and relying on per-instalation config
file overriding system-wide defaults.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-25 12:36:43 -07:00
Michael J Gruber
600a6a68c0 sh-18n: quell "unused variable" warning
show_variables is set but never used. Comment it out rather than remove it so
that the relation with upstream remains clear.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-25 09:35:59 -07:00
Nguyen Thai Ngoc Duy
09ffc706e4 init/clone: remove short option -L and document --separate-git-dir
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-25 09:30:26 -07:00
Junio C Hamano
73546c085d handle_options(): do not miscount how many arguments were used
The handle_options() function advances the base of the argument array and
returns the number of arguments it used. The caller in handle_alias()
wants to reallocate the argv array it passes to this function, and
attempts to do so by subtracting the returned value to compensate for the
change handle_options() makes to the new_argv.

But handle_options() did not correctly count when "-c <config=value>" is
given, causing a wrong pointer to be passed to realloc().

Fix it by saving the original argv at the beginning of handle_options(),
and return the difference between the final value of argv, which will
relieve the places that move the array pointer from the additional burden
of keeping track of "handled" counter.

Noticed-by: Kazuki Tsujimoto
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 16:25:46 -07:00
Jeff King
06eb708f33 config: always parse GIT_CONFIG_PARAMETERS during git_config
Previously we parsed GIT_CONFIG_PARAMETERS lazily into a
linked list, and then checked that list during future
invocations of git_config. However, that ignores the fact
that the environment variable could change during our run
(e.g., because we parse more "-c" as part of an alias).

Instead, let's just re-parse the environment variable each
time. It's generally not very big, and it's no more work
than parsing the config files, anyway.

As a bonus, we can ditch all of the linked list storage code
entirely, making the code much simpler.

The test unfortunately still does not pass because of an
unrelated bug in handle_options.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 16:25:36 -07:00
Jeff King
5a0c9eeb89 git_config: don't peek at global config_parameters
The config_parameters list in config.c is an implementation
detail of git_config_from_parameters; instead, that function
should tell us whether it found anything.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 16:20:56 -07:00