Re: [RFC] Clone repositories recursive with depth 1

2015-11-12 Thread Lars Schneider

On 11 Nov 2015, at 21:09, Stefan Beller  wrote:

> On Wed, Nov 11, 2015 at 11:19 AM, Stefan Beller  wrote:
>> On Wed, Nov 11, 2015 at 6:09 AM, Lars Schneider
>>  wrote:
>>> Hi,
>>> 
>>> I have a clean build machine and I want to clone my source code to this 
>>> machine while transferring only the minimal necessary amount of data. 
>>> Therefore I use this command:
>>> 
>>> git clone --recursive --depth 1 --single-branch 
>> 
>> That *should* work, actually.
>> However looking at the code it does not.
>> 
>> citing from builtin/clone.c:
>> 
>>static struct option builtin_clone_options[] = {
>>...
>>OPT_BOOL(0, "recursive", _recursive,
>>   N_("initialize submodules in the clone")),
>>OPT_BOOL(0, "recurse-submodules", _recursive,
>>  N_("initialize submodules in the clone")),
>>...
>>};
>>...
>>static const char *argv_submodule[] = {
>>"submodule", "update", "--init", "--recursive", NULL
>>};
>> 
>>if (!err && option_recursive)
>>err = run_command_v_opt(argv_submodule, RUN_GIT_CMD);
>> 
>> So the --depth argument is not passed on, although "git submodule update"
>> definitely supports --depth.
>> 
>> In an upcoming series (next version of origin/sb/submodule-parallel-update),
>> this will slightly change, such it will be even easier to add the
>> depth argument in
>> there as we construct the argument list in code instead of hard coding
>> argv_submodule.
>> 
>> This may require some discussion whether you expect --depth to be recursed.
>> (What if you only want a top level shallow thing?, What if you want to have 
>> only
>> submodules shallow? What is the user expectation here?)
>> 
>>> 
>>> Apparently this does not clone the submodules with "--depth 1" (using Git 
>>> 2.4.9). As a workaround I tried:
>>> 
>>> git clone --depth 1 --single-branch 
>>> cd 
>>> git submodule update --init --recursive --depth 1
>>> 
> 
> The workaround works with the origin/master version for me.
> 
> Notice the other email thread, which suggests to include --remote into the
> call to  git submodule update depending on a branch config option being
> present in the .gitmodules file.

Can you check "[PATCH v2] add test to demonstrate that shallow recursive clones 
fail"? This demonstrates the failure that I see. I also tried the "--remote" 
flag but this does not work either (see test case).
Can you confirm this behavior?

Cheers,
Lars--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] add test to demonstrate that shallow recursive clones fail

2015-11-12 Thread larsxschneider
From: Lars Schneider 

"git clone --recursive --depth 1 --single-branch " clones the
submodules successfully. However, it does not obey "--depth 1" for
submodule cloning.

The following workaround does only work if the used submodule pointer
is on the default branch. Otherwise "git submodule update" fails with
"fatal: reference is not a tree:" and "Unable to checkout".
git clone --depth 1 --single-branch 
cd 
git submodule update --init --recursive --depth 1

The workaround does not fail using the "--remote" flag. However, in that
case the wrong commit is checked out.

Signed-off-by: Lars Schneider 
---
 t/t7412-submodule-recursive.sh | 78 ++
 1 file changed, 78 insertions(+)
 create mode 100755 t/t7412-submodule-recursive.sh

diff --git a/t/t7412-submodule-recursive.sh b/t/t7412-submodule-recursive.sh
new file mode 100755
index 000..aaf252b
--- /dev/null
+++ b/t/t7412-submodule-recursive.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+test_description='Test shallow cloning of repos with submodules'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+   git checkout -b master &&
+   echo file >file &&
+   git add file &&
+   test_tick &&
+   git commit -m "master commit 1" &&
+
+   git checkout -b branch &&
+   echo file >branch-file &&
+   git add branch-file &&
+   test_tick &&
+   git commit -m "branch commit 1" &&
+
+   git checkout master &&
+   git clone . repo &&
+   (
+   cd repo &&
+   git checkout master &&
+   git submodule add ../. submodule &&
+   (
+   cd submodule &&
+   git checkout branch
+   ) &&
+   git add submodule &&
+   test_tick &&
+   git commit -m "master commit 2"
+   )
+'
+
+test_expect_failure shallow-clone-recursive '
+   URL="file://$(pwd | sed "s/[[:space:]]/%20/g")/repo" &&
+   echo $URL &&
+   git clone --recursive --depth 1 --single-branch $URL clone-recursive &&
+   (
+   cd "clone-recursive" &&
+   git log --oneline >lines &&
+   test_line_count = 1 lines
+   ) &&
+   (
+   cd "clone-recursive/submodule" &&
+   git log --oneline >lines &&
+   test_line_count = 1 lines
+   )
+'
+
+test_expect_failure shallow-clone-recursive-workaround '
+   URL="file://$(pwd | sed "s/[[:space:]]/%20/g")/repo" &&
+   echo $URL &&
+   git clone --depth 1 --single-branch $URL clone-recursive-workaround &&
+   (
+   cd "clone-recursive-workaround" &&
+   git log --oneline >lines &&
+   test_line_count = 1 lines &&
+   git submodule update --init --recursive --depth 1
+   )
+'
+
+test_expect_failure shallow-clone-recursive-with-remote-workaround '
+   URL="file://$(pwd | sed "s/[[:space:]]/%20/g")/repo" &&
+   echo $URL &&
+   git clone --depth 1 --single-branch $URL 
clone-recursive-remote-workaround &&
+   (
+   cd "clone-recursive-remote-workaround" &&
+   git log --oneline >lines &&
+   test_line_count = 1 lines &&
+   git submodule update --init --remote --recursive --depth 1 &&
+   git status submodule >status &&
+   test_must_fail grep "modified:" status
+   )
+'
+
+test_done
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v1] add test to demonstrate that shallow recursive clones fail

2015-11-12 Thread larsxschneider
From: Lars Schneider 

"git clone --recursive --depth 1 --single-branch " clones the
submodules successfully. However, it does not obey "--depth 1" for
submodule cloning.

The following workaround does only work if the used submodule pointer
is on the default branch. Otherwise "git submodule update" fails with
"fatal: reference is not a tree:" and "Unable to checkout".
git clone --depth 1 --single-branch 
cd 
git submodule update --init --recursive --depth 1

Signed-off-by: Lars Schneider 
---
 t/t7412-submodule-recursive.sh | 64 ++
 1 file changed, 64 insertions(+)
 create mode 100755 t/t7412-submodule-recursive.sh

