Log any failures while creating patch set refs
Some users have noticed failure cases where the ref isn't being created for a patch set, and the pack file the objects are supposed to be in is also not present in the repository after the upload. I haven't yet tracked down why this happens only some of the time, but I did identify these call sites weren't doing any error checking for unexpected return values. We should always be getting a NEW result here, as the ref must not exist locally and must be created successfully. Any other return value indicates the ref didn't create as we expected it to, which means the repository isn't in the state it should be either before we started, or after we finished this operation. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -652,7 +652,10 @@ class Receive extends AbstractGitCommand {
|
||||
ru.setNewObjectId(c);
|
||||
ru.setRefLogIdent(refLogIdent);
|
||||
ru.setRefLogMessage("uploaded", false);
|
||||
ru.update(walk);
|
||||
if (ru.update(walk) != RefUpdate.Result.NEW) {
|
||||
throw new IOException("Failed to create ref " + ps.getRefName() + " in "
|
||||
+ repo.getDirectory() + ": " + ru.getResult());
|
||||
}
|
||||
PushQueue.scheduleUpdate(proj.getNameKey(), ru.getName());
|
||||
|
||||
allNewChanges.add(change.getId());
|
||||
@@ -825,7 +828,10 @@ class Receive extends AbstractGitCommand {
|
||||
ru.setNewObjectId(c);
|
||||
ru.setRefLogIdent(refLogIdent);
|
||||
ru.setRefLogMessage("uploaded", false);
|
||||
ru.update(rp.getRevWalk());
|
||||
if (ru.update(rp.getRevWalk()) != RefUpdate.Result.NEW) {
|
||||
throw new IOException("Failed to create ref " + ps.getRefName()
|
||||
+ " in " + repo.getDirectory() + ": " + ru.getResult());
|
||||
}
|
||||
PushQueue.scheduleUpdate(proj.getNameKey(), ru.getName());
|
||||
cmd.setResult(ReceiveCommand.Result.OK);
|
||||
|
||||
|
Reference in New Issue
Block a user