with_env(key,val): temporarily set and restore an evironment value.

Use this to fix #4494 — older gits don't support merge --no-edit.