diff --git a/t/t7412-submodule-recursive.sh b/t/t7412-submodule-recursive.sh
new file mode 100755
index 000..c639f96
--- /dev/null
+++ b/t/t7412-submodule-recursive.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+test_description='Test shallow cloning of repos with submodules'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+   git checkout -b master &&
+   echo file >file &&
+   git add file &&
+   test_tick &&
+   git commit -m "master commit" &&
+
+   git checkout -b branch &&
+   echo file >branch-file &&
+   git add branch-file &&
+   test_tick &&
+   git commit -m "branch commit" &&
+
+   git checkout master &&
+
+   git clone . repo &&
+   (
+   cd repo &&
+   git submodule add ../. submodule &&
+   (
+   cd submodule &&
+   git checkout branch
+   ) &&
+   git add submodule &&
+   test_tick &&
+   git commit -m "submodule"
+   )
+'
+
+test_expect_failure shallow-clone-recursive '
+   URL="file://$(pwd | sed "s/[[:space:]]/%20/g")/repo" &&
+   echo $URL &&
+   git clone --recursive --depth 1 --single-branch $URL clone-recursive &&
+   (
+   cd "clone-recursive" &&
+   git log --oneline >lines &&
+   test_line_count = 1 lines
+   ) &&
+   (
+   cd "clone-recursive/submodule" &&
+   git log --oneline >lines &&
+   test_line_count = 1 lines
+   )
+'
+
+test_expect_failure shallow-clone-recursive-workaround '
+   URL="file://$(pwd | sed "s/[[:space:]]/%20/g")/repo" &&
+   echo $URL &&
+   git clone --depth 1 --single-branch $URL clone-recursive-workaround &&
+   (
+   cd "clone-recursive-workaround" &&
+   git log --oneline >lines &&
+   test_line_count = 1 lines &&
+   git submodule update --init --recursive --depth 1
+   )
+'
+
+test_done
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] add test to demonstrate that shallow recursive clones fail

2015-11-12 Thread Stefan Beller
On Thu, Nov 12, 2015 at 1:37 AM,   wrote:
> From: Lars Schneider 
>
> "git clone --recursive --depth 1 --single-branch " clones the
> submodules successfully. However, it does not obey "--depth 1" for
> submodule cloning.
>
> The following workaround does only work if the used submodule pointer
> is on the default branch. Otherwise "git submodule update" fails with
> "fatal: reference is not a tree:" and "Unable to checkout".
> git clone --depth 1 --single-branch 
> cd 
> git submodule update --init --recursive --depth 1
>
> The workaround does not fail using the "--remote" flag. However, in that
> case the wrong commit is checked out.
>
> Signed-off-by: Lars Schneider 
> ---

Thanks for writing these tests. :)

> +test_expect_failure shallow-clone-recursive-workaround '
> +   URL="file://$(pwd | sed "s/[[:space:]]/%20/g")/repo" &&
> +   echo $URL &&
> +   git clone --depth 1 --single-branch $URL clone-recursive-workaround &&
> +   (
> +   cd "clone-recursive-workaround" &&
> +   git log --oneline >lines &&
> +   test_line_count = 1 lines &&
> +   git submodule update --init --recursive --depth 1

Should we prepend the lines with git submodule update with test_must_fail here?

> +   )
> +'
> +
> +test_expect_failure shallow-clone-recursive-with-remote-workaround '
> +   URL="file://$(pwd | sed "s/[[:space:]]/%20/g")/repo" &&
> +   echo $URL &&
> +   git clone --depth 1 --single-branch $URL 
> clone-recursive-remote-workaround &&
> +   (
> +   cd "clone-recursive-remote-workaround" &&
> +   git log --oneline >lines &&
> +   test_line_count = 1 lines &&
> +   git submodule update --init --remote --recursive --depth 1 &&
> +   git status submodule >status &&
> +   test_must_fail grep "modified:" status

Use ! here instead of test_must_fail.

IIUC we use test_must_fail for git commands (to test that git does
return a non null value instead of segfaulting).
But on the other hand we trust grep to not segfault, so just negating
its output is enough here.

> +   )
> +'
> +
> +test_done
> --
> 2.5.1
>
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] Clone repositories recursive with depth 1

2015-11-12 Thread Stefan Beller
+cc Stanislav, who came up with the other thread for passing --remote
to git submodule

On Thu, Nov 12, 2015 at 1:39 AM, Lars Schneider
 wrote:
>> Notice the other email thread, which suggests to include --remote into the
>> call to  git submodule update depending on a branch config option being
>> present in the .gitmodules file.
>
> Can you check "[PATCH v2] add test to demonstrate that shallow recursive 
> clones fail"? This demonstrates the failure that I see. I also tried the 
> "--remote" flag but this does not work either (see test case).
> Can you confirm this behavior?
>
> Cheers,
> Lars

I can confirm it breaks as expected here.

I may have confused you here by pointing to the --remote option.

(git clone is a bit stupid when it comes to submodule handling.)
All it does currently is this:

if --recurseSubmodules option or --recursive option is given:
run: "git submodule update --init --recursive"

No attention is paid to any other option such as --depth.
That's all I wanted to point out there.

Ideally we want to add:

If there is a branch configured in the .gitmodules file,
we would want to add the --remote command

if we have given other options such as --depth or --reference
we want to pass that along to the called submodule helper.

So I was looking at the internal code structure and think one of the next
series I am going to send will touch the code such that we can incorporate
the conditions as outlined above easier, because it is not hardcoded into an
array ["git", "submodule", "update" "--init", "--recursive"], as I
want to add yet
another dynamic option to the submodule helper invocation. (I want to add
--jobs  there)

Cheers,
Stefan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Draft of Git Rev News edition 8

2015-11-12 Thread Eric Sunshine
On Sun, Oct 11, 2015 at 5:56 AM, Christian Couder
 wrote:
> On Sun, Oct 11, 2015 at 1:45 AM, Eric Sunshine  
> wrote:
>> On Sat, Oct 10, 2015 at 7:36 PM, Christian Couder
>>  wrote:
>>> A draft of Git Rev News edition 8 is available here:
>>> https://github.com/git/git.github.io/blob/master/rev_news/drafts/edition-8.md
>>
>> Does Karsten's comprehensive post[1] about nanosecond-related racy
>> detection problems merit mention?
>
> Yeah, probably, would you like to write something which can be very
> short, about it.

Thanks for picking up the slack here and writing about Karsten in
edition 9. My git time has been somewhat sparse of late, and this task
kept slipping farther and farther down the list.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Request: git stash create --include-untracked

2015-11-12 Thread Gioele Barabucci

Hello,

`git stash create` does not accepts the same options that `git stash 
save` accepts.


It would be handy to have `git stash create` accept 
`-u`/`--include-untracked` and `-a`/`--all`. This would allow a very 
simple "freeze-the-world-I-have-to-leave emergency backup" command such as


git push -f origin $(git stash create 
-u):refs/heads/emergency/$USER-$(date +%s)


(Derived from  by user nybble41; 
useful for .)


Regards,

--
Gioele Barabucci 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] http: fix some printf format warnings on 32-bit builds

2015-11-12 Thread Ramsay Jones


On 12/11/15 05:27, Torsten Bögershausen wrote:
>>Ah. OK, so %ld for long and %lld for long long, I suppose.
> Only if you have a system that's support it.
> 
> Linux does, Windows not.

Sure, but I was speculating specifically about Eric's mac (which I
have no experience with).

