@matheusbsbs / matheus-bagliano / commits / e3b59a44f6
Fork 0

Keep Porcelainish from failing by broken ident after making changes.

"empty ident not allowed" error makes commit-tree fail, so we are already safer in that we would not end up with commit objects that have bogus names on the author or committer fields. However, before commit-tree is called there are already changes made to the index file and the working tree. The operation can be resumed after fixing the environment problem, but when this triggers to a newcomer with unusable gecos, the first question becomes "what did I lose and how would I recover". This patch modifies some Porcelainish commands to verify GIT_COMMITTER_IDENT as soon as we know we are going to make some commits before doing much damage to prevent confusion. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 18, 2006 at 20:51 UTC e3b59a44f6705896db80965427a7cf9e2112634b
4 files changed +13 -1
git-am.sh
+3 -1
@@ -1,11 +1,13 @@
1 #!/bin/sh
2 #
3 -#
3 +# Copyright (c) 2005, 2006 Junio C Hamano
4
5 USAGE='[--signoff] [--dotest=<dir>] [--utf8] [--binary] [--3way] <mbox>
6 or, when resuming [--skip | --resolved]'
7 . git-sh-setup
8
9 +git var GIT_COMMITTER_IDENT >/dev/null || exit
10 +
11 stop_here () {
12 echo "$1" >"$dotest/next"
13 exit 1
git-applymbox.sh
+2
@@ -21,6 +21,8 @@
21 USAGE='[-u] [-k] [-q] [-m] (-c .dotest/<num> | mbox) [signoff]'
22 . git-sh-setup
23
24 +git var GIT_COMMITTER_IDENT >/dev/null || exit
25 +
26 keep_subject= query_apply= continue= utf8= resume=t
27 while case "$#" in 0) break ;; esac
28 do
git-merge.sh
+5
@@ -142,6 +142,8 @@ case "$#,$common,$no_commit" in
142 1,*,)
143 # We are not doing octopus, not fast forward, and have only
144 # one common. See if it is really trivial.
145 + git var GIT_COMMITTER_IDENT >/dev/null || exit
146 +
147 echo "Trying really trivial in-index merge..."
148 git-update-index --refresh 2>/dev/null
149 if git-read-tree --trivial -m -u $common $head "$1" &&
@@ -179,6 +181,9 @@ case "$#,$common,$no_commit" in
181 ;;
182 esac
183
184 +# We are going to make a new commit.
185 +git var GIT_COMMITTER_IDENT >/dev/null || exit
186 +
187 case "$use_strategies" in
188 '')
189 case "$#" in
git-resolve.sh
+3
@@ -50,6 +50,9 @@ case "$common" in
50 ;;
51 esac
52
53 +# We are going to make a new commit.
54 +git var GIT_COMMITTER_IDENT >/dev/null || exit
55 +
56 # Find an optimum merge base if there are more than one candidates.
57 LF='
58 '