Re: [PATCH] git-clean: Display more accurate delete messages
Use git clean --force --force to delete all untracked git repositories But I am not sure if this is ever sane. Especially the one that removes an embedded repository is suspicious. git clean should not ever touch it with or without --superforce or any other command. My original intention with this patch was to provide more accurate delete messages for the git-clean command when it's used with the current set of command line options. I didn't know that --force --force was so controversial. The --force --force option has been around since v1.6.4.2. Commit a0f4afbe introduced it. If the consensus is that it is not a sane option to have let's remove it by all means. But I think it should be done in a separate patch '[PATCH] git-clean: Never delete any embedded git repository' or such. I do not think trying to remove something that cannot be removed due to filesystem permissions is sensible, either. We simply should treat such a case a grave error and have the user sort things out, instead of blindly attempt to chmod them ourselves (which may still fail). But this is not how git-clean works with or without the --force --force flag. The recursive delete does the right thing: it tries to delete a file or directory, if that fails for whatever reason it will report the error and move on. That's it. No chmod or any other hackery at all. The --force --force flag only means if during recursion you encounter an embedded git directory that is not tracked you are allowed to recurse into it and keep on deleting files and sub-directories as per usual. Cheers, Zoltan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] git-clean: Display more accurate delete messages
Hi Zoltan, On Sun, Dec 09, 2012 at 10:18:19PM +1100, Zoltan Klinger wrote: Hrm, following your discussion (ellided above), I would have expected that you would show Removing directory foo/bar Removing untracked_file1 Also it would be nice to have warnings about undeleted directories since this git clean behavior (or the work around to pass -f twice) is not documented. Without a warning you would probably miss that something was _not_ deleted. Thanks for the feedback. I think you're right. Showing 'foo/bar/bar.txt' in the list when 'foo/bar/' directory has been successfully deleted is just noise. Would like to get some more feedback on the proposed output in case of (1) an untracked subdirectory with multiple files where at least one of them cannot be removed. (2) reporting ignored untracked git subdirectories Suppose we have a repo like the one below: test.git/ |-- tracked_file |-- untracked_file |-- untracked_foo/ | |-- bar/ | | |-- bar.txt | |-- emptydir/ | |-- frotz.git/ | | |-- frotx.txt | |-- quux/ | |-- failedquux.txt | |-- quux.txt |-- untracked_unreadable_dir/ | |-- afile |-- untracked_some.git/ |-- some.txt $ git clean -fd Removing untracked_file Removing untracked_foo/bar Removing untracked_foo/emptydir Removing untracked_foo/quux/quux.txt warning: failed to remove untracked_foo/quux/failedquux.txt warning: failed to remove remove untracked_unreadable_dir/ warning: ignoring untracked git repository untracked_foo/frotz.git/ warning: ignoring untracked git repository untracked_some.git/ Use git clean --force --force to delete all untracked git repositories $ # use forced remove $ git clean --force --force -d Removing untracked_foo/frotz.git Removing untracked_foo/quux/quux.txt Removing untracked_some.git/ warning: failed to remove untracked_foo/quux/failedquux.txt warning: failed to remove untracked_unreadable_dir/ Can you see any issues with the proposed output, wording above? If everyone is happy, I'm going to prepare patch V2 for it. Looks good to me. Thanks, Soren -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] git-clean: Display more accurate delete messages
Hi, On Sun, Dec 09, 2012 at 11:04:59PM -0800, Junio C Hamano wrote: Zoltan Klinger zoltan.klin...@gmail.com writes: Would like to get some more feedback on the proposed output in case of (1) an untracked subdirectory with multiple files where at least one of them cannot be removed. (2) reporting ignored untracked git subdirectories Suppose we have a repo like the one below: test.git/ |-- tracked_file |-- untracked_file |-- untracked_foo/ | |-- bar/ | | |-- bar.txt | |-- emptydir/ | |-- frotz.git/ | | |-- frotx.txt | |-- quux/ | |-- failedquux.txt | |-- quux.txt |-- untracked_unreadable_dir/ | |-- afile |-- untracked_some.git/ |-- some.txt $ git clean -fd Removing untracked_file Removing untracked_foo/bar Removing untracked_foo/emptydir Removing untracked_foo/quux/quux.txt warning: failed to remove untracked_foo/quux/failedquux.txt warning: failed to remove remove untracked_unreadable_dir/ remove remove is a typo, I presume. warning: ignoring untracked git repository untracked_foo/frotz.git/ warning: ignoring untracked git repository untracked_some.git/ If you mean we report the topmost directory and nothing about (recursive) contents in it if everything is removed successfully (in other words, if we had subdirectories and files inside untracked_foo/bar/ and we successfully removed all of them, the above output does not change), it seems quite reasonable. Use git clean --force --force to delete all untracked git repositories But I am not sure if this is ever sane. Especially the one that removes an embedded repository is suspicious. git clean should not ever touch it with or without --superforce or any other command. As I mentioned in my email where I reported this incorrect git clean output, I have a use case where I want git clean to remove embedded repositories. Whether it is a sane one is probably a different discussion. Soren -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] git-clean: Display more accurate delete messages
Soren Brinkmann soren.brinkm...@xilinx.com writes: Use git clean --force --force to delete all untracked git repositories But I am not sure if this is ever sane. Especially the one that removes an embedded repository is suspicious. git clean should not ever touch it with or without --superforce or any other command. As I mentioned in my email where I reported this incorrect git clean output, I have a use case where I want git clean to remove embedded repositories. Whether it is a sane one is probably a different discussion. Why is it a different discussion? If something is not sane, the tool shouldn't encourage users to do such an insane thing. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] git-clean: Display more accurate delete messages
On Mon, Dec 10, 2012 at 10:03:28AM -0800, Junio C Hamano wrote: Soren Brinkmann soren.brinkm...@xilinx.com writes: Use git clean --force --force to delete all untracked git repositories But I am not sure if this is ever sane. Especially the one that removes an embedded repository is suspicious. git clean should not ever touch it with or without --superforce or any other command. As I mentioned in my email where I reported this incorrect git clean output, I have a use case where I want git clean to remove embedded repositories. Whether it is a sane one is probably a different discussion. Why is it a different discussion? If something is not sane, the tool shouldn't encourage users to do such an insane thing. Well, ok. So I have a repository which essentially consists of a bunch of scripts which then pull sources via git to build root filesystems, busybox, kernel etc. So I have the master repository I'm actually interested in. And then all the other projects which are pulled in to build stuff from. looking somehow like this: top.git |-src | |-proj1.git | |-proj2.git | |-projn.git |-build |-proj1 |-proj2 ... Since the scripts are not perfect I usually used 'git clean -xdf' to wipe everything and build from scratch. And I had to experience that the git clean behavior somehow changed recently and the 'projn.git' directories were no longer removed anymore, despite git indicating otherwise in its output. So, I think having 'git clean -ff' removing embedded git repos is okay. But either way, the output of git clean should match what it is doing. And at least tell me if it didn't remove certain dirs or files. Soren -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] git-clean: Display more accurate delete messages
Soren Brinkmann soren.brinkm...@xilinx.com writes: But either way, the output of git clean should match what it is doing. And at least tell me if it didn't remove certain dirs or files. Oh, no question about that part. I was reacting to --force --force in general, and an unrelated git repository inside a working tree is just a subset of the issue. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] git-clean: Display more accurate delete messages
Hrm, following your discussion (ellided above), I would have expected that you would show Removing directory foo/bar Removing untracked_file1 Also it would be nice to have warnings about undeleted directories since this git clean behavior (or the work around to pass -f twice) is not documented. Without a warning you would probably miss that something was _not_ deleted. Thanks for the feedback. I think you're right. Showing 'foo/bar/bar.txt' in the list when 'foo/bar/' directory has been successfully deleted is just noise. Would like to get some more feedback on the proposed output in case of (1) an untracked subdirectory with multiple files where at least one of them cannot be removed. (2) reporting ignored untracked git subdirectories Suppose we have a repo like the one below: test.git/ |-- tracked_file |-- untracked_file |-- untracked_foo/ | |-- bar/ | | |-- bar.txt | |-- emptydir/ | |-- frotz.git/ | | |-- frotx.txt | |-- quux/ | |-- failedquux.txt | |-- quux.txt |-- untracked_unreadable_dir/ | |-- afile |-- untracked_some.git/ |-- some.txt $ git clean -fd Removing untracked_file Removing untracked_foo/bar Removing untracked_foo/emptydir Removing untracked_foo/quux/quux.txt warning: failed to remove untracked_foo/quux/failedquux.txt warning: failed to remove remove untracked_unreadable_dir/ warning: ignoring untracked git repository untracked_foo/frotz.git/ warning: ignoring untracked git repository untracked_some.git/ Use git clean --force --force to delete all untracked git repositories $ # use forced remove $ git clean --force --force -d Removing untracked_foo/frotz.git Removing untracked_foo/quux/quux.txt Removing untracked_some.git/ warning: failed to remove untracked_foo/quux/failedquux.txt warning: failed to remove untracked_unreadable_dir/ Can you see any issues with the proposed output, wording above? If everyone is happy, I'm going to prepare patch V2 for it. Thanks, Zoltan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] git-clean: Display more accurate delete messages
Zoltan Klinger zoltan.klin...@gmail.com writes: Would like to get some more feedback on the proposed output in case of (1) an untracked subdirectory with multiple files where at least one of them cannot be removed. (2) reporting ignored untracked git subdirectories Suppose we have a repo like the one below: test.git/ |-- tracked_file |-- untracked_file |-- untracked_foo/ | |-- bar/ | | |-- bar.txt | |-- emptydir/ | |-- frotz.git/ | | |-- frotx.txt | |-- quux/ | |-- failedquux.txt | |-- quux.txt |-- untracked_unreadable_dir/ | |-- afile |-- untracked_some.git/ |-- some.txt $ git clean -fd Removing untracked_file Removing untracked_foo/bar Removing untracked_foo/emptydir Removing untracked_foo/quux/quux.txt warning: failed to remove untracked_foo/quux/failedquux.txt warning: failed to remove remove untracked_unreadable_dir/ remove remove is a typo, I presume. warning: ignoring untracked git repository untracked_foo/frotz.git/ warning: ignoring untracked git repository untracked_some.git/ If you mean we report the topmost directory and nothing about (recursive) contents in it if everything is removed successfully (in other words, if we had subdirectories and files inside untracked_foo/bar/ and we successfully removed all of them, the above output does not change), it seems quite reasonable. Use git clean --force --force to delete all untracked git repositories But I am not sure if this is ever sane. Especially the one that removes an embedded repository is suspicious. git clean should not ever touch it with or without --superforce or any other command. I do not think trying to remove something that cannot be removed due to filesystem permissions is sensible, either. We simply should treat such a case a grave error and have the user sort things out, instead of blindly attempt to chmod them ourselves (which may still fail). Thanks. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] git-clean: Display more accurate delete messages
Zoltan Klinger zoltan.klin...@gmail.com writes: Only print out the names of the files and directories that got actually deleted. Consider the following repo layout: |-- test.git/ |-- foo/ |-- bar/ |-- bar.txt |-- frotz.git/ |-- frotz.txt |-- tracked_file1 |-- untracked_file1 ... Consider the output of the improved version: $ git clean -fd Removed foo/bar/bar.txt Removed foo/bar Removed untracked_file1 Hrm, following your discussion (ellided above), I would have expected that you would show Removing directory foo/bar Removing untracked_file1 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] git-clean: Display more accurate delete messages
Hi, On Thu, Dec 06, 2012 at 09:37:31AM -0800, Junio C Hamano wrote: Zoltan Klinger zoltan.klin...@gmail.com writes: Only print out the names of the files and directories that got actually deleted. Consider the following repo layout: |-- test.git/ |-- foo/ |-- bar/ |-- bar.txt |-- frotz.git/ |-- frotz.txt |-- tracked_file1 |-- untracked_file1 ... Consider the output of the improved version: $ git clean -fd Removed foo/bar/bar.txt Removed foo/bar Removed untracked_file1 Hrm, following your discussion (ellided above), I would have expected that you would show Removing directory foo/bar Removing untracked_file1 Also it would be nice to have warnings about undeleted directories since this git clean behavior (or the work around to pass -f twice) is not documented. Without a warning you would probably miss that something was _not_ deleted. So something like: Removing foo Removing bar ... Warning: Not all untracked objects have been deleted: list objects here (optional) Use git clean --force --force to delete all objects. But clearly going into a good direction. Thanks. Soren -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html