> 
>> Hmm, not that it matters, but I wonder what the PRId64 macro is. ;-)
> It's "I64d" for Windows, and "lld" for all Gnu based systems and others,

[On Gnu systems, I believe it is %lld on 32-bit and %ld on 64-bit.]

Again, I was commenting on Eric's mac, which _seems_ to allow
the use of both %ld and %lld when printing 64-bit integers, so
which does it choose for PRId64 ...

> 
> When you do printf("%lld %ld", long_long_var, long_var),
> the "printf runtime" under Windows will treat "%lld" as "%ld", and print
> the lower part of long_long_var.
> And will not pull a long long from stack, but a long, resulting i all kinds 
> of confusion
> 
> So whenever a long long is printed, I can warmly recommend to use
> 
> PRId64

Indeed.

ATB,
Ramsay Jones


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fw: [git-users] git fsck error - duplicate file entries - different then existing stackoverflow scenarios

2015-11-12 Thread Konstantin Khomoutov
A user recently asked an interesting question on the git-users list.
I think it warrants attentions of a specialists more hard-core than
we're there over at git-users.

So I'd like to solicit help if those knowledgeable, if possible.

Begin forwarded message:

Date: Wed, 11 Nov 2015 14:30:40 -0800 (PST)
From: Wind Over Water 
To: Git for human beings 
Subject: [git-users] git fsck error - duplicate file entries -
different then existing stackoverflow scenarios


Hi all,

I have a repo that is giving a 'git fsck --full' error that seems to be 
different from the existing questions and answers on stackoverflow on
this topic.  For example, in our fsck error it is not obvious which
file is actually duplicated and how/where.  And there is no commit sha
involved - apparently only blob and tree sha's.  But then finding good
documentation on this is challenging.

Might anyone have a pointer as to what to read to help figure out a 
solution/fix to the below?  Or know of a solution outright?

Thanks much in advance!

-sandy

$ git fsck --full

Checking object directories: 100% (256/256), done.

error in tree df79068051fa8702eae7e91635cca7eee1339002: contains
duplicate file entries

error in tree c2d09540a3c3f44c42be1dc8a2b0afa73a35f861: contains
duplicate file entries

Checking objects: 100% (623704/623704), done.

Checking connectivity: 623532, done.

dangling commit 4d1402c8c74c9f4de6172d7dbd5a14c41683c9e8


$ git ls-tree df79068051fa8702eae7e91635cca7eee1339002

100644 blob 14d6d1a6a2f4a7db4e410583c2893d24cb587766 build.gradle

12 blob cd70e37500a35663957cf60f011f81703be5d032 msrc

04 tree 658c892e15fbe0d3ea6b8490d9d54c5f2e658fc9 msrc

100644 blob f623819c94a08252298220871ac0ba1118372e59 pom.xml

100644 blob 9223cc2fddb138f691312c1ea2656b9dc17612d2 settings.gradle

04 tree c3bac1d92722bdee9588a27747b164baa275201f src


$ git ls-tree c2d09540a3c3f44c42be1dc8a2b0afa73a35f861

100644 blob 14d6d1a6a2f4a7db4e410583c2893d24cb587766 build.gradle

12 blob cd70e37500a35663957cf60f011f81703be5d032 msrc

04 tree 658c892e15fbe0d3ea6b8490d9d54c5f2e658fc9 msrc

100644 blob f623819c94a08252298220871ac0ba1118372e59 pom.xml

100644 blob 9223cc2fddb138f691312c1ea2656b9dc17612d2 settings.gradle

04 tree a5aa6758a25fee779cbb8c9717d744297071ea79 src


$ git show cd70e37500a35663957cf60f011f81703be5d032

src/main/java/com/foo/bar/baz/common/


$ git show 658c892e15fbe0d3ea6b8490d9d54c5f2e658fc9

tree 658c892e15fbe0d3ea6b8490d9d54c5f2e658fc9


BillingAggregator.java

BillingDataThriftAdapter.java

[...]

MetricsProcessor.java
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] contrib/subtree: unwrap tag refs

2015-11-12 Thread David A. Greene
Rob Mayoff  writes:

> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
> index 9f06571..b051600 100755
> --- a/contrib/subtree/git-subtree.sh
> +++ b/contrib/subtree/git-subtree.sh
> @@ -245,7 +245,10 @@ find_latest_squash()
>   case "$a" in
>   START) sq="$b" ;;
>   git-subtree-mainline:) main="$b" ;;
> - git-subtree-split:) sub="$b" ;;
> + git-subtree-split:)
> + sub="$b"

Why include the above line?

> + sub="$(git rev-parse "$b^0")" || die "could not 
> rev-parse split hash $b from commit $sq"

This seems like odd quoting.  Would not this do the same?

sub="$(git rev-parse $b^0)" || die "could not 
rev-parse split hash $b from commit $sq"

Perhaps I am missing something.

> + ;;
>   END)
>   if [ -n "$sub" ]; then
>   if [ -n "$main" ]; then
> @@ -278,7 +281,10 @@ find_existing_splits()
>   case "$a" in
>   START) sq="$b" ;;
>   git-subtree-mainline:) main="$b" ;;
> - git-subtree-split:) sub="$b" ;;
> + git-subtree-split:)
> + sub="$b"

And here too.

> + sub="$(git rev-parse "$b^0")" || die "could not 
> rev-parse split hash $b from commit $sq"

Same as above.

-David
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] rebase-i-exec: Allow space in SHELL_PATH

2015-11-12 Thread Fredrik Medley
On Windows, when Git is installed under "C:\Program Files\Git", SHELL_PATH
will include a space. Fix "git rebase --interactive --exec" so that it
works with spaces in SHELL_PATH.

