{"thread":{"id":"7255","subject":"[RFC] Add --index to git-commit: just commit current index","startedAt":"2007-03-15T09:43:37Z","lastAt":"2007-03-16T09:37:49Z","messageCount":3,"participants":["Alex Riesen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"37154","messageId":"81b0412b0703150243h6a5f036aye8f115d82e11e883@mail.gmail.com","threadId":"7255","inReplyTo":null,"subject":"[RFC] Add --index to git-commit: just commit current index","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-03-15T09:43:37Z","receivedAt":"2007-03-15T09:43:37Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Refreshing index takes a long time on big repositories with many files,\nespecially if the developer was unlucky enough to stick to a slow filesystem\nor a broken OS. In this situation explicit git-update-index with\ngit-commit --index will speedup the workflow.\nGiving either --all, -o, or -i silently turns --index off (these have to\nrefresh index).\nIn case of unmodified index no status message is shown, for all\nthe same reasons: it takes too long.\n---\n\nFirst use of new --quiet :)\n\n git-commit.sh |   21 +++++++++++++++++----\n 1 files changed, 17 insertions(+), 4 deletions(-)\n\n\nFrom 49b846a654d2f1ef540d6438356bffeafa97ba62 Mon Sep 17 00:00:00 2001\nFrom: Alex Riesen <raa.lkml@gmail.com>\nDate: Thu, 15 Mar 2007 10:39:36 +0100\nSubject: [PATCH] Add --index to git-commit: just commit current index\n\nRefreshing index takes a long time on big repositories with many files,\nespecially if the developer is unlucky enough to stick to a slow filesystem\nor a broken OS. In this situation explicit git-update-index with\ngit-commit --index will speedup the workflow.\nGiving either --all, --only, or --include silently turns --index off.\n---\n git-commit.sh |   21 +++++++++++++++++----\n 1 files changed, 17 insertions(+), 4 deletions(-)\n\ndiff --git a/git-commit.sh b/git-commit.sh\nindex 3656d60..56543c9 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 | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [[-i | -o] <path>...]'\n+USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [--index] [[-i | -o] <path>...]'\n SUBDIRECTORY_OK=Yes\n . git-sh-setup\n require_work_tree\n@@ -87,6 +87,7 @@ signoff=\n force_author=\n only_include_assumed=\n untracked_files=\n+index_only=\n while case \"$#\" in 0) break;; esac\n do\n \tcase \"$1\" in\n@@ -262,6 +263,10 @@ $1\"\n \t\tuntracked_files=t\n \t\tshift\n \t\t;;\n+\t--index)\n+\t\tindex_only=t\n+\t\tshift\n+\t\t;;\n \t--)\n \t\tshift\n \t\tbreak\n@@ -275,6 +280,7 @@ $1\"\n \tesac\n done\n case \"$edit_flag\" in t) no_edit= ;; esac\n+case \"$all$also$only\" in t*) index_only= ;; esac\n \n ################################################################\n # Sanity check options\n@@ -404,15 +410,22 @@ else\n \tUSE_INDEX=\"$THIS_INDEX\"\n fi\n \n-case \"$status_only\" in\n-t)\n+case \"$status_only,$index_only\" in\n+t,*)\n \t# This will silently fail in a read-only repository, which is\n \t# what we want.\n \tGIT_INDEX_FILE=\"$USE_INDEX\" git-update-index -q --unmerged --refresh\n \trun_status\n \texit $?\n \t;;\n-'')\n+,t)\n+\tGIT_INDEX_FILE=\"$USE_INDEX\" \\\n+\tgit-diff-index --cached --quiet --exit-code HEAD && {\n+\t\techo >&2 \"No changes in the index\"\n+\t\texit 1\n+\t}\n+\t;;\n+,)\n \tGIT_INDEX_FILE=\"$USE_INDEX\" git-update-index -q --refresh || exit\n \t;;\n esac\n-- \n1.5.0.4.439.gce5f\n\n"},{"id":"37184","messageId":"7vird2yr1w.fsf@assigned-by-dhcp.cox.net","threadId":"7255","inReplyTo":"81b0412b0703150243h6a5f036aye8f115d82e11e883@mail.gmail.com","subject":"Re: [RFC] Add --index to git-commit: just commit current index","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-16T00:23:39Z","receivedAt":"2007-03-16T00:23:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Alex Riesen\" <raa.lkml@gmail.com> writes:\n\n> First use of new --quiet :)\n\nYou do not need to say --exit-code if you use --quiet.\n\n> Refreshing index takes a long time on big repositories with\n> many files, especially if the developer was unlucky enough to\n> stick to a slow filesystem or a broken OS. In this situation\n> explicit git-update-index with git-commit --index will speedup\n> the workflow.\n\nDoes it?\n\nA typical workflow would go something like this:\n\n\t- repeat from here\n\t- \"edit foo\"\n        - \"edit bar\"\n        - \"git diff\" to help me see what I changed\n        - \"git add foo\" as the change is sane\n        - test and see breakage\n        - \"git diff HEAD\" to help me see what I broke\n        - go back to 'here' to fix it up\n        - \"git diff HEAD\" to help me see what I changed\n        - \"git add foo bar\" to include what I changed\n        - \"git commit\"\n\nIf I have a large project on a filesystem with slow lstat(2), I\nwould imagine your development is slowed anyway because you\nwould use diff far more often than commit.  I wonder if it may\nbe a better idea to use (and extend if needed) existing 'assume\nunchanged' on such a system, exactly because \"diff\" side would\ntake more time than final \"commit\", and if you do use 'assume\nunchanged', then it also makes --refresh a no-op.\n\nIn any case, I think your --index is a misnomer, as we do commit\nthe current index.  If the sole purpose of your patch is to omit\nrefreshing it, then it should be named as such.\n"},{"id":"37219","messageId":"81b0412b0703160237l90dd158x87646be6c2731886@mail.gmail.com","threadId":"7255","inReplyTo":"7vird2yr1w.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFC] Add --index to git-commit: just commit current index","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-03-16T09:37:49Z","receivedAt":"2007-03-16T09:37:49Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 3/16/07, Junio C Hamano <junkio@cox.net> wrote:\n>\n> > First use of new --quiet :)\n>\n> You do not need to say --exit-code if you use --quiet.\n\nJust forgot it in\n\n> > Refreshing index takes a long time on big repositories with\n> > many files, especially if the developer was unlucky enough to\n> > stick to a slow filesystem or a broken OS. In this situation\n> > explicit git-update-index with git-commit --index will speedup\n> > the workflow.\n>\n> Does it?\n\nIFF you use git-update-index, yes\n\n> A typical workflow would go something like this:\n>\n>         - repeat from here\n>         - \"edit foo\"\n>         - \"edit bar\"\n>         - \"git diff\" to help me see what I changed\n>         - \"git add foo\" as the change is sane\n>         - test and see breakage\n>         - \"git diff HEAD\" to help me see what I broke\n>         - go back to 'here' to fix it up\n>         - \"git diff HEAD\" to help me see what I changed\n>         - \"git add foo bar\" to include what I changed\n>         - \"git commit\"\n\n- edit\n- test\n- edit\n- test\n- update-index (or add) file(s)\n- git commit --index <--- this is faster than before\n- repeat\n\n> If I have a large project on a filesystem with slow lstat(2), I\n> would imagine your development is slowed anyway because you\n> would use diff far more often than commit.  I wonder if it may\n\nI avoid using diff-files for the whole project. diff-index --cached is\nfast always. It is ok even on windows\n\n> be a better idea to use (and extend if needed) existing 'assume\n> unchanged' on such a system, exactly because \"diff\" side would\n> take more time than final \"commit\", and if you do use 'assume\n> unchanged', then it also makes --refresh a no-op.\n\nForgot about it too. It didn't seem to work properly, the last time\nI tried (for a long time, I admit). Besides, sometimes I want to do a\nrefresh, and having to switch the option on and off is annoying.\n\n> In any case, I think your --index is a misnomer, as we do commit\n> the current index.  If the sole purpose of your patch is to omit\n> refreshing it, then it should be named as such.\n\n--no-refresh?\n"}]}