doctr icon indicating copy to clipboard operation
doctr copied to clipboard

Be smarter about detecting changes from --command

Open asmeurer opened this issue 6 years ago • 2 comments

See https://github.com/drdoctr/doctr/pull/266. Prior to that PR, if --command changes a file that isn't synced, it is either ignored, or in the case where no files are actually added by the sync, errors. After that PR, it doesn't error.

I'm not so sure about auto-adding new files from --command. The command line docs for the flag do say they need to be added manually. But changed files should most likely be detected and added. Perhaps we just need to do an "add all" when --command is used. Or we could do a before and after diff?

asmeurer avatar Oct 20 '17 20:10 asmeurer

I agree that changed files should be detected and added. As for new files -- maybe we can offer an additional flag in case users want to add those, but default to leaving them alone?

gforsyth avatar Oct 20 '17 21:10 gforsyth

Maybe we should even just do it by default. I think previously we had to be more careful about this because of unrelated files, but we now copy the built docs to a temporary directory and do a git stash --all, which makes all ignored and untracked files be stashed, before checkout out gh-pages, meaning gh-pages is always in a clean state before we sync.

So I wonder if we should just not bother with manual adding and removing based on the sync log and just do a git add -A (which updates all tracked files and adds all untracked files).

asmeurer avatar Oct 20 '17 21:10 asmeurer