{"thread":{"id":"4247","subject":"[PATCH] git status: ignore empty directories (because they cannot be added)","startedAt":"2006-05-22T21:02:06Z","lastAt":"2006-05-23T14:00:55Z","messageCount":4,"participants":["Matthias Lederhofer","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"20476","messageId":"E1FiHXS-0008MC-LB@moooo.ath.cx","threadId":"4247","inReplyTo":null,"subject":"[PATCH] git status: ignore empty directories (because they cannot be added)","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-05-22T21:02:06Z","receivedAt":"2006-05-22T21:02:06Z","isPatch":true,"sender":{"key":"matled@gmx.net","avatar":null},"body":"and a new option -u / --untracked-files to show files in untracked\ndirectories.\n\n---\nA few things I'm not sure about:\n- Should there be another option to disable --no-empty-directory?\n- Is the option name --untracked-files ok?\n- Should it be documented (probably yes :))? At the moment the\n  git-status man page does not tell about any command line option at\n  all but for git-commit it does not make sense.\n\n git-commit.sh |   17 ++++++++++++++---\n 1 files changed, 14 insertions(+), 3 deletions(-)\n\n---\n\n1921592d5e7809f72a902cca1a38217b150800a9\ndiff --git a/git-commit.sh b/git-commit.sh\nindex 6ef1a9d..6785826 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -3,7 +3,7 @@ #\n # Copyright (c) 2005 Linus Torvalds\n # Copyright (c) 2006 Junio C Hamano\n \n-USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>) [--amend] [-e] [--author <author>] [[-i | -o] <path>...]'\n+USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>] [-u] [--amend] [-e] [--author <author>] [[-i | -o] <path>...]'\n SUBDIRECTORY_OK=Yes\n . git-sh-setup\n \n@@ -134,13 +134,17 @@ #'\n \treport \"Changed but not updated\" \\\n \t    \"use git-update-index to mark for commit\"\n \n+        option=\"\"\n+        if test -z \"$untracked_files\"; then\n+            option=\"--directory --no-empty-directory\"\n+        fi\n \tif test -f \"$GIT_DIR/info/exclude\"\n \tthen\n-\t    git-ls-files -z --others --directory \\\n+\t    git-ls-files -z --others $option \\\n \t\t--exclude-from=\"$GIT_DIR/info/exclude\" \\\n \t\t--exclude-per-directory=.gitignore\n \telse\n-\t    git-ls-files -z --others --directory \\\n+\t    git-ls-files -z --others $option \\\n \t\t--exclude-per-directory=.gitignore\n \tfi |\n \tperl -e '$/ = \"\\0\";\n@@ -203,6 +207,7 @@ verbose=\n signoff=\n force_author=\n only_include_assumed=\n+untracked_files=\n while case \"$#\" in 0) break;; esac\n do\n   case \"$1\" in\n@@ -340,6 +345,12 @@ do\n       verbose=t\n       shift\n       ;;\n+  -u|--u|--un|--unt|--untr|--untra|--untrac|--untrack|--untracke|--untracked|\\\n+  --untracked-|--untracked-f|--untracked-fi|--untracked-fil|--untracked-file|\\\n+  --untracked-files)\n+      untracked_files=t\n+      shift\n+      ;;\n   --)\n       shift\n       break\n-- \n1.3.2\n"},{"id":"20502","messageId":"7vu07h8rzr.fsf@assigned-by-dhcp.cox.net","threadId":"4247","inReplyTo":"E1FiHXS-0008MC-LB@moooo.ath.cx","subject":"Re: [PATCH] git status: ignore empty directories (because they cannot be added)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-23T01:11:36Z","receivedAt":"2006-05-23T01:11:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthias Lederhofer <matled@gmx.net> writes:\n\n> and a new option -u / --untracked-files to show files in untracked\n> directories.\n>\n> ---\n> A few things I'm not sure about:\n> - Should there be another option to disable --no-empty-directory?\n\nI am not sure about this.  We used to show everything in a\ndirectory full of untracked directory, which was distracting and\nthat was the reason we added --directory there.  Maybe it would\nbe less confusing if we just updated the message\n\n\t    print \"#\\n# Untracked files:\\n\";\n\t    print \"#   (use \\\"git add\\\" to add to commit)\\n\";\n\t    print \"#\\n\";\n\nto say \"use 'git add' on these files and files in these\ndirectories you wish to add\", or something silly like that,\nwithout this patch?\n"},{"id":"20508","messageId":"E1FiPIu-0003cJ-03@moooo.ath.cx","threadId":"4247","inReplyTo":"7vu07h8rzr.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git status: ignore empty directories (because they cannot be added)","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-05-23T05:35:18Z","receivedAt":"2006-05-23T05:35:18Z","isPatch":true,"sender":{"key":"matled@gmx.net","avatar":null},"body":"> > and a new option -u / --untracked-files to show files in untracked\n> > directories.\n> >\n> > ---\n> > A few things I'm not sure about:\n> > - Should there be another option to disable --no-empty-directory?\n>\n> I am not sure about this.  We used to show everything in a\n> directory full of untracked directory, which was distracting and\n> that was the reason we added --directory there.  Maybe it would\n> be less confusing if we just updated the message\n>\n>           print \"#\\n# Untracked files:\\n\";\n>           print \"#   (use \\\"git add\\\" to add to commit)\\n\";\n>           print \"#\\n\";\n>\n> to say \"use 'git add' on these files and files in these\n> directories you wish to add\", or something silly like that,\n> without this patch?\n\nI do not know if I understand you correctly, do you want to leave out\nthe -u part of the patch or the whole patch?\n\nWell, anyway, here the reasons for this patch:\n- Working in a git repository with a lot of empty directories is\n  annoying, because all of them show up in git status even though they\n  cannot be added. With --no-empty-directories they are hidden.\n- If there is a directory which may be added because it is quite\n  useful to have the -u option to see what is in there to add (without\n  using ls path/to/directory).\n"},{"id":"20548","messageId":"E1FiXRP-0006lG-5Z@moooo.ath.cx","threadId":"4247","inReplyTo":"7vd5e56yi6.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git status: ignore empty directories (because they cannot be added)","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-05-23T14:00:55Z","receivedAt":"2006-05-23T14:00:55Z","isPatch":true,"sender":{"key":"matled@gmx.net","avatar":null},"body":"> > Well, anyway, here the reasons for this patch:\n> > - Working in a git repository with a lot of empty directories is\n> >   annoying, because all of them show up in git status even though they\n> >   cannot be added. With --no-empty-directories they are hidden.\n> \n> What directories are they?  Will they some day have files that\n> you might want to keep track of?  The reason for this question\n> is, \"otherwise you could .gitignore them\".\n\nI have been trying ruby on rails and there are some empty directories\nwhich will have files later. I would even add those empty directories\nif it would be possible.\n\n> > - If there is a directory which may be added because it is quite\n> >   useful to have the -u option to see what is in there to add (without\n> >   using ls path/to/directory).\n> \n> It really depends on how many files there are in such a\n> \"interesting\" directory _and_ other \"uninteresting\" directories\n> full of transitory files.  The -u option that disables \"skip\n> contents and show only the top directory\" behaviour globally\n> might not be so useful in such a case -- you will see useful\n> contents of an otherwise \"closed\" directory (because it defeats\n> the --directory flag), but at the same time you would get tons\n> of uninteresting files in another directory as well in such a\n> case.  You are likely to end up doing ls path/to/dir after\n> noticing that there are non-empty foo/ and bar/ directories that\n> have no tracked files, and you know which one has files\n> interesting to you.\n> So I am OK with the change, but I am somewhat still doubtful how\n> useful the option would be.\n\nThe case I think about is that there are some directories which are\nnot tracked because they contain no files yet. All other directories\nwhich are uninteresting are added to .gitignore. If an untracked\ndirectory shows up in git-status one could easily check with\ngit-status -u what can be added.\n\nPS: I had a typo in the git mailing list e-mail address and resent my\nlast e-mail to the list. Your reply did not make it to the list,\nperhaps you can send it again.\n"}]}