-
Notifications
You must be signed in to change notification settings - Fork 1k
Use evaluated project root path #812
Changes from all commits
849e187
f9b8523
1ad2706
88faf50
c28ab32
45540a7
96a9333
40d9942
3d59125
b124a46
618951f
92886c5
93dfae7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -502,8 +502,21 @@ func (h *Helper) TempDir(path string) { | |
} | ||
|
||
// Path returns the absolute pathname to file with the temporary | ||
// directory. | ||
// directory. Symlinks are evaluated. | ||
func (h *Helper) Path(name string) string { | ||
path := h.OriginalPath(name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we instead keep There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ibrasho yes, it makes sense. But I'd propose to delay that change after @sdboyer decides if this PR is mergeable or not. Because, this change will just increase the diff by a few hundred lines and increase the possibility of merge conflicts with the current If everything is OK, I'll make sure that the PR with this additional change merges in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sdboyer What's your opinion? |
||
|
||
// Ensure it's the absolute, symlink-less path we're returning | ||
abs, err := filepath.EvalSymlinks(path) | ||
if err != nil { | ||
h.t.Fatalf("%+v", errors.Wrapf(err, "internal testsuite error: could not get absolute path for dir(%q)", path)) | ||
} | ||
return abs | ||
} | ||
|
||
// OriginalPath returns the absolute pathname to file with the temporary | ||
// directory. Symlinks are NOT evaluated. | ||
func (h *Helper) OriginalPath(name string) string { | ||
if h.tempdir == "" { | ||
h.t.Fatalf("%+v", errors.Errorf("internal testsuite error: path(%q) with no tempdir", name)) | ||
} | ||
|
@@ -515,12 +528,7 @@ func (h *Helper) Path(name string) string { | |
joined = filepath.Join(h.tempdir, name) | ||
} | ||
|
||
// Ensure it's the absolute, symlink-less path we're returning | ||
abs, err := filepath.EvalSymlinks(joined) | ||
if err != nil { | ||
h.t.Fatalf("%+v", errors.Wrapf(err, "internal testsuite error: could not get absolute path for dir(%q)", joined)) | ||
} | ||
return abs | ||
return joined | ||
} | ||
|
||
// MustExist fails if path does not exist. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just do
path = p.ResolvedAbsRoot
instead?If they are the same, we did what line 223 is doing. If they are different, we did the if block logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just use
p.ResolvedAbsRoot
instead ofpath
...