Signed-off-by: Fredrik Medley 
---
 git-rebase--interactive.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 30edb17..b938a6d 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -610,7 +610,7 @@ do_next () {
read -r command rest < "$todo"
mark_action_done
printf 'Executing: %s\n' "$rest"
-   ${SHELL:-@SHELL_PATH@} -c "$rest" # Actual execution
+   "${SHELL:-@SHELL_PATH@}" -c "$rest" # Actual execution
status=$?
# Run in subshell because require_clean_work_tree can die.
dirty=f
-- 
2.6.2.468.gf34be46.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Fw: [git-users] git fsck error - duplicate file entries - different then existing stackoverflow scenarios

2015-11-12 Thread Jeff King
On Thu, Nov 12, 2015 at 02:02:10PM +0300, Konstantin Khomoutov wrote:

> A user recently asked an interesting question on the git-users list.
> I think it warrants attentions of a specialists more hard-core than
> we're there over at git-users.
> 
> So I'd like to solicit help if those knowledgeable, if possible.

Thanks. Curating user questions and forwarding the hard ones here is
appreciated.

> I have a repo that is giving a 'git fsck --full' error that seems to be 
> different from the existing questions and answers on stackoverflow on
> this topic.  For example, in our fsck error it is not obvious which
> file is actually duplicated and how/where.  And there is no commit sha
> involved - apparently only blob and tree sha's.  But then finding good
> documentation on this is challenging.

Yes, fsck does not traverse the graph in order. So it sees a problem
with a particular tree, but cannot know where that tree is within the
whole project tree, or which commits reference it. In fact, an arbitrary
number of commits might reference it.

The most useful thing is sometimes to ask which commit introduced the
tree (which can _also_ have multiple answers, but usually just one). You
can do that by walking the history, like this:

  tree=df79068051fa8702eae7e91635cca7eee1339002
  git log --all --format=raw --raw -t --no-abbrev | less +/$tree

That will visit each commit. The options are:

  - we visit commits reachable from all branches and tags (--all)

  - we include the sha1 of the root tree (due to --format=raw)

  - adding --raw shows the raw diff, which includes the sha1 of each
file touched by the commit

  - using "-t" includes the raw diff for trees, rather than just blobs

  - using "--no-abbrev" gives full 40-hex sha1s

And then "less +/$tree" will open the pager and immediately jump to the
first instance of the sha1 in question.

But of course that doesn't tell you how to fix it. It might tell you how
the bogus object came about (and it is a bogus object; a bug-free git
implementation should _never_ produce a tree with duplicate entries.
AFAIK we have never had such a bug in Git itself, but I have
occasionally come across problematic entries that I suspect were created
with very old versions of JGit).

> error in tree df79068051fa8702eae7e91635cca7eee1339002: contains
> duplicate file entries
> [...]
> $ git ls-tree df79068051fa8702eae7e91635cca7eee1339002
> 
> 100644 blob 14d6d1a6a2f4a7db4e410583c2893d24cb587766 build.gradle
> 
> 12 blob cd70e37500a35663957cf60f011f81703be5d032 msrc
> 
> 04 tree 658c892e15fbe0d3ea6b8490d9d54c5f2e658fc9 msrc
> 
> 100644 blob f623819c94a08252298220871ac0ba1118372e59 pom.xml
> 
> 100644 blob 9223cc2fddb138f691312c1ea2656b9dc17612d2 settings.gradle
> 
> 04 tree c3bac1d92722bdee9588a27747b164baa275201f src

Looks like "msrc" is your duplicate entry (even though the sha1s of the
sub-entries are different, the tree cannot have two entries with the
same name). You can use the "log" trick above to find the full path to it.

The fact that one is a symlink (mode 12) and one is a tree means
that whatever git implementation created this presumably has a bug
related to symlinks.

The only way to fix it is to rewrite the history mentioning the tree
(because once the tree is fixed, it will get a new sha1, and then any
commit referencing it will get a new sha1, and commits built on that,
and so forth).

You can use "git filter-branch" to do so. There is a sample command
here:

  
http://stackoverflow.com/questions/32577974/duplicate-file-error-while-pushing-mirror-into-git-repository/

that just rewrites each tree via a round-trip to the index (so it's not
clear which of the duplicate entries it will discard). You could also
write a more clever index-filter snippet to use git-update-index to
insert the entry you want.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Replicating the default "git log" format with a format string.

2015-11-12 Thread Jeff King
On Thu, Nov 12, 2015 at 12:55:53AM +, Kannan Goundan wrote:

> For our workflow, author dates aren't very useful.  I'm looking for a way to
> configure Git so that "git log" shows commit dates instead of author dates.
>  "--pretty=fuller" gets me almost what I want, but I'd like to avoid the
> extra two lines if possible.
> 
> I tried achieving this by putting a custom format string in ~/.gitconfig:
> 
> [format]
>   pretty = "%C(auto,yellow)commit %C(auto)%H\nAuthor: %an <%ae>\nDate:  
> %cd\n\n%w(0,4,4)%B"
> 
> This works pretty well, but has a few corner cases.  When you do "git log
> --decorate", the default format decorates commits with ref names.  I can add
> "%d" to my format string, but then the ref names show up all the time, even
> without "--decorate".
> 
> The "--walk-reflogs" option presents a similar problem.  The %g*
> placeholders all become empty strings when "--walk-reflogs" isn't present,
> which is sort of what I want, but it leaves extra blank lines in the output.
> 
> Is it possible to exactly replicate the default "git log" format with a
> format string?

Sadly, no, I don't think it is possible with the current format
specifiers. It would be nice if it was, though.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Documentation: make formatting more consistent

2015-11-12 Thread Jeff King
On Wed, Nov 11, 2015 at 04:41:06PM -0500, Jeff King wrote:

> I know we've discussed this particular spot before, and I think there
> may have been some disagreement about which style was the best. But
> since clearly no patch came out of the last discussion, and since
> an inconsistent set of styles is probably worse than consistent use of
> any of the choices, this makes sense to me as an incremental step.
> 
> If we want to move to all-backticks (for example) later on, we can
> easily do so (or we can leave this as the final state).

Andrey helpfully dug up that thread off-list:

  http://thread.gmane.org/gmane.comp.version-control.git/267990/

If we want to move to backticks, we probably want to also turn on
MAN_BOLD_LITERAL by default, or it's a step backwards for some folks.

As I was the person who suggested backticks back in that thread, and I
do not want to spend the time myself on figuring out if MAN_BOLD_LITERAL
is safe to use everywhere, I somewhat retract my suggestion.

I've queued this patch as-is for now, but I'd be happy to hear other
opinions, or if people want to dig into the MAN_BOLD_LITERAL thing.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] allow hooks to ignore their standard input stream

2015-11-12 Thread Jeff King
On Wed, Nov 11, 2015 at 03:42:22PM +0100, Clemens Buchacher wrote:

> On Wed, Nov 11, 2015 at 03:39:20PM +0100, Clemens Buchacher wrote:
> > +   if (write_in_full(proc.in, buf.buf, buf.len) < 0) {
> > +   /* We do not mind if a hook does not read all refs. */
> > +   if (errno != EPIPE)
> > +   ret = -1;
> 
> I can reproduce the pipe error reliably with the test below. I did not
> include it in the patch since I am in doubt if we should add an optional
> sleep to the code.

Yeah, we definitely do not want to do so. The reliable way to get a
SIGPIPE is:

  1. Have one process write more than a pipe buffer's worth of data.

  2. Have the other process exit without reading anything.

Then even if the writer process goes first, it will block, and
eventually get EPIPE when the other side closes the descriptor.

Unfortunately, the pipe buffer size varies from system to system. It's
128K by default on modern Linux platforms. Using that is probably
enough. The worst case is that the system has a larger buffer, and the
test will succeed even without the fix. But that is OK as long as
somebody somewhere is running the test with a smaller buffer and would
catch a regression.

Of course, convincing git to generate 128K worth of hook input is often
quite inefficient. The existing test in t5571 is quite painful because
it calls "git branch" in a loop. We can do much better than that.
The test below reliably fails without your patch and passes with it, and
seems to run reasonably quickly for me:

diff --git a/t/t5571-pre-push-hook.sh b/t/t5571-pre-push-hook.sh
index 6f9916a..61df2f9 100755
--- a/t/t5571-pre-push-hook.sh
+++ b/t/t5571-pre-push-hook.sh
@@ -109,23 +109,28 @@ test_expect_success 'push to URL' '
diff expected actual
 '
 
-# Test that filling pipe buffers doesn't cause failure
-# Too slow to leave enabled for general use
-if false
-then
-   printf 'parent1\nrepo1\n' >expected
-   nr=1000
-   while test $nr -lt 2000
-   do
-   nr=$(( $nr + 1 ))
-   git branch b/$nr $COMMIT3
-   echo "refs/heads/b/$nr $COMMIT3 refs/heads/b/$nr $_z40" 
>>expected
-   done
-
-   test_expect_success 'push many refs' '
-   git push parent1 "refs/heads/b/*:refs/heads/b/*" &&
-   diff expected actual
-   '
-fi
+test_expect_success 'set up many-ref tests' '
+   {
+   echo >&3 parent1 &&
+   echo >&3 repo1 &&
+   nr=1000
+   while test $nr -lt 2000
+   do
+   nr=$(( $nr + 1 ))
+   echo "create refs/heads/b/$nr $COMMIT3"
+   echo >&3 "refs/heads/b/$nr $COMMIT3 refs/heads/b/$nr 
$_z40"
+   done
+   } 3>expected | git update-ref --stdin
+'
+
+test_expect_success 'filling pipe buffer does not cause failure' '
+   git push parent1 "refs/heads/b/*:refs/heads/b/*" &&
+   test_cmp expected actual
+'
+
+test_expect_success 'sigpipe does not cause pre-push hook failure' '
+   echo "exit 0" | write_script "$HOOK" &&
+   git push parent1 "refs/heads/b/*:refs/heads/c/*"
+'
 
 test_done
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] allow hooks to ignore their standard input stream

