Nguyễn Thái Ngọc Duy
557bd833bb
git_path(): be aware of file relocation in $GIT_DIR
...
We allow the user to relocate certain paths out of $GIT_DIR via
environment variables, e.g. GIT_OBJECT_DIRECTORY, GIT_INDEX_FILE and
GIT_GRAFT_FILE. Callers are not supposed to use git_path() or
git_pathdup() to get those paths. Instead they must use
get_object_directory(), get_index_file() and get_graft_file()
respectively. This is inconvenient and could be missed in review (for
example, there's git_path("objects/info/alternates") somewhere in
sha1_file.c).
This patch makes git_path() and git_pathdup() understand those
environment variables. So if you set GIT_OBJECT_DIRECTORY to /foo/bar,
git_path("objects/abc") should return /foo/bar/abc. The same is done
for the two remaining env variables.
"git rev-parse --git-path" is the wrapper for script use.
This patch kinda reverts a0279e1 (setup_git_env: use git_pathdup
instead of xmalloc + sprintf - 2014-06-19) because using git_pathdup
here would result in infinite recursion:
setup_git_env() -> git_pathdup("objects") -> .. -> adjust_git_path()
-> get_object_directory() -> oops, git_object_directory is NOT set
yet -> setup_git_env()
I wanted to make git_pathdup_literal() that skips adjust_git_path().
But that won't work because later on when $GIT_COMMON_DIR is
introduced, git_pathdup_literal("objects") needs adjust_git_path() to
replace $GIT_DIR with $GIT_COMMON_DIR.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com >
Signed-off-by: Junio C Hamano <gitster@pobox.com >
2014-12-01 11:00:11 -08:00
..
2014-11-04 13:14:44 -08:00
2014-11-26 13:18:04 -08:00
2014-11-04 13:14:44 -08:00
2013-08-06 14:34:43 -07:00
2013-04-03 16:14:19 -07:00
2014-07-16 11:33:03 -07:00
2014-11-10 11:26:18 -08:00
2013-11-12 10:47:17 -08:00
2014-05-21 13:57:10 -07:00
2014-03-31 15:16:22 -07:00
2014-03-31 15:16:22 -07:00
2014-10-10 16:02:26 -07:00
2014-06-05 15:13:12 -07:00
2014-04-08 12:00:28 -07:00
2014-03-25 11:01:31 -07:00
2014-02-28 09:55:35 -08:00
2014-11-04 13:14:44 -08:00
2014-05-21 13:57:10 -07:00
2014-02-11 11:03:07 -08:00
2013-09-09 11:03:01 -07:00
2013-12-26 11:54:26 -08:00
2013-09-04 12:23:25 -07:00
2013-09-12 15:40:29 -07:00
2013-07-13 10:19:37 -07:00
2013-09-12 14:39:34 -07:00
2014-01-21 13:50:00 -08:00
2014-03-24 10:43:34 -07:00
2013-11-27 12:16:49 -08:00
2014-11-04 13:14:44 -08:00
2014-02-11 11:03:07 -08:00
2014-01-27 08:34:34 -08:00
2014-02-24 14:51:35 -08:00
2014-11-18 10:19:42 -08:00
2014-05-21 13:57:10 -07:00
2014-03-31 15:16:22 -07:00
2014-09-16 11:11:58 -07:00
2014-11-06 09:51:08 -08:00
2013-09-06 14:49:06 -07:00
2014-11-04 13:14:44 -08:00
2014-11-04 13:14:44 -08:00
2014-05-21 13:57:10 -07:00
2013-09-04 15:03:03 -07:00
2013-05-20 15:50:44 -07:00
2014-03-31 15:16:22 -07:00
2014-10-28 10:36:57 -07:00
2014-11-19 13:47:56 -08:00
2014-11-11 14:47:04 -08:00
2013-12-17 11:34:24 -08:00
2014-06-12 09:59:13 -07:00
2014-11-04 13:14:44 -08:00
2013-05-17 12:09:21 -07:00
2014-01-27 08:34:34 -08:00
2014-05-27 12:38:32 -07:00
2013-05-17 12:09:21 -07:00
2014-03-31 10:26:24 -07:00
2014-03-20 12:38:00 -07:00
2014-05-21 13:57:10 -07:00
2014-04-09 11:45:04 -07:00
2014-10-13 13:35:37 -07:00
2013-05-28 08:07:20 -07:00
2014-08-08 13:17:42 -07:00
2014-11-04 13:14:44 -08:00
2013-12-17 11:35:41 -08:00
2014-05-21 13:57:10 -07:00
2013-06-23 00:33:58 -07:00
2013-05-17 12:09:21 -07:00
2013-10-29 13:06:08 -07:00
2013-08-09 14:19:59 -07:00
2013-04-15 11:08:37 -07:00
2013-09-04 15:02:56 -07:00
2014-04-22 12:53:59 -07:00
2014-04-24 11:29:05 -07:00
2014-01-07 14:33:04 -08:00
2013-09-04 15:03:03 -07:00
2014-03-24 10:43:34 -07:00
2014-01-22 08:06:20 -08:00
2014-03-11 13:32:10 -07:00
2013-07-18 16:23:46 -07:00
2014-06-10 13:09:24 -07:00
2014-10-13 13:35:18 -07:00
2014-03-31 15:16:22 -07:00
2014-02-05 14:03:47 -08:00
2014-10-16 14:16:42 -07:00
2014-10-13 13:35:18 -07:00
2014-05-21 13:57:10 -07:00
2014-10-14 10:49:07 -07:00
2014-09-17 15:19:54 -07:00
2013-05-29 14:23:04 -07:00
2014-11-11 14:47:04 -08:00
2014-11-11 14:47:04 -08:00
2014-02-11 11:03:07 -08:00
2014-03-18 13:50:29 -07:00
2014-07-27 15:14:18 -07:00
2014-03-13 14:22:20 -07:00
2014-04-08 12:00:28 -07:00
2014-08-29 12:37:02 -07:00
2014-12-01 11:00:11 -08:00
2014-03-24 10:43:34 -07:00
2014-01-07 14:34:06 -08:00
2014-06-20 13:12:20 -07:00
2014-08-26 12:58:02 -07:00
2013-10-18 13:50:12 -07:00
2014-05-08 10:26:26 -07:00
2013-04-21 23:11:02 -07:00
2014-03-31 15:16:22 -07:00
2013-04-15 11:08:37 -07:00
2014-03-31 15:16:22 -07:00
2013-07-17 17:50:56 -07:00
2014-10-13 13:35:18 -07:00
2014-02-24 09:13:30 -08:00
2014-10-19 20:45:16 -07:00
2014-07-10 11:08:31 -07:00
2014-11-04 13:14:44 -08:00
2014-10-07 13:40:51 -07:00
2013-04-12 12:00:52 -07:00
2013-11-07 14:37:36 -08:00
2014-11-04 13:14:44 -08:00
2014-04-07 12:09:13 -07:00
2014-02-28 09:55:37 -08:00
2014-06-23 15:50:31 -07:00
2013-04-15 11:08:37 -07:00
2013-04-15 11:08:37 -07:00
2014-05-21 13:57:10 -07:00
2013-08-13 09:01:54 -07:00
2014-11-26 13:18:34 -08:00
2014-11-04 13:14:44 -08:00
2014-05-21 13:57:10 -07:00
2014-10-10 16:02:26 -07:00
2014-10-10 16:02:26 -07:00
2013-06-03 10:53:11 -07:00
2014-10-10 16:02:26 -07:00
2014-10-10 16:02:26 -07:00
2014-11-04 13:14:44 -08:00
2014-11-12 12:13:12 -08:00
2014-05-21 13:57:10 -07:00
2014-04-07 10:32:20 -07:00
2014-11-11 14:47:04 -08:00
2014-06-13 11:49:39 -07:00
2014-11-19 13:47:59 -08:00
2014-11-19 13:47:59 -08:00
2014-05-21 13:57:10 -07:00
2014-02-20 14:14:58 -08:00
2014-11-04 13:14:44 -08:00
2014-04-17 11:14:57 -07:00
2014-04-17 11:14:58 -07:00
2013-08-06 14:48:02 -07:00
2014-10-29 10:07:40 -07:00
2014-03-31 15:16:22 -07:00
2014-04-03 13:39:03 -07:00
2014-10-29 10:35:10 -07:00
2014-03-31 15:16:22 -07:00
2014-06-12 09:59:13 -07:00
2014-11-04 13:14:44 -08:00
2014-05-13 12:35:00 -07:00
2014-11-13 10:39:24 -08:00
2013-07-21 22:51:24 -07:00
2014-06-16 12:18:39 -07:00