* [RFC] Add --index to git-commit: just commit current index
@ 2007-03-15 9:43 Alex Riesen
2007-03-16 0:23 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Alex Riesen @ 2007-03-15 9:43 UTC (permalink / raw
To: Git Mailing List; +Cc: Junio C Hamano
[-- Attachment #1: Type: text/plain, Size: 579 bytes --]
Refreshing index takes a long time on big repositories with many files,
especially if the developer was unlucky enough to stick to a slow filesystem
or a broken OS. In this situation explicit git-update-index with
git-commit --index will speedup the workflow.
Giving either --all, -o, or -i silently turns --index off (these have to
refresh index).
In case of unmodified index no status message is shown, for all
the same reasons: it takes too long.
---
First use of new --quiet :)
git-commit.sh | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
[-- Attachment #2: 0001-Add-index-to-git-commit-just-commit-current-index.txt --]
[-- Type: text/plain, Size: 2319 bytes --]
From 49b846a654d2f1ef540d6438356bffeafa97ba62 Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@gmail.com>
Date: Thu, 15 Mar 2007 10:39:36 +0100
Subject: [PATCH] Add --index to git-commit: just commit current index
Refreshing index takes a long time on big repositories with many files,
especially if the developer is unlucky enough to stick to a slow filesystem
or a broken OS. In this situation explicit git-update-index with
git-commit --index will speedup the workflow.
Giving either --all, --only, or --include silently turns --index off.
---
git-commit.sh | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/git-commit.sh b/git-commit.sh
index 3656d60..56543c9 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2005 Linus Torvalds
# Copyright (c) 2006 Junio C Hamano
-USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [[-i | -o] <path>...]'
+USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [--index] [[-i | -o] <path>...]'
SUBDIRECTORY_OK=Yes
. git-sh-setup
require_work_tree
@@ -87,6 +87,7 @@ signoff=
force_author=
only_include_assumed=
untracked_files=
+index_only=
while case "$#" in 0) break;; esac
do
case "$1" in
@@ -262,6 +263,10 @@ $1"
untracked_files=t
shift
;;
+ --index)
+ index_only=t
+ shift
+ ;;
--)
shift
break
@@ -275,6 +280,7 @@ $1"
esac
done
case "$edit_flag" in t) no_edit= ;; esac
+case "$all$also$only" in t*) index_only= ;; esac
################################################################
# Sanity check options
@@ -404,15 +410,22 @@ else
USE_INDEX="$THIS_INDEX"
fi
-case "$status_only" in
-t)
+case "$status_only,$index_only" in
+t,*)
# This will silently fail in a read-only repository, which is
# what we want.
GIT_INDEX_FILE="$USE_INDEX" git-update-index -q --unmerged --refresh
run_status
exit $?
;;
-'')
+,t)
+ GIT_INDEX_FILE="$USE_INDEX" \
+ git-diff-index --cached --quiet --exit-code HEAD && {
+ echo >&2 "No changes in the index"
+ exit 1
+ }
+ ;;
+,)
GIT_INDEX_FILE="$USE_INDEX" git-update-index -q --refresh || exit
;;
esac
--
1.5.0.4.439.gce5f
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC] Add --index to git-commit: just commit current index
2007-03-15 9:43 [RFC] Add --index to git-commit: just commit current index Alex Riesen
@ 2007-03-16 0:23 ` Junio C Hamano
2007-03-16 9:37 ` Alex Riesen
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2007-03-16 0:23 UTC (permalink / raw
To: Alex Riesen; +Cc: Git Mailing List
"Alex Riesen" <raa.lkml@gmail.com> writes:
> First use of new --quiet :)
You do not need to say --exit-code if you use --quiet.
> Refreshing index takes a long time on big repositories with
> many files, especially if the developer was unlucky enough to
> stick to a slow filesystem or a broken OS. In this situation
> explicit git-update-index with git-commit --index will speedup
> the workflow.
Does it?
A typical workflow would go something like this:
- repeat from here
- "edit foo"
- "edit bar"
- "git diff" to help me see what I changed
- "git add foo" as the change is sane
- test and see breakage
- "git diff HEAD" to help me see what I broke
- go back to 'here' to fix it up
- "git diff HEAD" to help me see what I changed
- "git add foo bar" to include what I changed
- "git commit"
If I have a large project on a filesystem with slow lstat(2), I
would imagine your development is slowed anyway because you
would use diff far more often than commit. I wonder if it may
be a better idea to use (and extend if needed) existing 'assume
unchanged' on such a system, exactly because "diff" side would
take more time than final "commit", and if you do use 'assume
unchanged', then it also makes --refresh a no-op.
In any case, I think your --index is a misnomer, as we do commit
the current index. If the sole purpose of your patch is to omit
refreshing it, then it should be named as such.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] Add --index to git-commit: just commit current index
2007-03-16 0:23 ` Junio C Hamano
@ 2007-03-16 9:37 ` Alex Riesen
0 siblings, 0 replies; 3+ messages in thread
From: Alex Riesen @ 2007-03-16 9:37 UTC (permalink / raw
To: Junio C Hamano; +Cc: Git Mailing List
On 3/16/07, Junio C Hamano <junkio@cox.net> wrote:
>
> > First use of new --quiet :)
>
> You do not need to say --exit-code if you use --quiet.
Just forgot it in
> > Refreshing index takes a long time on big repositories with
> > many files, especially if the developer was unlucky enough to
> > stick to a slow filesystem or a broken OS. In this situation
> > explicit git-update-index with git-commit --index will speedup
> > the workflow.
>
> Does it?
IFF you use git-update-index, yes
> A typical workflow would go something like this:
>
> - repeat from here
> - "edit foo"
> - "edit bar"
> - "git diff" to help me see what I changed
> - "git add foo" as the change is sane
> - test and see breakage
> - "git diff HEAD" to help me see what I broke
> - go back to 'here' to fix it up
> - "git diff HEAD" to help me see what I changed
> - "git add foo bar" to include what I changed
> - "git commit"
- edit
- test
- edit
- test
- update-index (or add) file(s)
- git commit --index <--- this is faster than before
- repeat
> If I have a large project on a filesystem with slow lstat(2), I
> would imagine your development is slowed anyway because you
> would use diff far more often than commit. I wonder if it may
I avoid using diff-files for the whole project. diff-index --cached is
fast always. It is ok even on windows
> be a better idea to use (and extend if needed) existing 'assume
> unchanged' on such a system, exactly because "diff" side would
> take more time than final "commit", and if you do use 'assume
> unchanged', then it also makes --refresh a no-op.
Forgot about it too. It didn't seem to work properly, the last time
I tried (for a long time, I admit). Besides, sometimes I want to do a
refresh, and having to switch the option on and off is annoying.
> In any case, I think your --index is a misnomer, as we do commit
> the current index. If the sole purpose of your patch is to omit
> refreshing it, then it should be named as such.
--no-refresh?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-16 9:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-15 9:43 [RFC] Add --index to git-commit: just commit current index Alex Riesen
2007-03-16 0:23 ` Junio C Hamano
2007-03-16 9:37 ` Alex Riesen
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).