aboutsummaryrefslogtreecommitdiff
path: root/credential-store.c
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2017-02-03 03:48:23 +0100
committerJunio C Hamano <gitster@pobox.com>2017-02-03 22:18:41 -0800
commita2f5a8762693d5af6dbbca714d882a21d7ba0b75 (patch)
tree956133193ee027fe271fa40be9bcb628026d5f93 /credential-store.c
parent336d694ce4bff3e7cdedb3df1f819280026aa19f (diff)
downloadgit-a2f5a8762693d5af6dbbca714d882a21d7ba0b75.tar.gz
git-a2f5a8762693d5af6dbbca714d882a21d7ba0b75.tar.xz
rev-parse: add '--absolute-git-dir' option
The output of 'git rev-parse --git-dir' can be either a relative or an absolute path, depending on whether the current working directory is at the top of the worktree or the .git directory or not, or how the path to the repository is specified via the '--git-dir=<path>' option or the $GIT_DIR environment variable. And if that output is a relative path, then it is relative to the directory where any 'git -C <path>' options might have led us. This doesn't matter at all for regular scripts, because the git wrapper automatically takes care of changing directories according to the '-C <path>' options, and the scripts can then simply follow any path returned by 'git rev-parse --git-dir', even if it's a relative path. Our Bash completion script, however, is unique in that it must run directly in the user's interactive shell environment. This means that it's not executed through the git wrapper and would have to take care of any '-C <path> options on its own, and it can't just change directories as it pleases. Consequently, adding support for taking any '-C <path>' options on the command line into account during completion turned out to be considerably more difficult, error prone and required more subshells and git processes when it had to cope with a relative path to the .git directory. Help this rather special use case and teach 'git rev-parse' a new '--absolute-git-dir' option which always outputs a canonicalized absolute path to the .git directory, regardless of whether the path is discovered automatically or is specified via $GIT_DIR or 'git --git-dir=<path>'. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'credential-store.c')
0 files changed, 0 insertions, 0 deletions