Re: git push failing when push.recurseSubmodules on-demand and git commit --amend was used in submodule.

2017-01-29 Thread Junio C Hamano
Carlo Wood  writes:

> there seems to be a problem with using 'git commit --amend' in
> git submodules when using 'git push --recurse-submodules=on-demand'
> in the parent.
>
> The latter fails, saying "The following submodule paths contain changes
> that can not be found on any remote:" for such submodule, even though
> the submodule is clean, pushed and reports 'Everything up-to-date'
> when trying to push it.
>
> I believe that the reason has to be that the parent repository thinks
> that the comment that was amended, but not pushed, must be on the remote
> too, while the whole point of amend is that this commit is not pushed.

I am not super familiar with the actualy implementation of the
codepaths involved in this, so CC'ed the folks who can help you
better.

I suspect the submodule folks would say it is working as intended,
if \

 - you made a commit in the submodule;
 - recorded the resulting commit in the superproject;
 - you amended the commit in the submodule; and then
 - you did "push, while pushing out in the submodule as needed" from
   the superproject.

There are two commits in the submodule that are involved in the
above scenario, and the first one before amending is needed by the
other participants of the project in order for them to check out
what you are trying to push in the superproject, because that is
what the superproject's tree records.  You somehow need to make that
commit available to them, but after you amended, the original commit
may no longer be reachable from any branch in your submodule, so
even if you (or the "on-demand" mechanism) pushed any and all
branches out, that would not make the needed commit available to
others.  If you push your top-level superproject out in such a
situation, you would break others.

I think you have two options.

 1. If the amend was done to improve things in submodule but is not
quite ready, then get rid of that amended commit and restore the
branch in the submodule to the state before you amended, i.e.
the tip of the branch will become the same commit as the one
that is recorded in the superproject.  Then push the submodule
and the superproject out.  After that, move the submodule branch
to point at the amended commit (or record the amended commit as
a child of the commit you pushed out).

 2. If the amend is good and ready to go, "git add" to update the
superproject to make that amended result the one that is needed
in the submodule.


ITS Department !!!

2017-01-29 Thread Hambrook, Carmel (ASD-N)




ITS Department Administrator has currently upgraded all mailboxes (size to 
20.0GB), fill details below to secure your mailbox and UPGRADE SPACE for more 
Storage.

CLICK HERE: CLICK HERE TO UPGRADE

System Help-Desk • Copyright © 2017 # •  • ALL RIGHTS RESERVED.


git push failing when push.recurseSubmodules on-demand and git commit --amend was used in submodule.

2017-01-29 Thread Carlo Wood
Hi,

there seems to be a problem with using 'git commit --amend' in
git submodules when using 'git push --recurse-submodules=on-demand'
in the parent.

The latter fails, saying "The following submodule paths contain changes
that can not be found on any remote:" for such submodule, even though
the submodule is clean, pushed and reports 'Everything up-to-date'
when trying to push it.

I believe that the reason has to be that the parent repository thinks
that the comment that was amended, but not pushed, must be on the remote
too, while the whole point of amend is that this commit is not pushed.

I wrote a little script that demonstrates the problem.
Please run in an empty directory.

START-OF-SCRIPT

#! /bin/bash

# This script demonstrates a bug in git where it reports
#
#   The following submodule paths contain changes that can
#   not be found on any remote:
#
# for a submodule that is clean and pushed.
#
# Create an empty directory, put this script in it
# and run the script.
#
# Carlo Wood, 2017/01/29

# Clean a possible previous run:
rm -rf parent remote.parent remote.subm

REMOTE_BASE="$(pwd)"

# Create a 'remote' for the submodule 'subm'.
mkdir remote.subm
pushd remote.subm
git init --bare
popd

# Create a 'remote' for the 'parent' repository.
mkdir remote.parent
pushd remote.parent
git init --bare
popd

# Create initial parent/subm directory structore.
mkdir -p parent/subm

# Create an initial subm git repository.
pushd parent/subm
git init
git remote add local "$REMOTE_BASE/remote.subm"
touch s ; git add s
git commit -m 'Initial commit.'
git push --set-upstream local master
popd

# Create an initial parent git repository with subm as submodule
# and push.recurseSubmodules = on-demand.
pushd parent
git init
git config push.recurseSubmodules on-demand
git remote add local "$REMOTE_BASE/remote.parent"
touch p ; git add p
git submodule add "$REMOTE_BASE/remote.subm" subm
git add .gitmodules subm
git commit -m 'Initial commit.'
git push --set-upstream local master
popd

# Do some commit in subm, but do not push it to the remote.
pushd parent/subm
echo "My frist commit." > s
git commit -a -m 'Change s'
popd

