Skip to content

Commit e3b59a4

Browse files
author
Junio C Hamano
committed
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 <[email protected]>
1 parent 749be72 commit e3b59a4

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

git-am.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#!/bin/sh
22
#
3-
#
3+
# Copyright (c) 2005, 2006 Junio C Hamano
44

55
USAGE='[--signoff] [--dotest=<dir>] [--utf8] [--binary] [--3way] <mbox>
66
or, when resuming [--skip | --resolved]'
77
. git-sh-setup
88

9+
git var GIT_COMMITTER_IDENT >/dev/null || exit
10+
911
stop_here () {
1012
echo "$1" >"$dotest/next"
1113
exit 1

git-applymbox.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
USAGE='[-u] [-k] [-q] [-m] (-c .dotest/<num> | mbox) [signoff]'
2222
. git-sh-setup
2323

24+
git var GIT_COMMITTER_IDENT >/dev/null || exit
25+
2426
keep_subject= query_apply= continue= utf8= resume=t
2527
while case "$#" in 0) break ;; esac
2628
do

git-merge.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ case "$#,$common,$no_commit" in
142142
1,*,)
143143
# We are not doing octopus, not fast forward, and have only
144144
# one common. See if it is really trivial.
145+
git var GIT_COMMITTER_IDENT >/dev/null || exit
146+
145147
echo "Trying really trivial in-index merge..."
146148
git-update-index --refresh 2>/dev/null
147149
if git-read-tree --trivial -m -u $common $head "$1" &&
@@ -179,6 +181,9 @@ case "$#,$common,$no_commit" in
179181
;;
180182
esac
181183

184+
# We are going to make a new commit.
185+
git var GIT_COMMITTER_IDENT >/dev/null || exit
186+
182187
case "$use_strategies" in
183188
'')
184189
case "$#" in

git-resolve.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ case "$common" in
5050
;;
5151
esac
5252

53+
# We are going to make a new commit.
54+
git var GIT_COMMITTER_IDENT >/dev/null || exit
55+
5356
# Find an optimum merge base if there are more than one candidates.
5457
LF='
5558
'

0 commit comments

Comments
 (0)