diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-12-01 09:04:29 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-12-01 09:04:29 -0800 |
commit | a2b0451434db903975cb1dfda0eafef939ebc6db (patch) | |
tree | 95c12b249b5ec1d47d7eda8ecdd1b3606ac2c3ca /path.c | |
parent | 0be5caf97ce1ad5f3c10ac00875f9aaf4939339d (diff) | |
parent | 76a53d640f72fc77e7e9358dfeb5df5ece56515f (diff) | |
download | git-a2b0451434db903975cb1dfda0eafef939ebc6db.tar.gz |
Merge branch 'js/git-path-head-dot-lock-fix'
"git rev-parse --git-path HEAD.lock" did not give the right path
when run in a secondary worktree.
* js/git-path-head-dot-lock-fix:
git_path(): handle `.lock` files correctly
t1400: wrap setup code in test case
Diffstat (limited to 'path.c')
-rw-r--r-- | path.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -11,6 +11,7 @@ #include "path.h" #include "packfile.h" #include "object-store.h" +#include "lockfile.h" static int get_st_mode_bits(const char *path, int *mode) { @@ -362,9 +363,14 @@ static void update_common_dir(struct strbuf *buf, int git_dir_len, const char *common_dir) { char *base = buf->buf + git_dir_len; + int has_lock_suffix = strbuf_strip_suffix(buf, LOCK_SUFFIX); + init_common_trie(); if (trie_find(&common_trie, base, check_common, NULL) > 0) replace_dir(buf, git_dir_len, common_dir); + + if (has_lock_suffix) + strbuf_addstr(buf, LOCK_SUFFIX); } void report_linked_checkout_garbage(void) |