Merge branch 'maint'
* maint: add-interactive: fix deletion of non-empty files pull: clarify advice for the unconfigured error casemaint
commit
ff86bdd5ca
|
@ -1216,7 +1216,11 @@ sub patch_update_file {
|
||||||
if (@{$mode->{TEXT}}) {
|
if (@{$mode->{TEXT}}) {
|
||||||
unshift @hunk, $mode;
|
unshift @hunk, $mode;
|
||||||
}
|
}
|
||||||
if (@{$deletion->{TEXT}} && !@hunk) {
|
if (@{$deletion->{TEXT}}) {
|
||||||
|
foreach my $hunk (@hunk) {
|
||||||
|
push @{$deletion->{TEXT}}, @{$hunk->{TEXT}};
|
||||||
|
push @{$deletion->{DISPLAY}}, @{$hunk->{DISPLAY}};
|
||||||
|
}
|
||||||
@hunk = ($deletion);
|
@hunk = ($deletion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
48
git-pull.sh
48
git-pull.sh
|
@ -91,45 +91,63 @@ error_on_no_merge_candidates () {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if test true = "$rebase"
|
||||||
|
then
|
||||||
|
op_type=rebase
|
||||||
|
op_prep=against
|
||||||
|
else
|
||||||
|
op_type=merge
|
||||||
|
op_prep=with
|
||||||
|
fi
|
||||||
|
|
||||||
curr_branch=${curr_branch#refs/heads/}
|
curr_branch=${curr_branch#refs/heads/}
|
||||||
upstream=$(git config "branch.$curr_branch.merge")
|
upstream=$(git config "branch.$curr_branch.merge")
|
||||||
remote=$(git config "branch.$curr_branch.remote")
|
remote=$(git config "branch.$curr_branch.remote")
|
||||||
|
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
echo "There are no candidates for merging in the refs that you just fetched."
|
if [ "$rebase" = true ]; then
|
||||||
|
printf "There is no candidate for rebasing against "
|
||||||
|
else
|
||||||
|
printf "There are no candidates for merging "
|
||||||
|
fi
|
||||||
|
echo "among the refs that you just fetched."
|
||||||
echo "Generally this means that you provided a wildcard refspec which had no"
|
echo "Generally this means that you provided a wildcard refspec which had no"
|
||||||
echo "matches on the remote end."
|
echo "matches on the remote end."
|
||||||
elif [ $# -gt 0 ] && [ "$1" != "$remote" ]; then
|
elif [ $# -gt 0 ] && [ "$1" != "$remote" ]; then
|
||||||
echo "You asked to pull from the remote '$1', but did not specify"
|
echo "You asked to pull from the remote '$1', but did not specify"
|
||||||
echo "a branch to merge. Because this is not the default configured remote"
|
echo "a branch. Because this is not the default configured remote"
|
||||||
echo "for your current branch, you must specify a branch on the command line."
|
echo "for your current branch, you must specify a branch on the command line."
|
||||||
elif [ -z "$curr_branch" ]; then
|
elif [ -z "$curr_branch" ]; then
|
||||||
echo "You are not currently on a branch, so I cannot use any"
|
echo "You are not currently on a branch, so I cannot use any"
|
||||||
echo "'branch.<branchname>.merge' in your configuration file."
|
echo "'branch.<branchname>.merge' in your configuration file."
|
||||||
echo "Please specify which branch you want to merge on the command"
|
echo "Please specify which remote branch you want to use on the command"
|
||||||
echo "line and try again (e.g. 'git pull <repository> <refspec>')."
|
echo "line and try again (e.g. 'git pull <repository> <refspec>')."
|
||||||
echo "See git-pull(1) for details."
|
echo "See git-pull(1) for details."
|
||||||
elif [ -z "$upstream" ]; then
|
elif [ -z "$upstream" ]; then
|
||||||
echo "You asked me to pull without telling me which branch you"
|
echo "You asked me to pull without telling me which branch you"
|
||||||
echo "want to merge with, and 'branch.${curr_branch}.merge' in"
|
echo "want to $op_type $op_prep, and 'branch.${curr_branch}.merge' in"
|
||||||
echo "your configuration file does not tell me either. Please"
|
echo "your configuration file does not tell me, either. Please"
|
||||||
echo "specify which branch you want to merge on the command line and"
|
echo "specify which branch you want to use on the command line and"
|
||||||
echo "try again (e.g. 'git pull <repository> <refspec>')."
|
echo "try again (e.g. 'git pull <repository> <refspec>')."
|
||||||
echo "See git-pull(1) for details."
|
echo "See git-pull(1) for details."
|
||||||
echo
|
echo
|
||||||
echo "If you often merge with the same branch, you may want to"
|
echo "If you often $op_type $op_prep the same branch, you may want to"
|
||||||
echo "configure the following variables in your configuration"
|
echo "use something like the following in your configuration file:"
|
||||||
echo "file:"
|
|
||||||
echo
|
echo
|
||||||
echo " branch.${curr_branch}.remote = <nickname>"
|
echo " [branch \"${curr_branch}\"]"
|
||||||
echo " branch.${curr_branch}.merge = <remote-ref>"
|
echo " remote = <nickname>"
|
||||||
echo " remote.<nickname>.url = <url>"
|
echo " merge = <remote-ref>"
|
||||||
echo " remote.<nickname>.fetch = <refspec>"
|
test rebase = "$op_type" &&
|
||||||
|
echo " rebase = true"
|
||||||
|
echo
|
||||||
|
echo " [remote \"<nickname>\"]"
|
||||||
|
echo " url = <url>"
|
||||||
|
echo " fetch = <refspec>"
|
||||||
echo
|
echo
|
||||||
echo "See git-config(1) for details."
|
echo "See git-config(1) for details."
|
||||||
else
|
else
|
||||||
echo "Your configuration specifies to merge the ref '${upstream#refs/heads/}' from the"
|
echo "Your configuration specifies to $op_type $op_prep the ref '${upstream#refs/heads/}'"
|
||||||
echo "remote, but no such ref was fetched."
|
echo "from the remote, but no such ref was fetched."
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,6 +228,26 @@ test_expect_success 'add first line works' '
|
||||||
test_cmp expected diff
|
test_cmp expected diff
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat >expected <<EOF
|
||||||
|
diff --git a/non-empty b/non-empty
|
||||||
|
deleted file mode 100644
|
||||||
|
index d95f3ad..0000000
|
||||||
|
--- a/non-empty
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1 +0,0 @@
|
||||||
|
-content
|
||||||
|
EOF
|
||||||
|
test_expect_success 'deleting a non-empty file' '
|
||||||
|
git reset --hard &&
|
||||||
|
echo content >non-empty &&
|
||||||
|
git add non-empty &&
|
||||||
|
git commit -m non-empty &&
|
||||||
|
rm non-empty &&
|
||||||
|
echo y | git add -p non-empty &&
|
||||||
|
git diff --cached >diff &&
|
||||||
|
test_cmp expected diff
|
||||||
|
'
|
||||||
|
|
||||||
cat >expected <<EOF
|
cat >expected <<EOF
|
||||||
diff --git a/empty b/empty
|
diff --git a/empty b/empty
|
||||||
deleted file mode 100644
|
deleted file mode 100644
|
||||||
|
|
Loading…
Reference in New Issue