<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/path.c, branch v2.6.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.6.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.6.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-08-10T22:37:14Z</updated>
<entry>
<title>memoize common git-path "constant" files</title>
<updated>2015-08-10T22:37:14Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-08-10T09:38:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f932729cc7707390f4d6739be1573e93ceb9df22'/>
<id>urn:sha1:f932729cc7707390f4d6739be1573e93ceb9df22</id>
<content type='text'>
One of the most common uses of git_path() is to pass a
constant, like git_path("MERGE_MSG"). This has two
drawbacks:

  1. The return value is a static buffer, and the lifetime
     is dependent on other calls to git_path, etc.

  2. There's no compile-time checking of the pathname. This
     is OK for a one-off (after all, we have to spell it
     correctly at least once), but many of these constant
     strings appear throughout the code.

This patch introduces a series of functions to "memoize"
these strings, which are essentially globals for the
lifetime of the program. We compute the value once, take
ownership of the buffer, and return the cached value for
subsequent calls.  cache.h provides a helper macro for
defining these functions as one-liners, and defines a few
common ones for global use.

Using a macro is a little bit gross, but it does nicely
document the purpose of the functions. If we need to touch
them all later (e.g., because we learned how to change the
git_dir variable at runtime, and need to invalidate all of
the stored values), it will be much easier to have the
complete list.

Note that the shared-global functions have separate, manual
declarations. We could do something clever with the macros
(e.g., expand it to a declaration in some places, and a
declaration _and_ a definition in path.c). But there aren't
that many, and it's probably better to stay away from
too-magical macros.