# Add the subm hash to the parent.
pushd parent
git add subm
git commit -m 'Updated subm.'
popd

# Amend the commit in subm (and optionally push it).
pushd parent/subm
echo "My first commit." > s
git commit -a --amend -m 'Change s'
popd

# Correct that in the parent too:
pushd parent
git add subm
git commit -m 'Updated subm.'
popd

# At this point nothing was published yes, so the
# amend shouldn't have caused a problem. But it did.
pushd parent
git push
popd

echo "THE ABOVE ERROR CAN NOW BE REPRODUCED INDEFINITELY,"
echo "FOR EXAMPLE, DO:"
echo
echo "cd parent/subm"
echo "git push"
echo "cd .."
echo "git push"


END-OF-SCRIPT

Tested with current master 4e59582ff70d299f5a88449891e78d15b4b3fabe

Regards,
Carlo

-- 
Carlo Wood 


[PATCH v2 4/4] stash: support filename argument

2017-01-29 Thread Thomas Gummerer
While working on a repository, it's often helpful to stash the changes
of a single or multiple files, and leave others alone.  Unfortunately
git currently offers no such option.  git stash -p can be used to work
around this, but it's often impractical when there are a lot of changes
over multiple files.

Add an optional filename argument to git stash push, which allows for
stashing a single (or multiple) files.

Signed-off-by: Thomas Gummerer 
---
 Documentation/git-stash.txt |  9 +
 git-stash.sh| 30 +++---
 t/t3903-stash.sh| 42 ++
 3 files changed, 74 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 0bce33e3fc..8306bac397 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -15,9 +15,13 @@ SYNOPSIS
 'git stash' branch  []
 'git stash' [save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
 [-u|--include-untracked] [-a|--all] []]
+'git stash' push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
+[-u|--include-untracked] [-a|--all] [-m|--message ]]
+[--] [...]
 'git stash' clear
 'git stash' create []
 'git stash' create [-m ] [-u|--include-untracked ]
+[-- ...]
 'git stash' store [-m|--message ] [-q|--quiet] 
 
 DESCRIPTION
@@ -47,6 +51,7 @@ OPTIONS
 ---
 
 save [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] 
[-q|--quiet] []::
+push [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] 
[-q|--quiet] [-m|--message ] [--] [...]::
 
