Really don't allow commits to replace in wrong project
In afca17b92a
I tried to add this block
to validate that a replacement commit isn't mapped into the wrong
project by accident. Unfortunately that test wasn't performed in the
right section of code. We really need it earlier, as we parse through
the mapping supplied by the client.
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@ -548,6 +548,10 @@ final class Receive extends AbstractGitCommand {
|
||||
reject(cmd, "change " + changeId.get() + " not found");
|
||||
return;
|
||||
}
|
||||
if (!proj.getNameKey().equals(changeEnt.getDest().getParentKey())) {
|
||||
reject(cmd, "change " + changeId.get() + " not in " + proj.getName());
|
||||
return;
|
||||
}
|
||||
if (changeEnt.getStatus().isClosed()) {
|
||||
reject(cmd, "change " + changeId.get() + " closed");
|
||||
return;
|
||||
@ -800,12 +804,6 @@ final class Receive extends AbstractGitCommand {
|
||||
reject(cmd, "change " + changeId.get() + " closed");
|
||||
return null;
|
||||
}
|
||||
if (change.getDest() == null
|
||||
|| !proj.getNameKey().equals(change.getDest().getParentKey())) {
|
||||
reject(cmd, "change " + changeId.get() + " not in "
|
||||
+ proj.getName());
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
change = changeCache.get(changeId);
|
||||
}
|
||||
|
Reference in New Issue
Block a user