2015-11-12 Thread Jeff King
On Wed, Nov 11, 2015 at 03:39:20PM +0100, Clemens Buchacher wrote:

> Since ec7dbd145 (receive-pack: allow hooks to ignore its standard input
> stream) the pre-receive and post-receive hooks ignore SIGPIPE. Do the
> same for the remaining hooks pre-push and post-rewrite, which read from
> standard input. The same arguments for ignoring SIGPIPE apply.

The reasoning and the patch itself look good to me. I posted some
thoughts on tests in response to your other message.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] rebase-i-exec: Allow space in SHELL_PATH

2015-11-12 Thread Jeff King
On Fri, Nov 13, 2015 at 07:03:19AM +0100, Fredrik Medley wrote:

> On Windows, when Git is installed under "C:\Program Files\Git", SHELL_PATH
> will include a space. Fix "git rebase --interactive --exec" so that it
> works with spaces in SHELL_PATH.
> 
> Signed-off-by: Fredrik Medley 
> ---
>  git-rebase--interactive.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 30edb17..b938a6d 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -610,7 +610,7 @@ do_next () {
>   read -r command rest < "$todo"
>   mark_action_done
>   printf 'Executing: %s\n' "$rest"
> - ${SHELL:-@SHELL_PATH@} -c "$rest" # Actual execution
> + "${SHELL:-@SHELL_PATH@}" -c "$rest" # Actual execution

I think this is the right thing to do (at least I could not think of a
case that would be harmed by it, and it certainly fixes your case). It
looks like filter-branch would need a similar fix?

I think this still isn't resilient to weird meta-characters in the
@SHELL_PATH@, but as this is a build-time option, I think it's OK to let
people who do

  make SHELL_PATH='}"; rm -rf /'

hang themselves.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


GitGui: get rid of information popup window

2015-11-12 Thread Francis ANDRE

Hi Git people

This popup  saying that "No difference has been detected" is little bit 
boring and useless since it states that an automatic resync will be 
started and there is no way to stop the resync.


Can GitGui remove this popup?

Thanks


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/7] contrib/subtree: Testsuite cleanup

2015-11-12 Thread Jeff King
On Thu, Nov 12, 2015 at 08:32:29PM -0600, David Greene wrote:

> Sending again with a proper From: address after rebasing on latest master.
> 
> Copying the maintainers because the origin patchset didn't get any
> comments and I'm unsure of how to proceed.

That's because Junio is on vacation and I am just slow (I'm filling in
for the next few weeks, but I haven't pushed out any updates yet). :)

> These are some old changes I have lying around that should get applied
> to clean up git-subtree's testbase.  With these changes post-mortem
> analysis is much easier and adding new tests can be done in an orderly
> fashion.

OK. Since these are all in a contrib subdir, and since AFAIK you are the
last person who volunteered to be the subsystem maintainer, I am happy
to pick them up if you think they're good.

I'll queue what's here for now, but review from interested parties is
welcome.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] contrib/subtree: unwrap tag refs

2015-11-12 Thread Rob Mayoff
From: Rob Mayoff 

If a subtree was added using a tag ref, the tag ref is stored in
the subtree commit message instead of the underlying commit's ref.
To split or push subsequent changes to the subtree, the subtree
command needs to unwrap the tag ref.  This patch makes it do so.

The problem was described in a message to the mailing list from
Junio C Hamano dated 29 Apr 2014, with the subject "Re: git subtree
issue in more recent versions". The archived message can be found
at .

Signed-off-by: Rob Mayoff 
---
 contrib/subtree/git-subtree.sh | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 9f06571..b051600 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -245,7 +245,10 @@ find_latest_squash()
case "$a" in
START) sq="$b" ;;
git-subtree-mainline:) main="$b" ;;
-   git-subtree-split:) sub="$b" ;;
+   git-subtree-split:)
+   sub="$b"
+   sub="$(git rev-parse "$b^0")" || die "could not 
rev-parse split hash $b from commit $sq"
+   ;;
END)
if [ -n "$sub" ]; then
if [ -n "$main" ]; then
@@ -278,7 +281,10 @@ find_existing_splits()
case "$a" in
START) sq="$b" ;;
git-subtree-mainline:) main="$b" ;;
-   git-subtree-split:) sub="$b" ;;
+   git-subtree-split:)
+   sub="$b"
+   sub="$(git rev-parse "$b^0")" || die "could not 
rev-parse split hash $b from commit $sq"
+   ;;
END)
debug "  Main is: '$main'"
if [ -z "$main" -a -n "$sub" ]; then
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] contrib/subtree: unwrap tag refs

2015-11-12 Thread Jeff King
On Thu, Nov 12, 2015 at 10:36:16PM -0600, David A. Greene wrote:

> > +   sub="$(git rev-parse "$b^0")" || die "could not 
> > rev-parse split hash $b from commit $sq"
> 
> This seems like odd quoting.  Would not this do the same?
> 
>   sub="$(git rev-parse $b^0)" || die "could not 
> rev-parse split hash $b from commit $sq"
> 
> Perhaps I am missing something.

The former is quoting "$b" against whitespace splitting in the
sub-command. Given that the value just came from a "read" call, I think
by definition it cannot contains IFS. Still, quoting here is a good
habit.

It is actually the _outer_ quotes that are unnecessary, as variable
assignment does not do extra splitting. So:

  foo=$(echo one two)

will put the full "one two" into $foo. But the quotes do not hurt
anything, and it is a reasonable style to use them to avoid this
discussion. :)

