mirror of
https://github.com/git-for-windows/git.git
synced 2026-05-01 12:45:02 -05:00
Merge branch 'master' into next
* master: Log ref changes made by git-fetch and git-pull. Record the type of commit operation in the reflog. Allow user.name and user.email to drive reflog entry. Fix linking for not-so-clever linkers. git-rev-list: add documentation for --parents, --no-merges
This commit is contained in:
@@ -56,6 +56,9 @@ OPTIONS
|
||||
Print the contents of the commit in raw-format; each
|
||||
record is separated with a NUL character.
|
||||
|
||||
--parents::
|
||||
Print the parents of the commit.
|
||||
|
||||
--objects::
|
||||
Print the object IDs of any object referenced by the listed commits.
|
||||
'git-rev-list --objects foo ^bar' thus means "send me all object IDs
|
||||
@@ -102,6 +105,9 @@ OPTIONS
|
||||
--remove-empty::
|
||||
Stop when a given path disappears from the tree.
|
||||
|
||||
--no-merges::
|
||||
Do not print commits with more than one parent.
|
||||
|
||||
--not::
|
||||
Reverses the meaning of the '{caret}' prefix (or lack
|
||||
thereof) for all following revision specifiers, up to
|
||||
|
||||
@@ -12,6 +12,7 @@ int cmd_update_ref(int argc, const char **argv, char **envp)
|
||||
unsigned char sha1[20], oldsha1[20];
|
||||
int i;
|
||||
|
||||
setup_ident();
|
||||
setup_git_directory();
|
||||
git_config(git_default_config);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ char git_commit_encoding[MAX_ENCODING_LENGTH] = "utf-8";
|
||||
int shared_repository = PERM_UMASK;
|
||||
const char *apply_default_whitespace = NULL;
|
||||
int zlib_compression_level = Z_DEFAULT_COMPRESSION;
|
||||
int pager_in_use;
|
||||
|
||||
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
|
||||
*git_graft_file;
|
||||
|
||||
@@ -635,9 +635,12 @@ fi
|
||||
PARENTS="-p HEAD"
|
||||
if test -z "$initial_commit"
|
||||
then
|
||||
rloga='commit'
|
||||
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
|
||||
rloga='commit (merge)'
|
||||
PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"`
|
||||
elif test -n "$amend"; then
|
||||
rloga='commit (amend)'
|
||||
PARENTS=$(git-cat-file commit HEAD |
|
||||
sed -n -e '/^$/q' -e 's/^parent /-p /p')
|
||||
fi
|
||||
@@ -649,6 +652,7 @@ else
|
||||
fi
|
||||
PARENTS=""
|
||||
current=
|
||||
rloga='commit (initial)'
|
||||
fi
|
||||
|
||||
if test -z "$no_edit"
|
||||
@@ -724,7 +728,7 @@ then
|
||||
fi &&
|
||||
commit=$(cat "$GIT_DIR"/COMMIT_MSG | git-commit-tree $tree $PARENTS) &&
|
||||
rlogm=$(sed -e 1q "$GIT_DIR"/COMMIT_MSG) &&
|
||||
git-update-ref -m "commit: $rlogm" HEAD $commit $current &&
|
||||
git-update-ref -m "$rloga: $rlogm" HEAD $commit $current &&
|
||||
rm -f -- "$GIT_DIR/MERGE_HEAD" &&
|
||||
if test -f "$NEXT_INDEX"
|
||||
then
|
||||
|
||||
20
git-fetch.sh
20
git-fetch.sh
@@ -11,6 +11,7 @@ LF='
|
||||
'
|
||||
IFS="$LF"
|
||||
|
||||
rloga=fetch
|
||||
no_tags=
|
||||
tags=
|
||||
append=
|
||||
@@ -51,6 +52,9 @@ do
|
||||
-k|--k|--ke|--kee|--keep)
|
||||
keep=--keep
|
||||
;;
|
||||
--reflog-action=*)
|
||||
rloga=`expr "z$1" : 'z-[^=]*=\(.*\)'`
|
||||
;;
|
||||
-*)
|
||||
usage
|
||||
;;
|
||||
@@ -75,6 +79,9 @@ refs=
|
||||
rref=
|
||||
rsync_slurped_objects=
|
||||
|
||||
rloga="$rloga $remote_nick"
|
||||
test "$remote_nick" == "$remote" || rloga="$rloga $remote"
|
||||
|
||||
if test "" = "$append"
|
||||
then
|
||||
: >"$GIT_DIR/FETCH_HEAD"
|
||||
@@ -149,11 +156,12 @@ fast_forward_local () {
|
||||
[ "$verbose" ] && echo >&2 "* $1: same as $3"
|
||||
else
|
||||
echo >&2 "* $1: updating with $3"
|
||||
git-update-ref -m "$rloga: updating tag" "$1" "$2"
|
||||
fi
|
||||
else
|
||||
echo >&2 "* $1: storing $3"
|
||||
git-update-ref -m "$rloga: storing tag" "$1" "$2"
|
||||
fi
|
||||
git-update-ref "$1" "$2"
|
||||
;;
|
||||
|
||||
refs/heads/* | refs/remotes/*)
|
||||
@@ -174,7 +182,7 @@ fast_forward_local () {
|
||||
*,$local)
|
||||
echo >&2 "* $1: fast forward to $3"
|
||||
echo >&2 " from $local to $2"
|
||||
git-update-ref "$1" "$2" "$local"
|
||||
git-update-ref -m "$rloga: fast-forward" "$1" "$2" "$local"
|
||||
;;
|
||||
*)
|
||||
false
|
||||
@@ -184,7 +192,7 @@ fast_forward_local () {
|
||||
case ",$force,$single_force," in
|
||||
*,t,*)
|
||||
echo >&2 " forcing update."
|
||||
git-update-ref "$1" "$2" "$local"
|
||||
git-update-ref -m "$rloga: forced-update" "$1" "$2" "$local"
|
||||
;;
|
||||
*)
|
||||
echo >&2 " not updating."
|
||||
@@ -194,7 +202,7 @@ fast_forward_local () {
|
||||
}
|
||||
else
|
||||
echo >&2 "* $1: storing $3"
|
||||
git-update-ref "$1" "$2"
|
||||
git-update-ref -m "$rloga: storing head" "$1" "$2"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -422,7 +430,9 @@ case ",$update_head_ok,$orig_head," in
|
||||
curr_head=$(git-rev-parse --verify HEAD 2>/dev/null)
|
||||
if test "$curr_head" != "$orig_head"
|
||||
then
|
||||
git-update-ref HEAD "$orig_head"
|
||||
git-update-ref \
|
||||
-m "$rloga: Undoing incorrectly fetched HEAD." \
|
||||
HEAD "$orig_head"
|
||||
die "Cannot fetch into the current branch."
|
||||
fi
|
||||
;;
|
||||
|
||||
@@ -45,7 +45,7 @@ do
|
||||
done
|
||||
|
||||
orig_head=$(git-rev-parse --verify HEAD) || die "Pulling into a black hole?"
|
||||
git-fetch --update-head-ok "$@" || exit 1
|
||||
git-fetch --update-head-ok --reflog-action=pull "$@" || exit 1
|
||||
|
||||
curr_head=$(git-rev-parse --verify HEAD)
|
||||
if test "$curr_head" != "$orig_head"
|
||||
|
||||
2
pager.c
2
pager.c
@@ -5,8 +5,6 @@
|
||||
* something different on Windows, for example.
|
||||
*/
|
||||
|
||||
int pager_in_use;
|
||||
|
||||
static void run_pager(const char *pager)
|
||||
{
|
||||
execlp(pager, pager, NULL);
|
||||
|
||||
1
refs.c
1
refs.c
@@ -379,7 +379,6 @@ static int log_ref_write(struct ref_lock *lock,
|
||||
lock->log_file, strerror(errno));
|
||||
}
|
||||
|
||||
setup_ident();
|
||||
committer = git_committer_info(1);
|
||||
if (msg) {
|
||||
maxlen = strlen(committer) + strlen(msg) + 2*40 + 5;
|
||||
|
||||
@@ -188,17 +188,30 @@ test_expect_success \
|
||||
echo OTHER >F &&
|
||||
GIT_AUTHOR_DATE="2005-05-26 23:41" \
|
||||
GIT_COMMITTER_DATE="2005-05-26 23:41" git-commit -F M -a &&
|
||||
h_OTHER=$(git-rev-parse --verify HEAD)
|
||||
h_OTHER=$(git-rev-parse --verify HEAD) &&
|
||||
echo FIXED >F &&
|
||||
EDITOR=true \
|
||||
GIT_AUTHOR_DATE="2005-05-26 23:44" \
|
||||
GIT_COMMITTER_DATE="2005-05-26 23:44" git-commit --amend &&
|
||||
h_FIXED=$(git-rev-parse --verify HEAD) &&
|
||||
echo TEST+FIXED >F &&
|
||||
echo Merged initial commit and a later commit. >M &&
|
||||
echo $h_TEST >.git/MERGE_HEAD &&
|
||||
GIT_AUTHOR_DATE="2005-05-26 23:45" \
|
||||
GIT_COMMITTER_DATE="2005-05-26 23:45" git-commit -F M &&
|
||||
h_MERGED=$(git-rev-parse --verify HEAD)
|
||||
rm -f M'
|
||||
|
||||
cat >expect <<EOF
|
||||
$Z $h_TEST $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 commit: add
|
||||
$Z $h_TEST $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 commit (initial): add
|
||||
$h_TEST $h_OTHER $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000 commit: The other day this did not work.
|
||||
$h_OTHER $h_FIXED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151040 +0000 commit (amend): The other day this did not work.
|
||||
$h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000 commit (merge): Merged initial commit and a later commit.
|
||||
EOF
|
||||
test_expect_success \
|
||||
'git-commit logged updates' \
|
||||
'diff expect .git/logs/$m'
|
||||
unset h_TEST h_OTHER
|
||||
unset h_TEST h_OTHER h_FIXED h_MERGED
|
||||
|
||||
test_expect_success \
|
||||
'git-cat-file blob master:F (expect OTHER)' \
|
||||
|
||||
Reference in New Issue
Block a user