Closed (fixed)
Project:
Drush Issue Queue Commands
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
10 Dec 2012 at 20:55 UTC
Updated:
27 Dec 2012 at 07:00 UTC
I was having an issue where iq-diff was add'ing all files to my patch, including .svn and patch files, even when those were excluded by .gitignore. After a little heading of the (seemingly infinite) git docs I turned up the -u/--update option to "git add", which only adds files that are already tracked by git - I think makes it work more like I would expect. In my tests I was able to explicitly "git add" new files that I wanted included.
I am not sure if this addresses the "TODO: can we easily ignore *.patch, etc., or easily add only modified files?" fully or only partially, so left that in.
| Comment | File | Size | Author |
|---|---|---|---|
| dash-u.patch | 2.09 KB | owen barton |
Comments
Comment #1
greg.1.anderson commentedYes, I agree with this, and will likely commit the change in #0 as suggested, with
git add -u ., but might want to change it slightly, e.g. perhaps togit add -A ., which is similar. Now that drush iq-diff works well with multiple commits on the branch (and iq-merge can be used to easily squash them down to a single commit when done), I think that folks will feel more confident in usinggit addon their own when they want to add new files to a diff.I set this to "needs work" because I'd like to figure out exactly what modes to use everywhere that
git addis called, and commit one fix that adjusts all of them. I'm getting pretty good results withgit add -Awhen applying a patch. If there is a reason for being different in different parts of the code, the difference should be noted in a comment; otherwise, it should behave uniformly.I'll do this when I have time, but any help is welcome and appreciated.
Comment #2
owen barton commentedI am unclear how -A is different from the current behavior (with no flags) in terms of adding untracked files - the help section says:
It sounds like the main difference is just that it detects/handles removed files - is that correct?
I often end up with files/patches lying around that I don't want added to the commit - I would generally prefer only files I explicitly request to be tracked to be added to a commit/patch (I don't have a particular preference with removed files). If this is different from what others are expecting, perhaps we need to add an option here?
Comment #3
greg.1.anderson commentedNo, I agree with you. I was thinking about this some more, and I don't think that iq-apply-patch is going to work correctly until I manually extract the paths to all of the files provided or modified by the patch and explicitly git-add all of the new files. (Note that this is only an issue when applying patches created with diff or git diff, as format-patch will already add the right files.) There is no good heuristic to determine which files that just "happen" to be in the directory should be added to the commit, so by default, extra files that are found should not be added unless the user explicitly requests them.
Supporting --all in iq-diff would be reasonable.
Comment #4
greg.1.anderson commentedModified iq-apply-patch to also use 'git add -u .', and explicitly added new files using 'git add filename'. Committed this and #0 to the 7.x-1.x branch.
Did not implement --all in iq-diff; that can be handled separately, if desired at all.