File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -17,21 +17,23 @@ function fail () {
17
17
}
18
18
19
19
function chdir_toplevel() {
20
- local root
20
+ local root_padded root
21
21
22
- # NOTE: We get the wrong directory name, if the name ends in newline.
23
- root =" $( git rev-parse --show-toplevel) " ||
22
+ # Find the working tree's root. (Padding is for the trailing- newline case.)
23
+ root_padded =" $( git rev-parse --show-toplevel && echo -n . ) " ||
24
24
fail ' git-rev-parse failed to find top-level dir'
25
+ root=" ${root_padded% $' \n .' } "
25
26
26
27
cd -- " $root "
27
28
}
28
29
29
30
function merging () {
30
- local git_dir
31
+ local git_dir_padded git_dir
31
32
32
- # NOTE: We get the wrong directory name, if the name ends in newline.
33
- git_dir =" $( git rev-parse --git-dir) " ||
33
+ # Find the .git directory. (Padding is for the trailing- newline case.)
34
+ git_dir_padded =" $( git rev-parse --git-dir && echo -n . ) " ||
34
35
fail ' git-rev-parse failed to find git dir'
36
+ git_dir=" ${git_dir_padded% $' \n .' } "
35
37
36
38
test -e " $git_dir /MERGE_HEAD"
37
39
}
You can’t perform that action at this time.
0 commit comments