Commit graph

29863 commits

Author SHA1 Message Date
Jonathan Nieder 96b9e0e313 config: treat user and xdg config permission problems as errors
Git reads multiple configuration files: settings come first from the
system config file (typically /etc/gitconfig), then the xdg config
file (typically ~/.config/git/config), then the user's dotfile
(~/.gitconfig), then the repository configuration (.git/config).

Git has always used access(2) to decide whether to use each file; as
an unfortunate side effect, that means that if one of these files is
unreadable (e.g., EPERM or EIO), git skips it.  So if I use
~/.gitconfig to override some settings but make a mistake and give it
the wrong permissions then I am subject to the settings the sysadmin
chose for /etc/gitconfig.

Better to error out and ask the user to correct the problem.

This only affects the user and xdg config files, since the user
presumably has enough access to fix their permissions.  If the system
config file is unreadable, the best we can do is to warn about it so
the user knows to notify someone and get on with work in the meantime.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-13 21:59:16 -07:00
Jonathan Nieder e5c52c9898 config, gitignore: failure to access with ENOTDIR is ok
The access_or_warn() function is used to check for optional
configuration files like .gitconfig and .gitignore and warn when they
are not accessible due to a configuration issue (e.g., bad
permissions).  It is not supposed to complain when a file is simply
missing.

Noticed on a system where ~/.config/git was a file --- when the new
XDG_CONFIG_HOME support looks for ~/.config/git/config it should
ignore ~/.config/git instead of printing irritating warnings:

 $ git status -s
 warning: unable to access '/home/jrn/.config/git/config': Not a directory
 warning: unable to access '/home/jrn/.config/git/config': Not a directory
 warning: unable to access '/home/jrn/.config/git/config': Not a directory
 warning: unable to access '/home/jrn/.config/git/config': Not a directory

Compare v1.7.12.1~2^2 (attr:failure to open a .gitattributes file
is OK with ENOTDIR, 2012-09-13).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-13 21:59:13 -07:00
Junio C Hamano 8e950dab86 attr: failure to open a .gitattributes file is OK with ENOTDIR
Often we consult an in-tree .gitattributes file that exists per
directory.  Majority of directories do not usually have such a file,
and it is perfectly fine if we cannot open it because there is no
such file, but we do want to know when there is an I/O or permission
error.  Earlier, we made the codepath warn when we fail to open it
for reasons other than ENOENT for that reason.

We however sometimes have to attempt to open the .gitattributes file
from a directory that does not exist in the commit that is currently
checked out.  "git pack-objects" wants to know if a path is marked
with "-delta" attributes, and "git archive" wants to know about
export-ignore and export-subst attributes.  Both commands may and do
need to ask the attributes system about paths in an arbitrary
commit.  "git diff", after removing an entire directory, may want to
know textconv on paths that used to be in that directory.

Make sure we also ignore a failure to open per-directory attributes
file due to ENOTDIR.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-13 22:15:10 -07:00
Junio C Hamano 55b38a48e2 warn_on_inaccessible(): a helper to warn on inaccessible paths
The previous series introduced warnings to multiple places, but it
could become tiring to see the warning on the same path over and
over again during a single run of Git.  Making just one function
responsible for issuing this warning, we could later choose to keep
track of which paths we issued a warning (it would involve a hash
table of paths after running them through real_path() or something)
in order to reduce noise.

Right now we do not know if the noise reduction is necessary, but it
still would be a good code reduction/sharing anyway.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-21 14:52:07 -07:00
Jeff King 11e50b2736 attr: warn on inaccessible attribute files
Just like config and gitignore files, we silently ignore
missing or inaccessible attribute files. An existent but
inaccessible file is probably a configuration error, so
let's warn the user.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-21 14:47:07 -07:00
Jeff King 6966073102 gitignore: report access errors of exclude files
When we try to access gitignore files, we check for their
existence with a call to "access". We silently ignore
missing files. However, if a file is not readable, this may
be a configuration error; let's warn the user.

For $GIT_DIR/info/excludes or core.excludesfile, we can just
use access_or_warn. However, for per-directory files we
actually try to open them, so we must add a custom warning.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-21 14:46:47 -07:00
Jeff King ba8bd8300a config: warn on inaccessible files
Before reading a config file, we check "!access(path, R_OK)"
to make sure that the file exists and is readable. If it's
not, then we silently ignore it.

