Commit graph

38594 commits

Author SHA1 Message Date
Paul Tan 2845ce7ff1 dir.c: replace home_config_paths() with xdg_config_home()
Since only the xdg excludes file path is required, simplify the code by
replacing use of home_config_paths() with xdg_config_home().

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-05-06 11:33:17 -07:00
Paul Tan 2527bbce25 attr.c: replace home_config_paths() with xdg_config_home()
Since only the xdg attributes file path is required, simplify the code
by using xdg_config_home() instead of home_config_paths().

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-05-06 11:32:46 -07:00
Paul Tan ea19289bc8 path.c: implement xdg_config_home()
The XDG base dir spec[1] specifies that configuration files be stored in
a subdirectory in $XDG_CONFIG_HOME. To construct such a configuration
file path, home_config_paths() can be used. However, home_config_paths()
combines distinct functionality:

1. Retrieve the home git config file path ~/.gitconfig

2. Construct the XDG config path of the file specified by `file`.

This function was introduced in commit 21cf3227 ("read (but not write)
from $XDG_CONFIG_HOME/git/config file").  While the intention of the
function was to allow the home directory configuration file path and the
xdg directory configuration file path to be retrieved with one function
call, the hard-coding of the path ~/.gitconfig prevents it from being
used for other configuration files. Furthermore, retrieving a file path
relative to the user's home directory can be done with
expand_user_path(). Hence, it can be seen that home_config_paths()
introduces unnecessary complexity, especially if a user just wants to
retrieve the xdg config file path.

As such, implement a simpler function xdg_config_home() for constructing
the XDG base dir spec configuration file path. This function, together
with expand_user_path(), can replace all uses of home_config_paths().

[1] http://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-05-06 11:21:04 -07:00
Junio C Hamano efee5981d3 t0302: "unreadable" test needs POSIXPERM
Noticed and fixed by Eric Sunshine, confirmed by Johannes Sixt.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-03-25 13:23:21 -07:00
Paul Tan 7e314539d6 t0302: test credential-store support for XDG_CONFIG_HOME
t0302 now tests git-credential-store's support for the XDG user-specific
configuration file $XDG_CONFIG_HOME/git/credentials. Specifically:

* Ensure that the XDG file is strictly opt-in. It should not be created
  by git at all times if it does not exist.

* Conversely, if the XDG file exists, ~/.git-credentials should
  not be created at all times.

* If both the XDG file and ~/.git-credentials exists, then both files
  should be used for credential lookups. However, credentials should
  only be written to ~/.git-credentials.

* Credentials must be erased from both files.

* $XDG_CONFIG_HOME can be a custom directory set by the user as per the
  XDG base directory specification. Test that git-credential-store
  respects that, but defaults to "~/.config/git/credentials" if it does
  not exist or is empty.

Helped-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-03-24 08:08:10 -07:00
Paul Tan 44b228985e git-credential-store: support XDG_CONFIG_HOME
Add $XDG_CONFIG_HOME/git/credentials to the default credential search
path of git-credential-store. This allows git-credential-store to
support user-specific configuration files in accordance with the XDG
base directory specification[1].

[1] http://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html

~/.git-credentials has a higher precedence than
$XDG_CONFIG_HOME/git/credentials when looking up credentials.  This
means that if any duplicate matching credentials are found in the xdg
file (due to ~/.git-credentials being updated by old versions of git or
outdated tools), they will not be used at all. This is to give the user
some leeway in switching to old versions of git while keeping the xdg
directory. This is consistent with the behavior of git-config.

However, the higher precedence of ~/.git-credentials means that as long
as ~/.git-credentials exist, all credentials will be written to the
~/.git-credentials file even if the user has an xdg file as having a
~/.git-credentials file indicates that the user wants to preserve
backwards-compatibility. This is also consistent with the behavior of
git-config.

To make this precedence explicit in docs/git-credential-store, add a new
section FILES that lists out the credential file paths in their order of
precedence, and explain how the ordering affects the lookup, storage and
erase operations.

Also, update the documentation for --file to briefly explain the
operations on multiple files if the --file option is not provided.

Since the xdg file will not be used unless it actually exists, to
prevent the situation where some credentials are present in the xdg file
while some are present in the home file, users are recommended to not
create the xdg file if they require compatibility with old versions of
git or outdated tools. Note, though, that "erase" can be used to
explicitly erase matching credentials from all files.

Helped-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-03-24 08:08:02 -07:00
Paul Tan cb2c2796e0 git-credential-store: support multiple credential files
Previously, git-credential-store only supported storing credentials in a
single file: ~/.git-credentials. In order to support the XDG base
directory specification[1], git-credential-store needs to be able to
lookup and erase credentials from multiple files, as well as to pick the
appropriate file to write to so that the credentials can be found on
subsequent lookups.

[1] http://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html

Note that some credential storage files may not be owned, readable or
writable by the user, as they may be system-wide files that are meant to
apply to every user.

Instead of a single file path, lookup_credential(), remove_credential()
and store_credential() now take a precedence-ordered string_list of
file paths. lookup_credential() expects both user-specific and
system-wide credential files to be provided to support the use case of
system administrators setting default credentials for users.
remove_credential() and store_credential() expect only the user-specific
credential files to be provided as usually the only config files that
users are allowed to edit are their own user-specific ones.

lookup_credential() will read these (user-specific and system-wide) file
paths in order until it finds the 1st matching credential and print it.
As some files may be private and thus unreadable, any file which cannot
be read will be ignored silently.

remove_credential() will erase credentials from all (user-specific)
files in the list.  This is because if credentials are only erased from
the file with the highest precedence, a matching credential may still be
found in a file further down the list. (Note that due to the lockfile
code, this requires the directory to be writable, which should be so for
user-specific config files)

store_credential() will write the credentials to the first existing
(user-specific) file in the list. If none of the files in the list
exist, store_credential() will write to the filename specified by the
first item of the filename list. For backwards compatibility, this
filename should be "~/.git-credentials".

Helped-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-03-24 08:07:54 -07:00
Junio C Hamano 9874fca712 Git 2.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-02-05 13:23:56 -08:00
Junio C Hamano 0d1c285af2 Merge git://github.com/git-l10n/git-po
* git://github.com/git-l10n/git-po:
  l10n: ca.po: Fix trailing whitespace
2015-02-02 12:05:56 -08:00
Alex Henrie 7471cf88f5 l10n: ca.po: Fix trailing whitespace
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
2015-01-30 15:02:34 -07:00
Junio C Hamano 15598cf41b Git 2.3.0-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-27 14:39:53 -08:00
Junio C Hamano ff76d36b35 Merge git://github.com/git-l10n/git-po
* git://github.com/git-l10n/git-po:
  l10n: de.po: correct singular form
  l10n: de.po: translate "leave behind" correctly
  l10n: de.po: fix typo
  l10n: ca.po: update translation
2015-01-27 11:01:05 -08:00
Jiang Xin b4fde1e37d Merge branch 'master' of git://github.com/alexhenrie/git-po
* 'master' of git://github.com/alexhenrie/git-po:
  l10n: ca.po: update translation
2015-01-27 15:00:48 +08:00
Michael J Gruber 07586ebd4f l10n: de.po: correct singular form
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-01-26 19:36:04 +01:00
Michael J Gruber 2f334c6461 l10n: de.po: translate "leave behind" correctly
This message is about leaving orphaned commits behind, not about
behind an upstream branch. Try to make this clear.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-01-26 19:36:04 +01:00
Benedikt Heine 3b36ef9188 l10n: de.po: fix typo
Signed-off-by: Benedikt Heine <bebe@bebehei.de>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-01-26 19:36:04 +01:00
Alex Henrie 573ed5e147 l10n: ca.po: update translation
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
2015-01-26 10:12:50 -07:00
Junio C Hamano 76afe74b10 Merge branch 'js/t1050'
* js/t1050:
  t1050-large: generate large files without dd
2015-01-22 13:46:45 -08:00
Junio C Hamano 67b5440d0d Merge branch 'ak/cat-file-clean-up'
* ak/cat-file-clean-up:
  cat-file: use "type" and "size" from outer scope
2015-01-22 13:46:38 -08:00
Junio C Hamano d588d4d940 Merge git://github.com/git-l10n/git-po
* git://github.com/git-l10n/git-po:
  l10n: correct indentation of show-branch usage
  l10n: de.po: translate 3 messages
  l10n: zh_CN: various fixes on command arguments
  l10n: vi.po(2298t): Updated 3 new strings
  l10n: sv.po: Update Swedish translation (2298t0f0u)
  l10n: fr.po v2.3.0 round 2
  l10n: git.pot: v2.3.0 round 2 (3 updated)
  l10n: de.po: translate 13 new messages
  l10n: de.po: fix typo
  l10n: de.po: translate "track" as "versionieren"
  l10n: zh_CN: translations for git v2.3.0-rc0
  l10n: sv.po: Update Swedish translation (2298t0f0u)
  l10n: fr.po v2.3.0 round 1
  l10n: vi.po(2298t): Updated and change Plural-Forms
  l10n: git.pot: v2.3.0 round 1 (13 new, 11 removed)
  l10n: ca.po: various fixes
2015-01-22 13:45:07 -08:00
Junio C Hamano ab9432d375 Merge branch 'sh/asciidoc-git-version-fix'
* sh/asciidoc-git-version-fix:
  Documentation: fix version numbering
2015-01-22 13:44:47 -08:00
Sven van Haastregt a4c044484e Documentation: fix version numbering
Version numbers in asciidoc-generated content (such as man pages)
went missing as of da8a366 (Documentation: refactor common operations
into variables).  Fix by putting the underscore back in the variable
name.

Signed-off-by: Sven van Haastregt <svenvh@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-22 13:44:14 -08:00
Junio C Hamano ee443cf236 Merge branch 'jh/empty-notes'
* jh/empty-notes:
  Fix unclosed here document in t3301.sh
2015-01-22 13:42:37 -08:00
Kacper Kornet 85cb1d0ba8 Fix unclosed here document in t3301.sh
Commit 908a320363 introduced  indentation
to here documents in t3301.sh. However in one place <<-EOF was missing
-, which broke this test when run with mksh-50d. This commit fixes it.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-22 12:23:42 -08:00
Jiang Xin 1e60744913 l10n: correct indentation of show-branch usage
An indentation error was found right after we started l10n round 2, and
commit d6589d1 (show-branch: fix indentation of usage string) and this
update would fix it.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-01-21 15:35:37 +08:00
Jiang Xin 54d80a9343 Merge branch 'master' of git://github.com/git-l10n/git-po
* 'master' of git://github.com/git-l10n/git-po:
  l10n: de.po: translate 3 messages
  l10n: zh_CN: various fixes on command arguments
  l10n: vi.po(2298t): Updated 3 new strings
  l10n: sv.po: Update Swedish translation (2298t0f0u)
  l10n: fr.po v2.3.0 round 2
  l10n: git.pot: v2.3.0 round 2 (3 updated)
  l10n: de.po: translate 13 new messages
  l10n: de.po: fix typo
  l10n: de.po: translate "track" as "versionieren"
  l10n: zh_CN: translations for git v2.3.0-rc0
  l10n: sv.po: Update Swedish translation (2298t0f0u)
  l10n: fr.po v2.3.0 round 1
  l10n: vi.po(2298t): Updated and change Plural-Forms
  l10n: git.pot: v2.3.0 round 1 (13 new, 11 removed)
  l10n: ca.po: various fixes
2015-01-21 14:20:53 +08:00
Junio C Hamano 627736ca79 Git 2.3.0-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-20 17:35:41 -08:00
Junio C Hamano ea6e82c875 Merge branch 'jk/http-push-symref-fix'
* jk/http-push-symref-fix:
  http-push: trim trailing newline from remote symref
2015-01-20 17:31:50 -08:00
Junio C Hamano 17ad37112d Merge branch 'ak/show-branch-usage-string'
* ak/show-branch-usage-string:
  show-branch: fix indentation of usage string
2015-01-20 16:16:09 -08:00
Ralf Thielow d6589d1ba4 show-branch: fix indentation of usage string
Noticed-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-20 16:12:54 -08:00
Junio C Hamano d06ce4a508 Merge branch 'jk/colors'
* jk/colors:
  parse_color: fix return value for numeric color values 0-8
2015-01-20 15:57:22 -08:00
Jeff King 3759d27aca parse_color: fix return value for numeric color values 0-8
When commit 695d95d refactored the color parsing, it missed
a "return 0" when parsing literal numbers 0-8 (which
represent basic ANSI colors), leading us to report these
colors as an error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-20 15:56:03 -08:00
Ralf Thielow a235de4bd2 l10n: de.po: translate 3 messages
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-01-20 19:23:57 +01:00
Jiang Xin d9d56b2357 l10n: zh_CN: various fixes on command arguments
Updated translations for Git 2.3.0 l10n round 2, and fixed various
translations for command arguments.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-01-19 10:23:53 +08:00
Jiang Xin 07361f12ab Merge branch 'v2.3.0' of git://github.com/jnavila/git
* 'v2.3.0' of git://github.com/jnavila/git:
  l10n: fr.po v2.3.0 round 2
2015-01-19 10:12:46 +08:00
Jiang Xin 482f68e741 Merge branch 'master' of git://github.com/nafmo/git-l10n-sv
* 'master' of git://github.com/nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation (2298t0f0u)
2015-01-19 10:10:57 +08:00
Tran Ngoc Quan d1f9c7b77e l10n: vi.po(2298t): Updated 3 new strings
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2015-01-19 07:20:28 +07:00
Peter Krefting 0ef279509b l10n: sv.po: Update Swedish translation (2298t0f0u)
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2015-01-18 20:30:18 +01:00
Jean-Noel Avila bf41b712c7 l10n: fr.po v2.3.0 round 2
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
2015-01-18 17:03:27 +01:00
Jiang Xin 105979f71c l10n: git.pot: v2.3.0 round 2 (3 updated)
Generate po/git.pot from v2.3.0-rc0-44-ga94655d for git v2.3.0 l10n
round 2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-01-18 11:26:57 +08:00
Jiang Xin 48a9a6b5eb Merge branch 'master' of git://github.com/git-l10n/git-po
* 'master' of git://github.com/git-l10n/git-po:
  l10n: de.po: translate 13 new messages
  l10n: de.po: fix typo
  l10n: de.po: translate "track" as "versionieren"
  l10n: zh_CN: translations for git v2.3.0-rc0
  l10n: sv.po: Update Swedish translation (2298t0f0u)
  l10n: fr.po v2.3.0 round 1
  l10n: vi.po(2298t): Updated and change Plural-Forms
  l10n: git.pot: v2.3.0 round 1 (13 new, 11 removed)
  l10n: ca.po: various fixes
2015-01-18 11:24:00 +08:00
Ralf Thielow 124d80928d l10n: de.po: translate 13 new messages
Translate 13 new messages came from git.pot update in
beb691f (l10n: git.pot: v2.3.0 round 1 (13 new, 11 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-01-17 18:10:46 +01:00
Ralf Thielow e1a05ad851 l10n: de.po: fix typo
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-01-17 18:10:02 +01:00
Ralf Thielow 463243d49c l10n: de.po: translate "track" as "versionieren"
Suggested-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-01-17 18:09:56 +01:00
Jiang Xin 04cb2f28cc l10n: zh_CN: translations for git v2.3.0-rc0
Translate 13 new messages (2298t0f0u) for git v2.3.0-rc0.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-01-17 15:28:36 +08:00
Ramkumar Ramachandra a94655dcfe git-svn: make it play nicely with submodules
It's a simple matter of opening the directory specified in the gitfile.

[ew: tweaked check to avoid open() on directories]

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2015-01-15 08:35:55 +00:00
Ramkumar Ramachandra 9a2bb059e7 Git::SVN: handle missing ref_id case correctly
ref_id should not match "refs/remotes/".

[ew: dropped initial hunk for GIT_SVN_ID at Ramkumar's request]

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2015-01-15 08:35:55 +00:00
Peter Krefting 2a26377047 l10n: sv.po: Update Swedish translation (2298t0f0u)
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2015-01-14 22:55:49 +01:00
Johannes Sixt d0a042a186 t1050-large: generate large files without dd
For some unknown reason, the dd on my Windows box segfaults randomly,
but since recently, it does so much more often than it used to, which
makes running the test suite burdensome.

Use printf to write large files instead of dd. To emphasize that three
of the large blobs are exact copies, use cp to allocate them.

The new code makes the files a bit smaller, and they are not sparse
anymore, but the tests do not depend on these properties. We do not want
to use test-genrandom here (which is used to generate large files
elsewhere in t1050), so that the files can be compressed well (which
keeps the run-time short).

The files are now large text files, not binary files. But since they
are larger than core.bigfilethreshold they are diagnosed as binary
by Git. For this reason, the 'git diff' tests that check the output
for "Binary files differ" still pass.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-14 13:08:12 -08:00
Junio C Hamano 563d4e59bd Fifth batch for 2.3 cycle
Hopefully this will be the final feature update for 2.3-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-14 12:44:03 -08:00