Document how to recover when deliver before wrapup
Usecase: I write git phlow deliver before git phlow wrapup. How do I recover?
~/projects/martinmosegaard/test-git-phlow (master) $ ghi create -m "Say hi in README"
#1: Say hi in README
@martinmosegaard opened this issue 0 seconds ago. open
Opened on martinmosegaard/test-git-phlow.
~/projects/martinmosegaard/test-git-phlow (master) $ git phlow workon 1
No .phlow config found
Bootstrapping new .phlow file
Created workspace: 1-say-hi-in-readme
-------- Issue #1 updated --------
Label => Status - in progress
Assignee => @martinmosegaard
----------------------------------
~/projects/martinmosegaard/test-git-phlow (1-say-hi-in-readme) $ echo hi > README.md
~/projects/martinmosegaard/test-git-phlow (1-say-hi-in-readme) $ git status
On branch 1-say-hi-in-readme
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: README.md
Untracked files:
(use "git add <file>..." to include in what will be committed)
.phlow
no changes added to commit (use "git add" and/or "git commit -a")
~/projects/martinmosegaard/test-git-phlow (1-say-hi-in-readme) $ git phlow deliver
| delivering error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.
Delivered branch 1-say-hi-in-readme
~/projects/martinmosegaard/test-git-phlow (master) $ git slog
c964bc3 2017-10-05 Martin Mosegaard Amdisen (HEAD -> master, origin/ready/1-say-hi-in-readme, origin/master, origin/HEAD, delivered/1-say-hi-in-readme) Initial commit
To me this sounds like a bug or at least an obvious place for improvement.
-
If at all possible, operations should be atomic. I.e. if something in the deliver fails, as above, then it should abort back to where it was, not as in this case, switch to master, and leave the user wondering which parts went through an which didn't. Problem is that this might be non-trivial to implement.
-
Maybe the default behaviour should be more safe? If we have a dirty workspace (unstaged modified files) then it should refuse the deliver. Obviously we would need a switch to override this behaviour. This could be either a --force to just do things, or as a rogue idea maybe a softer --stash that stashes changes, and unstashes after the deliver? (haven't thought this one through entirely).