For the case of ENOENT, this is fine, as the presence of the
file is optional. For other cases, though, it may indicate a
configuration error (e.g., not having permissions to read
the file). Let's print a warning in these cases to let the
user know.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-21 14:46:11 -07:00
Junio C Hamano 889d35899b Git 1.7.12
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-19 17:02:11 -07:00
Junio C Hamano 91e4bfe96f Merge branch 'jc/doc-git-updates' (early part)
* 'jc/doc-git-updates' (early part):
  Documentation: update URL for formatted pages
2012-08-17 13:27:10 -07:00
Junio C Hamano c70c09b6fc Documentation: update URL for formatted pages
The one at kernel.org has not been updated for quite a while and
can no longer be called "the latest".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-17 13:25:43 -07:00
Junio C Hamano bd120e36d2 Merge git://github.com/git-l10n/git-po to update Swedish translation
* git://github.com/git-l10n/git-po:
  l10n: Fixes to Swedish translation
2012-08-16 20:13:45 -07:00
Peter Krefting 5b8056c155 l10n: Fixes to Swedish translation
Tersify texts overflowing an 80-character terminal.
Fix spelling mistakes.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2012-08-16 13:57:51 +01:00
Junio C Hamano 2a9a19e1b1 Git 1.7.12-rc3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-15 13:46:16 -07:00
Junio C Hamano 47e32d071e Sync with 1.7.11.5 2012-08-15 13:41:17 -07:00
Junio C Hamano cd7c0be19f Git 1.7.11.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-15 13:39:53 -07:00
Junio C Hamano d7d3b56bb1 Merge branch 'rj/maint-grep-remove-redundant-test' into maint
* rj/maint-grep-remove-redundant-test:
  t7810-*.sh: Remove redundant test
2012-08-15 13:37:20 -07:00
Junio C Hamano 45b65a6b67 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
2012-08-15 13:36:47 -07:00
Peter Baumann 61b472ed8b git svn: reset invalidates the memoized mergeinfo caches
Since v1.7.0-rc2~11 (git-svn: persistent memoization, 2010-01-30),
git-svn has maintained some private per-repository caches in
.git/svn/.caches to avoid refetching and recalculating some
mergeinfo-related information with every 'git svn fetch'.

This memoization can cause problems, e.g consider the following case:

SVN repo:

  ... - a - b - c - m  <- trunk
          \        /
            d  -  e    <- branch1

The Git import of the above repo is at commit 'a' and doesn't know about
the branch1. In case of an 'git svn rebase', only the trunk of the
SVN repo is imported. During the creation of the git commit 'm', git svn
uses the svn:mergeinfo property and tries to find the corresponding git
commit 'e' to create 'm' with 'c' and 'e' as parents. But git svn rebase
only imports the current branch so commit 'e' is not imported.
Therefore git svn fails to create commit 'm' as a merge commit, because one
of its parents is not known to git. The imported history looks like this:

  ... - a - b - c - m  <- trunk

A later 'git svn fetch' to import all branches can't rewrite the commit 'm'
to add 'e' as a parent and to make it a real git merge commit, because it
was already imported.

That's why the imported history misses the merge and looks like this:

  ... - a - b - c - m  <- trunk
          \
            d  -  e    <- branch1

Right now the only known workaround for importing 'm' as a merge is to
force reimporting 'm' again from SVN, e.g. via

  $ git svn reset --revision $(git find-rev $c)
  $ git svn fetch

Sadly, this is where the behavior has regressed: git svn reset doesn't
invalidate the old mergeinfo cache, which is no longer valid for the
reimport, which leads to 'm' beeing imprted with only 'c' as parent.

As solution to this problem, this commit invalidates the mergeinfo cache
to force correct recalculation of the parents.

During development of this patch, several ways for invalidating the cache
where considered. One of them is to use Memoize::flush_cache, which will
call the CLEAR method on the underlying Memoize persistency implementation.
Sadly, neither Memoize::Storable nor the newer Memoize::YAML module
introduced in 68f532f4ba could optionally be used implement the
CLEAR method, so this is not an option.