Likewise, if we abandon the C preprocessor in favor of
generating these with a script, we could get much fancier.
E.g., normalizing "FOO/BAR-BAZ" into "git_path_foo_bar_baz".
But the small amount of saved typing is probably not worth
the resulting confusion to readers who want to grep for the
function's definition.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>path.c: drop git_path_submodule</title>
<updated>2015-08-10T22:37:13Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-08-10T09:36:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=07e3070d2aa69b0c8f1da5f103a87125ff4baaea'/>
<id>urn:sha1:07e3070d2aa69b0c8f1da5f103a87125ff4baaea</id>
<content type='text'>
There are no callers of the slightly-dangerous static-buffer
git_path_submodule left. Let's drop it.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cache.h: complete set of git_path_submodule helpers</title>
<updated>2015-08-10T22:15:41Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-08-10T09:32:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f5895fd399855e782ed0f86f1ac0531517efa0d9'/>
<id>urn:sha1:f5895fd399855e782ed0f86f1ac0531517efa0d9</id>
<content type='text'>
The git_path function has "git_pathdup" and
"strbuf_git_path" variants, but git_submodule_path only
comes in the dangerous, static-buffer variant. That makes
refactoring callers to use the safer functions hard (since
they don't exist).

Since we're already using a strbuf behind the scenes, it's
easy to expose all three of these interfaces with thin
wrappers.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pt/xdg-config-path'</title>
<updated>2015-05-11T21:24:01Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-05-11T21:24:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=558e5a8c40944a6a952c7e15dab648b922e0bd02'/>
<id>urn:sha1:558e5a8c40944a6a952c7e15dab648b922e0bd02</id>
<content type='text'>
Code clean-up for xdg configuration path support.

* pt/xdg-config-path:
  path.c: remove home_config_paths()
  git-config: replace use of home_config_paths()
  git-commit: replace use of home_config_paths()
  credential-store.c: replace home_config_paths() with xdg_config_home()
  dir.c: replace home_config_paths() with xdg_config_home()
  attr.c: replace home_config_paths() with xdg_config_home()
  path.c: implement xdg_config_home()
</content>
</entry>
<entry>
<title>Merge branch 'nd/multiple-work-trees'</title>
<updated>2015-05-11T21:23:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-05-11T21:23:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=68a2e6a2c80303144807c8c91a087427e3c8e727'/>
<id>urn:sha1:68a2e6a2c80303144807c8c91a087427e3c8e727</id>
<content type='text'>
A replacement for contrib/workdir/git-new-workdir that does not
rely on symbolic links and make sharing of objects and refs safer
by making the borrowee and borrowers aware of each other.

* nd/multiple-work-trees: (41 commits)
  prune --worktrees: fix expire vs worktree existence condition
  t1501: fix test with split index
  t2026: fix broken &amp;&amp;-chain
  t2026 needs procondition SANITY
  git-checkout.txt: a note about multiple checkout support for submodules
  checkout: add --ignore-other-wortrees
  checkout: pass whole struct to parse_branchname_arg instead of individual flags
  git-common-dir: make "modules/" per-working-directory directory
  checkout: do not fail if target is an empty directory
  t2025: add a test to make sure grafts is working from a linked checkout
  checkout: don't require a work tree when checking out into a new one
  git_path(): keep "info/sparse-checkout" per work-tree
  count-objects: report unused files in $GIT_DIR/worktrees/...
  gc: support prune --worktrees
  gc: factor out gc.pruneexpire parsing code
  gc: style change -- no SP before closing parenthesis
  checkout: clean up half-prepared directories in --to mode
  checkout: reject if the branch is already checked out elsewhere
  prune: strategies for linked checkouts
  checkout: support checking out into a new working directory
  ...
</content>
</entry>
<entry>
<title>path.c: remove home_config_paths()</title>
<updated>2015-05-06T18:33:53Z</updated>
<author>
<name>Paul Tan</name>
<email>pyokagan@gmail.com</email>
</author>
<published>2015-05-06T08:01:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=846e5dfbab5d5a0a85252c1400dc0371e02e75a8'/>
<id>urn:sha1:846e5dfbab5d5a0a85252c1400dc0371e02e75a8</id>
<content type='text'>
home_config_paths() combines distinct functionality already implemented
by expand_user_path() and xdg_config_home(), and it also hard-codes the
path ~/.gitconfig, which makes it unsuitable to use for other home
config file paths. Since its use will just add unnecessary complexity to
the code, remove it.

Signed-off-by: Paul Tan &lt;pyokagan@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>path.c: implement xdg_config_home()</title>
<updated>2015-05-06T18:21:04Z</updated>
<author>
<name>Paul Tan</name>
<email>pyokagan@gmail.com</email>
</author>
<published>2015-04-21T04:06:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ea19289bc82351b7ac20ea2fd877e2bdde97ae34'/>
<id>urn:sha1:ea19289bc82351b7ac20ea2fd877e2bdde97ae34</id>
<content type='text'>
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 &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Paul Tan &lt;pyokagan@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pt/enter-repo-comment-fix'</title>
<updated>2015-04-14T17:34:05Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-04-14T17:34:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bf2cfcaabf1f7497ff283c221af9d8b3058867af'/>
<id>urn:sha1:bf2cfcaabf1f7497ff283c221af9d8b3058867af</id>
<content type='text'>
* pt/enter-repo-comment-fix:
  enter_repo(): fix docs to match code
</content>
</entry>
<entry>
<title>enter_repo(): fix docs to match code</title>
<updated>2015-03-31T17:19:53Z</updated>
<author>
<name>Paul Tan</name>
<email>pyokagan@gmail.com</email>
</author>
<published>2015-03-31T13:39:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c8c3f1d087f2195fd6ef61d6cca8241a808ac11a'/>
<id>urn:sha1:c8c3f1d087f2195fd6ef61d6cca8241a808ac11a</id>
<content type='text'>
In b3256eb (standardize and improve lookup rules for external local
repos), enter_repo() was modified to use a different precedence
ordering of suffixes for DWIM of the repository path, and to ensure
that the repository path is actually valid instead of just testing
for existence.

However, the documentation was not modified to reflect these
changes.  Fix the documentation to match the code.

Documentation contributed by Jeff King.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Paul Tan &lt;pyokagan@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Sync with v2.1.4</title>
<updated>2014-12-17T19:46:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-12-17T19:46:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=77933f4449b8d6aa7529d627f3c7b55336f491db'/>
<id>urn:sha1:77933f4449b8d6aa7529d627f3c7b55336f491db</id>
<content type='text'>
* maint-2.1:
  Git 2.1.4
  Git 2.0.5
  Git 1.9.5
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index
</content>
</entry>
</feed>