It also matches style-wise with nearby assignments, like:

  main="$b"

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] add test to demonstrate that shallow recursive clones fail

2015-11-12 Thread Jeff King
On Thu, Nov 12, 2015 at 10:37:41AM +0100, larsxschnei...@gmail.com wrote:

> From: Lars Schneider 
> 
> "git clone --recursive --depth 1 --single-branch " clones the
> submodules successfully. However, it does not obey "--depth 1" for
> submodule cloning.
> 
> The following workaround does only work if the used submodule pointer
> is on the default branch. Otherwise "git submodule update" fails with
> "fatal: reference is not a tree:" and "Unable to checkout".
> git clone --depth 1 --single-branch 
> cd 
> git submodule update --init --recursive --depth 1
> 
> The workaround does not fail using the "--remote" flag. However, in that
> case the wrong commit is checked out.

Hrm. Do we want to make these workarounds work correctly? Or is the
final solution going to be that the first command you gave simply works,
and no workarounds are needed.  If the latter, I wonder if we want to be
adding tests for the workarounds in the first place.

I'm not clear on the expected endgame.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/7] contrib/subtree: Handle '--prefix' argument with a slash appended

2015-11-12 Thread David Greene
From: Techlive Zheng 

'git subtree merge' will fail if the argument of '--prefix' has a slash
appended.

Signed-off-by: Techlive Zheng 
Signed-off-by: David A. Greene 
---
 contrib/subtree/git-subtree.sh |  2 +-
 contrib/subtree/t/t7900-subtree.sh | 20 
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 308b777..edf36f8 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -90,7 +90,7 @@ while [ $# -gt 0 ]; do
--annotate) annotate="$1"; shift ;;
--no-annotate) annotate= ;;
-b) branch="$1"; shift ;;
-   -P) prefix="$1"; shift ;;
+   -P) prefix="${1%/}"; shift ;;
-m) message="$1"; shift ;;
--no-prefix) prefix= ;;
--onto) onto="$1"; shift ;;
diff --git a/contrib/subtree/t/t7900-subtree.sh 
b/contrib/subtree/t/t7900-subtree.sh
index 2683d7d..751aee3 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -257,6 +257,26 @@ test_expect_success 'merge the added subproj again, should 
do nothing' '
)
 '
 
+next_test
+test_expect_success 'merge new subproj history into subdir/ with a slash 
appended to the argument of --prefix' '
+   test_create_repo "$test_count" &&
+   test_create_repo "$test_count/subproj" &&
+   test_create_commit "$test_count" main1 &&
+   test_create_commit "$test_count/subproj" sub1 &&
+   (
+   cd "$test_count" &&
+   git fetch ./subproj master &&
+   git subtree add --prefix=subdir/ FETCH_HEAD
+   ) &&
+   test_create_commit "$test_count/subproj" sub2 &&
+   (
+   cd "$test_count" &&
+   git fetch ./subproj master &&
+   git subtree merge --prefix=subdir/ FETCH_HEAD &&
+   check_equal "$(last_commit_message)" "Merge commit '\''$(git 
rev-parse FETCH_HEAD)'\''"
+   )
+'
+
 #
 # Tests for 'git subtree split'
 #
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/7] contrib/subtree: Make each test self-contained

2015-11-12 Thread David Greene
From: Techlive Zheng 

Each test runs a full repository creation and any subtree actions
needed to perform the test.  Each test starts with a clean slate,
making debugging and post-mortem analysis much easier.

Signed-off-by: Techlive Zheng 
Signed-off-by: David A. Greene 
---
 contrib/subtree/t/t7900-subtree.sh | 1258 
 1 file changed, 840 insertions(+), 418 deletions(-)

diff --git a/contrib/subtree/t/t7900-subtree.sh 
b/contrib/subtree/t/t7900-subtree.sh
index 6250194..2683d7d 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -14,6 +14,15 @@ export TEST_DIRECTORY
 
 . ../../../t/test-lib.sh
 
+subtree_test_create_repo()
+{
+   test_create_repo "$1"
+   (
+   cd $1
+   git config log.date relative
+   )
+}
+
 create()
 {
echo "$1" >"$1"
@@ -61,515 +70,928 @@ join_commits()
echo "$commit $all"
 }
 
+test_create_commit() (
+   repo=$1
+   commit=$2
+   cd "$repo"
+   mkdir -p $(dirname "$commit") \
+   || error "Could not create directory for commit"
+   echo "$commit" >"$commit"
+   git add "$commit" || error "Could not add commit"
+   git commit -m "$commit" || error "Could not commit"
+)
+
 last_commit_message()
 {
git log --pretty=format:%s -1
 }
 
-test_expect_success 'init subproj' '
-   test_create_repo "sub proj"
-'
-
-# To the subproject!
-cd ./"sub proj"
-
-test_expect_success 'add sub1' '
-   create sub1 &&
-   git commit -m "sub1" &&
-   git branch sub1 &&
-   git branch -m master subproj
-'
-
-# Save this hash for testing later.
-
-subdir_hash=$(git rev-parse HEAD)
-
-test_expect_success 'add sub2' '
-   create sub2 &&
-   git commit -m "sub2" &&
-   git branch sub2
-'
-
-test_expect_success 'add sub3' '
-   create sub3 &&
-   git commit -m "sub3" &&
-   git branch sub3
-'
-
-# Back to mainline
-cd ..
-
-test_expect_success 'enable log.date=relative to catch errors' '
-   git config log.date relative
-'
-
-test_expect_success 'add main4' '
-   create main4 &&
-   git commit -m "main4" &&
-   git branch -m master mainline &&
-   git branch subdir
-'
-
-test_expect_success 'fetch subproj history' '
-   git fetch ./"sub proj" sub1 &&
-   git branch sub1 FETCH_HEAD
-'
-
-test_expect_success 'no subtree exists in main tree' '
-   test_must_fail git subtree merge --prefix="sub dir" sub1
-'
+subtree_test_count=0
+next_test() {
+   subtree_test_count=$(($subtree_test_count+1))
+}
 
-test_expect_success 'no pull from non-existant subtree' '
-   test_must_fail git subtree pull --prefix="sub dir" ./"sub proj" sub1
-'
+#
+# Tests for 'git subtree add'
+#
 
+next_test
 test_expect_success 'no merge from non-existent subtree' '
-   test_must_fail git subtree merge --prefix="sub dir" FETCH_HEAD
+   subtree_test_create_repo "$subtree_test_count" &&
+   subtree_test_create_repo "$subtree_test_count/sub proj" &&
+   test_create_commit "$subtree_test_count" main1 &&
+   test_create_commit "$subtree_test_count/sub proj" sub1 &&
+   (
+   cd "$subtree_test_count" &&
+   git fetch ./"sub proj" master &&
+   test_must_fail git subtree merge --prefix="sub dir" FETCH_HEAD
+   )
 '
 
