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
This commit is contained in:
commit
a2b0451434
6
path.c
6
path.c
@ -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)
|
||||
|
@ -285,8 +285,10 @@ test_git_path GIT_OBJECT_DIRECTORY=foo objects/foo foo/foo
|
||||
test_git_path GIT_OBJECT_DIRECTORY=foo objects2 .git/objects2
|
||||
test_expect_success 'setup common repository' 'git --git-dir=bar init'
|
||||
test_git_path GIT_COMMON_DIR=bar index .git/index
|
||||
test_git_path GIT_COMMON_DIR=bar index.lock .git/index.lock
|
||||
test_git_path GIT_COMMON_DIR=bar HEAD .git/HEAD
|
||||
test_git_path GIT_COMMON_DIR=bar logs/HEAD .git/logs/HEAD
|
||||
test_git_path GIT_COMMON_DIR=bar logs/HEAD.lock .git/logs/HEAD.lock
|
||||
test_git_path GIT_COMMON_DIR=bar logs/refs/bisect/foo .git/logs/refs/bisect/foo
|
||||
test_git_path GIT_COMMON_DIR=bar logs/refs bar/logs/refs
|
||||
test_git_path GIT_COMMON_DIR=bar logs/refs/ bar/logs/refs/
|
||||
|
@ -344,14 +344,16 @@ test_expect_success "verifying $m's log (logged by config)" '
|
||||
test_cmp expect .git/logs/$m
|
||||
'
|
||||
|
||||
git update-ref $m $D
|
||||
cat >.git/logs/$m <<EOF
|
||||
$Z $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
|
||||
$C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500
|
||||
$A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500
|
||||
$F $Z $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
|
||||
$Z $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500
|
||||
EOF
|
||||
test_expect_success 'set up for querying the reflog' '
|
||||
git update-ref $m $D &&
|
||||
cat >.git/logs/$m <<-EOF
|
||||
$Z $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
|
||||
$C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500
|
||||
$A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500
|
||||
$F $Z $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
|
||||
$Z $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500
|
||||
EOF
|
||||
'
|
||||
|
||||
ed="Thu, 26 May 2005 18:32:00 -0500"
|
||||
gd="Thu, 26 May 2005 18:33:00 -0500"
|
||||
|
Loading…
Reference in New Issue
Block a user