Skip to content

Commit

Permalink
Keep Porcelainish from failing by broken ident after making changes.
Browse files Browse the repository at this point in the history
"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>
  • Loading branch information
Junio C Hamano committed Feb 22, 2006
1 parent 589e4f9 commit d64e6b0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion git-am.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/sh
#
#
# Copyright (c) 2005, 2006 Junio C Hamano

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

git var GIT_COMMITTER_IDENT >/dev/null || exit

stop_here () {
echo "$1" >"$dotest/next"
exit 1
Expand Down
2 changes: 2 additions & 0 deletions git-applymbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
USAGE='[-u] [-k] [-q] [-m] (-c .dotest/<num> | mbox) [signoff]'
. git-sh-setup

git var GIT_COMMITTER_IDENT >/dev/null || exit

keep_subject= query_apply= continue= utf8= resume=t
while case "$#" in 0) break ;; esac
do
Expand Down
5 changes: 5 additions & 0 deletions git-merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ case "$#,$common,$no_commit" in
1,*,)
# We are not doing octopus, not fast forward, and have only
# one common. See if it is really trivial.
git var GIT_COMMITTER_IDENT >/dev/null || exit

echo "Trying really trivial in-index merge..."
git-update-index --refresh 2>/dev/null
if git-read-tree --trivial -m -u $common $head "$1" &&
Expand Down Expand Up @@ -179,6 +181,9 @@ case "$#,$common,$no_commit" in
;;
esac

# We are going to make a new commit.
git var GIT_COMMITTER_IDENT >/dev/null || exit

case "$use_strategies" in
'')
case "$#" in
Expand Down
3 changes: 3 additions & 0 deletions git-resolve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ case "$common" in
;;
esac

# We are going to make a new commit.
git var GIT_COMMITTER_IDENT >/dev/null || exit

# Find an optimum merge base if there are more than one candidates.
LF='
'
Expand Down

0 comments on commit d64e6b0

Please sign in to comment.