-test_expect_success 'add subproj as subtree into sub dir/ with --prefix' '
-   git subtree add --prefix="sub dir" sub1 &&
-   check_equal "$(last_commit_message)" "Add '\''sub dir/'\'' from commit 
'\''$(git rev-parse sub1)'\''" &&
-   undo
-'
+next_test
+test_expect_success 'no pull from non-existent subtree' '
+   subtree_test_create_repo "$subtree_test_count" &&
+   subtree_test_create_repo "$subtree_test_count/sub proj" &&
+   test_create_commit "$subtree_test_count" main1 &&
+   test_create_commit "$subtree_test_count/sub proj" sub1 &&
+   (
+   cd "$subtree_test_count" &&
+   git fetch ./"sub proj" master &&
+   test_must_fail git subtree pull --prefix="sub dir" ./"sub proj" 
master
+   )'
 
-test_expect_success 'check if --message works for add' '
-   git subtree add --prefix="sub dir" --message="Added subproject" sub1 &&
-   check_equal ''"$(last_commit_message)"'' "Added subproject" &&
-   undo
+next_test
+test_expect_success 'add subproj as subtree into sub dir/ with --prefix' '
+   subtree_test_create_repo "$subtree_test_count" &&
+   subtree_test_create_repo "$subtree_test_count/sub proj" &&
+   test_create_commit "$subtree_test_count" main1 &&
+   test_create_commit "$subtree_test_count/sub proj" sub1 &&
+   (
+   cd "$subtree_test_count" &&
+   git fetch ./"sub proj" master &&
+   git subtree add --prefix="sub dir" FETCH_HEAD &&
+   check_equal "$(last_commit_message)" "Add '\''sub dir/'\'' 

[PATCH 4/7] contrib/subtree: Add merge tests

2015-11-12 Thread David Greene
From: Techlive Zheng 

Add some tests for various merge operations.  Test combinations of merge
with --message, --prefix and --squash.

Signed-off-by: Techlive Zheng 
Signed-off-by: David A. Greene 
---
 contrib/subtree/t/t7900-subtree.sh | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/contrib/subtree/t/t7900-subtree.sh 
b/contrib/subtree/t/t7900-subtree.sh
index 1fa5991..7d59a1a 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -210,11 +210,22 @@ test_expect_success 'check if --message for merge works 
with squash too' '
 
 test_expect_success 'merge new subproj history into subdir' '
git subtree merge --prefix="sub dir" FETCH_HEAD &&
-   git branch pre-split &&
check_equal ''"$(last_commit_message)"'' "Merge commit '"'"'"$(git 
rev-parse sub2)"'"'"' into mainline" &&
undo
 '
 
+test_expect_success 'merge new subproj history into subdir/ with --prefix and 
--message' '
+   git subtree merge --prefix="sub dir" --message="Merged changes from 
subproject" FETCH_HEAD &&
+   check_equal "$(last_commit_message)" "Merged changes from subproject" &&
+   undo
+'
+
+test_expect_success 'merge new subproj history into subdir/ with --squash and 
--prefix and --message' '
+   git subtree merge --prefix="sub dir" --message="Merged changes from 
subproject using squash" --squash FETCH_HEAD &&
+   check_equal "$(last_commit_message)" "Merged changes from subproject 
using squash" &&
+   undo
+'
+
 test_expect_success 'split requires option --prefix' '
echo "You must provide the --prefix option." > expected &&
test_must_fail git subtree split > actual 2>&1 &&
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/7] contrib/subtree: Add tests for subtree add

2015-11-12 Thread David Greene
From: Techlive Zheng 

Add some tests to check various options to subtree add.  These test
various combinations of --message, --prefix and --squash.

Signed-off-by: Techlive Zheng 
Signed-off-by: David A. Greene 
---
 contrib/subtree/t/t7900-subtree.sh | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/contrib/subtree/t/t7900-subtree.sh 
b/contrib/subtree/t/t7900-subtree.sh
index 4471786..1fa5991 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -127,12 +127,24 @@ test_expect_success 'no merge from non-existent subtree' '
test_must_fail git subtree merge --prefix="sub dir" FETCH_HEAD
 '
 
+test_expect_success 'add subproj as subtree into sub dir/ with --prefix' '
+   git subtree add --prefix="sub dir" sub1 &&
+   check_equal "$(last_commit_message)" "Add '\''sub dir/'\'' from commit 
'\''$(git rev-parse sub1)'\''" &&
+   undo
+'
+
 test_expect_success 'check if --message works for add' '
git subtree add --prefix="sub dir" --message="Added subproject" sub1 &&
check_equal ''"$(last_commit_message)"'' "Added subproject" &&
undo
 '
 
+test_expect_success 'add subproj as subtree into sub dir/ with --prefix and 
--message' '
+   git subtree add --prefix="sub dir" --message="Added subproject" sub1 &&
+   check_equal "$(last_commit_message)" "Added subproject" &&
+   undo
+'
+
 test_expect_success 'check if --message works as -m and --prefix as -P' '
git subtree add -P "sub dir" -m "Added subproject using git subtree" 
sub1 &&
check_equal ''"$(last_commit_message)"'' "Added subproject using git 
subtree" &&
@@ -145,6 +157,13 @@ test_expect_success 'check if --message works with squash 
too' '
undo
 '
 
+test_expect_success 'add subproj as subtree into sub dir/ with --squash and 
--prefix and --message' '
+   git subtree add --prefix="sub dir" --message="Added subproject with 
squash" --squash sub1 &&
+   check_equal "$(last_commit_message)" "Added subproject with squash" &&
+   undo
+'
+
+# Maybe delete
 test_expect_success 'add subproj to mainline' '
git subtree add --prefix="sub dir"/ FETCH_HEAD &&
check_equal ''"$(last_commit_message)"'' "Add '"'sub dir/'"' from 
commit '"'"'''"$(git rev-parse sub1)"'''"'"'"
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/7] contrib/subtree: Clean and refactor test code

2015-11-12 Thread David Greene
From: Techlive Zheng 

Mostly prepare for the later tests refactoring.  This moves some
common code to helper functions and generally cleans things up to be
more presentable.

Signed-off-by: Techlive Zheng 
Signed-off-by: David A. Greene 
---
 contrib/subtree/t/Makefile |  31 ---
 contrib/subtree/t/t7900-subtree.sh | 103 -
 2 files changed, 79 insertions(+), 55 deletions(-)

diff --git a/contrib/subtree/t/Makefile b/contrib/subtree/t/Makefile
index c864810..276898e 100644
--- a/contrib/subtree/t/Makefile
+++ b/contrib/subtree/t/Makefile
@@ -13,11 +13,23 @@ TAR ?= $(TAR)
 RM ?= rm -f
 PROVE ?= prove
 DEFAULT_TEST_TARGET ?= test
+TEST_LINT ?= test-lint
+
+ifdef TEST_OUTPUT_DIRECTORY
+TEST_RESULTS_DIRECTORY = $(TEST_OUTPUT_DIRECTORY)/test-results
+else
+TEST_RESULTS_DIRECTORY = ../../../t/test-results
+endif
 
 # Shell quote;
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
+TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY))
 
-T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
+T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
+TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
+TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
+THELPERS = $(sort $(filter-out $(T),$(wildcard *.sh)))
 
 all: $(DEFAULT_TEST_TARGET)
 