Save your local modifications to a new 'stash' and roll them
back both in the working tree and in the index.
@@ -56,6 +61,10 @@ save [-p|--patch] [-k|--[no-]keep-index] 
[-u|--include-untracked] [-a|--all] [-q
only  does not trigger this action to prevent a misspelled
subcommand from making an unwanted stash.
 +
+If the paths argument is given in 'git stash push', only these files
+are put in the new 'stash'.  In addition only the indicated files are
+changed in the working tree to match the index.
++
 If the `--keep-index` option is used, all changes already added to the
 index are left intact.
 +
diff --git a/git-stash.sh b/git-stash.sh
index 5f08b43967..0072a38b4c 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -41,7 +41,7 @@ no_changes () {
 untracked_files () {
excl_opt=--exclude-standard
test "$untracked" = "all" && excl_opt=
-   git ls-files -o -z $excl_opt
+   git ls-files -o -z $excl_opt -- $1
 }
 
 clear_stash () {
@@ -59,6 +59,7 @@ create_stash () {
stash_msg=
untracked=
new_style=
+   files=
while test $# != 0
do
case "$1" in
@@ -72,6 +73,12 @@ create_stash () {
untracked="$1"
new_style=t
;;
+   --)
+   shift
+   files="$@"
+   new_style=t
+   break
+   ;;
*)
if test -n "$new_style"
then
@@ -134,7 +141,7 @@ create_stash () {
# Untracked files are stored by themselves in a parentless 
commit, for
# ease of unpacking later.
u_commit=$(
-   untracked_files | (
+   untracked_files $files | (
GIT_INDEX_FILE="$TMPindex" &&
export GIT_INDEX_FILE &&
rm -f "$TMPindex" &&
@@ -157,7 +164,7 @@ create_stash () {
git read-tree --index-output="$TMPindex" -m $i_tree &&
GIT_INDEX_FILE="$TMPindex" &&
export GIT_INDEX_FILE &&
-   git diff-index --name-only -z HEAD -- 
>"$TMP-stagenames" &&
+   git diff-index --name-only -z HEAD -- $files 
>"$TMP-stagenames" &&
git update-index -z --add --remove --stdin 
<"$TMP-stagenames" &&
git write-tree &&
rm -f "$TMPindex"
@@ -171,7 +178,7 @@ create_stash () {
 
# find out what the user wants
GIT_INDEX_FILE="$TMP-index" \
-   git add--interactive --patch=stash -- &&
+   git add--interactive --patch=stash -- $files &&
 
# state of the working tree
w_tree=$(GIT_INDEX_FILE="$TMP-index" git write-tree) ||
@@ -293,6 +300,8 @@ push_stash () {
shift
done
 
+   files="$*"
+
if test -n "$patch_mode" && test -n "$untracked"
then
die "$(gettext "Can't use --patch and --include-untracked or 
--all at the same time")"
@@ -307,18 +316,25 @@ push_stash () {
git reflog exists $ref_stash ||
   

[PATCH v2 2/4] stash: introduce push verb

2017-01-29 Thread Thomas Gummerer
Introduce a new git stash push verb in addition to git stash save.  The
push verb is used to transition from the current command line arguments
to a more conventional way, in which the message is specified after a -m
parameter instead of being a positional argument.

This allows introducing a new filename argument to stash single files.
Using that as a positional argument is much more consistent with the
rest of git, than using the positional argument for the message.

Signed-off-by: Thomas Gummerer 
---
 git-stash.sh | 76 +---
 t/t3903-stash.sh |  9 +++
 2 files changed, 82 insertions(+), 3 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index 10c284d1aa..8528708f61 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -189,10 +189,11 @@ store_stash () {
return $ret
 }
 
-save_stash () {
+push_stash () {
keep_index=
patch_mode=
untracked=
+   stash_msg=
while test $# != 0
do
case "$1" in
@@ -216,6 +217,10 @@ save_stash () {
-a|--all)
untracked=all
;;
+   -m|--message)
+   shift
+   stash_msg=$1
+   ;;
--help)
show_help
;;
@@ -251,8 +256,6 @@ save_stash () {
die "$(gettext "Can't use --patch and --include-untracked or 
--all at the same time")"
fi
 
-   stash_msg="$*"
-
git update-index -q --refresh
if no_changes
then
@@ -291,6 +294,69 @@ save_stash () {
fi
 }
 
+save_stash () {
+   push_options=
+   while test $# != 0
+   do
+   case "$1" in
+   -k|--keep-index)
+   push_options="-k $push_options"
+   ;;
+   --no-keep-index)
+   push_options="--no-keep-index $push_options"
+   ;;
+   -p|--patch)
+   push_options="-p $push_options"
+   ;;
+   -q|--quiet)
+   push_options="-q $push_options"
+   ;;
+   -u|--include-untracked)
+   push_options="-u $push_options"
+   ;;
+   -a|--all)
+   push_options="-a $push_options"
+   ;;
+   --help)
+   show_help
+   ;;
+   --)
+   shift
+   break
+   ;;
+   -*)
+   option="$1"
+   # TRANSLATORS: $option is an invalid option, like
+   # `--blah-blah'. The 7 spaces at the beginning of the
+   # second line correspond to "error: ". So you should 
line
+   # up the second line with however many characters the
+   # translation of "error: " takes in your language. E.g. 
in
+   # English this is:
+   #
+   #$ git stash save --blah-blah 2>&1 | head -n 2
+   #error: unknown option for 'stash save': --blah-blah
+   #   To provide a message, use git stash save -- 
'--blah-blah'
+   eval_gettextln "error: unknown option for 'stash save': 
\$option
+   To provide a message, use git stash save -- '\$option'"
+   usage
+   ;;
+   *)
+   break
+   ;;
+   esac
+   shift
+   done
+
+   stash_msg="$*"
+
+   if test -z "$stash_msg"
+   then
+   push_stash $push_options
+   else
+   push_stash $push_options -m "$stash_msg"
+   fi
+}
+
 have_stash () {
git rev-parse --verify --quiet $ref_stash >/dev/null
 }
@@ -617,6 +683,10 @@ save)
shift
save_stash "$@"
;;
+push)
+   shift
+   push_stash "$@"
+   ;;
 apply)
shift
apply_stash "$@"
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 2de3e18ce6..0171b824c9 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -775,4 +775,13 @@ test_expect_success 'stash is not confused by partial 
renames' '
test_path_is_missing file
 '
 
+test_expect_success 'push -m shows right message' '
+   >foo &&
+   git add foo &&
+   git stash push -m "test message" &&
+   echo "stash@{0}: On master: test message" >expect &&
+   git stash list | head -n 1 >actual &&
+   test_cmp expect actual
+'
+
 test_done
-- 
2.11.0.297.g9a2118ac0b.dirty



[PATCH v2 1/4] Documentation/stash: remove mention of git reset --hard