Reseting the internal hash used to store the memoized values has the same
problem, because it calls the non-existing CLEAR method of the
underlying persistency layer, too.

Considering this and taking into account the different implementations
of the memoization modules, where Memoize::Storable is not in our control,
implementing the missing CLEAR method is not an option, at least not if
Memoize::Storable is still used.

Therefore the easiest solution to clear the cache is to delete the files
on disk in 'git svn reset'. Normally, deleting the files behind the back
of the memoization module would be problematic, because the in-memory
representation would still exist and contain wrong data. Fortunately, the
memoization is active in memory only for a small portion of the code.
Invalidating the cache by deleting the files on disk if it isn't active
should be safe.

Signed-off-by: Peter Baumann <waste.manager@gmx.de>
Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-08-10 19:53:18 +00:00
Robert Luberda e48fb750f5 git svn: handle errors and concurrent commits in dcommit
dcommit didn't handle errors returned by SVN and coped very
poorly with concurrent commits that appear in SVN repository
while dcommit was running. In both cases it left git repository
in inconsistent state: index (which was reset with `git reset
--mixed' after a successful commit to SVN) no longer matched the
checkouted tree, when the following commit failed or needed to be
rebased. See http://bugs.debian.org/676904 for examples.

This patch fixes the issues by:
- introducing error handler for dcommit. The handler will try
  to rebase or reset working tree before returning error to the
  end user. dcommit_rebase function was extracted out of cmd_dcommit
  to ensure consistency between cmd_dcommit and the error handler.
- calling `git reset --mixed' only once after all patches are
  successfully committed to SVN. This ensures index is not touched
  for most of the time of dcommit run.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-08-10 19:53:18 +00:00
Junio C Hamano 034161a94e Merge git://github.com/git-l10n/git-po
L10n updates for 1.7.12-rc2

* 'master' of git://github.com/git-l10n/git-po:
  l10n: Update Swedish translation (1168t0f0u)
  l10n: de.po: translate 77 new messages
  l10n: vi.po: update one message
  l10n: zh_CN.po: update one translation
  l10n: Update one message in git.pot
2012-08-09 10:51:46 -07:00
Peter Krefting cc2f50dafe l10n: Update Swedish translation (1168t0f0u)
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2012-08-09 06:39:17 +01:00
Junio C Hamano e5acacfb48 Merge branch 'bw/maint-1.7.9-solaris-getpass'
The recent update to terminal I/O interface to get passwords &c
interactively didn't quite work on Solaris.

* bw/maint-1.7.9-solaris-getpass:
  Enable HAVE_DEV_TTY for Solaris
  terminal: seek when switching between reading and writing
2012-08-08 15:14:58 -07:00
Matthieu Moy fa0aad4ff5 Documentation: list git-credential in plumbing commands
Commit e30b2feb1b (Jun 24 2012, add 'git credential' plumbing command)
forgot to add git-credential to command-list.txt, hence the command was
not appearing in the documentation, making it hard for users to discover
it.

While we're there, capitalize the description line for git-crendential
for consistency with other commands.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-08 09:59:17 -07:00
Jiang Xin da53e27e94 Merge git://github.com/ralfth/git-po-de
* git://github.com/ralfth/git-po-de:
  l10n: de.po: translate 77 new messages
2012-08-08 07:23:01 +08:00
Junio C Hamano e15c16de39 Git 1.7.12-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-07 10:39:34 -07:00
Ralf Thielow 33a54e7d9a l10n: de.po: translate 77 new messages
Translate 77 new messages came from git.pot update
in 3b6137f (l10n: Update git.pot (76 new, 4 removed
messages)) and bb2ba06 (l10n: Update one message in
git.pot).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
2012-08-07 18:41:18 +02:00
Ben Walton 436783c95a 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>
2012-08-06 22:12:43 -07:00
Jeff King 67ba123fd1 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>
2012-08-06 22:11:47 -07:00
Tran Ngoc Quan 58b66f8f76 l10n: vi.po: update one message
* Translate message that updated from commit bb2ba06

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2012-08-07 07:22:59 +07:00
Junio C Hamano b1d9b1d0f1 Drop 1.7.11.x items from 1.7.12 release notes
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-06 15:58:38 -07:00
Junio C Hamano 9ffdd46ae4 Sync with maint 2012-08-06 15:53:33 -07:00
Junio C Hamano b17a01df49 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>
2012-08-06 15:51:58 -07:00
Junio C Hamano c8dacba762 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
2012-08-06 15:40:00 -07:00
Junio C Hamano dbf64e125a 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"
2012-08-06 15:39:38 -07:00
Junio C Hamano c2e585f530 Merge branch 'ms/daemon-doc-typo' into maint
* ms/daemon-doc-typo:
  Documentation/git-daemon: add missing word
2012-08-06 15:39:16 -07:00
Junio C Hamano 05f5ba6b5d 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
2012-08-06 15:37:54 -07:00
Junio C Hamano 125f6435b1 Merge branch 'rs/ipv6-ssh-url' into maint
* rs/ipv6-ssh-url:
  git: Wrong parsing of ssh urls with IPv6 literals ignores port
2012-08-06 15:37:43 -07:00
Junio C Hamano e597c43de2 Merge branch 'rs/git-blame-mapcar-mapc' into maint
* rs/git-blame-mapcar-mapc:
  git-blame.el: use mapc instead of mapcar
2012-08-06 15:37:28 -07:00
Junio C Hamano 809b262543 Merge branch 'rr/doc-commit' into maint
* rr/doc-commit:
  commit: document a couple of options
2012-08-06 15:37:09 -07:00
Štěpán Němec 7615cb005b 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>
2012-08-06 15:34:20 -07:00
Junio C Hamano 1b8e822e57 Merge branch 'jk/maint-checkout-orphan-check-fix' into maint
* jk/maint-checkout-orphan-check-fix:
  checkout: don't confuse ref and object flags
2012-08-06 15:31:16 -07:00
Junio C Hamano eb536007df Merge branch 'mh/maint-revisions-doc' into maint
* mh/maint-revisions-doc:
  Enumerate revision range specifiers in the documentation
  Make <refname> documentation more consistent.
2012-08-06 15:30:57 -07:00
Junio C Hamano f52a386ef2 Merge branch 'jc/mergetool-tool-help' into maint
* jc/mergetool-tool-help:
  mergetool: support --tool-help option like difftool does
2012-08-06 15:30:18 -07:00
Johannes Sixt 9145b19ecf Makefile: use overridable $(FIND) instead of hard-coded 'find'
The Makefile already offers the variable $(FIND) and uses it except in one
place. Fix it.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-06 14:21:13 -07:00
Jiang Xin e5e38ce485 l10n: zh_CN.po: update one translation
Translate 1 new messages came from git.pot update in bb2ba06
(l10n: Update one message in git.pot)

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2012-08-07 01:10:34 +08:00
Jiang Xin bb2ba06fd3 l10n: Update one message in git.pot
This update comes from commit v1.7.12-rc1-18-ge0453
(merge-recursive: separate message for common ancestors).

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2012-08-06 23:48:08 +08:00
Junio C Hamano bfbf4d477a Merge git://github.com/git-l10n/git-po
* git://github.com/git-l10n/git-po:
  l10n: zh_CN.po: translate 76 new messages
  l10n: vi.po update to follow POT in 3b613
  l10n: Update git.pot (76 new, 4 removed messages)
2012-08-05 20:51:05 -07:00
Ralf Thielow e0453cd8f0 merge-recursive: separate message for common ancestors
The function "merge_recursive" prints the count of common ancestors
as "found %u common ancestor(s):".  We should use a singular and a
plural form of this message to help translators.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-05 12:34:57 -07:00
Jiang Xin 649900bc12 l10n: zh_CN.po: translate 76 new messages
Translate 76 new messages came from git.pot update in 3b6137f
(l10n: Update git.pot (76 new, 4 removed messages))

Thynson reviewed this update and also contributed other improvements:

 * blob -> 二进制对象(blob)
 * 共用 -> 同时使用

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Reviewed-by: Thynson <lanxingcan@gmail.com>
2012-08-05 07:12:27 +08:00
Matthieu Moy 9a7365cfa4 git-remote-mediawiki: replace TODO-list in comment by appropriate link
My account on Github is now used as wiki and issue tracking. This will be
more flexible than in-tree management of a TODO-list.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-03 09:13:28 -07:00