@@ -26,20 +38,22 @@ test: pre-clean $(TEST_LINT)
 
 prove: pre-clean $(TEST_LINT)
@echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec 
'$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
-   $(MAKE) clean
+   $(MAKE) clean-except-prove-cache
 
 $(T):
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ 
$(GIT_TEST_OPTS)
 
 pre-clean:
-   $(RM) -r test-results
+   $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
 
-clean:
-   $(RM) -r 'trash directory'.* test-results
+clean-except-prove-cache:
+   $(RM) -r 'trash directory'.* '$(TEST_RESULTS_DIRECTORY_SQ)'
$(RM) -r valgrind/bin
+
+clean: clean-except-prove-cache
$(RM) .prove
 
-test-lint: test-lint-duplicates test-lint-executable
+test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
 
 test-lint-duplicates:
@dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
@@ -51,12 +65,15 @@ test-lint-executable:
test -z "$$bad" || { \
echo >&2 "non-executable tests:" $$bad; exit 1; }
 
+test-lint-shell-syntax:
+   @'$(PERL_PATH_SQ)' ../../../t/check-non-portable-shell.pl $(T) 
$(THELPERS)
+
 aggregate-results-and-cleanup: $(T)
$(MAKE) aggregate-results
$(MAKE) clean
 
 aggregate-results:
-   for f in ../../../t/test-results/t*-*.counts; do \
+   for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \
echo "$$f"; \
done | '$(SHELL_PATH_SQ)' ../../../t/aggregate-results.sh
 
diff --git a/contrib/subtree/t/t7900-subtree.sh 
b/contrib/subtree/t/t7900-subtree.sh
index dfbe443..f9dda3d 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -5,7 +5,7 @@
 #
 test_description='Basic porcelain support for subtrees
 
-This test verifies the basic operation of the merge, pull, add
+This test verifies the basic operation of the add, pull, merge
 and split subcommands of git subtree.
 '
 
@@ -20,7 +20,6 @@ create()
git add "$1"
 }
 
-
 check_equal()
 {
test_debug 'echo'
@@ -38,6 +37,30 @@ undo()
git reset --hard HEAD~
 }
 
+# Make sure no patch changes more than one file.
+# The original set of commits changed only one file each.
+# A multi-file change would imply that we pruned commits
+# too aggressively.
+join_commits()
+{
+   commit=
+   all=
+   while read x y; do
+   if [ -z "$x" ]; then
+   continue
+   elif [ "$x" = "commit:" ]; then
+   if [ -n "$commit" ]; then
+   echo "$commit $all"
+   all=
+   fi
+   commit="$y"
+   else
+   all="$all $y"
+   fi
+   done
+   echo "$commit $all"
+}
+
 last_commit_message()
 {
git log --pretty=format:%s -1
@@ -123,9 +146,11 @@ test_expect_success 'add subproj to mainline' '
check_equal ''"$(last_commit_message)"'' "Add '"'sub dir/'"' from 
commit '"'"'''"$(git rev-parse sub1)"'''"'"'"
 '
 
-# this shouldn't actually do anything, since FETCH_HEAD is already a parent
-test_expect_success 'merge fetched subproj' '
-   git merge -m "merge -s -ours" -s ours FETCH_HEAD
+test_expect_success 'merge the added subproj again, should do nothing' '
+   # this shouldn not actually do anything, since FETCH_HEAD
+   # is already a parent
+   result=$(git merge -s ours -m "merge -s -ours" FETCH_HEAD) &&
+   check_equal "${result}" "Already 

[PATCH 5/7] contrib/subtree: Add split tests

2015-11-12 Thread David Greene
From: Techlive Zheng 

Add tests to check various options to split.  Check combinations of
--prefix, --message, --annotate, --branch and --rejoin.

Signed-off-by: Techlive Zheng 
Signed-off-by: David A. Greene 
---
 contrib/subtree/t/t7900-subtree.sh | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/contrib/subtree/t/t7900-subtree.sh 
b/contrib/subtree/t/t7900-subtree.sh
index 7d59a1a..6250194 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -250,7 +250,6 @@ test_expect_success 'split requires path given by option 
--prefix must exist' '
 
 test_expect_success 'check if --message works for split+rejoin' '
spl1=''"$(git subtree split --annotate='"'*'"' --prefix "sub dir" 
--onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
-   git branch spl1 "$spl1" &&
check_equal ''"$(last_commit_message)"'' "Split & rejoin" &&
undo
 '
@@ -282,7 +281,21 @@ test_expect_success 'check split with --branch for an 
incompatible branch' '
test_must_fail git subtree split --prefix "sub dir" --onto FETCH_HEAD 
--branch subdir
 '
 
-test_expect_success 'check split+rejoin' '
+test_expect_success 'split sub dir/ with --rejoin' '
+   spl1=$(git subtree split --prefix="sub dir" --annotate="*") &&
+   git branch spl1 "$spl1" &&
+   git subtree split --prefix="sub dir" --annotate="*" --rejoin &&
+   check_equal "$(last_commit_message)" "Split '\''sub dir/'\'' into 
commit '\''$spl1'\''" &&
+   undo
+'
+
+test_expect_success 'split sub dir/ with --rejoin and --message' '
+   git subtree split --prefix="sub dir" --message="Split & rejoin" 
--annotate="*" --rejoin &&
+   check_equal "$(last_commit_message)" "Split & rejoin" &&
+   undo
+'
+
+test_expect_success 'check split+rejoin+onto' '
spl1=''"$(git subtree split --annotate='"'*'"' --prefix "sub dir" 
--onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
undo &&
git subtree split --annotate='"'*'"' --prefix "sub dir" --onto 
FETCH_HEAD --rejoin &&
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7] contrib/subtree: Add test for missing subtree

2015-11-12 Thread David Greene
From: Techlive Zheng 

Test that a merge from a non-existant subtree fails.

Signed-off-by: Techlive Zheng 
Signed-off-by: David A. Greene 
---
 contrib/subtree/t/t7900-subtree.sh | 4 
 1 file changed, 4 insertions(+)

diff --git a/contrib/subtree/t/t7900-subtree.sh 
b/contrib/subtree/t/t7900-subtree.sh
index f9dda3d..4471786 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -123,6 +123,10 @@ test_expect_success 'no pull from non-existant subtree' '
test_must_fail git subtree pull --prefix="sub dir" ./"sub proj" sub1
 '
 
+test_expect_success 'no merge from non-existent subtree' '
+   test_must_fail git subtree merge --prefix="sub dir" FETCH_HEAD
+'
+
 test_expect_success 'check if --message works for add' '
git subtree add --prefix="sub dir" --message="Added subproject" sub1 &&
check_equal ''"$(last_commit_message)"'' "Added subproject" &&
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] http: fix some printf format warnings on 32-bit builds

2015-11-12 Thread Andreas Schwab
Torsten Bögershausen  writes:

> So whenever a long long is printed, I can warmly recommend to use
>
> PRId64

PRId64 is not suitable for long long, only for int64_t.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html