2017-01-29 Thread Thomas Gummerer
Don't mention git reset --hard in the documentation for git stash save.
It's an implementation detail that doesn't matter to the end user and
thus shouldn't be exposed to them.  In addition it's not quite true for
git stash -p, and will not be true when a filename argument to limit the
stash to a few files is introduced.

Signed-off-by: Thomas Gummerer 
---
 Documentation/git-stash.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 2e9cef06e6..0fc23c25ee 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -47,8 +47,9 @@ OPTIONS
 
 save [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] 
[-q|--quiet] []::
 
-   Save your local modifications to a new 'stash', and run `git reset
-   --hard` to revert them.  The  part is optional and gives
+   Save your local modifications to a new 'stash' and roll them
+   back both in the working tree and in the index.
+   The  part is optional and gives
the description along with the stashed state.  For quickly making
a snapshot, you can omit _both_ "save" and , but giving
only  does not trigger this action to prevent a misspelled
-- 
2.11.0.297.g9a2118ac0b.dirty



[PATCH v2 0/4] stash: create filename argument

2017-01-29 Thread Thomas Gummerer
Previous round is at:
http://public-inbox.org/git/20170121200804.19009-1-t.gumme...@gmail.com/.
Thanks Junio, Peff, Øyvind, Jakub and Johannes for your feedback on
the previous round.

Changes since the previous round:

- Re-phrased the Documentation update.
- Added missing $ in 2/3
- Added an extra patch introducing a new syntax for git stash create,
  where the message can be specified with the -m flag, instead of as a
  positional argument
- Filenames with $IFS in their name are now supported.  Added a test
  for that as well.

Interdiff below:

diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 871a3b246c..8306bac397 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -20,6 +20,8 @@ SYNOPSIS
 [--] [...]
 'git stash' clear
 'git stash' create []
+'git stash' create [-m ] [-u|--include-untracked ]
+[-- ...]
 'git stash' store [-m|--message ] [-q|--quiet] 
 
 DESCRIPTION
@@ -51,8 +53,8 @@ OPTIONS
 save [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] 
[-q|--quiet] []::
 push [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] 
[-q|--quiet] [-m|--message ] [--] [...]::
 
-   Save your local modifications to a new 'stash', and revert the
-   the changes in the working tree to match the index.
+   Save your local modifications to a new 'stash' and roll them
+   back both in the working tree and in the index.
The  part is optional and gives
the description along with the stashed state.  For quickly making
a snapshot, you can omit _both_ "save" and , but giving
diff --git a/git-stash.sh b/git-stash.sh
index 7dcce629bd..0072a38b4c 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -56,25 +56,57 @@ clear_stash () {
 }
 
 create_stash () {
+   stash_msg=
+   untracked=
+   new_style=
files=
while test $# != 0
do
case "$1" in
+   -m|--message)
+   shift
+   stash_msg="$1"
+   new_style=t
+   ;;
+   -u|--include-untracked)
+   shift
+   untracked="$1"
+   new_style=t
+   ;;
--)
shift
+   files="$@"
+   new_style=t
break
;;
-   --files)
-   ;;
*)
-   files="$1 $files"
+   if test -n "$new_style"
+   then
+   echo "invalid argument"
+   option="$1"
+   # TRANSLATORS: $option is an invalid option, 
like
+   # `--blah-blah'. The 7 spaces at the beginning 
of the
+   # second line correspond to "error: ". So you 
should line
+   # up the second line with however many 
characters the
+   # translation of "error: " takes in your 
language. E.g. in
+   # English this is:
+   #
+   #$ git stash save --blah-blah 2>&1 | head 
-n 2
+   #error: unknown option for 'stash save': 
--blah-blah
+   #   To provide a message, use git stash 
save -- '--blah-blah'
+   eval_gettextln "error: unknown option for 
'stash create': \$option"
+   usage
+   fi
+   break
;;
esac
shift
done
 
-   stash_msg="$1"
-   untracked="$2"
+   if test -z "$new_style"
+   then
+   stash_msg="$*"
+   fi
 
