OSDN Git Service
(root)
/
git-core
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
81eff27
)
worktree.c: avoid referencing to worktrees[i] multiple times
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Fri, 22 Apr 2016 13:01:32 +0000
(20:01 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 22 Apr 2016 21:09:38 +0000
(14:09 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
worktree.c
patch
|
blob
|
history
diff --git
a/worktree.c
b/worktree.c
index
dc092a7
..
927905b
100644
(file)
--- a/
worktree.c
+++ b/
worktree.c
@@
-229,10
+229,12
@@
const struct worktree *find_shared_symref(const char *symref,
worktrees = get_worktrees();
for (i = 0; worktrees[i]; i++) {
+ struct worktree *wt = worktrees[i];
+
strbuf_reset(&path);
strbuf_reset(&sb);
strbuf_addf(&path, "%s/%s",
- get_worktree_git_dir(w
orktrees[i]
),
+ get_worktree_git_dir(w
t
),
symref);
if (parse_ref(path.buf, &sb, NULL)) {
@@
-240,7
+242,7
@@
const struct worktree *find_shared_symref(const char *symref,
}
if (!strcmp(sb.buf, target)) {
- existing = w
orktrees[i]
;
+ existing = w
t
;
break;
}
}