Details
-
Bug
-
Resolution: Won't Fix
-
Medium
-
None
-
2.12.1, 3.8.0
-
Severity 2 - Major
-
4
-
Description
Given a simple repository
repo
a/Validator.java
Precondition
Branches master and feature/f1. feature/f1 branches from master. File Validator.java was modified in branch feature/f1 (23f27c), and in branch master moved from a/Validator.java to a/a2/a3/Validator.java (4128b7). A pull request was successful created from feature/f1 to master.
Error 1
In pull request TAB "Diff" the file is shown with destination path a/a2/a3. Is this the right behaviour? But file diffs are correct shown.
But after button "View the full source of this file"
is pressed, the warning "The path "a/a2/a3/Validator.java" does not exist at revision "refs/heads/feature/f1"" is printed.
With debug and trace enabled, we can see the git commands:
git for-each-ref --sort=-objecttype --format=%(objecttype)%02%(refname)%02%(objectname)%02%(*objectname) refs/heads/ refs/tags/ git cat-file -t refs/heads/feature/f1:a/a2/a3/Validator.java
In the 2nd command, the a/a2/a3/Validator.java doesn't match to branch feature/f1.
Error 2
Using a merge hook (MergeRequestCheck implementation), the methode contentService.streamFile() has the same problem, which leads to an Exception:
com.atlassian.stash.exception.NoSuchPathException: The path "a/a2/a3/Validator.java" does not exist at revision "23f27cf991c70ee70da1a553cd1f9654776ba744"
Where the last commit id got by
String latestCommitId = mergeRequest.getPullRequest().getFromRef().getLatestChangeset();
The resulting git command is
git cat-file -p 23f27cf991c70ee70da1a553cd1f9654776ba744:a/a2/a3/Validator.java
These both errors are present in our production stash 2.12.1 as well as in 3.8.0.
They can be avoided by an update of the source-branch with the destination branch.
But I think the API should handle this properly.
Attachments
Issue Links
- Testing discovered
-
BSERV-9097 'Unexpected Error occurred' in source view when switching branches from a branch without a file to a branch with a file
- Closed