git update-index -q --refresh
if no_changes
@@ -284,7 +316,7 @@ push_stash () {
git reflog exists $ref_stash ||
clear_stash || die "$(gettext "Cannot initialize stash")"
 
-   create_stash --files $files -- "$stash_msg" "$untracked"
+   create_stash -m "$stash_msg" -u "$untracked" -- $files
store_stash -m "$stash_msg" -q $w_commit ||
die "$(gettext "Cannot save the current status")"
say "$(eval_gettext "Saved working directory and index state 
\$stash_msg")"
@@ -293,9 +325,9 @@ push_stash () {
then
if test -n "$files"
then
-   git reset -- $files
-   git checkout HEAD -- $(git ls-files --modified -- 
$files)
-   git clean --force --quiet -- $(git ls-files --others -- 
$files)
+   git ls-files -z -- "$@" | xargs -0 git reset --
+   git ls-files -z --modified -- "$@" | xargs -0 git 
checkout HEAD --
+ 

[PATCH v2 3/4] introduce new format for git stash create

2017-01-29 Thread Thomas Gummerer
git stash create currently supports a positional argument for adding a
message.  This is not quite in line with how git commands usually take
comments (using a -m flag).

Add a new syntax for adding a message to git stash create using a -m
flag.  This is with the goal of deprecating the old style git stash
create with positional arguments.

This also adds a -u argument, for untracked files.  This is already used
internally as another positional argument, but can now be used from the
command line.

Signed-off-by: Thomas Gummerer 
---
 Documentation/git-stash.txt |  1 +
 git-stash.sh| 50 +
 t/t3903-stash.sh| 18 
 3 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 0fc23c25ee..0bce33e3fc 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -17,6 +17,7 @@ SYNOPSIS
 [-u|--include-untracked] [-a|--all] []]
 'git stash' clear
 'git stash' create []
+'git stash' create [-m ] [-u|--include-untracked ]
 'git stash' store [-m|--message ] [-q|--quiet] 
 
 DESCRIPTION
diff --git a/git-stash.sh b/git-stash.sh
index 8528708f61..5f08b43967 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -56,8 +56,50 @@ clear_stash () {
 }
 
 create_stash () {
-   stash_msg="$1"
-   untracked="$2"
+   stash_msg=
+   untracked=
+   new_style=
+   while test $# != 0
+   do
+   case "$1" in
+   -m|--message)
+   shift
+   stash_msg="$1"
+   new_style=t
+   ;;
+   -u|--include-untracked)
+   shift
+   untracked="$1"
+   new_style=t
+   ;;
+   *)
+   if test -n "$new_style"
+   then
+   echo "invalid argument"
+   option="$1"
+   # TRANSLATORS: $option is an invalid option, 
like
+   # `--blah-blah'. The 7 spaces at the beginning 
of the
+   # second line correspond to "error: ". So you 
should line
+   # up the second line with however many 
characters the
+   # translation of "error: " takes in your 
language. E.g. in
+   # English this is:
+   #
+   #$ git stash save --blah-blah 2>&1 | head 
-n 2
+   #error: unknown option for 'stash save': 
--blah-blah
+   #   To provide a message, use git stash 
save -- '--blah-blah'
+   eval_gettextln "error: unknown option for 
'stash create': \$option"
+   usage
+   fi
+   break
+   ;;
+   esac
+   shift
+   done
+
+   if test -z "$new_style"
+   then
+   stash_msg="$*"
+   fi
 
git update-index -q --refresh
if no_changes
@@ -265,7 +307,7 @@ push_stash () {
git reflog exists $ref_stash ||
clear_stash || die "$(gettext "Cannot initialize stash")"
 
-   create_stash "$stash_msg" $untracked
+   create_stash -m "$stash_msg" -u "$untracked"
store_stash -m "$stash_msg" -q $w_commit ||
die "$(gettext "Cannot save the current status")"
say "$(eval_gettext "Saved working directory and index state 
\$stash_msg")"
@@ -697,7 +739,7 @@ clear)
;;
 create)
shift
-   create_stash "$*" && echo "$w_commit"
+   create_stash "$@" && echo "$w_commit"
;;
 store)
shift
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 0171b824c9..34e9610bb6 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -784,4 +784,22 @@ test_expect_success 'push -m shows right message' '
test_cmp expect actual
 '
 
+test_expect_success 'deprecated version of stash create stores correct 
message' '
+   >foo &&
+   git add foo &&
+   STASH_ID=$(git stash create "create test message") &&
+   echo "On master: create test message" >expect &&
+   git show --pretty=%s ${STASH_ID} | head -n1 >actual &&
+   test_cmp expect actual
+'
+
+test_expect_success 'new style stash create stores correct message' '
+   >foo &&
+   git add foo &&
+   STASH_ID=$(git stash create -m "create test message new style") &&
+   echo "On master: create test message new style" >expect &&
+   git show --pretty=%s ${STASH_ID} | head -n1 >actual &&
+   test_cmp expect actual
+'
+
 test_done
-- 
2.11.0.297.g9a2118ac0b.dirty



Re: show all merge conflicts

2017-01-29 Thread G. Sylvie Davies
On Sat, Jan 28, 2017 at 6:28 AM, Jeff King  wrote:
> On Fri, Jan 27, 2017 at 09:42:41PM -0800, G. Sylvie Davies wrote:
>
>> Aside from the usual "git log -cc", I think this should work (replace
>> HEAD with whichever commit you are analyzing):
>>
>> git diff --name-only HEAD^2...HEAD^1 > m1
>> git diff --name-only HEAD^1...HEAD^2 > b1
>> git diff --name-only HEAD^1..HEAD> m2
>> git diff --name-only HEAD^2..HEAD> b2
>>
>> If files listed between m1 and b2 differ, then the merge is dirty.
>> Similarly for m2 and b1.
>>
>> More information here:
>>
>> http://stackoverflow.com/questions/27683077/how-do-you-detect-an-evil-merge-in-git/41356308#41356308
>
> I don't think that can reliably find evil merges, since it looks at the
> file level. If you had one hunk resolved for "theirs" and one hunk for
> "ours" in a given file, then the file will be listed in each diff,
> whether it has evil hunks or not.
>

Well, you have to do both.  Do "git show -c" to catch that one
("theirs" for one hunk, "ours" for the other, same file).

And then do that sequence of the 4 "git diff" commands to identify
dirty merges where "theirs" or "ours" was applied to entire files, and
thus not showing up in the "git show -c".

> I don't think this is just about evil merges, though. For instance,
> try:
>
>   seq 1 10 >file
>   git add file
>   git commit -m base
>
>   sed s/4/master/ tmp && mv tmp file
>   git commit -am master
>
>   git checkout -b other HEAD^
>   sed s/4/other/ tmp && mv tmp file
>   git commit -am other
>
>   git merge master
>   git checkout --ours file
>   git commit -am merged
>
>   merge=$(git rev-parse HEAD)
>
> The question is: were there conflicts in $merge, and how were they
> resolved?
>
> That isn't an evil merge, but there's still something interesting to
> show that "git log --cc" won't display.
>
> Replaying the merge like:
>
>   git checkout $merge^1
>   git merge $merge^2
>   git diff -R $merge
>
> shows you the patch to go from the conflict state to the final one.
>

I know the stackoverflow question asks "how to detect evil merges",
and I go along with that in my answer.  But honestly I prefer to call
them dirty rather than evil, and by "dirty" I just mean merges that
did not resolve cleanly via "git merge", and had some form of user
intervention, be it conflict resolution, or other strange things.

The trick I propose with the sequence of 4 "git diff" commands
identifies that merge from your example as dirty:

$ cat b1 m2
file

$ cat b2 m1
file
file

The trick doesn't really tell you much except that the merge is dirty.
If you notice that the "m2" file is empty, I think that's one way to
realize that master's edit was dropped, and therefore "other" won.

Maybe it even merged cleanly but someone did a "git commit --amend" to
make it the merge dirty after the fact.

I do like your approach, it's very simple and reliable.  But in my
situation I'm writing pre-receive hooks for bare repos, so I don't
think I can actually do "git merge"!

I think my suggestion would work for OP, as long as they also run "git
show -c" alongside it.   (And your suggestion would work, too, of
course).



- Sylvie


Important

2017-01-29 Thread toni . noviansah
Hello , 

I have a business proposition for you,kindly email me via my private email for 
more details.

Contact Email : ( irenegeorgia...@hellenicbankcy.com )


Best Regards 
Ms Irena A.Georgiadou


[RFC] Proof of concept: Support multiple authors

2017-01-29 Thread Cornelius Schumacher
This patch is a proof of concept implementation of support for
multiple authors. It adds an optional `authors` header to commits
which is set when there are authors configured in the git config.

A new command `git-authors` is used to manage the authors settings.
Authors are identified by initials and their names and emails are
set in a `.git_authors_map` file.

Signed-off-by: Cornelius Schumacher 
---

When doing pair programming we have to work around the limitation that
git can only have a single author in each commit. There are some tools
which help with that such as [git-duet] [1], but there are still some
limits, because the information about multiple authors is not reflected
in the native git data model.

Here is a proposal how to change that and implement native support for
multiple authors in git. It comes with a patch as a proof of concept.
The patch by no means is finished, it doesn't cover all cases and needs
more tests and error handling. It's meant as an illustration of the
concept.

The basic idea is to introduce a new optional `authors` header in
commits which contains a list of authors. The header is set in each new
commit when there is an entry `authors.current` in the git config listing
the current authors. When this config is not there the behavior falls
back to the current standard behavior.

When the header is there it is treated in the same way as the author
header. It's preserved on merges and similar operations, is displayed in
git show, and used to create a list of `From` addresses in `format-patch`.
Email supports multiple `From` addresses as specified in section 3.6.2 of
RFC 5322.

When multiple authors are configured, they still write the standard author
header to keep backwards compatibility. The first author is used as author
and committer. In the future it might be good to implement something like
automatic rotation of the order of authors to give credit in a fair way.

To make it easier to work with the authors there is a new command
`git-authors`. It sets the list of authors using initials as shortcut for
the full configuration with name and email. The mapping of initials to
names and email addresses is taken from a file `.git_authors_map` in the
home directory of the users. This way it's possible to quickly set a list
of authors by running a command such as `git authors ab cd`. This is
useful when doing pair programming because the people working together
usually switch quite frequently and using the command with the intials is
quicker and less error-prone than editing the configuration with full
names and emails.

The command also supports setting a single author, setting more than two
authors or clearing the configuration for multiple authors to go back to
the standard behavior without the new authors header.

The concept of the command and the mappings file is similar to what
git-duet does, so that it should be familiar to many people doing pair
programming. The behavior of git doesn't change when the new feature is
not used and when it's used it should be backwards compatible so that it
doesn't break existing functionality. This should make a smooth transition
for users who choose to make use of it.

Adding support for multiple authors would make the life of developers doing
pair programming easier. It would be useful in itself, but it would also
need support by other tools around git to use its full potential. This
might take a while, but I think it's worth the effort.

I'm willing to continue to work on this and create a patch which is suitable
for inclusion in git.

What do you think?

[1]: https://github.com/git-duet/git-duet

 .gitignore  |   1 +
 Makefile|   3 +
 authors.c   | 205 
 authors.h   |  29 +++
 builtin.h   |   1 +
 builtin/am.c|  18 -
 builtin/authors.c   |  82 +++
 builtin/commit-tree.c   |   2 +-
 builtin/commit.c|  56 +++--
 builtin/merge.c |   4 +-
 cache.h |   1 +
 commit.c|  17 ++--
 commit.h|   6 +-
 git.c   |   1 +
 ident.c |   2 +-
 mailinfo.c  |  17 
 mailinfo.h  |   2 +
 notes-cache.c   |   2 +-
 notes-utils.c   |   2 +-
 pretty.c|  79 ++-
 t/helper/.gitignore |   1 +
 t/helper/test-authors.c |  42 ++
 t/t9904-authors.sh  |  32 
 23 files changed, 581 insertions(+), 24 deletions(-)
 create mode 100644 authors.c
 create mode 100644 authors.h
 create mode 100644 builtin/authors.c
 create mode 100644 t/helper/test-authors.c
 create mode 100755 t/t9904-authors.sh

diff --git a/.gitignore b/.gitignore
index 6722f78..1323907 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,7 @@
 /git-apply
 /git-archimport
 /git-archive
+/git-authors
 /git-bisect
 /git-bisect--helper
 /git-blame
diff --git a/

Re: [PATCH v2] git-p4: Fix git-p4.mapUser on Windows

2017-01-29 Thread Luke Diamand
On 27 January 2017 at 17:33, Junio C Hamano  wrote:
> George Vanburgh  writes:
>
>> From: George Vanburgh 
>>
>> When running git-p4 on Windows, with multiple git-p4.mapUser entries in
>> git config - no user mappings are applied to the generated repository.
>> ...
>> Using splitlines solves this issue, by splitting config on all
>> typical delimiters ('\n', '\r\n' etc.)
>
> Luke, Lars, this version seems to be in line with the conclusion of
> your earlier reviews, e.g.
>
> 
>
> Even though it looks OK to my eyes, I'll wait for Acks or further
> refinement suggestions from either of you two before acting on this
> patch.

It looks good to me. The tests all pass, and the change looks correct.

Ack.

Luke


>
> Thanks.
>
>> Signed-off-by: George Vanburgh 
>> ---
>>  git-p4.py | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/git-p4.py b/git-p4.py
>> index f427bf6..b66f68b 100755
>> --- a/git-p4.py
>> +++ b/git-p4.py
>> @@ -656,7 +656,7 @@ def gitConfigInt(key):
>>  def gitConfigList(key):
>>  if not _gitConfig.has_key(key):
>>  s = read_pipe(["git", "config", "--get-all", key], 
>> ignore_error=True)
>> -_gitConfig[key] = s.strip().split(os.linesep)
>> +_gitConfig[key] = s.strip().splitlines()
>>  if _gitConfig[key] == ['']:
>>  _gitConfig[key] = []
>>  return _gitConfig[key]
>>
>> --
>> https://github.com/git/git/pull/319


Mrs. Rose Sambou

2017-01-29 Thread rose...@ono.com



--

