Skip to content

batches: getting changed files in step: applying cached diff: error: unrecognized input: exit status 128 #755

@sfllaw

Description

@sfllaw

Sometimes, when updating a batch change that has already been applied, the cached diff cannot be applied:

sfllaw@hostname:~$ src batch apply -v -f batch-changes.yaml 
✅ Parsing batch spec
✅ Resolving namespace
✅ Preparing container images  ██████████████████████████████████████████████
🚧 Workspace creator: bind
✅ Set workspace type
✅ Resolved 137 repositories
✅ Found 137 workspaces with steps to execute
✅ Found 0 cached changeset specs; 137 tasks need to be executed

✅ Executing... (137/137, 24 errored)  ██████████████████████████████████████

❌ 24 errors:
   github.com/sfllaw/repo:
   getting changed files in step: applying cached diff: 'git apply -p0 /home/sfllaw/.cache/sourcegraph/batch/bind-workspace-test-1611338046' failed: error: unrecognized input: exit status 128
   Log: /tmp/changeset-github.com-sfllaw-repo-5e3e8f2c3e2780ec35240790d1971b2c0b7ed9b0.3325954318.log

If we look into the cache, we see that the diff is empty!

sfllaw@hostname:~/.cache/sourcegraph/batch$ jq -C . < github.com-sfllaw-repo-5e3e8f2c3e2780ec35240790d1971b2c0b7ed9b0/j7ViTNOX3Gkk_8XnX-MbZQ.json
{
  "diff": "",
  "changedFiles": {
    "modified": null,
    "added": null,
    "deleted": null,
    "renamed": null
  },
  "outputs": {},
  "path": ""
}

This is exactly the behaviour you’d expect from an empty patch:

sfllaw@hostname:~/src/repo$ echo -n '' > patch
sfllaw@hostname:~/src/repo$ git apply -p0 patch
error: unrecognized input
sfllaw@hostname:~/src/repo$ echo $?
128

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions