[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/6] Fix partial commit support.
From: |
Gary V. Vaughan |
Subject: |
[PATCH 2/6] Fix partial commit support. |
Date: |
Tue, 31 Aug 2010 13:43:16 +0700 |
From: Gary V. Vaughan <address@hidden>
* clcommit.m4sh (func_commit): Commit only staged files instead
of passing `-a' when no file list was given on the command line.
Signed-off-by: Gary V. Vaughan <address@hidden>
---
ChangeLog | 6 ++++++
clcommit.m4sh | 15 +++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c3287b2..49fe694 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-27 Gary V. Vaughan <address@hidden>
+
+ Fix partial commit support.
+ * clcommit.m4sh (func_commit): Commit only staged files instead
+ of passing `-a' when no file list was given on the command line.
+
2010-08-26 Gary V. Vaughan <address@hidden>
Add --gnulib-version and --news options to announce-gen.
diff --git a/clcommit.m4sh b/clcommit.m4sh
index 8292d6a..f916cd9 100644
--- a/clcommit.m4sh
+++ b/clcommit.m4sh
@@ -268,11 +268,18 @@ func_commit ()
sleep 1 # give the user some time for a ^C
- subject=`git status 2>/dev/null | $SED -n 's/^#.*[mad][ode][dl].*ed: *//p'`
- test $# -gt 0 && subject="$@"
+ if test $# -gt 0; then
+ # Given a list of files to commit from the command line: unstage all
+ # files, and add back those in the list...
+ for staged in `$GIT status -s --porcelain 2>/dev/null | $SED -n 's/^M.
//p'`
+ do
+ $GIT reset -- $staged
+ done
+ $GIT add ${1+"$@"}
+ fi
+ # ...otherwise, by default, only staged files are committed.
- test $# -gt 0 || { set dummy -a; shift; }
- func_show_eval "$GIT commit $git_flags -F $log_file address@hidden" "exit
$EXIT_FAILURE"
+ func_show_eval "$GIT commit $git_flags -F $log_file" "exit $EXIT_FAILURE"
$opt_push && {
func_show_eval "$GIT push"
--
1.7.2.2
- Backport non-gnulib dependent parts of my use-gnulib topic branch, Gary V. Vaughan, 2010/08/31
- [PATCH 1/6] Add --gnulib-version and --news options to announce-gen., Gary V. Vaughan, 2010/08/31
- [PATCH 2/6] Fix partial commit support.,
Gary V. Vaughan <=
- [PATCH 3/6] Support missing detached signatures, like gnulib implementation., Gary V. Vaughan, 2010/08/31
- [PATCH 4/6] Rewrite bootstrap script for consistency with our other shell code., Gary V. Vaughan, 2010/08/31
- [PATCH 6/6] Simplify and improve safety of bootstrap process., Gary V. Vaughan, 2010/08/31