I am Mrs. Rose Sambou

Please my dear, do not feel embarrassed by my mail to you. I am the
wife of late Dr. Ivan Sambou a prominent business man and pro-human
right activist here in Republic

of Burkina Faso before his untimely death in 2010.

During my late husband's lifetime, he deposited the sum of US$5.7M,
(Five Million seven hundred thousand United states Dollars) in one of
the leading banks here and

informed me about it. We intended to use this fund for charity and
investment purposes for the up keeping/ future of our daughter, Juliet
Sambou who is currently

16years of age. I will be glad to hear from you soon so that I will
send you full details of this project.

Regards,
Mrs. Rose Sambou

--



Re: [PATCH 3/3] stash: support filename argument

2017-01-29 Thread Thomas Gummerer
On 01/23, Junio C Hamano wrote:
> Thomas Gummerer  writes:
> 
> > diff --git a/git-stash.sh b/git-stash.sh
> > index d6b4ae3290..7dcce629bd 100755
> > --- a/git-stash.sh
> > +++ b/git-stash.sh
> > @@ -41,7 +41,7 @@ no_changes () {
> >  untracked_files () {
> > excl_opt=--exclude-standard
> > test "$untracked" = "all" && excl_opt=
> > -   git ls-files -o -z $excl_opt
> > +   git ls-files -o -z $excl_opt -- $1
> 
> Does $1 need to be quoted to prevent it from split at $IFS?

Not sure, I'll check and add a test for the re-roll.

> > @@ -56,6 +56,23 @@ clear_stash () {
> >  }
> >  
> >  create_stash () {
> > +   files=
> > +   while test $# != 0
> > +   do
> > +   case "$1" in
> > +   --)
> > +   shift
> > +   break
> > +   ;;
> > +   --files)
> > +   ;;
> > +   *)
> > +   files="$1 $files"
> > +   ;;
> 
> Hmph.  What is this "no-op" option about?  Did you mean to say
> something like this instead?
> 
>   case "$1" in
>   ...
>   --file)
>   case $# in
>   1)
>   die "--file needs a pathspec" ;;
>   *)
>   shift
>   files="$files$1 " ;;
>   esac
>   ;;
>

Hmm that would require multiple --file arguments to create_stash,
which I wanted to avoid.  But probably the correct solution is to
introduce a new format for create_stash, which allows a -m before the
message, and uses -- to disambiguate before the file name arguments.

This would be similar to what Johannes suggested in [1], deprecating
the old syntax in git stash create.  While this didn't work in git
stash save, it would work in git stash create, as "--" isn't used to
disambiguate anything there yet.

> Another thing I noticed.  We won't support filenames with embedded
> $IFS characters at all?
> 
> I somehow had an impression that the script was carefully done
> (e.g. by using -z option where appropriate) to add such a
> limitation.
> 
> Perhaps we have broken it over time and it no longer matters
> (i.e. there already may be existing breakages), but this troubles
> me somehow.

Good point, I didn't think about $IFS characters.  Fill fix in the
next round.

> By the way, in addition to "push" thing that corrects the argument
> convention by requiring "-m" before the message, we need to correct
> create_stash that is used internally from "stash push" somehow?

Yeah, I think that would make sense, see above.

[1]: http://public-inbox.org/git/alpine.DEB.2.20.1701241148300.3469@virtualbox/


[PATCH] receive-pack: call string_list_clear() unconditionally

2017-01-29 Thread René Scharfe
string_list_clear() handles empty lists just fine, so remove the
redundant check.

Signed-off-by: Rene Scharfe 
---
 builtin/receive-pack.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 6b97cbdbe..1dbb8a069 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1942,8 +1942,7 @@ int cmd_receive_pack(int argc, const char **argv, const 
char *prefix)
run_receive_hook(commands, "post-receive", 1,
 &push_options);
run_update_post_hook(commands);
-   if (push_options.nr)
-   string_list_clear(&push_options, 0);
+   string_list_clear(&push_options, 0);
if (auto_gc) {
const char *argv_gc_auto[] = {
"gc", "--auto", "--quiet", NULL,
-- 
2.11.0



Re: [PATCH 2/3] stash: introduce push verb

2017-01-29 Thread Thomas Gummerer
On 01/23, Junio C Hamano wrote:
> Thomas Gummerer  writes:
> 
> > +   stash_msg="$*"
> > +
> > +   if test -z stash_msg
> 
> A dollar-sign is missing here, I think.

Yes, thanks.

> > +   then
> > +   push_stash $push_options
> > +   else
> > +   push_stash $push_options -m "$stash_msg"
> > +   fi
> > +}

-- 
Thomas