summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 61c2bcb)
raw | patch | inline | side by side (parent: 61c2bcb)
author | Junio C Hamano <junkio@cox.net> | |
Thu, 20 Apr 2006 08:20:56 +0000 (01:20 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 20 Apr 2006 09:51:12 +0000 (02:51 -0700) |
When running "git commit --amend" only to fix the commit log
message without any content change, we mistakenly showed the
git-status output that says "nothing to commit" without
commenting it out.
If you have already run update-index but you want to amend the
top commit, "git commit --amend --only" without any paths should
have worked, because --only means "starting from the base
commit, update-index these paths only to prepare the index to
commit, and perform the commit". However, we refused -o without
paths.
Signed-off-by: Junio C Hamano <junkio@cox.net>
message without any content change, we mistakenly showed the
git-status output that says "nothing to commit" without
commenting it out.
If you have already run update-index but you want to amend the
top commit, "git commit --amend --only" without any paths should
have worked, because --only means "starting from the base
commit, update-index these paths only to prepare the index to
commit, and perform the commit". However, we refused -o without
paths.
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-commit.sh | patch | blob | history | |
t/t1200-tutorial.sh | patch | blob | history |
diff --git a/git-commit.sh b/git-commit.sh
index 01c73bdd08e075d650e58664650bcd7fe1cd1551..26cd7ca54de2e0b4802546d2611cd379694ec005 100755 (executable)
--- a/git-commit.sh
+++ b/git-commit.sh
fi
case "$committable" in
0)
- echo "nothing to commit"
- exit 1
+ case "$amend" in
+ t)
+ echo "# No changes" ;;
+ *)
+ echo "nothing to commit" ;;
+ esac
+ exit 1 ;;
esac
exit 0
)
die "Only one of -c/-C/-F/-m can be used." ;;
esac
-case "$#,$also$only" in
-*,tt)
+case "$#,$also,$only,$amend" in
+*,t,t,*)
die "Only one of --include/--only can be used." ;;
-0,t)
+0,t,,* | 0,,t,)
die "No paths with --include/--only does not make sense." ;;
-0,)
+0,,t,t)
+ only_include_assumed="# Clever... amending the last one with dirty index." ;;
+0,,,*)
;;
-*,)
+*,,,*)
only_include_assumed="# Explicit paths specified without -i nor -o; assuming --only paths..."
also=
;;
diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
index 10024133e3e69af0d14200d23c00d1ba7d1dbf74..f4d53c078a4a476c5dfadcfb2582dbb97c71db5c 100755 (executable)
--- a/t/t1200-tutorial.sh
+++ b/t/t1200-tutorial.sh
git commit -m 'Merged "mybranch" changes.' -i hello
+test_done
+
cat > show-branch.expect << EOF
* [master] Merged "mybranch" changes.
! [mybranch] Some work.