git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/
  2006-07-26 17:41 19% [PATCH 1/2] t7001: add test for git-mv dir1 dir2/ Johannes Schindelin
@ 2006-07-26 17:50  6% ` Jon Smirl
  2006-07-26 18:47  6%   ` Johannes Schindelin
      1 sibling, 2 replies; 200+ results
From: Jon Smirl @ 2006-07-26 17:50 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, junkio

An exact test case:

git clone git foo
git clone git foo1
cd foo
mkdir zzz
git mv gitweb zzz
cg diff >patch
cd ../foo1
cg patch <../foo/patch

This patch won't apply because zzz does not exist in foo1

-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/
  2006-07-26 17:50  6% ` Jon Smirl
@ 2006-07-26 18:47  6%   ` Johannes Schindelin
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin @ 2006-07-26 18:47 UTC (permalink / raw)
  To: Jon Smirl; +Cc: git, junkio

Hi,

On Wed, 26 Jul 2006, Jon Smirl wrote:

> An exact test case:
> 
> git clone git foo
> git clone git foo1
> cd foo
> mkdir zzz
> git mv gitweb zzz
> cg diff >patch
> cd ../foo1
> cg patch <../foo/patch
> 
> This patch won't apply because zzz does not exist in foo1

Okay, I got it wrong, then. Thanks for the clarification!

Ciao,
Dscho

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/
  @ 2006-07-26 18:58  6%       ` Junio C Hamano
  2006-07-26 19:31  6%         ` Junio C Hamano
  0 siblings, 1 reply; 200+ results
From: Junio C Hamano @ 2006-07-26 18:58 UTC (permalink / raw)
  To: Jon Smirl; +Cc: git

"Jon Smirl" <jonsmirl@gmail.com> writes:

> git diff HEAD makes a much longer patch that deltas out the existing
> files and delta in the new file.
>
> It's applying patches in the extended git format that fails.

Thanks.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/
  @ 2006-07-26 19:05  6%   ` Junio C Hamano
    1 sibling, 0 replies; 200+ results
From: Junio C Hamano @ 2006-07-26 19:05 UTC (permalink / raw)
  To: git

Josef Weidendorfer <Josef.Weidendorfer@gmx.de> writes:

> On Wednesday 26 July 2006 19:41, Johannes Schindelin wrote:
>> 
>> If dir2 already exists, git-mv should move dir1 _into_dir2/.
>> Noticed by Jon Smirl.
>
> Thanks for adding this test.
> BTW, the original PERL script passes it quite fine.
>
> I just looked at Jon's problem. Doesn't seem to be related to
> git-mv or git at all, but more a cogito problem.
> I have some cogito-0.18pre installed, and cg-patch is patching
> the stuff all itself, not using git for this. Pasky?

"git apply" seems to grok this just fine.

> Doing the same with git, i.e. in a rep with existing dir/
>
>  mkdir new
>  git mv dir new
>  git diff --cached -M -C >patch
>  git reset --hard
>  git apply <patch
>
> However, "git status" shows the "new/" directory totally
> untracked afterwards. Is this expected?

Running "git apply --index <patch" I see the "renamed: " in
there and zzz (or your "new") is tracked.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/
  2006-07-26 18:58  6%       ` Junio C Hamano
@ 2006-07-26 19:31  6%         ` Junio C Hamano
  2006-07-26 20:33  6%           ` Jon Smirl
  0 siblings, 1 reply; 200+ results
From: Junio C Hamano @ 2006-07-26 19:31 UTC (permalink / raw)
  To: Jon Smirl; +Cc: git

Junio C Hamano <junkio@cox.net> writes:

> "Jon Smirl" <jonsmirl@gmail.com> writes:
>
>> git diff HEAD makes a much longer patch that deltas out the existing
>> files and delta in the new file.
>>
>> It's applying patches in the extended git format that fails.
>
> Thanks.

... and it turns out that "git apply" (with or without --index)
groks it just fine.  I suspect the fix is quite recent (not in
v1.4.2-rc1 but in v1.4.2-rc2).

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/
  2006-07-26 19:31  6%         ` Junio C Hamano
@ 2006-07-26 20:33  6%           ` Jon Smirl
  0 siblings, 0 replies; 200+ results
From: Jon Smirl @ 2006-07-26 20:33 UTC (permalink / raw)
  To: Junio C Hamano, Petr Baudis; +Cc: git

On 7/26/06, Junio C Hamano <junkio@cox.net> wrote:
> Junio C Hamano <junkio@cox.net> writes:
>
> > "Jon Smirl" <jonsmirl@gmail.com> writes:
> >
> >> git diff HEAD makes a much longer patch that deltas out the existing
> >> files and delta in the new file.
> >>
> >> It's applying patches in the extended git format that fails.
> >
> > Thanks.
>
> ... and it turns out that "git apply" (with or without --index)
> groks it just fine.  I suspect the fix is quite recent (not in
> v1.4.2-rc1 but in v1.4.2-rc2).

I can confirm that git apply is handling this correctly with code from
the current git tree. cogito is failing this case.

-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/
  @ 2006-07-28  2:41  6%     ` Junio C Hamano
  2006-07-28  2:56  6%       ` Petr Baudis
  0 siblings, 1 reply; 200+ results
From: Junio C Hamano @ 2006-07-28  2:41 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> writes:

>   (i) No git-apply -R - well, it seems to me that I revert patches all
> the time, don't you?
>
>   (ii) I'd like git-apply to be as verbose as patch is, that is list
> the files it touches as it goes
>
>   (iii) There's no reject handling besides "panic" right now - it should
> be able to create .rej files so that the user can fix things up
>
>   (iv) I need git-apply to add/remove to/from index new/gone files,
> while at the same time...
>
>   (v) I want to allow applying of patches to working copy that is not
> completely clean, even on top of modified files

You probably should be able to talk me into doing these, but
doesn't it already do (iv) and (v)?

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/
  2006-07-28  2:41  6%     ` Junio C Hamano
@ 2006-07-28  2:56  6%       ` Petr Baudis
  2006-07-28  4:48  6%         ` Junio C Hamano
  0 siblings, 1 reply; 200+ results
From: Petr Baudis @ 2006-07-28  2:56 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Dear diary, on Fri, Jul 28, 2006 at 04:41:04AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Petr Baudis <pasky@suse.cz> writes:
> >   (iv) I need git-apply to add/remove to/from index new/gone files,
> > while at the same time...
> >
> >   (v) I want to allow applying of patches to working copy that is not
> > completely clean, even on top of modified files
> 
> You probably should be able to talk me into doing these, but
> doesn't it already do (iv) and (v)?

Well, at once? I can do (iv) by adding --index but that contradicts (v).
But maybe I'm missing something.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/
  2006-07-28  2:56  6%       ` Petr Baudis
@ 2006-07-28  4:48  6%         ` Junio C Hamano
  2006-07-28 15:47  6%           ` Petr Baudis
  0 siblings, 1 reply; 200+ results
From: Junio C Hamano @ 2006-07-28  4:48 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> writes:

> Dear diary, on Fri, Jul 28, 2006 at 04:41:04AM CEST, I got a letter
> where Junio C Hamano <junkio@cox.net> said that...
>> Petr Baudis <pasky@suse.cz> writes:
>> >   (iv) I need git-apply to add/remove to/from index new/gone files,
>> > while at the same time...
>> >
>> >   (v) I want to allow applying of patches to working copy that is not
>> > completely clean, even on top of modified files
>> 
>> You probably should be able to talk me into doing these, but
>> doesn't it already do (iv) and (v)?
>
> Well, at once? I can do (iv) by adding --index but that contradicts (v).
> But maybe I'm missing something.

What should the semantics of such operation be?  Apply to index
on paths that are clean while leave the index entries untouched
for paths that are dirty?  What should happen on renamed paths
that are dirty?

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/
  2006-07-28  4:48  6%         ` Junio C Hamano
@ 2006-07-28 15:47  6%           ` Petr Baudis
  0 siblings, 0 replies; 200+ results
From: Petr Baudis @ 2006-07-28 15:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Dear diary, on Fri, Jul 28, 2006 at 06:48:49AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Petr Baudis <pasky@suse.cz> writes:
> > Well, at once? I can do (iv) by adding --index but that contradicts (v).
> > But maybe I'm missing something.
> 
> What should the semantics of such operation be?  Apply to index
> on paths that are clean while leave the index entries untouched
> for paths that are dirty?  What should happen on renamed paths
> that are dirty?

Keep the original sha1 but change the name. If an entry with the new
name already exists, we might just leave the index alone and create a
.rej file. (Alternatively we might create two stages in the index file
but we can't do that in case of regular rejects so I'd rather stay
consistent.)

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam

^ permalink raw reply	[relevance 6%]

* Re: [PATCH] t/t7001-mv.sh: Propose ability to use git-mv on conflicting entries
  2008-07-28  1:13 16%   ` Junio C Hamano
@ 2008-07-28  1:21  6%     ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2008-07-28  1:21 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git, gitster

Junio C Hamano <gitster@pobox.com> writes:

>> +# Rationale: I cannot git mv around a conflicted file. This is unnecessary
>> +# restriction in case another part of conflict resolution requires me to
>> +# move the file around.
>
> Yes, I would agree this is a reasonable thing to support.  Something like
> this patch, perhaps.
> ...

Just in case if somebody is inclined to test the patch and polish it into
a shape good enough for inclusion...

> @@ -177,7 +177,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
>  				} else
>  					bad = "Cannot overwrite";
>  			}
> -		} else if (cache_name_pos(src, length) < 0)
> +		} else if (((pos = cache_name_pos(src, length)) < 0) &&
> +			   strcmp(active_cache[-1 - pos]->name, src))

There is a bug here; "-1 - pos" needs to be checked against active_nr
before strcmp().

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/2] Missing && in t/t7001.sh.
       [not found]     <1233309819-777-?= =?ISO-8859-1?Q?1-git-send-email?= =?ISO-8859-1?Q?-=0E=10>
@ 2009-01-30 10:36  6% ` Matthieu Moy
  0 siblings, 0 replies; 200+ results
From: Matthieu Moy @ 2009-01-30 10:36 UTC (permalink / raw)
  To: git

^N^P@imag.fr writes:
^^^^

(Sorry for the bad From: header line. I must have typed something
weird at the git send-email prompt, while I thought I had just typed
"enter")

-- 
Matthieu

^ permalink raw reply	[relevance 6%]

* Re: [RFC PATCHv2 13/16] t7001 (mv): add missing &&
  2010-09-24 22:22 19% ` [RFC PATCHv2 13/16] t7001 (mv): add missing && Elijah Newren
@ 2010-09-24 23:00  6%   ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-24 23:00 UTC (permalink / raw)
  To: Elijah Newren; +Cc: git

On Fri, Sep 24, 2010 at 22:22, Elijah Newren <newren@gmail.com> wrote:
> FIXME: I believe the mv was meant to fail here so I added a test_must_fail;
> was that the right change?

Yeah, you can't mv an untracked file.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH] test: fix t7001 cp to use POSIX options
  2014-04-11  8:24 19% [PATCH] test: fix t7001 cp to use POSIX options Kyle J. McKay
@ 2014-04-11 11:43  6% ` Jeff King
  2014-04-11 13:44 18%   ` Kyle J. McKay
  0 siblings, 1 reply; 200+ results
From: Jeff King @ 2014-04-11 11:43 UTC (permalink / raw)
  To: Kyle J. McKay; +Cc: git, Junio C Hamano, Jens Lehmann

On Fri, Apr 11, 2014 at 01:24:02AM -0700, Kyle J. McKay wrote:

> Since 11502468 and 04c1ee57 (both first appearing in v1.8.5), the
> t7001-mv test has used "cp -a" to perform a copy in several of the
> tests.
> 
> However, the "-a" option is not required for a POSIX cp utility and
> some platforms' cp utilities do not support it.
> 
> The POSIX equivalent of -a is -R -P -p.
> 
> Change "cp -a" to "cp -R -P -p" so that the t7001-mv test works
> on systems with a cp utility that only implements the POSIX
> required set of options and not the "-a" option.

I wonder if the "-R" is the part that we actually care about here.
Including the others does not hurt in that case, but using only "-R"
would perhaps make it more obvious to a later reader of the code exactly
what we are trying to do.

-Peff

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/3] t7001: reformat to newer style
  2018-09-21 23:58 11% ` [PATCH 1/3] t7001: reformat " Stefan Beller
@ 2018-09-24 13:31  6%   ` Derrick Stolee
    0 siblings, 1 reply; 200+ results
From: Derrick Stolee @ 2018-09-24 13:31 UTC (permalink / raw)
  To: Stefan Beller, git

On 9/21/2018 7:58 PM, Stefan Beller wrote:
> The old formatting style is a real hindrance of getting people up to speed
> contributing as they use existing code as an example and follow that style.
> So let's get rid of the old style and reformat it in our current style.
I was suspicious of your automated approach catching everything, so I 
looked carefully at this patch. There are still a lot of things 
happening that we would not recommend doing in new tests.
>
> Reported-by: Derrick Stolee <stolee@gmail.com>
> Reported-by: Jeff Hostetler <git@jeffhostetler.com>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>   t/t7001-mv.sh | 268 +++++++++++++++++++++++++-------------------------
>   1 file changed, 134 insertions(+), 134 deletions(-)
>
> diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
> index 36b50d0b4c1..2251d24735c 100755
> --- a/t/t7001-mv.sh
> +++ b/t/t7001-mv.sh
> @@ -3,74 +3,74 @@
>   test_description='git mv in subdirs'
>   . ./test-lib.sh
>   
> -test_expect_success \
> -    'prepare reference tree' \
> -    'mkdir path0 path1 &&
> -     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
> -     git add path0/COPYING &&
> -     git commit -m add -a'
> +test_expect_success 'prepare reference tree' '
> +	mkdir path0 path1 &&
> +	cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
> +	git add path0/COPYING &&
> +	git commit -m add -a
> +'
>   
> -test_expect_success \
> -    'moving the file out of subdirectory' \
> -    'cd path0 && git mv COPYING ../path1/COPYING'
> +test_expect_success 'moving the file out of subdirectory' '
> +	cd path0 && git mv COPYING ../path1/COPYING
> +'
Perhaps split this line on the &&?
>   
>   # in path0 currently
> -test_expect_success \
> -    'commiting the change' \
> -    'cd .. && git commit -m move-out -a'
> +test_expect_success 'commiting the change' '
> +	cd .. && git commit -m move-out -a
> +'

This "cd .." should probably be removed and use a subshell in the test 
above where we "cd path0".

>   
> -test_expect_success \
> -    'checking the commit' \
> -    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
> -    grep "^R100..*path0/COPYING..*path1/COPYING" actual'
> +test_expect_success 'checking the commit' '
> +	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
> +	grep "^R100..*path0/COPYING..*path1/COPYING" actual
> +'
>   
> -test_expect_success \
> -    'moving the file back into subdirectory' \
> -    'cd path0 && git mv ../path1/COPYING COPYING'
> +test_expect_success 'moving the file back into subdirectory' '
> +	cd path0 && git mv ../path1/COPYING COPYING
> +'

Split at &&, use subshell?


> +test_expect_success 'commiting the change' '
> +	cd .. && git commit -m move-in -a
> +'

Drop "cd .." (and the comments about being in path0)

[big snip]

> +test_expect_success 'moving to existing tracked target with trailing slash' '
> +	mkdir path2 &&
> +	>path2/file && git add path2/file &&
This line in particular looks a bit strange. What is this doing? At 
least we should split the &&.
> +	git mv path1/path0/ path2/ &&
> +	test_path_is_dir path2/path0/
> +'
> +
> +test_expect_success 'clean up' '
> +	git reset --hard
> +'
> +
> +test_expect_success 'adding another file' '
> +	cp "$TEST_DIRECTORY"/../README.md path0/README &&
> +	git add path0/README &&
> +	git commit -m add2 -a
> +'
> +
> +test_expect_success 'moving whole subdirectory' '
> +	git mv path0 path2
> +'
> +
> +test_expect_success 'commiting the change' '
> +	git commit -m dir-move -a
> +'
> +
> +test_expect_success 'checking the commit' '
> +	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
> +	grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
> +	grep "^R100..*path0/README..*path2/README" actual
> +'
> +
> +test_expect_success 'succeed when source is a prefix of destination' '
> +	git mv path2/COPYING path2/COPYING-renamed
> +'
> +
> +test_expect_success 'moving whole subdirectory into subdirectory' '
> +	git mv path2 path1
> +'
> +
> +test_expect_success 'commiting the change' '
> +	git commit -m dir-move -a
> +'
> +
> +test_expect_success 'checking the commit' '
> +	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
> +	grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
> +	grep "^R100..*path2/README..*path1/path2/README" actual
> +'
> +
> +test_expect_success 'do not move directory over existing directory' '
> +	mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
> +'

Split this line.

Thanks,

-Stolee


^ permalink raw reply	[relevance 6%]

* Re: [PATCH 1/3] t7001: reformat to newer style
  @ 2018-09-25 20:36  6%       ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2018-09-25 20:36 UTC (permalink / raw)
  To: Stefan Beller; +Cc: Derrick Stolee, git

Stefan Beller <sbeller@google.com> writes:

> Heh, thanks for calling that out. So we're looking at a full formatter
> instead of a partial formatter that helps moving in the right direction now. :-/

The parts left out of these patches (e.g. use subshell when working
in a subdirectory) need human decision and a bit of good taste, and
I think it was a good design decision to keep these three patches
all mechanical.  There do need a follow-up [PATCH {4,5,6}/3] that
cannot be done mechanically, though, before the result can be called
"this script has been cleaned up and new people are encouraged to
mimick the way it does things".  

That way, we can keep the mechanically good bits that are early in
the series while polishing the later bits that need human judgement.



^ permalink raw reply	[relevance 6%]

* Re: [PATCH 00/11] Modernizing the t7001 test script
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
                   ` (10 preceding siblings ...)
  2020-09-25 17:02 13% ` [PATCH 02/11] t7001: use TAB instead of spaces shubham verma
@ 2020-09-25 17:33  6% ` Eric Sunshine
  2020-10-01  5:42  6%   ` Shubham Verma
  11 siblings, 1 reply; 200+ results
From: Eric Sunshine @ 2020-09-25 17:33 UTC (permalink / raw)
  To: shubham verma; +Cc: Git List

On Fri, Sep 25, 2020 at 1:03 PM shubham verma <shubhunic@gmail.com> wrote:
> In this patch series modernize the t7001 test script by changing the
> style of its tests from an old one to the modern one and by cleaning
> up the test script.

Thanks for tackling this task. I presume it was prompted by [1] or
[2], as this series covers many of the items mentioned in [1].
Overall, the series looks good. I'll leave comments in a few of the
individual patches.

[1]: https://lore.kernel.org/git/CAPig+cQpUu2UO-+jWn1nTaDykWnxwuEitzVB7PnW2SS_b7V8Hg@mail.gmail.com/
[2]: https://git.github.io/rev_news/2020/08/27/edition-66/

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 07/11] t7001: use ': >' rather than 'touch'
  2020-09-25 17:02 18% ` [PATCH 07/11] t7001: use ': >' rather than 'touch' shubham verma
@ 2020-09-25 18:57  6%   ` Eric Sunshine
  2020-09-25 20:21  6%     ` Junio C Hamano
  0 siblings, 1 reply; 200+ results
From: Eric Sunshine @ 2020-09-25 18:57 UTC (permalink / raw)
  To: shubham verma; +Cc: Git List

On Fri, Sep 25, 2020 at 1:03 PM shubham verma <shubhunic@gmail.com> wrote:
> t7001: use ': >' rather than 'touch'
>
> Use `>` rather than `touch` to create an empty file when the
> timestamp isn't relevant to the test.

There is an inconsistency here. In the subject you say ": >" but in
the body just ">".

A couple more comments below...

> Signed-off-by: shubham verma <shubhunic@gmail.com>
> ---
> diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
> @@ -47,14 +47,14 @@ test_expect_success 'checking -k on non-existing file' '
>  test_expect_success 'checking -k on untracked file' '
> -       touch untracked1 &&
> +       : > untracked1 &&

In patch [5/11] you dropped whitespace following the redirection
operator, however, this patch introduces several new cases of unwanted
whitespace.

Checking "master", I see that there are 209 instances of `: >` in
tests, but 1023 instances of `>`, which suggests that we should stick
with plain `>` rather than `: >` in this patch.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 08/11] t7001: put each command on a separate line
  2020-09-25 17:02 19% ` [PATCH 08/11] t7001: put each command on a separate line shubham verma
@ 2020-09-25 19:01  6%   ` Eric Sunshine
  0 siblings, 0 replies; 200+ results
From: Eric Sunshine @ 2020-09-25 19:01 UTC (permalink / raw)
  To: shubham verma; +Cc: Git List

On Fri, Sep 25, 2020 at 1:03 PM shubham verma <shubhunic@gmail.com> wrote:
> Multiple commands on one line  should be split across multiple lines.

Drop the extra whitespace between "line" and "should".

I might have written the commit message with a bit more explanation,
perhaps like this:

    Modern practice is to avoid multiple commands per line, and
    instead place each command on its own line.

The patch itself looks fine.

> Signed-off-by: shubham verma <shubhunic@gmail.com>

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 09/11] t7001: use here-docs instead of echo
  2020-09-25 17:02 19% ` [PATCH 09/11] t7001: use here-docs instead of echo shubham verma
@ 2020-09-25 20:23  6%   ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2020-09-25 20:23 UTC (permalink / raw)
  To: shubham verma; +Cc: git

shubham verma <shubhunic@gmail.com> writes:

> From: Shubham Verma <shubhunic@gmail.com>
>
> Change from old style to current style by taking advantage of
> here-docs instead of echo commands.
>
> Signed-off-by: shubham verma <shubhunic@gmail.com>
> ---
>  t/t7001-mv.sh | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
> index 94c5b10f8a..30714a8200 100755
> --- a/t/t7001-mv.sh
> +++ b/t/t7001-mv.sh
> @@ -222,7 +222,10 @@ test_expect_success 'git mv to move multiple sources into a directory' '
>  	git add dir/?.txt &&
>  	git mv dir/a.txt dir/b.txt other &&
>  	git ls-files >actual &&
> -	{ echo other/a.txt; echo other/b.txt; } >expect &&
> +	cat >expect <<-\EOF &&
> +	other/a.txt
> +	other/b.txt
> +	EOF

This could be written with test_write_lines but a here-doc would be
a better option in this case, as we will see the expected output from
the tested command in the exact form.


^ permalink raw reply	[relevance 6%]

* Re: [PATCH 07/11] t7001: use ': >' rather than 'touch'
  2020-09-25 18:57  6%   ` Eric Sunshine
@ 2020-09-25 20:21  6%     ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2020-09-25 20:21 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: shubham verma, Git List

Eric Sunshine <sunshine@sunshineco.com> writes:

> In patch [5/11] you dropped whitespace following the redirection
> operator, however, this patch introduces several new cases of unwanted
> whitespace.
>
> Checking "master", I see that there are 209 instances of `: >` in
> tests, but 1023 instances of `>`, which suggests that we should stick
> with plain `>` rather than `: >` in this patch.

Agreed on both points.  Thanks for a careful review.


^ permalink raw reply	[relevance 6%]

* Re: [PATCH 03/11] t7001: remove unnecessary blank lines
  @ 2020-09-25 20:19  6%     ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2020-09-25 20:19 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: shubham verma, Git List

Eric Sunshine <sunshine@sunshineco.com> writes:

> It is very uncommon style to hide the subshell as these two tests do:
>
>     test_expect_success 'title' '(
>         ...
>     )'
>
> Instead, these should be formatted as:
>
>     test_expect_success 'title' '
>         (
>             ...
>         )
>     '
>
> Note that the "(" and ")" of the subshell are indented with a TAB, and
> then the body of the subshell is indented again with another TAB in
> order to comply with current style guidelines.
>
> Fixing these might possibly be done in patch [1/11], however, they are
> so unusual and would change indentation of the body lines that they
> might deserve a patch of their own to avoid being lost in the noise of
> [1/11].

I agree that adding that to 01/11 might be too noisy, but 04/11 may
be a good match.

Thanks.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 00/11] Modernizing the t7001 test script
  2020-09-25 17:33  6% ` [PATCH 00/11] Modernizing the t7001 test script Eric Sunshine
@ 2020-10-01  5:42  6%   ` Shubham Verma
  2020-12-22 19:22  6%     ` Junio C Hamano
  0 siblings, 1 reply; 200+ results
From: Shubham Verma @ 2020-10-01  5:42 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Git List

On Fri, Sep 25, 2020 at 11:03 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
>
> On Fri, Sep 25, 2020 at 1:03 PM shubham verma <shubhunic@gmail.com> wrote:
> > In this patch series modernize the t7001 test script by changing the
> > style of its tests from an old one to the modern one and by cleaning
> > up the test script.
>
> Thanks for tackling this task. I presume it was prompted by [1] or
> [2], as this series covers many of the items mentioned in [1].
> Overall, the series looks good. I'll leave comments in a few of the
> individual patches.
>
> [1]: https://lore.kernel.org/git/CAPig+cQpUu2UO-+jWn1nTaDykWnxwuEitzVB7PnW2SS_b7V8Hg@mail.gmail.com/
> [2]: https://git.github.io/rev_news/2020/08/27/edition-66/

Eric, Actually I follow the Instruction that you pointed out in [1].
Okay, I improve the commits and make changes according to your comments.

Thank You!

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 00/11] Modernizing the t7001 test script
  2020-10-01  5:42  6%   ` Shubham Verma
@ 2020-12-22 19:22  6%     ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2020-12-22 19:22 UTC (permalink / raw)
  To: Shubham Verma; +Cc: Eric Sunshine, Git List

Shubham Verma <shubhunic@gmail.com> writes:

> On Fri, Sep 25, 2020 at 11:03 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
>>
>> On Fri, Sep 25, 2020 at 1:03 PM shubham verma <shubhunic@gmail.com> wrote:
>> > In this patch series modernize the t7001 test script by changing the
>> > style of its tests from an old one to the modern one and by cleaning
>> > up the test script.
>>
>> Thanks for tackling this task. I presume it was prompted by [1] or
>> [2], as this series covers many of the items mentioned in [1].
>> Overall, the series looks good. I'll leave comments in a few of the
>> individual patches.
>>
>> [1]: https://lore.kernel.org/git/CAPig+cQpUu2UO-+jWn1nTaDykWnxwuEitzVB7PnW2SS_b7V8Hg@mail.gmail.com/
>> [2]: https://git.github.io/rev_news/2020/08/27/edition-66/
>
> Eric, Actually I follow the Instruction that you pointed out in [1].
> Okay, I improve the commits and make changes according to your comments.
>
> Thank You!

This series has seen quite a many review comments, and as far as I
remember, none of them was a suggestion that was hard to decipher.

It has been almost 3 months---has an update been posted that I
missed?

Thanks.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH v2 00/10] Modernizing the t7001 test script
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
                   ` (9 preceding siblings ...)
  2021-02-09 17:32 12% ` [PATCH v2 01/10] t7001: modernize test formatting shubham verma
@ 2021-02-09 19:24  6% ` Eric Sunshine
  2021-02-09 22:58  6% ` Junio C Hamano
  11 siblings, 0 replies; 200+ results
From: Eric Sunshine @ 2021-02-09 19:24 UTC (permalink / raw)
  To: shubham verma; +Cc: Git List

On Tue, Feb 9, 2021 at 12:35 PM shubham verma <shubhunic@gmail.com> wrote:
> In this patch series modernize the t7001 test script by changing the
> style of its tests from an old one to the modern one and by cleaning
> up the test script.
>
> Changes since v1:
>
> - Change commit messages and added brief explanation about commit.
> - Modernize subshell formatting
> - Use ': >' rather than '>'

For readers new to this series, v1 is here:
https://lore.kernel.org/git/20200925170256.11490-1-shubhunic@gmail.com/T/

^ permalink raw reply	[relevance 6%]

* Re: [PATCH v2 00/10] Modernizing the t7001 test script
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
                   ` (10 preceding siblings ...)
  2021-02-09 19:24  6% ` [PATCH v2 00/10] Modernizing the t7001 test script Eric Sunshine
@ 2021-02-09 22:58  6% ` Junio C Hamano
  2021-02-11  7:28  6%   ` Eric Sunshine
  11 siblings, 1 reply; 200+ results
From: Junio C Hamano @ 2021-02-09 22:58 UTC (permalink / raw)
  To: shubham verma; +Cc: git

shubham verma <shubhunic@gmail.com> writes:

> In this patch series modernize the t7001 test script by changing the
> style of its tests from an old one to the modern one and by cleaning
> up the test script.
>
> Changes since v1:
>
> - Change commit messages and added brief explanation about commit.
> - Modernize subshell formatting
> - Use ': >' rather than '>'
>
> Thanks everyone for your feedback and suggestions.
>
> shubham verma (10):
>   t7001: modernize test formatting
>   t7001: indent with TABs instead of spaces
>   t7001: remove unnecessary blank lines
>   t7001: modernize subshell formatting
>   t7001: remove whitespace after redirect operators
>   t7001: avoid using `cd` outside of subshells
>   t7001: use '>' rather than 'touch'
>   t7001: put each command on a separate line
>   t7001: use here-docs instead of echo
>   t7001: use `test` rather than `[`
>
>  t/t7001-mv.sh | 432 ++++++++++++++++++++++++--------------------------
>  1 file changed, 204 insertions(+), 228 deletions(-)


I would have used test_write_lines instead of here-doc in 9/10, but
that is such a minor preference thing that it is not worth going
back and replace.  Nothing else stood out during my cursory scan.

Will queue; thanks.




^ permalink raw reply	[relevance 6%]

* Re: [PATCH v2 00/10] Modernizing the t7001 test script
  2021-02-09 22:58  6% ` Junio C Hamano
@ 2021-02-11  7:28  6%   ` Eric Sunshine
  2021-02-11  7:37  6%     ` Junio C Hamano
  0 siblings, 1 reply; 200+ results
From: Eric Sunshine @ 2021-02-11  7:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: shubham verma, Git List

On Tue, Feb 9, 2021 at 6:13 PM Junio C Hamano <gitster@pobox.com> wrote:
> shubham verma <shubhunic@gmail.com> writes:
> > In this patch series modernize the t7001 test script by changing the
> > style of its tests from an old one to the modern one and by cleaning
> > up the test script.
> >
> I would have used test_write_lines instead of here-doc in 9/10, but
> that is such a minor preference thing that it is not worth going
> back and replace.  Nothing else stood out during my cursory scan.

I read over the entire series and likewise didn't find anything to
comment on, thus consider it in good shape. For what it's worth,
consider this series:

    Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>

^ permalink raw reply	[relevance 6%]

* Re: [PATCH v2 00/10] Modernizing the t7001 test script
  2021-02-11  7:28  6%   ` Eric Sunshine
@ 2021-02-11  7:37  6%     ` Junio C Hamano
  2021-02-11  7:56  6%       ` Shubham Verma
  0 siblings, 1 reply; 200+ results
From: Junio C Hamano @ 2021-02-11  7:37 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: shubham verma, Git List

Eric Sunshine <sunshine@sunshineco.com> writes:

> On Tue, Feb 9, 2021 at 6:13 PM Junio C Hamano <gitster@pobox.com> wrote:
>> shubham verma <shubhunic@gmail.com> writes:
>> > In this patch series modernize the t7001 test script by changing the
>> > style of its tests from an old one to the modern one and by cleaning
>> > up the test script.
>> >
>> I would have used test_write_lines instead of here-doc in 9/10, but
>> that is such a minor preference thing that it is not worth going
>> back and replace.  Nothing else stood out during my cursory scan.
>
> I read over the entire series and likewise didn't find anything to
> comment on, thus consider it in good shape. For what it's worth,
> consider this series:
>
>     Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>

Yup, this one looked good to me.  Thanks.

Except that the author's name were spelled in all lowercase, unlike
v1, which made me wonder if it was intentional, that is.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH v2 00/10] Modernizing the t7001 test script
  2021-02-11  7:56  6%       ` Shubham Verma
@ 2021-02-11  7:59  6%         ` Eric Sunshine
  0 siblings, 0 replies; 200+ results
From: Eric Sunshine @ 2021-02-11  7:59 UTC (permalink / raw)
  To: Shubham Verma; +Cc: Junio C Hamano, Git List

On Thu, Feb 11, 2021 at 2:56 AM Shubham Verma <shubhunic@gmail.com> wrote:
> Sorry I forget about spelling.
> Okay I will correct it and send a new patch series today.

Please remember that the spelling of the author (From:) and
Signed-off-by: should be the same.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH v2 00/10] Modernizing the t7001 test script
  2021-02-11  7:37  6%     ` Junio C Hamano
@ 2021-02-11  7:56  6%       ` Shubham Verma
  2021-02-11  7:59  6%         ` Eric Sunshine
  0 siblings, 1 reply; 200+ results
From: Shubham Verma @ 2021-02-11  7:56 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Eric Sunshine, Git List

Thank You Eric and Junio.

Sorry I forget about spelling.
Okay I will correct it and send a new patch series today.

Thank You!


On Thu, Feb 11, 2021 at 1:07 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Eric Sunshine <sunshine@sunshineco.com> writes:
>
> > On Tue, Feb 9, 2021 at 6:13 PM Junio C Hamano <gitster@pobox.com> wrote:
> >> shubham verma <shubhunic@gmail.com> writes:
> >> > In this patch series modernize the t7001 test script by changing the
> >> > style of its tests from an old one to the modern one and by cleaning
> >> > up the test script.
> >> >
> >> I would have used test_write_lines instead of here-doc in 9/10, but
> >> that is such a minor preference thing that it is not worth going
> >> back and replace.  Nothing else stood out during my cursory scan.
> >
> > I read over the entire series and likewise didn't find anything to
> > comment on, thus consider it in good shape. For what it's worth,
> > consider this series:
> >
> >     Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
>
> Yup, this one looked good to me.  Thanks.
>
> Except that the author's name were spelled in all lowercase, unlike
> v1, which made me wonder if it was intentional, that is.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH v3 00/10] Modernizing the t7001 test script
  2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
                   ` (9 preceding siblings ...)
  2021-02-11 19:46 12% ` [PATCH v3 01/10] t7001: modernize test formatting Shubham Verma
@ 2021-02-11 21:44  6% ` Junio C Hamano
  2021-02-23  8:26 11%   ` Shubham Verma
  10 siblings, 1 reply; 200+ results
From: Junio C Hamano @ 2021-02-11 21:44 UTC (permalink / raw)
  To: Shubham Verma; +Cc: git, Eric Sunshine

Shubham Verma <shubhunic@gmail.com> writes:

> In this patch series modernize the t7001 test script by changing the
> style of its tests from an old one to the modern one and by cleaning
> up the test script.
>
> Changes since v2:
>
> - Correct the author name spelling
>
> Thanks everyone for your feedback and suggestions.

I've compared between v2 and v3 and verified the only change is the
name spelling, so I'll port over Eric's reviewed-by's from the
previous round.

Thanks.




^ permalink raw reply	[relevance 6%]

* Re: [PATCH v3 00/10] Modernizing the t7001 test script
  2021-02-23  8:26 11%   ` Shubham Verma
@ 2021-02-23 17:33  6%     ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2021-02-23 17:33 UTC (permalink / raw)
  To: Shubham Verma; +Cc: Git List, Eric Sunshine

Shubham Verma <shubhunic@gmail.com> writes:

> Hello Junio,
>
> I already corrected the author-name spelling in this v3 series
> but I looking at the last "What's Cooking" message and saw that
> Modernizing the t7001 test script series described as
> "Expecting the final version with corrected author attribution".

I looked at it on Feb 12 and requeued already, but the entry in the
what's cooking report was left stale by mistake.

Thanks for pinging.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH] t7001-mv.sh:modernizing test script using function
  2022-10-30 17:20 13% [PATCH] t7001-mv.sh:modernizing test script using function Debra Obondo via GitGitGadget
  2022-11-03 18:39 13% ` [PATCH v2] t7001-mv.sh: modernizing test script using functions Debra Obondo via GitGitGadget
  2022-10-31 18:04 10% ` [PATCH] t7001-mv.sh:modernizing test script using function Martin Ågren
@ 2022-10-30 18:00  6% ` Taylor Blau
  2 siblings, 0 replies; 200+ results
From: Taylor Blau @ 2022-10-30 18:00 UTC (permalink / raw)
  To: Debra Obondo via GitGitGadget; +Cc: git, Debra Obondo

On Sun, Oct 30, 2022 at 05:20:41PM +0000, Debra Obondo via GitGitGadget wrote:
>  t/t7001-mv.sh | 62 +++++++++++++++++++++++++--------------------------
>  1 file changed, 31 insertions(+), 31 deletions(-)

Looks good. Will queue, thanks.

Thanks,
Taylor

^ permalink raw reply	[relevance 6%]

* Re: [PATCH] t7001-mv.sh:modernizing test script using function
  2022-10-31 18:04 10% ` [PATCH] t7001-mv.sh:modernizing test script using function Martin Ågren
@ 2022-11-01  1:14  6%   ` Taylor Blau
  0 siblings, 0 replies; 200+ results
From: Taylor Blau @ 2022-11-01  1:14 UTC (permalink / raw)
  To: Martin Ågren
  Cc: Debra Obondo via GitGitGadget, Git Mailing List, Debra Obondo

On Mon, Oct 31, 2022 at 07:04:20PM +0100, Martin Ågren wrote:
> Hi Debra,
>
> On Sun, 30 Oct 2022 at 18:35, Debra Obondo via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> >
> > From: Debra Obondo <debraobondo@gmail.com>
> >
> > Test script to verify the presence/absence of files, paths, directories,
> > symlinks and other features in 'git mv' command are using the command
> > format:
> >
> > 'test (-e|f|d|h|...)'
> >
> > Replace them with helper functions of format:
> >
> > 'test_path_is_*'
>
> This is a good idea.
>
> The subject of this patch could use a space after the colon. You could
> also write "modernize" to give an order to the code base. So something
> like
>
>   t7001-mv.sh: modernize test script using function
>
> perhaps. "Function" is a bit vague, perhaps.
>
> I wanted to comment on this:
>
> >  test_expect_success 'mv --dry-run does not move file' '
> >         git mv -n path0/COPYING MOVED &&
> > -       test -f path0/COPYING &&
> > -       test ! -f MOVED
> > +       test_path_is_file path0/COPYING &&
> > +       ! test_path_is_file MOVED
> >  '
>
> It is my understanding that we prefer to only use such a helper when we
> really expect the file to exist. If the path is not a file, this helper
> prints a helpful message before returning with an error.
>
> Here, this means we will emit this 'helpful'
>
>   File MOVED doesn't exist
>
> on every test run, when really everything is as it should. And if the
> file is actually there, i.e., we have a bug, we'll emit nothing -- but
> that is precisely when we would want some diagnostics such as
>
>   Path exists:
>   ... MOVED ...
>
> to show us that the file actually exists, contrary to the test's
> expectations.
>
> Such output is precisely what `test_path_is_missing` would give us. :-)
>
> My gut feeling is that where this patch adds "! test_path_foo", it
> should use "test_path_bar" instead, for various values of "foo" and
> "bar". What do you think about that?

All good suggestions, thanks. I'll hold this back while we wait for a
rerolled version.

Thanks,
Taylor

^ permalink raw reply	[relevance 6%]

* Re: [PATCH v3] t7001-mv.sh: modernizing test script using functions
  2022-11-04 15:05 13%   ` [PATCH v3] " Debra Obondo via GitGitGadget
@ 2022-11-04 22:00  6%     ` Taylor Blau
  0 siblings, 0 replies; 200+ results
From: Taylor Blau @ 2022-11-04 22:00 UTC (permalink / raw)
  To: Debra Obondo via GitGitGadget
  Cc: git, Taylor Blau, Martin Ågren, Debra Obondo

Hi Debra,

On Fri, Nov 04, 2022 at 03:05:52PM +0000, Debra Obondo via GitGitGadget wrote:
>  t/t7001-mv.sh | 62 +++++++++++++++++++++++++--------------------------
>  1 file changed, 31 insertions(+), 31 deletions(-)

This round looks great. Will queue, thanks.

Thanks,
Taylor

^ permalink raw reply	[relevance 6%]

* What's cooking in git.git (Oct 2020, #03; Mon, 19)
@ 2020-10-19 18:13  6% Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2020-10-19 18:13 UTC (permalink / raw)
  To: git

Here are the topics that have been cooking.  Commits prefixed with '-' are
only in 'seen' (formerly 'pu'---proposed updates) while commits prefixed
with '+' are in 'next'.  The ones marked with '.' do not appear in any of
the integration branches, but I am still holding onto them.

Git 2.29 final has been tagged.  We will hopefully either (1) not
see brown-paper-bag breakages at all, or (2) will see some but can
immediately deal with them, in coming couple of days.  After that,
the 2.30 cycle will gain steam, starting next week.  Let's see.

Copies of the source code to Git live in many repositories, and the
following is a list of the ones I push into.  Some repositories have
only a subset of branches.

With maint, master, next, seen, todo:

	git://git.kernel.org/pub/scm/git/git.git/
	git://repo.or.cz/alt-git.git/
	https://kernel.googlesource.com/pub/scm/git/git/
	https://github.com/git/git/

With all the integration branches and topics broken out:

	https://github.com/gitster/git/

Even though the preformatted documentation in HTML and man format
are not sources, they are published in these repositories for
convenience (replace "htmldocs" with "manpages" for the manual
pages):

	git://git.kernel.org/pub/scm/git/git-htmldocs.git/
	https://github.com/gitster/git-htmldocs.git/

Release tarballs are available at:

	https://www.kernel.org/pub/software/scm/git/

--------------------------------------------------
[New Topics]

* cw/ci-ghwf-check-ws-errors (2020-10-09) 1 commit
  (merged to 'next' on 2020-10-15 at 159e0f0277)
 + ci: github action - add check for whitespace errors

 Dev support.

 Will cook in 'next'.


* en/strmap (2020-10-13) 10 commits
 - strmap: enable allocations to come from a mem_pool
 - strmap: add a strset sub-type
 - strmap: add functions facilitating use as a string->int map
 - strmap: enable faster clearing and reusing of strmaps
 - strmap: add more utility functions
 - strmap: new utility functions
 - hashmap: introduce a new hashmap_partial_clear()
 - hashmap: allow re-use after hashmap_free()
 - hashmap: adjust spacing to fix argument alignment
 - hashmap: add usage documentation explaining hashmap_free[_entries]()

 A speciailization of hashmap that uses a string as key has been
 introduced.  Hopefully it will see wider use over time.

 Will merge to 'next'.


* en/test-selector (2020-10-18) 3 commits
 - test-lib: reduce verbosity of skipped tests
 - t6006, t6012: adjust tests to use 'setup' instead of synonyms
 - test-lib: allow selecting tests by substring/glob with --run

 Our test scripts can be told to run only individual pieces while
 skipping others with the "--run=..." option; they were taught to
 take a substring of test title, in addition to numbers, to name the
 test pices to run.

 Will merge to 'next'.


* jk/report-fn-typedef (2020-10-16) 1 commit
 - usage: define a type for a reporting function

 Code clean-up.

 Needs to get its log message updated.


* mr/bisect-in-c-3 (2020-10-16) 7 commits
 - bisect--helper: retire `--bisect-autostart` subcommand
 - bisect--helper: retire `--write-terms` subcommand
 - bisect--helper: retire `--check-expected-revs` subcommand
 - bisect--helper: reimplement `bisect_state` & `bisect_head` shell functions in C
 - bisect--helper: retire `--next-all` subcommand
 - bisect--helper: retire `--bisect-clean-state` subcommand
 - bisect--helper: finish porting `bisect_start()` to C

 Rewriting "git bisect" in C continues.

 How ready is this one?


* rs/dist-doc-with-git-archive (2020-10-12) 2 commits
  (merged to 'next' on 2020-10-15 at cb1029e046)
 + Makefile: remove the unused variable TAR_DIST_EXTRA_OPTS
 + Makefile: use git init/add/commit/archive for dist-doc

 Use "git archive" more to produce the release tarball.

 Will cook in 'next'.


* rs/tighten-callers-of-deref-tag (2020-10-12) 3 commits
  (merged to 'next' on 2020-10-15 at a0df4a45cb)
 + line-log: handle deref_tag() returning NULL
 + blame: handle deref_tag() returning NULL
 + grep: handle deref_tag() returning NULL

 Code clean-up.

 Will cook in 'next'.


* rs/worktree-list-show-locked (2020-10-12) 1 commit
  (merged to 'next' on 2020-10-15 at 3917e61c28)
 + worktree: teach `list` to annotate locked worktree

 "git worktree list" now shows if each worktree is locked.  This
 possibly may open us to show other kinds of states in the future.

 Will cook in 'next'.


* sc/sequencer-gpg-octopus (2020-10-18) 3 commits
 - t3435: add tests for rebase -r GPG signing
 - sequencer: pass explicit --no-gpg-sign to merge
 - sequencer: fix gpg option passed to merge subcommand

 "git rebase --rebase-merges" did not correctly pass --gpg-sign
 command line option to underying "git merge" when replaying a merge
 using non-default merge strategy or when replaying an octopus merge
 (because replaying a two-head merge with the default strategy was
 done in a separate codepath, the problem did not trigger for most
 users), which has been corrected.

 Will merge to 'next'.


* sm/curl-retry (2020-10-13) 3 commits
 - http: automatically retry some requests
 - replace CURLOPT_FILE With CURLOPT_WRITEDATA
 - remote-curl: add testing for intelligent retry for HTTP

 The http transport has been taught to retry a failed request that
 may reasonably be retried.

 Need to pick up reroll.


* as/sample-push-to-checkout-hook (2020-10-16) 1 commit
 - hook: add sample template for push-to-checkout

 Add a sample 'push-to-checkout' hook, that performs the same as
 what the built-in default action does.

 Will merge to 'next'.


* as/tests-cleanup (2020-10-18) 1 commit
 - t2200,t9832: avoid using 'git' upstream in a pipe

 Micro clean-up of a couple of test scripts.

 Will merge to 'next'.


* bk/sob-dco (2020-10-18) 3 commits
 - SubmittingPatches: clarify DCO is our --signoff rule
 - Documentation: clarify and expand description of --signoff
 - doc: preparatory clean-up of description on the sign-off option

 Document that the meaning of a Signed-off-by trailer can vary from
 project to project in the end-user documentation, and clarify what
 it means to this project.


* ct/t0000-use-test-path-is-file (2020-10-18) 1 commit
 - t0000: use test_path_is_file instead of "test -f"

 Micro clean-up of a test script.


* en/dir-rename-tests (2020-10-16) 4 commits
 - t6423: more involved rules for renaming directories into each other
 - t6423: update directory rename detection tests with new rule
 - t6423: more involved directory rename test
 - directory-rename-detection.txt: update references to regression tests

 More preliminary tests have been added to document desired outcome
 of various "directory rename" situations.

 Will merge to 'next'.


* en/t7518-unflake (2020-10-18) 1 commit
 - t7518: fix flaky grep invocation

 Work around flakiness in a test.

 Will merge to 'next'.


* es/test-cmp-typocatcher (2020-10-16) 1 commit
 - Revert "test_cmp: diagnose incorrect arguments"

 A test helper "test_cmp A B" was taught to diagnose missing files A
 or B as a bug in test, but some tests legitimately wanted to notice
 a failure to even create file B as an error, in addition to leaving
 the expected result in it, and were misdiagnosed as a bug.  This
 has been corrected.

 Will merge to 'next'.


* es/tutorial-mention-asciidoc-early (2020-10-16) 1 commit
 - MyFirstContribution: clarify asciidoc dependency

 Doc update.

 Will merge to 'next'.


* jk/fast-import-marks-alloc-fix (2020-10-15) 1 commit
 - fast-import: fix over-allocation of marks storage

 "git fast-import" wasted a lot of memory when many marks were in use.

 Will merge to 'next'.


* jk/fast-import-marks-cleanup (2020-10-16) 1 commit
 - fast-import: remove duplicated option-parsing line

 Code clean-up.

 Will merge to 'next'.


* jk/no-common (2020-10-16) 1 commit
 - config.mak.dev: build with -fno-common

 Dev support to catch a tentative definition of a variable in our C
 code as an error.

 Will merge to 'next'.


* js/ci-ghwf-dedup-tests (2020-10-12) 2 commits
 - ci: make the "skip-if-redundant" check more defensive
 - ci: work around old records of GitHub runs

 GitHub Actions automated test improvement to skip tests on a tree
 identical to what has already been tested.

 Will merge to 'next'.


* lo/zsh-completion (2020-10-16) 1 commit
 - completion: fix zsh installation instructions

 Update instructions for command line completion (in contrib/) for zsh.

 Will merge to 'next'.


* nk/diff-files-vs-fsmonitor (2020-10-18) 4 commits
 - t/perf: add fsmonitor perf test for git diff
 - t/perf/p7519-fsmonitor.sh: warm cache on first git status
 - t/perf/README: elaborate on output format
 - fsmonitor: use fsmonitor data in `git diff`

 "git diff" and other commands that share the same machinery to
 compare with working tree files have been taught to take advantage
 of the fsmonitor data when available.

 Will merge to 'next'.


* nk/dir-c-comment-update (2020-10-16) 1 commit
 - dir.c: fix comments to agree with argument name

 Update stale in-code comment.

 Will merge to 'next'.


* tk/credential-config (2020-10-16) 1 commit
 - credential: load default config

 "git credential' didn't honor the core.askPass configuration
 variable (among other things), which has been corrected.

 Will merge to 'next'.

--------------------------------------------------
[Stalled]

* sv/t7001-modernize (2020-09-25) 11 commits
 - t7001: move cleanup code from outside the tests into them
 - t7001: use `test` rather than `[`
 - t7001: use here-docs instead of echo
 - t7001: put each command on a separate line
 - t7001: use ': >' rather than 'touch'
 - t7001: change (cd <path> && git foo) to (git -C <path> foo)
 - t7001: remove whitespace after redirect operators
 - t7001: change the style for cd according to subshell
 - t7001: remove unnecessary blank lines
 - t7001: use TAB instead of spaces
 - t7001: convert tests from the old style to the current style

 Test script modernization.

 Expecting a reroll.
 cf. <20200925170256.11490-1-shubhunic@gmail.com>


* ew/decline-core-abbrev (2020-09-01) 1 commit
 - core.abbrev <off|false|no> disables abbreviations

 Allow the configuration to specify no abbreviation regardless of
 the hash algorithm.

 Expecting a reroll.  The intent is very good.


* bc/rev-parse-path-format (2020-10-09) 2 commits
 - rev-parse: add option for absolute or relative path formatting
 - abspath: add a function to resolve paths with missing components

 "git rev-parse" can be explicitly told to give output as absolute
 or relative path.


* ar/fetch-transfer-ipversion (2020-09-16) 1 commit
 - config: option transfer.ipversion to set transport protocol version for network fetches

 Adds transfer.ipversion configuration variable.

 Needs more work.


* vv/send-email-with-less-secure-apps-access (2020-08-29) 1 commit
 - Documentation/git-send-email.txt: Mention less secure app access might need to enable.

 Doc update.

 Expecting a reroll.
 cf. <xmqqwo1hi9nv.fsf@gitster.c.googlers.com>
 cf. <xmqqft85i72s.fsf@gitster.c.googlers.com>


* jc/war-on-dashed-git (2020-08-27) 1 commit
 - git: catch an attempt to run "git-foo"

 The first step to remove on-disk binaries for built-in subcommands
 by soliciting objections.

 On hold for now.


* dr/push-remoteref-fix (2020-04-23) 1 commit
 - remote.c: fix handling of %(push:remoteref)

 The "%(push:remoteref)" placeholder in the "--format=" argument of
 "git format-patch" (and friends) only showed what got explicitly
 configured, not what ref at the receiving end would be updated when
 "git push" was used, as it ignored the default behaviour (e.g. update
 the same ref as the source).

 Discard for now.
 cf. <xmqqv9gu7c61.fsf@gitster.c.googlers.com>
 cf. <20200911214358.acl3hy2e763begoo@feanor>


* mk/use-size-t-in-zlib (2018-10-15) 1 commit
 - zlib.c: use size_t for size

 The wrapper to call into zlib followed our long tradition to use
 "unsigned long" for sizes of regions in memory, which have been
 updated to use "size_t".

--------------------------------------------------
[Cooking]

* ag/merge-strategies-in-c (2020-10-06) 11 commits
 - sequencer: use the "octopus" merge strategy without forking
 - sequencer: use the "resolve" strategy without forking
 - merge: use the "octopus" strategy without forking
 - merge: use the "resolve" strategy without forking
 - merge-octopus: rewrite in C
 - merge-recursive: move better_branch_name() to merge.c
 - merge-resolve: rewrite in C
 - merge-index: don't fork if the requested program is `git-merge-one-file'
 - merge-index: libify merge_one_path() and merge_all()
 - merge-one-file: rewrite in C
 - t6027: modernise tests

 The resolve and octopus merge strategy backends have been rewritten
 in C.


* jk/symlinked-dotgitx-files (2020-10-06) 8 commits
  (merged to 'next' on 2020-10-08 at b9e128a280)
 + fsck: complain when .gitattributes or .gitignore is a symlink
 + verify_path(): disallow symlinks in .gitattributes and .gitignore
 + t0060: test obscured .gitattributes and .gitignore matching
 + t7450: test .gitmodules symlink matching against obscured names
 + t7450: test verify_path() handling of gitmodules
 + t7415: rename to expand scope
 + fsck_tree(): wrap some long lines
 + fsck_tree(): fix shadowed variable

 "git fsck" and the corresponding check done during the transport
 learned to ensure that in-tree files like `.gitignore` and
 `.gitattributes` are not symbolic links.

 Will cook in 'next'.


* dl/checkout-guess (2020-10-08) 2 commits
  (merged to 'next' on 2020-10-08 at c9a6bc9a54)
 + checkout: learn to respect checkout.guess
 + Documentation/config/checkout: replace sq with backticks

 "git checkout" learned to use checkout.guess configuration variable
 and enable/disable its "--[no-]guess" option accordingly.

 Will cook in 'next'.


* dl/checkout-p-merge-base (2020-10-07) 4 commits
  (merged to 'next' on 2020-10-08 at 807e047d68)
 + t2016: add a NEEDSWORK about the PERL prerequisite
 + add-patch: add NEEDSWORK about comparing commits
 + Doc: document "A...B" form for <tree-ish> in checkout and switch
 + builtin/checkout: fix `git checkout -p HEAD...` bug

 "git checkout -p A...B [-- <path>]" did not work, even though the
 same command without "-p" correctly used the merge-base between
 commits A and B.

 Will cook in 'next'.


* dl/resurrect-update-for-sha256 (2020-10-08) 2 commits
 - contrib/git-resurrect.sh: use hash-agnostic OID pattern
 - contrib/git-resurrect.sh: indent with tabs

 "git resurrect" script (in contrib/) learned that the object names
 may be longer than 40-hex depending on the hash function in use.


* ds/commit-graph-merging-fix (2020-10-09) 2 commits
 - commit-graph: don't write commit-graph when disabled
 - commit-graph: ignore duplicates when merging layers

 When "git commit-graph" detects the same commit recorded more than
 once while it is merging the layers, it used to die.  The code now
 ignores all but one of them and continues.

 Will merge to 'next'.


* ds/maintenance-commit-graph-auto-fix (2020-10-12) 2 commits
 - maintenance: core.commitGraph=false prevents writes
 - maintenance: test commit-graph auto condition

 Test-coverage enhancement of running commit-graph task "git
 maintenance" as needed led to discovery and fix of a bug.

 Will merge to 'next'.


* js/userdiff-php (2020-10-07) 1 commit
  (merged to 'next' on 2020-10-08 at 988c7ea068)
 + userdiff: PHP: catch "abstract" and "final" functions

 Userdiff for PHP update.

 Will cook in 'next'.


* kb/userdiff-rust-macro-rules (2020-10-07) 1 commit
  (merged to 'next' on 2020-10-08 at 949063bcae)
 + userdiff: recognize 'macro_rules!' as starting a Rust function block

 Userdiff for Rust update.

 Will cook in 'next'.


* rk/completion-stash (2020-10-07) 2 commits
  (merged to 'next' on 2020-10-08 at ad60933f40)
 + git-completion.bash: stash-show: complete $__git_diff_common_options
 + git-completion.bash: __git_diff_common_options: add --[no-]patch

 The command line completion script (in contrib/) learned that "git
 stash show" takes the options "git diff" takes.

 Will cook in 'next'.


* sd/userdiff-css-update (2020-10-08) 1 commit
  (merged to 'next' on 2020-10-08 at 69b7e9df5d)
 + userdiff: expand detected chunk headers for css

 Userdiff for CSS update.

 Will cook in 'next'.


* ss/submodule-add-in-c (2020-10-07) 3 commits
 - t7400: add test to check 'submodule add' for tracked paths
 - submodule: port submodule subcommand 'add' from shell to C
 - dir: change the scope of function 'directory_exists_in_index()'

 "git submodule add" being rewritten in C.


* ak/corrected-commit-date (2020-10-08) 10 commits
 - doc: add corrected commit date info
 - commit-reach: use corrected commit dates in paint_down_to_common()
 - commit-graph: use generation v2 only if entire chain does
 - commit-graph: implement generation data chunk
 - commit-graph: implement corrected commit date
 - commit-graph: add a slab to store topological levels
 - commit-graph: return 64-bit generation number
 - commit-graph: consolidate fill_commit_graph_info
 - revision: parse parent in indegree_walk_step()
 - commit-graph: fix regression when computing Bloom filters

 The commit-graph learned to use corrected commit dates instead of
 the generation number to help topological revision traversal.

 How ready is this?


* mk/diff-ignore-regex (2020-10-16) 2 commits
 - diff: add -I<regex> that ignores matching changes
 - merge-base, xdiff: zero out xpparam_t structures

 "git diff" family of commands learned the "-I<regex>" option to
 ignore hunks whose changed lines all match the given pattern.

 Expecting a reroll.


* mt/parallel-checkout-part-1 (2020-10-05) 20 commits
  (merged to 'next' on 2020-10-05 at 571e16d68a)
 + parallel-checkout: drop unused checkout state parameter
  (merged to 'next' on 2020-10-04 at 20438c1143)
 + ci: run test round with parallel-checkout enabled
 + parallel-checkout: add tests related to .gitattributes
 + parallel-checkout: add tests related to clone collisions
 + parallel-checkout: add tests for basic operations
 + checkout-index: add parallel checkout support
 + builtin/checkout.c: complete parallel checkout support
 + make_transient_cache_entry(): optionally alloc from mem_pool
 + parallel-checkout: support progress displaying
 + parallel-checkout: make it truly parallel
 + unpack-trees: add basic support for parallel checkout
 + entry: add checkout_entry_ca() which takes preloaded conv_attrs
 + entry: move conv_attrs lookup up to checkout_entry()
 + entry: extract cache_entry update from write_entry()
 + entry: make fstat_output() and read_blob_entry() public
 + entry: extract a header file for entry.c functions
 + convert: add conv_attrs classification
 + convert: add get_stream_filter_ca() variant
 + convert: add [async_]convert_to_working_tree_ca() variants
 + convert: make convert_attrs() and convert structs public

 Parallel checkout.

 Will cook in 'next'.


* dl/diff-merge-base (2020-09-21) 10 commits
 - contrib/completion: complete `git diff --merge-base`
 - builtin/diff-tree: learn --merge-base
 - builtin/diff-index: learn --merge-base
 - t4068: add --merge-base tests
 - diff-lib: define diff_get_merge_base()
 - diff-lib: accept option flags in run_diff_index()
 - contrib/completion: extract common diff/difftool options
 - git-diff.txt: backtick quote command text
 - git-diff-index.txt: make --cached description a proper sentence
 - t4068: remove unnecessary >tmp

 "git diff A...B" learned "git diff --merge-base A B", which is a
 longer short-hand to say the same thing.


* sb/clone-origin (2020-09-30) 7 commits
  (merged to 'next' on 2020-10-06 at 7178c9af9c)
 + clone: allow configurable default for `-o`/`--origin`
 + clone: read new remote name from remote_name instead of option_origin
 + clone: validate --origin option before use
 + refs: consolidate remote name validation
 + remote: add tests for add and rename with invalid names
 + clone: use more conventional config/option layering
 + clone: add tests for --template and some disallowed option pairs

 "git clone" learned clone.defaultremotename configuration variable
 to customize what nickname to use to call the remote the repository
 was cloned from.

 Will cook in 'next'.


* sk/force-if-includes (2020-10-03) 4 commits
  (merged to 'next' on 2020-10-04 at 09c4c1e088)
 + t, doc: update tests, reference for "--force-if-includes"
 + push: parse and set flag for "--force-if-includes"
 + push: add reflog check for "--force-if-includes"
 + Merge branch 'ds/in-merge-bases-many-optim-bug' into sk/force-if-includes

 "git push --force-with-lease[=<ref>]" can easily be misused to lose
 commits unless the user takes good care of their own "git fetch".
 A new option "--force-if-includes" attempts to ensure that what is
 being force-pushed was created after examining the commit at the
 tip of the remote ref that is about to be force-replaced.

 Will cook in 'next'.


* hn/reftable (2020-10-01) 13 commits
 . reftable: "test-tool dump-reftable" command.
 . reftable: rest of library
 . reftable: file level tests
 . reftable: read reftable files
 . reftable: write reftable files
 . reftable: a generic binary tree implementation
 . reftable: reading/writing blocks
 . reftable: (de)serialization for the polymorphic record type.
 . reftable: utility functions
 . reftable: add a barebones unittest framework
 . vcxproj: adjust for the reftable changes
 . reftable: define the public API
 . reftable: add LICENSE

 The reftable backend for the refs API.

 Expecting a reroll.
 Seems not to build for Windows folks.
 cf. <nycvar.QRO.7.76.6.2010021555290.50@tvgsbejvaqbjf.bet>
 cf. <nycvar.QRO.7.76.6.2010021557570.50@tvgsbejvaqbjf.bet>


* ds/maintenance-part-3 (2020-10-16) 8 commits
 - maintenance: add troubleshooting guide to docs
 - maintenance: use 'incremental' strategy by default
 - maintenance: create maintenance.strategy config
 - maintenance: add start/stop subcommands
 - maintenance: add [un]register subcommands
 - for-each-repo: run subcommands on configured repos
 - maintenance: add --schedule option and config
 - maintenance: optionally skip --auto process
 (this branch uses ds/maintenance-part-2.)

 Parts of "git maintenance" to ease writing crontab entries (and
 other scheduling system configuration) for it.


* es/config-hooks (2020-10-16) 8 commits
 - hook: replace find_hook() with hook_exists()
 - hook: add 'run' subcommand
 - parse-options: parse into strvec
 - hook: implement hookcmd.<name>.skip
 - hook: include hookdir hook in list
 - hook: add list command
 - hook: scaffolding for git-hook subcommand
 - doc: propose hooks managed by the config

 The "hooks defined in config" topic.


* mt/grep-sparse-checkout (2020-09-10) 9 commits
 - config: add setting to ignore sparsity patterns in some cmds
 - grep: honor sparse checkout patterns
 - config: correctly read worktree configs in submodules
 - config: make do_git_config_sequence receive a 'struct repository'
 - t/helper/test-config: unify exit labels
 - t/helper/test-config: diagnose missing arguments
 - t/helper/test-config: be consistent with exit codes
 - t1308-config-set: avoid false positives when using test-config
 - doc: grep: unify info on configuration variables

 "git grep" has been tweaked to be limited to the sparse checkout
 paths.


* ds/maintenance-part-2 (2020-09-25) 8 commits
  (merged to 'next' on 2020-10-04 at c2a46f390c)
 + maintenance: add incremental-repack auto condition
 + maintenance: auto-size incremental-repack batch
 + maintenance: add incremental-repack task
 + midx: use start_delayed_progress()
 + midx: enable core.multiPackIndex by default
 + maintenance: create auto condition for loose-objects
 + maintenance: add loose-objects task
 + maintenance: add prefetch task
 (this branch is used by ds/maintenance-part-3.)

 "git maintenance", an extended big brother of "git gc", continues
 to evolve.

 Will cook in 'next'.

^ permalink raw reply	[relevance 6%]

* Re: [BUG] assertion failure in builtin-mv.c with "git mv -k"
  @ 2009-01-14 19:02  6%       ` Junio C Hamano
  2009-01-15 10:53  6%         ` Michael J Gruber
  0 siblings, 1 reply; 200+ results
From: Junio C Hamano @ 2009-01-14 19:02 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Johannes Schindelin, Matthieu Moy, git

Michael J Gruber <git@drmicha.warpmail.net> writes:

> So, should I prepare a series like:
>
> 1: test case and mark known fail
> 2: the 1 line fix
> 3: mark test pass
>
> Or should 2+3 be squashed into one?

If "git mv" already has its own sets of tests with a good coverage, please
strive to add a case that covers your fix to an existing script.  Then
step #1 above would be a patch to add a few "test_expect_failure" tests to
an existing file, and step #3 would be a patch to flip expect_failure to
expect_success.

And in such a case, for a single liner, all three can be squashed in to a
single patch.  It would show what changed in the code and have a few new
test_expect_success tests added to the test suite, and it would be obvious
to anybody who looks at such a change 6 months down the road that the test
cases added by the patch are the cases that did not work without the
changes to the code.  It never makes sense to separate steps #2 and #3 for
any fix.

If "git mv" did not have adequate test coverage, then please add a test
script with both expect_success (for cases that should have been there
when somebody worked on "git mv" originally), and expect_failure to expose
the bug you found in your first patch.  Again, the second patch would
update the code and flip expect_failure to expect_success.

I see there is t7001-mv and even though it claims to concentrate on its
operation from subdirectory, it has tests for more basic modes of the
operation.

So my recommendation would be to have a single patch that:

 (1) retitles t7001;
 (2) adds your new -k tests to it; and
 (3) adds the 1-liner fix.

^ permalink raw reply	[relevance 6%]

* [PATCH v3 0/5] Teach mv to move submodules
@ 2013-07-30 19:48  6% Jens Lehmann
  2013-07-30 19:49 10% ` [PATCH v3 1/5] Teach mv to move submodules together with their work trees Jens Lehmann
                   ` (2 more replies)
  0 siblings, 3 replies; 200+ results
From: Jens Lehmann @ 2013-07-30 19:48 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Heiko Voigt, Nguyen Thai Ngoc Duy

Here is my third iteration of this series.

Changes to v2 are:

- I resolved the conflict with Duy's pathspec series by replacing the
  use of common_prefix() with relative_path().

- I separated the functions checking for modified unstaged .gitmodules
  and staging the changes to that file into another commit, as they
  are used by both mv and rm.

- mv and rm now die with the message "Please, stage your changes to
  .gitmodules or stash them to proceed" instead of changing and
  staging a .gitmodules file containing other unstaged modifications.

- Man pages for mv and rm are updated to tell the user what they do
  with the gitlink and the .gitmodules file in case of submodules.

- Minor changes according to the last review (typos and a bit more
  efficient coding).

This series applies cleanly on current pu (and I also ran t3600 and
t7001 manually to make sure I don't hit the silent breakage my last
series showed when I ran the whole test suite).

Jens Lehmann (5):
  Teach mv to move submodules together with their work trees
  Teach mv to move submodules using a gitfile
  submodule.c: add .gitmodules staging helper functions
  Teach mv to update the path entry in .gitmodules for moved submodules
  rm: delete .gitmodules entry of submodules removed from the work tree

 Documentation/git-mv.txt   |  10 ++-
 Documentation/git-rm.txt   |   8 ++-
 builtin/mv.c               | 126 ++++++++++++++++++++++----------------
 builtin/rm.c               |  19 +++++-
 submodule.c                | 147 +++++++++++++++++++++++++++++++++++++++++++++
 submodule.h                |   5 ++
 t/t3600-rm.sh              |  98 ++++++++++++++++++++++++++++--
 t/t7001-mv.sh              | 128 +++++++++++++++++++++++++++++++++++++++
 t/t7400-submodule-basic.sh |  14 ++---
 t/t7610-mergetool.sh       |   6 +-
 10 files changed, 484 insertions(+), 77 deletions(-)

-- 
1.8.4.rc0.199.g7079aac

^ permalink raw reply	[relevance 6%]

* [PATCH v2 1/2] t: don't spuriously close and reopen quotes
  @ 2020-08-06 20:08  6%   ` Martin Ågren
  0 siblings, 0 replies; 200+ results
From: Martin Ågren @ 2020-08-06 20:08 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Eric Sunshine, Chris Torek

In the test scripts, the recommended style is, e.g.:

    test_expect_success 'name' '
        do-something somehow &&
        do-some-more testing
    '

When using this style, any single quote in the multi-line test section
is actually closing the lone single quotes that surround it.

It can be a non-issue in practice:

    test_expect_success 'sed a little' '
        sed -e 's/hi/lo/' in >out # "ok": no whitespace in s/hi/lo/
    '

Or it can be a bug in the test, e.g., because variable interpolation
happens before the test even begins executing:

    v=abc

    test_expect_success 'variable interpolation' '
        v=def &&
        echo '"$v"' # abc
    '

Change several such in-test single quotes to use double quotes instead
or, in a few cases, drop them altogether. These were identified using
some crude grepping. We're not fixing any test bugs here, but we're
hopefully making these tests slightly easier to grok and to maintain.

There are legitimate use cases for closing a quote and opening a new
one, e.g., both '\'' and '"'"' can be used to produce a literal single
quote. I'm not touching any of those here.

In t9401, tuck the redirecting ">" to the filename while we're touching
those lines.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
---
 t/t1400-update-ref.sh           |  2 +-
 t/t3501-revert-cherry-pick.sh   |  4 ++--
 t/t3507-cherry-pick-conflict.sh |  4 ++--
 t/t4005-diff-rename-2.sh        |  4 ++--
 t/t4034-diff-words.sh           |  2 +-
 t/t4150-am.sh                   |  8 ++++----
 t/t4200-rerere.sh               |  2 +-
 t/t5302-pack-index.sh           |  2 +-
 t/t5510-fetch.sh                |  4 ++--
 t/t5553-set-upstream.sh         |  6 +++---
 t/t6026-merge-attr.sh           |  4 ++--
 t/t7001-mv.sh                   |  2 +-
 t/t7600-merge.sh                |  6 +++---
 t/t9001-send-email.sh           | 10 +++++-----
 t/t9100-git-svn-basic.sh        |  6 +++---
 t/t9401-git-cvsserver-crlf.sh   |  8 ++++----
 t/t9402-git-cvsserver-refs.sh   |  2 +-
 17 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 27171f8261..d0d36750bc 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -324,7 +324,7 @@ test_expect_success "create $m (logged by config)" '
 test_expect_success "update $m (logged by config)" '
 	test_config core.logAllRefUpdates true &&
 	GIT_COMMITTER_DATE="2005-05-26 23:33" \
-	git update-ref HEAD'" $B $A "'-m "Switch" &&
+	git update-ref HEAD $B $A -m "Switch" &&
 	test $B = $(git show-ref -s --verify $m)
 '
 test_expect_success "set $m (logged by config)" '
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 7c1da21df1..3669dfb1be 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -47,7 +47,7 @@ test_expect_success 'cherry-pick --nonsense' '
 	git diff --exit-code HEAD &&
 	test_must_fail git cherry-pick --nonsense 2>msg &&
 	git diff --exit-code HEAD "$pos" &&
-	test_i18ngrep '[Uu]sage:' msg
+	test_i18ngrep "[Uu]sage:" msg
 '
 
 test_expect_success 'revert --nonsense' '
@@ -56,7 +56,7 @@ test_expect_success 'revert --nonsense' '
 	git diff --exit-code HEAD &&
 	test_must_fail git revert --nonsense 2>msg &&
 	git diff --exit-code HEAD "$pos" &&
-	test_i18ngrep '[Uu]sage:' msg
+	test_i18ngrep "[Uu]sage:" msg
 '
 
 test_expect_success 'cherry-pick after renaming branch' '
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index 752bc43487..f107622a9e 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -512,7 +512,7 @@ test_expect_success 'commit after failed cherry-pick adds -s at the right place'
 	Signed-off-by: C O Mitter <committer@example.com>
 	# Conflicts:
 	EOF
-	grep -e "^# Conflicts:" -e '^Signed-off-by' .git/COMMIT_EDITMSG >actual &&
+	grep -e "^# Conflicts:" -e "^Signed-off-by" .git/COMMIT_EDITMSG >actual &&
 	test_cmp expect actual &&
 
 	cat <<-\EOF >expected &&
@@ -541,7 +541,7 @@ test_expect_success 'commit --amend -s places the sign-off at the right place' '
 	Signed-off-by: C O Mitter <committer@example.com>
 	Conflicts:
 	EOF
-	grep -e "^Conflicts:" -e '^Signed-off-by' .git/COMMIT_EDITMSG >actual &&
+	grep -e "^Conflicts:" -e "^Signed-off-by" .git/COMMIT_EDITMSG >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t4005-diff-rename-2.sh b/t/t4005-diff-rename-2.sh
index f542d2929d..d18a80493c 100755
--- a/t/t4005-diff-rename-2.sh
+++ b/t/t4005-diff-rename-2.sh
@@ -14,8 +14,8 @@ test_expect_success 'setup reference tree' '
 	git update-index --add COPYING rezrov &&
 	tree=$(git write-tree) &&
 	echo $tree &&
-	sed -e 's/HOWEVER/However/' <COPYING >COPYING.1 &&
-	sed -e 's/GPL/G.P.L/g' <COPYING >COPYING.2 &&
+	sed -e "s/HOWEVER/However/" <COPYING >COPYING.1 &&
+	sed -e "s/GPL/G.P.L/g" <COPYING >COPYING.2 &&
 	origoid=$(git hash-object COPYING) &&
 	oid1=$(git hash-object COPYING.1) &&
 	oid2=$(git hash-object COPYING.2)
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index fb145aa173..0c8fb39ced 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -102,7 +102,7 @@ test_expect_success 'word diff with runs of whitespace' '
 '
 
 test_expect_success '--word-diff=porcelain' '
-	sed 's/#.*$//' >expect <<-EOF &&
+	sed "s/#.*$//" >expect <<-EOF &&
 		diff --git a/pre b/post
 		index $pre..$post 100644
 		--- a/pre
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index bda4586a79..855ed11b32 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -989,7 +989,7 @@ test_expect_success 'am -s unexpected trailer block' '
 	Signed-off-by: J C H <j@c.h>
 	EOF
 	git commit -F msg &&
-	git cat-file commit HEAD | sed -e '1,/^$/d' >original &&
+	git cat-file commit HEAD | sed -e "1,/^$/d" >original &&
 	git format-patch --stdout -1 >patch &&
 
 	git reset --hard HEAD^ &&
@@ -998,7 +998,7 @@ test_expect_success 'am -s unexpected trailer block' '
 		cat original &&
 		echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
 	) >expect &&
-	git cat-file commit HEAD | sed -e '1,/^$/d' >actual &&
+	git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
 	test_cmp expect actual &&
 
 	cat >msg <<-\EOF &&
@@ -1009,7 +1009,7 @@ test_expect_success 'am -s unexpected trailer block' '
 	EOF
 	git reset HEAD^ &&
 	git commit -F msg file &&
-	git cat-file commit HEAD | sed -e '1,/^$/d' >original &&
+	git cat-file commit HEAD | sed -e "1,/^$/d" >original &&
 	git format-patch --stdout -1 >patch &&
 
 	git reset --hard HEAD^ &&
@@ -1020,7 +1020,7 @@ test_expect_success 'am -s unexpected trailer block' '
 		echo &&
 		echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
 	) >expect &&
-	git cat-file commit HEAD | sed -e '1,/^$/d' >actual &&
+	git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index 831d424c47..f99385c191 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -364,7 +364,7 @@ test_expect_success 'set up an unresolved merge' '
 	git reset --hard &&
 	git checkout version2 &&
 	fifth=$(git rev-parse fifth) &&
-	echo "$fifth		branch 'fifth' of ." |
+	echo "$fifth		branch fifth of ." |
 	git fmt-merge-msg >msg &&
 	ancestor=$(git merge-base version2 fifth) &&
 	test_must_fail git merge-recursive "$ancestor" -- HEAD fifth &&
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index 8981c9b90e..d1a6a3c37a 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -15,7 +15,7 @@ test_expect_success 'setup' '
 	i=1 &&
 	while test $i -le 100
 	do
-		iii=$(printf '%03i' $i)
+		iii=$(printf "%03i" $i)
 		test-tool genrandom "bar" 200 > wide_delta_$iii &&
 		test-tool genrandom "baz $iii" 50 >> wide_delta_$iii &&
 		test-tool genrandom "foo"$i 100 > deep_delta_$iii &&
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index a66dbe0bde..6cb954e2f0 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -213,7 +213,7 @@ test_expect_success 'fetch tags when there is no tags' '
 test_expect_success 'fetch following tags' '
 
 	cd "$D" &&
-	git tag -a -m 'annotated' anno HEAD &&
+	git tag -a -m "annotated" anno HEAD &&
 	git tag light HEAD &&
 
 	mkdir four &&
@@ -331,7 +331,7 @@ test_expect_success 'bundle does not prerequisite objects' '
 test_expect_success 'bundle should be able to create a full history' '
 
 	cd "$D" &&
-	git tag -a -m '1.0' v1.0 master &&
+	git tag -a -m "1.0" v1.0 master &&
 	git bundle create bundle4 v1.0
 
 '
diff --git a/t/t5553-set-upstream.sh b/t/t5553-set-upstream.sh
index 81975ad8f9..7622981cbf 100755
--- a/t/t5553-set-upstream.sh
+++ b/t/t5553-set-upstream.sh
@@ -81,7 +81,7 @@ test_expect_success 'fetch --set-upstream http://nosuchdomain.example.com fails
 
 test_expect_success 'fetch --set-upstream with valid URL sets upstream to URL' '
 	clear_config other other2 &&
-	url="file://'"$PWD"'" &&
+	url="file://$PWD" &&
 	git fetch --set-upstream "$url" &&
 	check_config master "$url" HEAD &&
 	check_config_missing other &&
@@ -158,7 +158,7 @@ test_expect_success 'pull --set-upstream upstream with more than one branch does
 test_expect_success 'pull --set-upstream with valid URL sets upstream to URL' '
 	clear_config master other other2 &&
 	git checkout master &&
-	url="file://'"$PWD"'" &&
+	url="file://$PWD" &&
 	git pull --set-upstream "$url" &&
 	check_config master "$url" HEAD &&
 	check_config_missing other &&
@@ -168,7 +168,7 @@ test_expect_success 'pull --set-upstream with valid URL sets upstream to URL' '
 test_expect_success 'pull --set-upstream with valid URL and branch sets branch' '
 	clear_config master other other2 &&
 	git checkout master &&
-	url="file://'"$PWD"'" &&
+	url="file://$PWD" &&
 	git pull --set-upstream "$url" master &&
 	check_config master "$url" refs/heads/master &&
 	check_config_missing other &&
diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh
index 5900358ce9..76a55f838c 100755
--- a/t/t6026-merge-attr.sh
+++ b/t/t6026-merge-attr.sh
@@ -122,7 +122,7 @@ test_expect_success 'custom merge backend' '
 	o=$(git unpack-file master^:text) &&
 	a=$(git unpack-file side^:text) &&
 	b=$(git unpack-file master:text) &&
-	sh -c "./custom-merge $o $a $b 0 'text'" &&
+	sh -c "./custom-merge $o $a $b 0 text" &&
 	sed -e 1,3d $a >check-2 &&
 	cmp check-1 check-2 &&
 	rm -f $o $a $b
@@ -149,7 +149,7 @@ test_expect_success 'custom merge backend' '
 	o=$(git unpack-file master^:text) &&
 	a=$(git unpack-file anchor:text) &&
 	b=$(git unpack-file master:text) &&
-	sh -c "./custom-merge $o $a $b 0 'text'" &&
+	sh -c "./custom-merge $o $a $b 0 text" &&
 	sed -e 1,3d $a >check-2 &&
 	cmp check-1 check-2 &&
 	sed -e 1,3d -e 4q $a >check-3 &&
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 36b50d0b4c..b64b736d2f 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -177,7 +177,7 @@ test_expect_success "Sergey Vlasov's test case" '
 	date >ab.c &&
 	date >ab/d &&
 	git add ab.c ab &&
-	git commit -m 'initial' &&
+	git commit -m "initial" &&
 	git mv ab a
 '
 
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 1d45f9a4ed..dffcf053db 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -246,7 +246,7 @@ test_expect_success 'merge --squash c3 with c7' '
 	#	file
 	EOF
 	git cat-file commit HEAD >raw &&
-	sed -e '1,/^$/d' raw >actual &&
+	sed -e "1,/^$/d" raw >actual &&
 	test_cmp expect actual
 '
 
@@ -268,7 +268,7 @@ test_expect_success 'merge c3 with c7 with commit.cleanup = scissors' '
 	#	file
 	EOF
 	git cat-file commit HEAD >raw &&
-	sed -e '1,/^$/d' raw >actual &&
+	sed -e "1,/^$/d" raw >actual &&
 	test_i18ncmp expect actual
 '
 
@@ -292,7 +292,7 @@ test_expect_success 'merge c3 with c7 with --squash commit.cleanup = scissors' '
 	#	file
 	EOF
 	git cat-file commit HEAD >raw &&
-	sed -e '1,/^$/d' raw >actual &&
+	sed -e "1,/^$/d" raw >actual &&
 	test_i18ncmp expect actual
 '
 
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index ec261085ec..3d68570450 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1551,7 +1551,7 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=quoted-printab
 		--smtp-server="$(pwd)/fake.sendmail" \
 		email-using-8bit \
 		2>errors >out &&
-	sed '1,/^$/d' msgtxt1 >actual &&
+	sed "1,/^$/d" msgtxt1 >actual &&
 	test_cmp expected actual
 '
 
@@ -1568,7 +1568,7 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=base64' '
 		--smtp-server="$(pwd)/fake.sendmail" \
 		email-using-8bit \
 		2>errors >out &&
-	sed '1,/^$/d' msgtxt1 >actual &&
+	sed "1,/^$/d" msgtxt1 >actual &&
 	test_cmp expected actual
 '
 
@@ -1594,7 +1594,7 @@ test_expect_success $PREREQ 'convert from quoted-printable to base64' '
 		--smtp-server="$(pwd)/fake.sendmail" \
 		email-using-qp \
 		2>errors >out &&
-	sed '1,/^$/d' msgtxt1 >actual &&
+	sed "1,/^$/d" msgtxt1 >actual &&
 	test_cmp expected actual
 '
 
@@ -1624,7 +1624,7 @@ test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=quoted-printabl
 		--smtp-server="$(pwd)/fake.sendmail" \
 		email-using-crlf \
 		2>errors >out &&
-	sed '1,/^$/d' msgtxt1 >actual &&
+	sed "1,/^$/d" msgtxt1 >actual &&
 	test_cmp expected actual
 '
 
@@ -1641,7 +1641,7 @@ test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=base64' '
 		--smtp-server="$(pwd)/fake.sendmail" \
 		email-using-crlf \
 		2>errors >out &&
-	sed '1,/^$/d' msgtxt1 >actual &&
+	sed "1,/^$/d" msgtxt1 >actual &&
 	test_cmp expected actual
 '
 
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 9f2d19ecc4..e9c575c359 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -63,16 +63,16 @@ test_expect_success "$name" '
 
 
 name='detect node change from file to directory #1'
-test_expect_success "$name" "
+test_expect_success "$name" '
 	mkdir dir/new_file &&
 	mv dir/file dir/new_file/file &&
 	mv dir/new_file dir/file &&
 	git update-index --remove dir/file &&
 	git update-index --add dir/file/file &&
-	git commit -m '$name' &&
+	git commit -m "$name" &&
 	test_must_fail git svn set-tree --find-copies-harder --rmdir \
 		remotes/git-svn..mybranch
-"
+'
 
 
 name='detect node change from directory to file #1'
diff --git a/t/t9401-git-cvsserver-crlf.sh b/t/t9401-git-cvsserver-crlf.sh
index 84787eee9a..c7a0dd84a4 100755
--- a/t/t9401-git-cvsserver-crlf.sh
+++ b/t/t9401-git-cvsserver-crlf.sh
@@ -167,10 +167,10 @@ test_expect_success 'adding files' '
 
 test_expect_success 'updating' '
     git pull gitcvs.git &&
-    echo 'hi' > subdir/newfile.bin &&
-    echo 'junk' > subdir/file.h &&
-    echo 'hi' > subdir/newfile.c &&
-    echo 'hello' >> binfile.bin &&
+    echo "hi" >subdir/newfile.bin &&
+    echo "junk" >subdir/file.h &&
+    echo "hi" >subdir/newfile.c &&
+    echo "hello" >>binfile.bin &&
     git add subdir/newfile.bin subdir/file.h subdir/newfile.c binfile.bin &&
     git commit -q -m "Add and change some files" &&
     git push gitcvs.git >/dev/null &&
diff --git a/t/t9402-git-cvsserver-refs.sh b/t/t9402-git-cvsserver-refs.sh
index cf31ace667..6436c91a3c 100755
--- a/t/t9402-git-cvsserver-refs.sh
+++ b/t/t9402-git-cvsserver-refs.sh
@@ -178,7 +178,7 @@ test_expect_success 'setup v1.2 on b1' '
 	mkdir cdir &&
 	echo "cdir/cfile" >cdir/cfile &&
 	git add -A cdir adir t3 t2 &&
-	git commit -q -m 'v1.2' &&
+	git commit -q -m "v1.2" &&
 	git tag v1.2 &&
 	git push --tags gitcvs.git b1:b1
 '
-- 
2.28.0.199.g4234a9100e


^ permalink raw reply related	[relevance 6%]

* [RFC PATCH v2 10/12] t7416: add new test about HEAD:.gitmodules and not existing .gitmodules
  @ 2018-08-02 13:46  6% ` Antonio Ospite
  0 siblings, 0 replies; 200+ results
From: Antonio Ospite @ 2018-08-02 13:46 UTC (permalink / raw)
  To: git
  Cc: Brandon Williams, Daniel Graña, Jonathan Nieder,
	Richard Hartmann, Stefan Beller, Antonio Ospite

git submodule commands can now access .gitmodules from the current
branch even when it's not in the working tree, add some tests for that
scenario.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
---

For the test files I used the most used style in other tests, Stefan suggested
to avoid subshells and use "git -C" but subshells make the test look cleaner
IMHO.

 t/t7416-submodule-sparse-gitmodules.sh | 112 +++++++++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100755 t/t7416-submodule-sparse-gitmodules.sh

diff --git a/t/t7416-submodule-sparse-gitmodules.sh b/t/t7416-submodule-sparse-gitmodules.sh
new file mode 100755
index 0000000000..3c7a53316b
--- /dev/null
+++ b/t/t7416-submodule-sparse-gitmodules.sh
@@ -0,0 +1,112 @@
+#!/bin/sh
+#
+# Copyright (C) 2018  Antonio Ospite <ao2@ao2.it>
+#
+
+test_description=' Test reading/writing .gitmodules is not in the working tree
+
+This test verifies that, when .gitmodules is in the current branch but is not
+in the working tree reading from it still works but writing to it does not.
+
+The test setup uses a sparse checkout, but the same scenario can be set up
+also by committing .gitmodules and then just removing it from the filesystem.
+
+NOTE: "git mv" and "git rm" are still supposed to work even without
+a .gitmodules file, as stated in the t3600-rm.sh and t7001-mv.sh tests.
+'
+
+. ./test-lib.sh
+
+test_expect_success 'sparse checkout setup which hides .gitmodules' '
+	echo file > file &&
+	git add file &&
+	test_tick &&
+	git commit -m upstream &&
+	git clone . super &&
+	git clone super submodule &&
+	git clone super new_submodule &&
+	(cd super &&
+		git submodule add ../submodule
+		test_tick &&
+		git commit -m submodule &&
+		cat >.git/info/sparse-checkout <<\EOF &&
+/*
+!/.gitmodules
+EOF
+		git config core.sparsecheckout true &&
+		git read-tree -m -u HEAD &&
+		test ! -e .gitmodules
+	)
+'
+
+test_expect_success 'reading gitmodules config file when it is not checked out' '
+	(cd super &&
+		echo "../submodule" >expected &&
+		git submodule--helper config submodule.submodule.url >actual &&
+		test_cmp expected actual
+	)
+'
+
+test_expect_success 'not writing gitmodules config file when it is not checked out' '
+	(cd super &&
+		test_must_fail git submodule--helper config submodule.submodule.url newurl
+	)
+'
+
+test_expect_success 'not staging gitmodules config when it is not checked out' '
+	(cd super &&
+		test_must_fail git submodule--helper config --stage
+	)
+'
+
+test_expect_success 'initialising submodule when the gitmodules config is not checked out' '
+	(cd super &&
+		git submodule init
+	)
+'
+
+test_expect_success 'showing submodule summary when the gitmodules config is not checked out' '
+	(cd super &&
+		git submodule summary
+	)
+'
+
+test_expect_success 'updating submodule when the gitmodules config is not checked out' '
+	(cd submodule &&
+		echo file2 >file2 &&
+		git add file2 &&
+		git commit -m "add file2 to submodule"
+	) &&
+	(cd super &&
+		git submodule update
+	)
+'
+
+test_expect_success 'not adding submodules when the gitmodules config is not checked out' '
+	(cd super &&
+		test_must_fail git submodule add ../new_submodule
+	)
+'
+
+# "git add" in the test above fails as expected, however it still leaves the
+# cloned tree in there and adds a config entry to .git/config. This is because
+# no cleanup is done by cmd_add in git-submodule.sh when "git
+# submodule--helper config" fails to add a new config setting.
+#
+# If we added the following commands to the test above:
+#
+#   rm -rf .git/modules/new_submodule &&
+#   git reset HEAD new_submodule &&
+#   rm -rf new_submodule
+#
+# then the repository would be in a clean state and the test below would pass.
+#
+# Maybe cmd_add should do the cleanup from above itself when failing to add
+# a submodule.
+test_expect_failure 'init submodule after adding failed when the gitmodules config is not checked out' '
+	(cd super &&
+		git submodule init
+	)
+'
+
+test_done
-- 
2.18.0


^ permalink raw reply related	[relevance 6%]

* Re: [BUG] assertion failure in builtin-mv.c with "git mv -k"
  2009-01-14 19:02  6%       ` Junio C Hamano
@ 2009-01-15 10:53  6%         ` Michael J Gruber
  0 siblings, 0 replies; 200+ results
From: Michael J Gruber @ 2009-01-15 10:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, Matthieu Moy, git

Junio C Hamano venit, vidit, dixit 14.01.2009 20:02:
...
> If "git mv" did not have adequate test coverage, then please add a test
> script with both expect_success (for cases that should have been there
> when somebody worked on "git mv" originally), and expect_failure to expose
> the bug you found in your first patch.  Again, the second patch would
> update the code and flip expect_failure to expect_success.
> 
> I see there is t7001-mv and even though it claims to concentrate on its
> operation from subdirectory, it has tests for more basic modes of the
> operation.
> 
> So my recommendation would be to have a single patch that:
> 
>  (1) retitles t7001;
>  (2) adds your new -k tests to it; and
>  (3) adds the 1-liner fix.
> 

Sorry to bother you again, even after your detailed reply, but I'm a bit
confused in multiple ways (I guess that makes for multiple bits...).
First, you replied to my post, not my patch v2, but (time-wise) after my
patch v2, so I'm not sure whether your reply applies to v2 as well or
that one is OK.

Second, I took the title of t7001 to mean "mv into subdir" or "mv in and
out subdir" in order to distiguish it from "mv oldname newname", albeit
in English that leaves room from improvement.

Third, various parts of that test are in vastly different styles, and I
haven't found any test writing directions other than "follow what is
there", which leaves several alternatives. (Some use the test-lib repo,
some create their own underneath, some make assumptions about the
contents of "$TEST_DIRECTORY"/../.)

Fourth, t7001-mv is missing any test for "mv -k", and 2 of my 3
additional tests cover cases which work (pass) without the fix, which is
why I kept it separate, being unrelated. Following all your arguments
lead to the conclusion I should squash 2+3 (fix + mark expect_pass) -
until I read your conclusion, which says squash all.

I'm happy to follow any variant ("1+2+3", "1 2+3", "1 2 3", in
increasing order of preference) so there's no need to discuss or explain
this further, just tell me "do x" ;)

Cheers,
Michael

^ permalink raw reply	[relevance 6%]

* [GSoC] [PATCH] test: avoid pipes in git related commands for test suite
@ 2018-03-13 20:19  6% Pratik Karki
  0 siblings, 0 replies; 200+ results
From: Pratik Karki @ 2018-03-13 20:19 UTC (permalink / raw)
  To: git; +Cc: Pratik Karki

This patch removes the necessity of pipes in git related commands for test suite.

Exit code of the upstream in a pipe is ignored so, it's use should be avoided. The fix for this is to write the output of the git command to a file and test the exit codes of both the commands being linked by pipe.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
---
 t/t7001-mv.sh                        | 24 ++++++++++++------------
 t/t9104-git-svn-follow-parent.sh     |  4 ++--
 t/t9110-git-svn-use-svm-props.sh     | 36 ++++++++++++++++++------------------
 t/t9111-git-svn-use-svnsync-props.sh | 36 ++++++++++++++++++------------------
 t/t9114-git-svn-dcommit-merge.sh     |  8 ++++----
 t/t9130-git-svn-authors-file.sh      | 16 ++++++++--------
 t/t9138-git-svn-authors-prog.sh      | 28 ++++++++++++++--------------
 t/t9153-git-svn-rewrite-uuid.sh      |  8 ++++----
 8 files changed, 80 insertions(+), 80 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 6e5031f56..0dcf1fa3e 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -21,8 +21,8 @@ test_expect_success \
 
 test_expect_success \
     'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD | \
-    grep "^R100..*path0/COPYING..*path1/COPYING"'
+    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+    grep "^R100..*path0/COPYING..*path1/COPYING" actual'
 
 test_expect_success \
     'moving the file back into subdirectory' \
@@ -35,8 +35,8 @@ test_expect_success \
 
 test_expect_success \
     'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD | \
-    grep "^R100..*path1/COPYING..*path0/COPYING"'
+    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+    grep "^R100..*path1/COPYING..*path0/COPYING" actual'
 
 test_expect_success \
     'checking -k on non-existing file' \
@@ -116,10 +116,10 @@ test_expect_success \
 
 test_expect_success \
     'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD | \
-     grep "^R100..*path0/COPYING..*path2/COPYING" &&
-     git diff-tree -r -M --name-status  HEAD^ HEAD | \
-     grep "^R100..*path0/README..*path2/README"'
+    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path0/README..*path2/README" actual'
 
 test_expect_success \
     'succeed when source is a prefix of destination' \
@@ -135,10 +135,10 @@ test_expect_success \
 
 test_expect_success \
     'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD | \
-     grep "^R100..*path2/COPYING..*path1/path2/COPYING" &&
-     git diff-tree -r -M --name-status  HEAD^ HEAD | \
-     grep "^R100..*path2/README..*path1/path2/README"'
+    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path2/README..*path1/path2/README" actual'
 
 test_expect_success \
     'do not move directory over existing directory' \
diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index cd480edf1..284d1224e 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -204,8 +204,8 @@ test_expect_success "follow-parent is atomic" '
 test_expect_success "track multi-parent paths" '
 	svn_cmd cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
 	git svn multi-fetch &&
-	test $(git cat-file commit refs/remotes/glob | \
-	       grep "^parent " | wc -l) -eq 2
+	test $(git cat-file commit refs/remotes/glob >actual &&
+	       grep "^parent " actual | wc -l) -eq 2
 	'
 
 test_expect_success "multi-fetch continues to work" "
diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh
index dde0a3c22..a1a00c298 100755
--- a/t/t9110-git-svn-use-svm-props.sh
+++ b/t/t9110-git-svn-use-svm-props.sh
@@ -21,32 +21,32 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89
 
 bar_url=http://mayonaise/svnrepo/bar
 test_expect_success 'verify metadata for /bar' "
-	git cat-file commit refs/remotes/bar | \
-	   grep '^git-svn-id: $bar_url@12 $uuid$' &&
-	git cat-file commit refs/remotes/bar~1 | \
-	   grep '^git-svn-id: $bar_url@11 $uuid$' &&
-	git cat-file commit refs/remotes/bar~2 | \
-	   grep '^git-svn-id: $bar_url@10 $uuid$' &&
-	git cat-file commit refs/remotes/bar~3 | \
-	   grep '^git-svn-id: $bar_url@9 $uuid$' &&
-	git cat-file commit refs/remotes/bar~4 | \
-	   grep '^git-svn-id: $bar_url@6 $uuid$' &&
-	git cat-file commit refs/remotes/bar~5 | \
-	   grep '^git-svn-id: $bar_url@1 $uuid$'
+	git cat-file commit refs/remotes/bar >actual &&
+	   grep '^git-svn-id: $bar_url@12 $uuid$' actual &&
+	git cat-file commit refs/remotes/bar~1 >actual &&
+	   grep '^git-svn-id: $bar_url@11 $uuid$' actual &&
+	git cat-file commit refs/remotes/bar~2 >actual &&
+	   grep '^git-svn-id: $bar_url@10 $uuid$' actual &&
+	git cat-file commit refs/remotes/bar~3 >actual &&
+	   grep '^git-svn-id: $bar_url@9 $uuid$' actual &&
+	git cat-file commit refs/remotes/bar~4 >actual &&
+	   grep '^git-svn-id: $bar_url@6 $uuid$' actual &&
+	git cat-file commit refs/remotes/bar~5 >actual &&
+	   grep '^git-svn-id: $bar_url@1 $uuid$' actual
 	"
 
 e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e
 test_expect_success 'verify metadata for /dir/a/b/c/d/e' "
-	git cat-file commit refs/remotes/e | \
-	   grep '^git-svn-id: $e_url@1 $uuid$'
+	git cat-file commit refs/remotes/e >actual &&
+	   grep '^git-svn-id: $e_url@1 $uuid$' actual
 	"
 
 dir_url=http://mayonaise/svnrepo/dir
 test_expect_success 'verify metadata for /dir' "
-	git cat-file commit refs/remotes/dir | \
-	   grep '^git-svn-id: $dir_url@2 $uuid$' &&
-	git cat-file commit refs/remotes/dir~1 | \
-	   grep '^git-svn-id: $dir_url@1 $uuid$'
+	git cat-file commit refs/remotes/dir >actual &&
+	   grep '^git-svn-id: $dir_url@2 $uuid$' actual &&
+	git cat-file commit refs/remotes/dir~1 >actual &&
+	   grep '^git-svn-id: $dir_url@1 $uuid$' actual
 	"
 
 test_expect_success 'find commit based on SVN revision number' "
diff --git a/t/t9111-git-svn-use-svnsync-props.sh b/t/t9111-git-svn-use-svnsync-props.sh
index 22b6e5ee7..5306a87f3 100755
--- a/t/t9111-git-svn-use-svnsync-props.sh
+++ b/t/t9111-git-svn-use-svnsync-props.sh
@@ -20,32 +20,32 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89
 
 bar_url=http://mayonaise/svnrepo/bar
 test_expect_success 'verify metadata for /bar' "
-	git cat-file commit refs/remotes/bar | \
-	   grep '^git-svn-id: $bar_url@12 $uuid$' &&
-	git cat-file commit refs/remotes/bar~1 | \
-	   grep '^git-svn-id: $bar_url@11 $uuid$' &&
-	git cat-file commit refs/remotes/bar~2 | \
-	   grep '^git-svn-id: $bar_url@10 $uuid$' &&
-	git cat-file commit refs/remotes/bar~3 | \
-	   grep '^git-svn-id: $bar_url@9 $uuid$' &&
-	git cat-file commit refs/remotes/bar~4 | \
-	   grep '^git-svn-id: $bar_url@6 $uuid$' &&
-	git cat-file commit refs/remotes/bar~5 | \
-	   grep '^git-svn-id: $bar_url@1 $uuid$'
+	git cat-file commit refs/remotes/bar >actual &&
+	   grep '^git-svn-id: $bar_url@12 $uuid$' actual &&
+	git cat-file commit refs/remotes/bar~1 >actual &&
+	   grep '^git-svn-id: $bar_url@11 $uuid$' actual &&
+	git cat-file commit refs/remotes/bar~2 >actual &&
+	   grep '^git-svn-id: $bar_url@10 $uuid$' actual &&
+	git cat-file commit refs/remotes/bar~3 >actual &&
+	   grep '^git-svn-id: $bar_url@9 $uuid$' actual &&
+	git cat-file commit refs/remotes/bar~4 >actual &&
+	   grep '^git-svn-id: $bar_url@6 $uuid$' actual &&
+	git cat-file commit refs/remotes/bar~5 >actual &&
+	   grep '^git-svn-id: $bar_url@1 $uuid$' actual
 	"
 
 e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e
 test_expect_success 'verify metadata for /dir/a/b/c/d/e' "
-	git cat-file commit refs/remotes/e | \
-	   grep '^git-svn-id: $e_url@1 $uuid$'
+	git cat-file commit refs/remotes/e >actual &&
+	   grep '^git-svn-id: $e_url@1 $uuid$' actual
 	"
 
 dir_url=http://mayonaise/svnrepo/dir
 test_expect_success 'verify metadata for /dir' "
-	git cat-file commit refs/remotes/dir | \
-	   grep '^git-svn-id: $dir_url@2 $uuid$' &&
-	git cat-file commit refs/remotes/dir~1 | \
-	   grep '^git-svn-id: $dir_url@1 $uuid$'
+	git cat-file commit refs/remotes/dir >actual &&
+	   grep '^git-svn-id: $dir_url@2 $uuid$' actual &&
+	git cat-file commit refs/remotes/dir~1 >actual &&
+	   grep '^git-svn-id: $dir_url@1 $uuid$' actual
 	"
 
 test_done
diff --git a/t/t9114-git-svn-dcommit-merge.sh b/t/t9114-git-svn-dcommit-merge.sh
index 50bca62de..c945c3758 100755
--- a/t/t9114-git-svn-dcommit-merge.sh
+++ b/t/t9114-git-svn-dcommit-merge.sh
@@ -68,7 +68,7 @@ test_debug 'gitk --all & sleep 1'
 test_expect_success 'verify pre-merge ancestry' "
 	test x\$(git rev-parse --verify refs/heads/svn^2) = \
 	     x\$(git rev-parse --verify refs/heads/merge) &&
-	git cat-file commit refs/heads/svn^ | grep '^friend$'
+	git cat-file commit refs/heads/svn^ >actual && grep '^friend$' actual
 	"
 
 test_expect_success 'git svn dcommit merges' "
@@ -82,12 +82,12 @@ test_expect_success 'verify post-merge ancestry' "
 	     x\$(git rev-parse --verify refs/remotes/origin/trunk) &&
 	test x\$(git rev-parse --verify refs/heads/svn^2) = \
 	     x\$(git rev-parse --verify refs/heads/merge) &&
-	git cat-file commit refs/heads/svn^ | grep '^friend$'
+	git cat-file commit refs/heads/svn^ >actual && grep '^friend$' actual
 	"
 
 test_expect_success 'verify merge commit message' "
-	git rev-list --pretty=raw -1 refs/heads/svn | \
-	  grep \"    Merge branch 'merge' into svn\"
+	git rev-list --pretty=raw -1 refs/heads/svn >actual &&
+	  grep \"    Merge branch 'merge' into svn\" actual
 	"
 
 test_done
diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh
index 41264818c..e12f8cf3b 100755
--- a/t/t9130-git-svn-authors-file.sh
+++ b/t/t9130-git-svn-authors-file.sh
@@ -27,10 +27,10 @@ test_expect_success 'imported 2 revisions successfully' '
 	(
 		cd x
 		test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 2 &&
-		git rev-list -1 --pretty=raw refs/remotes/git-svn | \
-		  grep "^author BBBBBBB BBBBBBB <bb@example\.com> " &&
-		git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
-		  grep "^author AAAAAAA AAAAAAA <aa@example\.com> "
+		git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
+		  grep "^author BBBBBBB BBBBBBB <bb@example\.com> " actual &&
+		git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
+		  grep "^author AAAAAAA AAAAAAA <aa@example\.com> " actual
 	)
 	'
 
@@ -44,10 +44,10 @@ test_expect_success 'continues to import once authors have been added' '
 		cd x
 		git svn fetch --authors-file=../svn-authors &&
 		test "$(git rev-list refs/remotes/git-svn | wc -l)" -eq 4 &&
-		git rev-list -1 --pretty=raw refs/remotes/git-svn | \
-		  grep "^author DDDDDDD DDDDDDD <dd@example\.com> " &&
-		git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
-		  grep "^author CCCCCCC CCCCCCC <cc@example\.com> "
+		git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
+		  grep "^author DDDDDDD DDDDDDD <dd@example\.com> " actual &&
+		git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
+		  grep "^author CCCCCCC CCCCCCC <cc@example\.com> " actual
 	)
 	'
 
diff --git a/t/t9138-git-svn-authors-prog.sh b/t/t9138-git-svn-authors-prog.sh
index 7d7e9d46b..5b04c2b40 100755
--- a/t/t9138-git-svn-authors-prog.sh
+++ b/t/t9138-git-svn-authors-prog.sh
@@ -44,24 +44,24 @@ test_expect_success 'imported 6 revisions successfully' '
 test_expect_success 'authors-prog ran correctly' '
 	(
 		cd x
-		git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \
-		  grep "^author ee-foo <ee-foo@example\.com> " &&
-		git rev-list -1 --pretty=raw refs/remotes/git-svn~2 | \
-		  grep "^author dd <dd@sub\.example\.com> " &&
-		git rev-list -1 --pretty=raw refs/remotes/git-svn~3 | \
-		  grep "^author cc <cc@sub\.example\.com> " &&
-		git rev-list -1 --pretty=raw refs/remotes/git-svn~4 | \
-		  grep "^author bb <bb@example\.com> " &&
-		git rev-list -1 --pretty=raw refs/remotes/git-svn~5 | \
-		  grep "^author aa <aa@example\.com> "
+		git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
+		  grep "^author ee-foo <ee-foo@example\.com> " actual &&
+		git rev-list -1 --pretty=raw refs/remotes/git-svn~2 >actual &&
+		  grep "^author dd <dd@sub\.example\.com> " actual &&
+		git rev-list -1 --pretty=raw refs/remotes/git-svn~3 >actual &&
+		  grep "^author cc <cc@sub\.example\.com> " actual &&
+		git rev-list -1 --pretty=raw refs/remotes/git-svn~4 >actual &&
+		  grep "^author bb <bb@example\.com> " actual &&
+		git rev-list -1 --pretty=raw refs/remotes/git-svn~5 >actual &&
+		  grep "^author aa <aa@example\.com> " actual
 	)
 '
 
 test_expect_success 'authors-file overrode authors-prog' '
 	(
 		cd x
-		git rev-list -1 --pretty=raw refs/remotes/git-svn | \
-		  grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> "
+		git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
+		  grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> " actual
 	)
 '
 
@@ -73,8 +73,8 @@ test_expect_success 'authors-prog handled special characters in username' '
 	(
 		cd x &&
 		git svn --authors-prog=../svn-authors-prog fetch &&
-		git rev-list -1 --pretty=raw refs/remotes/git-svn |
-		grep "^author xyz; touch evil <xyz; touch evil@example\.com> " &&
+		git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
+		grep "^author xyz; touch evil <xyz; touch evil@example\.com> " actual &&
 		! test -f evil
 	)
 '
diff --git a/t/t9153-git-svn-rewrite-uuid.sh b/t/t9153-git-svn-rewrite-uuid.sh
index 372ef1568..3b00a9135 100755
--- a/t/t9153-git-svn-rewrite-uuid.sh
+++ b/t/t9153-git-svn-rewrite-uuid.sh
@@ -16,10 +16,10 @@ test_expect_success 'load svn repo' "
 	"
 
 test_expect_success 'verify uuid' "
-	git cat-file commit refs/remotes/git-svn~0 | \
-	   grep '^git-svn-id: .*@2 $uuid$' &&
-	git cat-file commit refs/remotes/git-svn~1 | \
-	   grep '^git-svn-id: .*@1 $uuid$'
+	git cat-file commit refs/remotes/git-svn~0 >actual &&
+	   grep '^git-svn-id: .*@2 $uuid$' actual &&
+	git cat-file commit refs/remotes/git-svn~1 >actual &&
+	   grep '^git-svn-id: .*@1 $uuid$' actual
 	"
 
 test_done
-- 
2.16.2


^ permalink raw reply related	[relevance 6%]

* What's cooking in git.git (Sep 2020, #08; Tue, 29)
@ 2020-09-29 22:06  6% Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2020-09-29 22:06 UTC (permalink / raw)
  To: git

Here are the topics that have been cooking.  Commits prefixed with '-' are
only in 'seen' (formerly 'pu'---proposed updates) while commits prefixed
with '+' are in 'next'.  The ones marked with '.' do not appear in any of
the integration branches, but I am still holding onto them.

We have a topic on 'seen', sk/force-if-includes, that behaves
differently when the commit-graph feature is in use (a working
in_merge_bases_many() implementation is critical for the topic to
work as expected).  Help in debugging it is very much appreciated.

You can find the changes described here in the integration branches of the
repositories listed at

    http://git-blame.blogspot.com/p/git-public-repositories.html

--------------------------------------------------
[Graduated to 'master']

* ah/pull (2020-09-24) 1 commit
  (merged to 'next' on 2020-09-25 at b5ddf0cf8b)
 + pull: don't warn if pull.ff has been set

 Earlier we taught "git pull" to warn when the user does not say the
 histories need to be merged, rebased or accepts only fast-
 forwarding, but the warning triggered for those who have set the
 pull.ff configuration variable.


* bc/clone-with-git-default-hash-fix (2020-09-22) 1 commit
  (merged to 'next' on 2020-09-22 at 62ea45c20e)
 + builtin/clone: avoid failure with GIT_DEFAULT_HASH

 "git clone" that clones from SHA-1 repository, while
 GIT_DEFAULT_HASH set to use SHA-256 already, resulted in an
 unusable repository that half-claims to be SHA-256 repository
 with SHA-1 objects and refs.  This has been corrected.


* bc/faq-misc (2020-09-20) 3 commits
  (merged to 'next' on 2020-09-22 at a81b728010)
 + docs: explain how to deal with files that are always modified
 + docs: explain why reverts are not always applied on merge
 + docs: explain why squash merges are broken with long-running branches

 More FAQ entries.


* dl/zero-oid-in-hooks (2020-09-23) 3 commits
  (merged to 'next' on 2020-09-25 at 3c7d03d61a)
 + hooks--update.sample: use hash-agnostic zero OID
 + hooks--pre-push.sample: use hash-agnostic zero OID
 + hooks--pre-push.sample: modernize script

 Adjust sample hooks for hash algorithm other than SHA-1.


* jc/t1506-rev-parse-leaves-range-endpoint-unpeeled (2020-09-25) 1 commit
  (merged to 'next' on 2020-09-25 at e5233774ba)
 + t1506: rev-parse A..B and A...B

 Test update.


* jk/make-protocol-v2-the-default (2020-09-25) 1 commit
  (merged to 'next' on 2020-09-25 at 21a5f9e880)
 + protocol: re-enable v2 protocol by default

 The transport protocol v2 has become the default again.


* tb/bloom-improvements (2020-09-18) 13 commits
  (merged to 'next' on 2020-09-22 at 520d531ad8)
 + commit-graph: introduce 'commitGraph.maxNewFilters'
 + builtin/commit-graph.c: introduce '--max-new-filters=<n>'
 + commit-graph: rename 'split_commit_graph_opts'
 + bloom: encode out-of-bounds filters as non-empty
 + bloom/diff: properly short-circuit on max_changes
 + bloom: use provided 'struct bloom_filter_settings'
 + bloom: split 'get_bloom_filter()' in two
 + commit-graph.c: store maximum changed paths
 + commit-graph: respect 'commitGraph.readChangedPaths'
 + t/helper/test-read-graph.c: prepare repo settings
 + commit-graph: pass a 'struct repository *' in more places
 + t4216: use an '&&'-chain
 + commit-graph: introduce 'get_bloom_filter_settings()'

 "git commit-graph write" learned to limit the number of bloom
 filters that are computed from scratch with the --max-new-filters
 option.


* tg/range-diff-same-file-fix (2020-09-24) 1 commit
  (merged to 'next' on 2020-09-25 at c2078e5505)
 + diff: fix modified lines stats with --stat and --numstat

 "git range-diff" showed incorrect diffstat, which has been
 corrected.

--------------------------------------------------
[New Topics]

* al/ref-filter-merged-and-no-merged (2020-09-26) 1 commit
  (merged to 'next' on 2020-09-29 at 748a286753)
 + ref-filter: plug memory leak in reach_filter()

 Hotfix.

 Will merge to 'master'.


* au/complete-restore-s (2020-09-26) 2 commits
  (merged to 'next' on 2020-09-29 at 7bbf508562)
 + completion: complete refs after 'git restore -s'
 + completion: use "prev" variable instead of introducing "prevword"

 The command line completion (in contrib/) learned that "git restore
 -s <TAB>" is often followed by a refname.

 Will merge to 'master'.


* eg/mailinfo-doc-scissors (2020-09-28) 1 commit
  (merged to 'next' on 2020-09-29 at 4694f22fe9)
 + Doc: show example scissors line

 The explanation of the "scissors line" has been clarified.

 Will merge to 'master'.


* jc/fmt-merge-msg-suppress-destination (2020-09-27) 1 commit
  (merged to 'next' on 2020-09-29 at 2b1f8ee654)
 + config/fmt-merge-msg.txt: drop space in quote

 Docfix.

 Will merge to 'master'.


* jk/format-auto-base-when-able (2020-09-26) 1 commit
 - format-patch: teach format.useAutoBase "whenAble" option

 "git format-patch" learns to take "if-able" as a possible value for
 its "--base" option, and "whenAble" as a possible value for the
 format.useAutoBase configuration variable to become no-op when the
 automatically computed base does not make sense.


* ma/worktree-cleanups (2020-09-27) 7 commits
 - worktree: use skip_prefix to parse target
 - worktree: rename copy-pasted variable
 - worktree: update renamed variable in comment
 - worktree: inline `worktree_ref()` into its only caller
 - wt-status: introduce wt_status_state_free_buffers()
 - wt-status: print to s->fp, not stdout
 - wt-status: replace sha1 mentions with oid

 Code clean-up.

 Will merge to 'next'.


* mt/delta-base-cache-races (2020-09-28) 2 commits
  (merged to 'next' on 2020-09-29 at ee2d60c077)
 + packfile: fix memory leak in add_delta_base_cache()
 + packfile: fix race condition on unpack_entry()

 A race that leads to an access to a free'd data was corrected in
 the codepath that reads pack files.

 Will merge to 'master'.


* nl/credential-crlf (2020-09-28) 3 commits
 - docs: make notes regarding credential line reading
 - credentials: make line reading Windows compatible
 - credential.c: fix credential reading with regards to CR/LF

 cf. <pull.710.v2.git.git.1601293224.gitgitgadget@gmail.com>


* tb/upload-pack-filters (2020-09-27) 1 commit
  (merged to 'next' on 2020-09-29 at 3dde767170)
 + config/uploadpack.txt: fix typo in `--filter=tree:<n>`

 Hotfix.

 Will merge to 'master'.


* so/combine-diff-simplify (2020-09-29) 1 commit
 - diff: get rid of redundant 'dense' argument

--------------------------------------------------
[Stalled]

* vv/send-email-with-less-secure-apps-access (2020-08-29) 1 commit
 - Documentation/git-send-email.txt: Mention less secure app access might need to enable.

 Doc update.

 Expecting a reroll.
 cf. <xmqqwo1hi9nv.fsf@gitster.c.googlers.com>
 cf. <xmqqft85i72s.fsf@gitster.c.googlers.com>


* jc/war-on-dashed-git (2020-08-27) 1 commit
 - git: catch an attempt to run "git-foo"

 The first step to remove on-disk binaries for built-in subcommands
 by soliciting objections.

 On hold for now.


* dr/push-remoteref-fix (2020-04-23) 1 commit
 - remote.c: fix handling of %(push:remoteref)

 The "%(push:remoteref)" placeholder in the "--format=" argument of
 "git format-patch" (and friends) only showed what got explicitly
 configured, not what ref at the receiving end would be updated when
 "git push" was used, as it ignored the default behaviour (e.g. update
 the same ref as the source).

 Discard for now.
 cf. <xmqqv9gu7c61.fsf@gitster.c.googlers.com>
 cf. <20200911214358.acl3hy2e763begoo@feanor>


* mk/use-size-t-in-zlib (2018-10-15) 1 commit
 - zlib.c: use size_t for size

 The wrapper to call into zlib followed our long tradition to use
 "unsigned long" for sizes of regions in memory, which have been
 updated to use "size_t".

--------------------------------------------------
[Cooking]

* cc/bisect-start-fix (2020-09-25) 1 commit
  (merged to 'next' on 2020-09-29 at 637011d04a)
 + bisect: don't use invalid oid as rev when starting

 "git bisect start X Y", when X and Y are not valid committish
 object names, should take X and Y as pathspec, but didn't.

 Will merge to 'master'.


* mt/parallel-checkout-part-1 (2020-09-22) 19 commits
 - ci: run test round with parallel-checkout enabled
 - parallel-checkout: add tests related to .gitattributes
 - parallel-checkout: add tests related to clone collisions
 - parallel-checkout: add tests for basic operations
 - checkout-index: add parallel checkout support
 - builtin/checkout.c: complete parallel checkout support
 - make_transient_cache_entry(): optionally alloc from mem_pool
 - parallel-checkout: support progress displaying
 - parallel-checkout: make it truly parallel
 - unpack-trees: add basic support for parallel checkout
 - entry: add checkout_entry_ca() which takes preloaded conv_attrs
 - entry: move conv_attrs lookup up to checkout_entry()
 - entry: extract cache_entry update from write_entry()
 - entry: make fstat_output() and read_blob_entry() public
 - entry: extract a header file for entry.c functions
 - convert: add conv_attrs classification
 - convert: add get_stream_filter_ca() variant
 - convert: add [async_]convert_to_working_tree_ca() variants
 - convert: make convert_attrs() and convert structs public

 Parallel checkout.


* jk/drop-unaligned-loads (2020-09-24) 2 commits
  (merged to 'next' on 2020-09-29 at 29c05387a0)
 + Revert "fast-export: use local array to store anonymized oid"
 + bswap.h: drop unaligned loads

 Compilation fix around type punning.

 Will merge to 'master'.


* jc/blame-ignore-fix (2020-09-24) 2 commits
  (merged to 'next' on 2020-09-29 at 96fbdb57fb)
 + blame: validate and peel the object names on the ignore list
 + t8013: minimum preparatory clean-up

 "git blame --ignore-rev/--ignore-revs-file" failed to validate
 their input are valid revision, and failed to take into account
 that the user may want to give an annotated tag instead of a
 commit, which has been corrected.

 Will merge to 'master'.


* jk/shortlog-group-by-trailer (2020-09-27) 8 commits
  (merged to 'next' on 2020-09-29 at 3706b06db5)
 + shortlog: allow multiple groups to be specified
 + shortlog: parse trailer idents
 + shortlog: rename parse_stdin_ident()
 + shortlog: de-duplicate trailer values
 + shortlog: match commit trailers with --group
 + trailer: add interface for iterating over commit trailers
 + shortlog: add grouping option
 + shortlog: change "author" variables to "ident"

 "git shortlog" has been taught to group commits by the contents of
 the trailer lines, like "Reviewed-by:", "Coauthored-by:", etc.

 Will merge to 'master'.


* js/cmake-vs (2020-09-28) 11 commits
 - cmake: fix typo in message when `msgfmt` was not found
 - hashmap_for_each_entry(): workaround MSVC's runtime check failure #3
 - cmake (Windows): recommend using Visual Studio's built-in CMake support
 - cmake (Windows): initialize vcpkg/build dependencies automatically
 - cmake (Windows): complain when encountering an unknown compiler
 - cmake (Windows): let the `.dll` files be found when running the tests
 - cmake: quote the path accurately when editing `test-lib.sh`
 - cmake: fall back to using `vcpkg`'s `msgfmt.exe` on Windows
 - cmake: ensure that the `vcpkg` packages are found on Windows
 - cmake: do find Git for Windows' shell interpreter
 - cmake: ignore files generated by CMake as run in Visual Studio

 Using the CMake support we added some time ago for real with Visual
 Studio build revealed there were lot of usability improvements
 possible, which have been carried out.

 Expecting a (hopefully) final reroll.
 cf. <nycvar.QRO.7.76.6.2009291406310.50@tvgsbejvaqbjf.bet>
 cf. <nycvar.QRO.7.76.6.2009291407130.50@tvgsbejvaqbjf.bet>


* sv/t7001-modernize (2020-09-25) 11 commits
 - t7001: move cleanup code from outside the tests into them
 - t7001: use `test` rather than `[`
 - t7001: use here-docs instead of echo
 - t7001: put each command on a separate line
 - t7001: use ': >' rather than 'touch'
 - t7001: change (cd <path> && git foo) to (git -C <path> foo)
 - t7001: remove whitespace after redirect operators
 - t7001: change the style for cd according to subshell
 - t7001: remove unnecessary blank lines
 - t7001: use TAB instead of spaces
 - t7001: convert tests from the old style to the current style

 Test script modernization.

 Expecting a reroll.
 cf. <20200925170256.11490-1-shubhunic@gmail.com>


* jc/sequencer-stopped-sha-simplify (2020-09-25) 1 commit
  (merged to 'next' on 2020-09-29 at 9af3360572)
 + sequencer: stop abbreviating stopped-sha file

 Code simplification.

 Will merge to 'master'.


* rs/archive-add-file (2020-09-19) 3 commits
 - Makefile: use git-archive --add-file
 - archive: add --add-file
 - archive: read short blobs in archive.c::write_archive_entry()

 "git archive" learns the "--add-file" option to include untracked
 files into a snapshot from a tree-ish.


* js/default-branch-name-part-2 (2020-09-26) 5 commits
 - t9902: avoid using the branch name `master`
 - tests: avoid variations of the `master` branch name
 - t3200: avoid variations of the `master` branch name
 - fast-export: avoid using unnecessary language in a code comment
 - t/test-terminal: avoid non-inclusive language

 Update the tests to drop word 'master' from them


* jt/keep-partial-clone-filter-upon-lazy-fetch (2020-09-28) 2 commits
 - fetch: do not override partial clone filter
 - promisor-remote: remove unused variable

 The lazy fetching done internally to make missing objects available
 in a partial clone incorrectly made permanent damate to the partial
 clone filter in the repository, which has been corrected.


* dl/diff-merge-base (2020-09-21) 10 commits
 - contrib/completion: complete `git diff --merge-base`
 - builtin/diff-tree: learn --merge-base
 - builtin/diff-index: learn --merge-base
 - t4068: add --merge-base tests
 - diff-lib: define diff_get_merge_base()
 - diff-lib: accept option flags in run_diff_index()
 - contrib/completion: extract common diff/difftool options
 - git-diff.txt: backtick quote command text
 - git-diff-index.txt: make --cached description a proper sentence
 - t4068: remove unnecessary >tmp

 "git diff A...B" learned "git diff --merge-base A B", which is a
 longer short-hand to say the same thing.

 Expecting a reroll.
 cf. <xmqqblhyepup.fsf@gitster.c.googlers.com>


* sb/clone-origin (2020-09-29) 7 commits
 - clone: allow configurable default for `-o`/`--origin`
 - clone: read new remote name from remote_name instead of option_origin
 - clone: validate --origin option before use
 - refs: consolidate remote name validation
 - remote: add tests for add and rename with invalid names
 - clone: use more conventional config/option layering
 - clone: add tests for --template and some disallowed option pairs

 "git clone" learned clone.defaultremotename configuration variable
 to customize what nickname to use to call the remote the repository
 was cloned from.

 Expecting an update.


* sk/force-if-includes (2020-09-27) 4 commits
 - SQUASH??? name an array in singular and avoid commenting obvious
 - t, doc: update tests, reference for "--force-if-includes"
 - push: parse and set flag for "--force-if-includes"
 - push: add reflog check for "--force-if-includes"

 "git push --force-with-lease[=<ref>]" can easily be misused to lose
 commits unless the user takes good care of their own "git fetch".
 A new option "--force-if-includes" attempts to ensure that what is
 being force-pushed was created after examining the commit at the
 tip of the remote ref that is about to be force-replaced.

 On hold.
 Seems to trigger gotchas in the reachability logic in commit-graph.


* ab/mediawiki-fixes (2020-09-21) 18 commits
  (merged to 'next' on 2020-09-25 at 878693716e)
 + remote-mediawiki: use "sh" to eliminate unquoted commands
 + remote-mediawiki: annotate unquoted uses of run_git()
 + remote-mediawiki: convert to quoted run_git() invocation
 + remote-mediawiki: provide a list form of run_git()
 + remote-mediawiki tests: annotate failing tests
 + remote-mediawiki: fix duplicate revisions being imported
 + remote-mediawiki tests: use CLI installer
 + remote-mediawiki tests: use inline PerlIO for readability
 + remote-mediawiki tests: replace deprecated Perl construct
 + remote-mediawiki tests: use a more idiomatic dispatch table
 + remote-mediawiki tests: use "$dir/" instead of "$dir."
 + remote-mediawiki tests: change `[]` to `test`
 + remote-mediawiki tests: use test_cmp in tests
 + remote-mediawiki tests: use a 10 character password
 + remote-mediawiki tests: use the login/password variables
 + remote-mediawiki doc: don't hardcode Debian PHP versions
 + remote-mediawiki doc: link to MediaWiki's current version
 + remote-mediawiki doc: correct link to GitHub project

 Modernization and fixes to MediaWiki remote backend.

 Will merge to 'master'.


* ar/fetch-transfer-ipversion (2020-09-16) 1 commit
 - config: option transfer.ipversion to set transport protocol version for network fetches

 Adds transfer.ipversion configuration variable.

 Needs more work.


* hn/reftable (2020-09-22) 14 commits
 - reftable: fix some sparse warnings
 - reftable: "test-tool dump-reftable" command.
 - reftable: rest of library
 - reftable: file level tests
 - reftable: read reftable files
 - reftable: write reftable files
 - reftable: a generic binary tree implementation
 - reftable: reading/writing blocks
 - reftable: (de)serialization for the polymorphic record type.
 - reftable: utility functions
 - reftable: add a barebones unittest framework
 - vcxproj: adjust for the reftable changes
 - reftable: define the public API
 - reftable: add LICENSE


* bc/rev-parse-path-format (2020-09-08) 1 commit
 - rev-parse: add option for absolute or relative path formatting

 "git rev-parse" can be explicitly told to give output as absolute
 or relative path.

 Expecting a reroll.
 cf. <20200909222333.GH241078@camp.crustytoothpaste.net>


* ds/maintenance-part-3 (2020-09-25) 7 commits
 - maintenance: add troubleshooting guide to docs
 - maintenance: recommended schedule in register/start
 - maintenance: add start/stop subcommands
 - maintenance: add [un]register subcommands
 - for-each-repo: run subcommands on configured repos
 - maintenance: add --schedule option and config
 - maintenance: optionally skip --auto process
 (this branch uses ds/maintenance-part-2.)

 Parts of "git maintenance" to ease writing crontab entries (and
 other scheduling system configuration) for it.


* es/config-hooks (2020-09-09) 9 commits
 - run_commit_hook: take strvec instead of varargs
 - commit: use config-based hooks
 - hook: replace run-command.h:find_hook
 - hook: add 'run' subcommand
 - parse-options: parse into strvec
 - hook: add --porcelain to list command
 - hook: add list command
 - hook: scaffolding for git-hook subcommand
 - doc: propose hooks managed by the config

 The "hooks defined in config" topic.


* mt/grep-sparse-checkout (2020-09-10) 9 commits
 - config: add setting to ignore sparsity patterns in some cmds
 - grep: honor sparse checkout patterns
 - config: correctly read worktree configs in submodules
 - config: make do_git_config_sequence receive a 'struct repository'
 - t/helper/test-config: unify exit labels
 - t/helper/test-config: diagnose missing arguments
 - t/helper/test-config: be consistent with exit codes
 - t1308-config-set: avoid false positives when using test-config
 - doc: grep: unify info on configuration variables

 "git grep" has been tweaked to be limited to the sparse checkout
 paths.


* ew/decline-core-abbrev (2020-09-01) 1 commit
 - core.abbrev <off|false|no> disables abbreviations

 Allow the configuration to specify no abbreviation regardless of
 the hash algorithm.

 Expecting a reroll.  The intent is very good.


* mr/bisect-in-c-2 (2020-09-24) 6 commits
  (merged to 'next' on 2020-09-29 at a15f1729d2)
 + bisect--helper: reimplement `bisect_next` and `bisect_auto_next` shell functions in C
 + bisect: call 'clear_commit_marks_all()' in 'bisect_next_all()'
 + bisect--helper: reimplement `bisect_autostart` shell function in C
 + bisect--helper: introduce new `write_in_file()` function
 + bisect--helper: use '-res' in 'cmd_bisect__helper' return
 + bisect--helper: BUG() in cmd_*() on invalid subcommand

 Rewrite of the "git bisect" script in C continues.

 Will merge to 'master'.


* js/no-builtins-on-disk-option (2020-09-21) 3 commits
  (merged to 'next' on 2020-09-25 at 6b976da4d2)
 + ci: stop linking built-ins to the dashed versions
 + Optionally skip linking/copying the built-ins
 + msvc: copy the correct `.pdb` files in the Makefile target `install`

 The installation procedure learned to optionally omit "git-foo"
 executable files for each 'foo' built-in subcommand, which are only
 required by old timers that still rely on the age old promise that
 prepending "git --exec-path" output to PATH early in their script
 will keep the "git-foo" calls they wrote working.

 The old attempt to remove these executables from the disk failed in
 the 1.6 era; it may be worth attempting again, but I think it is
 worth to keep this topic separate from such a policy change to help
 it graduate early.

 Will merge to 'master'.


* jk/refspecs-negative (2020-09-25) 1 commit
 - refspec: add support for negative refspecs

 "git fetch" and "git push" support negative refspecs.


* ds/maintenance-part-2 (2020-09-25) 8 commits
 - maintenance: add incremental-repack auto condition
 - maintenance: auto-size incremental-repack batch
 - maintenance: add incremental-repack task
 - midx: use start_delayed_progress()
 - midx: enable core.multiPackIndex by default
 - maintenance: create auto condition for loose-objects
 - maintenance: add loose-objects task
 - maintenance: add prefetch task
 (this branch is used by ds/maintenance-part-3.)

 "git maintenance", an extended big brother of "git gc", continues
 to evolve.

--------------------------------------------------
[Discarded]

* js/ignore-cmake-build-artifacts (2020-09-23) 1 commit
 . cmake: ignore generated files

 Running CMake based build with VS (in contrib/) from the top-level
 of the working tree leaves extra build crufts behind.  Add patterns
 to .gitignore

 Retracted.
 cf. <pull.738.git.1601044118.gitgitgadget@gmail.com>

^ permalink raw reply	[relevance 6%]

* What's cooking in git.git (Oct 2020, #01; Mon, 5)
@ 2020-10-06 20:11  6% Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2020-10-06 20:11 UTC (permalink / raw)
  To: git

Here are the topics that have been cooking.  Commits prefixed with '-' are
only in 'seen' (formerly 'pu'---proposed updates) while commits prefixed
with '+' are in 'next'.  The ones marked with '.' do not appear in any of
the integration branches, but I am still holding onto them.

The preview release for the upcoming Git 2.29 has been tagged.

You can find the changes described here in the integration branches of the
repositories listed at

    http://git-blame.blogspot.com/p/git-public-repositories.html

--------------------------------------------------
[Graduated to 'master']

* ab/mediawiki-fixes (2020-09-21) 18 commits
  (merged to 'next' on 2020-09-25 at 878693716e)
 + remote-mediawiki: use "sh" to eliminate unquoted commands
 + remote-mediawiki: annotate unquoted uses of run_git()
 + remote-mediawiki: convert to quoted run_git() invocation
 + remote-mediawiki: provide a list form of run_git()
 + remote-mediawiki tests: annotate failing tests
 + remote-mediawiki: fix duplicate revisions being imported
 + remote-mediawiki tests: use CLI installer
 + remote-mediawiki tests: use inline PerlIO for readability
 + remote-mediawiki tests: replace deprecated Perl construct
 + remote-mediawiki tests: use a more idiomatic dispatch table
 + remote-mediawiki tests: use "$dir/" instead of "$dir."
 + remote-mediawiki tests: change `[]` to `test`
 + remote-mediawiki tests: use test_cmp in tests
 + remote-mediawiki tests: use a 10 character password
 + remote-mediawiki tests: use the login/password variables
 + remote-mediawiki doc: don't hardcode Debian PHP versions
 + remote-mediawiki doc: link to MediaWiki's current version
 + remote-mediawiki doc: correct link to GitHub project

 Modernization and fixes to MediaWiki remote backend.


* al/ref-filter-merged-and-no-merged (2020-09-26) 1 commit
  (merged to 'next' on 2020-09-29 at 748a286753)
 + ref-filter: plug memory leak in reach_filter()

 Hotfix.


* au/complete-restore-s (2020-09-26) 2 commits
  (merged to 'next' on 2020-09-29 at 7bbf508562)
 + completion: complete refs after 'git restore -s'
 + completion: use "prev" variable instead of introducing "prevword"

 The command line completion (in contrib/) learned that "git restore
 -s <TAB>" is often followed by a refname.


* cc/bisect-start-fix (2020-09-25) 1 commit
  (merged to 'next' on 2020-09-29 at 637011d04a)
 + bisect: don't use invalid oid as rev when starting

 "git bisect start X Y", when X and Y are not valid committish
 object names, should take X and Y as pathspec, but didn't.


* ds/in-merge-bases-many-optim-bug (2020-10-02) 1 commit
  (merged to 'next' on 2020-10-04 at b736873ada)
 + commit-reach: fix in_merge_bases_many bug
 (this branch is used by sk/force-if-includes.)

 in_merge_bases_many(), a way to see if a commit is reachable from
 any commit in a set of commits, was totally broken when the
 commit-graph feature was in use, which has been corrected.


* eg/mailinfo-doc-scissors (2020-09-28) 1 commit
  (merged to 'next' on 2020-09-29 at 4694f22fe9)
 + Doc: show example scissors line

 The explanation of the "scissors line" has been clarified.


* jc/blame-ignore-fix (2020-09-24) 2 commits
  (merged to 'next' on 2020-09-29 at 96fbdb57fb)
 + blame: validate and peel the object names on the ignore list
 + t8013: minimum preparatory clean-up

 "git blame --ignore-rev/--ignore-revs-file" failed to validate
 their input are valid revision, and failed to take into account
 that the user may want to give an annotated tag instead of a
 commit, which has been corrected.


* jc/fmt-merge-msg-suppress-destination (2020-09-27) 1 commit
  (merged to 'next' on 2020-09-29 at 2b1f8ee654)
 + config/fmt-merge-msg.txt: drop space in quote

 Docfix.


* jc/sequencer-stopped-sha-simplify (2020-09-25) 1 commit
  (merged to 'next' on 2020-09-29 at 9af3360572)
 + sequencer: stop abbreviating stopped-sha file

 Code simplification.


* jk/diff-cc-oidfind-fix (2020-09-30) 1 commit
  (merged to 'next' on 2020-10-04 at 637072574f)
 + combine-diff: handle --find-object in multitree code path

 "log -c --find-object=X" did not work well to find a merge that
 involves a change to an object X from only one parent.


* jk/drop-unaligned-loads (2020-09-24) 2 commits
  (merged to 'next' on 2020-09-29 at 29c05387a0)
 + Revert "fast-export: use local array to store anonymized oid"
 + bswap.h: drop unaligned loads

 Compilation fix around type punning.


* jk/format-auto-base-when-able (2020-10-01) 1 commit
  (merged to 'next' on 2020-10-04 at ab8f65b8c5)
 + format-patch: teach format.useAutoBase "whenAble" option

 "git format-patch" learns to take "whenAble" as a possible value
 for the format.useAutoBase configuration variable to become no-op
 when the  automatically computed base does not make sense.


* jk/refspecs-negative (2020-09-30) 1 commit
  (merged to 'next' on 2020-10-04 at 2948e90fab)
 + refspec: add support for negative refspecs

 "git fetch" and "git push" support negative refspecs.


* jk/shortlog-group-by-trailer (2020-09-27) 8 commits
  (merged to 'next' on 2020-09-29 at 3706b06db5)
 + shortlog: allow multiple groups to be specified
 + shortlog: parse trailer idents
 + shortlog: rename parse_stdin_ident()
 + shortlog: de-duplicate trailer values
 + shortlog: match commit trailers with --group
 + trailer: add interface for iterating over commit trailers
 + shortlog: add grouping option
 + shortlog: change "author" variables to "ident"

 "git shortlog" has been taught to group commits by the contents of
 the trailer lines, like "Reviewed-by:", "Coauthored-by:", etc.


* jk/unused (2020-09-30) 10 commits
  (merged to 'next' on 2020-10-01 at 440a7a0a7a)
 + dir.c: drop unused "untracked" from treat_path_fast()
 + sequencer: handle ignore_footer when parsing trailers
 + test-advise: check argument count with argc instead of argv
 + sparse-checkout: fill in some options boilerplate
 + sequencer: drop repository argument from run_git_commit()
 + push: drop unused repo argument to do_push()
 + assert PARSE_OPT_NONEG in parse-options callbacks
 + env--helper: write to opt->value in parseopt helper
 + drop unused argc parameters
 + convert: drop unused crlf_action from check_global_conv_flags_eol()

 Code cleanup.


* js/cmake-vs (2020-09-30) 10 commits
  (merged to 'next' on 2020-10-01 at 40be8c6094)
 + hashmap_for_each_entry(): workaround MSVC's runtime check failure #3
 + cmake (Windows): recommend using Visual Studio's built-in CMake support
 + cmake (Windows): initialize vcpkg/build dependencies automatically
 + cmake (Windows): complain when encountering an unknown compiler
 + cmake (Windows): let the `.dll` files be found when running the tests
 + cmake: quote the path accurately when editing `test-lib.sh`
 + cmake: fall back to using `vcpkg`'s `msgfmt.exe` on Windows
 + cmake: ensure that the `vcpkg` packages are found on Windows
 + cmake: do find Git for Windows' shell interpreter
 + cmake: ignore files generated by CMake as run in Visual Studio

 Using the CMake support we added some time ago for real with Visual
 Studio build revealed there were lot of usability improvements
 possible, which have been carried out.


* js/default-branch-name-part-2 (2020-09-26) 5 commits
  (merged to 'next' on 2020-09-30 at 3fb4047ce3)
 + t9902: avoid using the branch name `master`
 + tests: avoid variations of the `master` branch name
 + t3200: avoid variations of the `master` branch name
 + fast-export: avoid using unnecessary language in a code comment
 + t/test-terminal: avoid non-inclusive language

 Update the tests to drop word 'master' from them.


* js/no-builtins-on-disk-option (2020-09-21) 3 commits
  (merged to 'next' on 2020-09-25 at 6b976da4d2)
 + ci: stop linking built-ins to the dashed versions
 + Optionally skip linking/copying the built-ins
 + msvc: copy the correct `.pdb` files in the Makefile target `install`

 The installation procedure learned to optionally omit "git-foo"
 executable files for each 'foo' built-in subcommand, which are only
 required by old timers that still rely on the age old promise that
 prepending "git --exec-path" output to PATH early in their script
 will keep the "git-foo" calls they wrote working.

 The old attempt to remove these executables from the disk failed in
 the 1.6 era; it may be worth attempting again, but I think it is
 worth to keep this topic separate from such a policy change to help
 it graduate early.


* jt/keep-partial-clone-filter-upon-lazy-fetch (2020-09-28) 2 commits
  (merged to 'next' on 2020-10-01 at 77c4c6094c)
 + fetch: do not override partial clone filter
 + promisor-remote: remove unused variable

 The lazy fetching done internally to make missing objects available
 in a partial clone incorrectly made permanent damage to the partial
 clone filter in the repository, which has been corrected.


* ma/worktree-cleanups (2020-09-27) 7 commits
  (merged to 'next' on 2020-10-01 at 369dcfb161)
 + worktree: use skip_prefix to parse target
 + worktree: rename copy-pasted variable
 + worktree: update renamed variable in comment
 + worktree: inline `worktree_ref()` into its only caller
 + wt-status: introduce wt_status_state_free_buffers()
 + wt-status: print to s->fp, not stdout
 + wt-status: replace sha1 mentions with oid

 Code clean-up.


* mr/bisect-in-c-2 (2020-09-24) 6 commits
  (merged to 'next' on 2020-09-29 at a15f1729d2)
 + bisect--helper: reimplement `bisect_next` and `bisect_auto_next` shell functions in C
 + bisect: call 'clear_commit_marks_all()' in 'bisect_next_all()'
 + bisect--helper: reimplement `bisect_autostart` shell function in C
 + bisect--helper: introduce new `write_in_file()` function
 + bisect--helper: use '-res' in 'cmd_bisect__helper' return
 + bisect--helper: BUG() in cmd_*() on invalid subcommand

 Rewrite of the "git bisect" script in C continues.


* mt/delta-base-cache-races (2020-09-28) 2 commits
  (merged to 'next' on 2020-09-29 at ee2d60c077)
 + packfile: fix memory leak in add_delta_base_cache()
 + packfile: fix race condition on unpack_entry()

 A race that leads to an access to a free'd data was corrected in
 the codepath that reads pack files.


* nl/credential-crlf (2020-10-03) 1 commit
  (merged to 'next' on 2020-10-04 at 213256c1e6)
 + credential: treat CR/LF as line endings in the credential protocol

 Loosen the parser in the receiving end of the credential protocol
 to allow credential helper to terminate lines with CRLF line
 ending, as well as LF line ending.


* pb/submodule-doc-fix (2020-10-04) 1 commit
  (merged to 'next' on 2020-10-04 at c535486479)
 + gitsubmodules doc: invoke 'ls-files' with '--recurse-submodules'

 Doc update.


* pm/gitk-update (2020-10-03) 11 commits
  (merged to 'next' on 2020-10-04 at fd505ccfc1)
 + Merge remote-tracking branch 'paulus/master' into pm/gitk-update
 + gitk: Resize panes correctly when reducing window size
 + gitk: replace tabs with spaces
 + gitk: fix the context menu not appearing in the presence of submodule diffs
 + gitk: Un-hide selection in areas with non-default background color
 + gitk: add diff lines background colors
 + gitk: be prepared to be run in a bare repository
 + gitk: Preserve window dimensions on exit when not using ttk themes
 + gitk: don't highlight files after submodules as submodules
 + gitk: fix branch name encoding error
 + gitk: rename "commit summary" to "commit reference"

 "gitk" update.


* rs/archive-add-file (2020-09-19) 3 commits
  (merged to 'next' on 2020-10-04 at fffc088553)
 + Makefile: use git-archive --add-file
 + archive: add --add-file
 + archive: read short blobs in archive.c::write_archive_entry()

 "git archive" learns the "--add-file" option to include untracked
 files into a snapshot from a tree-ish.


* sn/fast-import-doc (2020-10-04) 1 commit
  (merged to 'next' on 2020-10-04 at fdf196b997)
 + fast-import: fix typo in documentation

 Doc update.


* so/combine-diff-simplify (2020-09-29) 1 commit
  (merged to 'next' on 2020-09-30 at d45e33ebb0)
 + diff: get rid of redundant 'dense' argument

 Code simplification.


* tb/upload-pack-filters (2020-09-27) 1 commit
  (merged to 'next' on 2020-09-29 at 3dde767170)
 + config/uploadpack.txt: fix typo in `--filter=tree:<n>`

 Hotfix.


* td/submodule-update-quiet (2020-10-01) 1 commit
  (merged to 'next' on 2020-10-01 at 4ae8bee636)
 + submodule update: silence underlying merge/rebase with "--quiet"

 "git submodule update --quiet" did not squelch underlying "rebase"
 and "pull" commands.

--------------------------------------------------
[New Topics]

* mk/diff-ignore-regex (2020-10-01) 2 commits
 - t: add -I<regex> tests
 - diff: add -I<regex> that ignores matching changes

 "git diff" family of commands learned the "-I<regex>" option to
 ignore hunks whose changed lines all match the given pattern.

 Expecting review response.

--------------------------------------------------
[Stalled]

* sv/t7001-modernize (2020-09-25) 11 commits
 - t7001: move cleanup code from outside the tests into them
 - t7001: use `test` rather than `[`
 - t7001: use here-docs instead of echo
 - t7001: put each command on a separate line
 - t7001: use ': >' rather than 'touch'
 - t7001: change (cd <path> && git foo) to (git -C <path> foo)
 - t7001: remove whitespace after redirect operators
 - t7001: change the style for cd according to subshell
 - t7001: remove unnecessary blank lines
 - t7001: use TAB instead of spaces
 - t7001: convert tests from the old style to the current style

 Test script modernization.

 Expecting a reroll.
 cf. <20200925170256.11490-1-shubhunic@gmail.com>


* ew/decline-core-abbrev (2020-09-01) 1 commit
 - core.abbrev <off|false|no> disables abbreviations

 Allow the configuration to specify no abbreviation regardless of
 the hash algorithm.

 Expecting a reroll.  The intent is very good.


* bc/rev-parse-path-format (2020-09-08) 1 commit
 - rev-parse: add option for absolute or relative path formatting

 "git rev-parse" can be explicitly told to give output as absolute
 or relative path.

 Expecting a reroll.
 cf. <20200909222333.GH241078@camp.crustytoothpaste.net>


* ar/fetch-transfer-ipversion (2020-09-16) 1 commit
 - config: option transfer.ipversion to set transport protocol version for network fetches

 Adds transfer.ipversion configuration variable.

 Needs more work.


* vv/send-email-with-less-secure-apps-access (2020-08-29) 1 commit
 - Documentation/git-send-email.txt: Mention less secure app access might need to enable.

 Doc update.

 Expecting a reroll.
 cf. <xmqqwo1hi9nv.fsf@gitster.c.googlers.com>
 cf. <xmqqft85i72s.fsf@gitster.c.googlers.com>


* jc/war-on-dashed-git (2020-08-27) 1 commit
 - git: catch an attempt to run "git-foo"

 The first step to remove on-disk binaries for built-in subcommands
 by soliciting objections.

 On hold for now.


* dr/push-remoteref-fix (2020-04-23) 1 commit
 - remote.c: fix handling of %(push:remoteref)

 The "%(push:remoteref)" placeholder in the "--format=" argument of
 "git format-patch" (and friends) only showed what got explicitly
 configured, not what ref at the receiving end would be updated when
 "git push" was used, as it ignored the default behaviour (e.g. update
 the same ref as the source).

 Discard for now.
 cf. <xmqqv9gu7c61.fsf@gitster.c.googlers.com>
 cf. <20200911214358.acl3hy2e763begoo@feanor>


* mk/use-size-t-in-zlib (2018-10-15) 1 commit
 - zlib.c: use size_t for size

 The wrapper to call into zlib followed our long tradition to use
 "unsigned long" for sizes of regions in memory, which have been
 updated to use "size_t".

--------------------------------------------------
[Cooking]

* mt/parallel-checkout-part-1 (2020-10-05) 20 commits
  (merged to 'next' on 2020-10-05 at 571e16d68a)
 + parallel-checkout: drop unused checkout state parameter
  (merged to 'next' on 2020-10-04 at 20438c1143)
 + ci: run test round with parallel-checkout enabled
 + parallel-checkout: add tests related to .gitattributes
 + parallel-checkout: add tests related to clone collisions
 + parallel-checkout: add tests for basic operations
 + checkout-index: add parallel checkout support
 + builtin/checkout.c: complete parallel checkout support
 + make_transient_cache_entry(): optionally alloc from mem_pool
 + parallel-checkout: support progress displaying
 + parallel-checkout: make it truly parallel
 + unpack-trees: add basic support for parallel checkout
 + entry: add checkout_entry_ca() which takes preloaded conv_attrs
 + entry: move conv_attrs lookup up to checkout_entry()
 + entry: extract cache_entry update from write_entry()
 + entry: make fstat_output() and read_blob_entry() public
 + entry: extract a header file for entry.c functions
 + convert: add conv_attrs classification
 + convert: add get_stream_filter_ca() variant
 + convert: add [async_]convert_to_working_tree_ca() variants
 + convert: make convert_attrs() and convert structs public

 Parallel checkout.

 Will cook in 'next'.


* dl/diff-merge-base (2020-09-21) 10 commits
 - contrib/completion: complete `git diff --merge-base`
 - builtin/diff-tree: learn --merge-base
 - builtin/diff-index: learn --merge-base
 - t4068: add --merge-base tests
 - diff-lib: define diff_get_merge_base()
 - diff-lib: accept option flags in run_diff_index()
 - contrib/completion: extract common diff/difftool options
 - git-diff.txt: backtick quote command text
 - git-diff-index.txt: make --cached description a proper sentence
 - t4068: remove unnecessary >tmp

 "git diff A...B" learned "git diff --merge-base A B", which is a
 longer short-hand to say the same thing.

 Expecting a reroll.
 cf. <xmqqblhyepup.fsf@gitster.c.googlers.com>


* sb/clone-origin (2020-09-30) 7 commits
 - clone: allow configurable default for `-o`/`--origin`
 - clone: read new remote name from remote_name instead of option_origin
 - clone: validate --origin option before use
 - refs: consolidate remote name validation
 - remote: add tests for add and rename with invalid names
 - clone: use more conventional config/option layering
 - clone: add tests for --template and some disallowed option pairs

 "git clone" learned clone.defaultremotename configuration variable
 to customize what nickname to use to call the remote the repository
 was cloned from.

 Will merge to 'next'.


* sk/force-if-includes (2020-10-03) 4 commits
  (merged to 'next' on 2020-10-04 at 09c4c1e088)
 + t, doc: update tests, reference for "--force-if-includes"
 + push: parse and set flag for "--force-if-includes"
 + push: add reflog check for "--force-if-includes"
 + Merge branch 'ds/in-merge-bases-many-optim-bug' into sk/force-if-includes

 "git push --force-with-lease[=<ref>]" can easily be misused to lose
 commits unless the user takes good care of their own "git fetch".
 A new option "--force-if-includes" attempts to ensure that what is
 being force-pushed was created after examining the commit at the
 tip of the remote ref that is about to be force-replaced.

 Will merge to 'master'.


* hn/reftable (2020-10-01) 13 commits
 . reftable: "test-tool dump-reftable" command.
 . reftable: rest of library
 . reftable: file level tests
 . reftable: read reftable files
 . reftable: write reftable files
 . reftable: a generic binary tree implementation
 . reftable: reading/writing blocks
 . reftable: (de)serialization for the polymorphic record type.
 . reftable: utility functions
 . reftable: add a barebones unittest framework
 . vcxproj: adjust for the reftable changes
 . reftable: define the public API
 . reftable: add LICENSE

 The reftable backend for the refs API.

 Expecting a reroll.
 Seems not to build for Windows folks.
 cf. <nycvar.QRO.7.76.6.2010021555290.50@tvgsbejvaqbjf.bet>
 cf. <nycvar.QRO.7.76.6.2010021557570.50@tvgsbejvaqbjf.bet>


* ds/maintenance-part-3 (2020-10-05) 7 commits
 - maintenance: add troubleshooting guide to docs
 - maintenance: use default schedule if not configured
 - maintenance: add start/stop subcommands
 - maintenance: add [un]register subcommands
 - for-each-repo: run subcommands on configured repos
 - maintenance: add --schedule option and config
 - maintenance: optionally skip --auto process
 (this branch uses ds/maintenance-part-2.)

 Parts of "git maintenance" to ease writing crontab entries (and
 other scheduling system configuration) for it.

 cf. <20201005195701.14268-1-martin.agren@gmail.com>


* es/config-hooks (2020-09-09) 9 commits
 - run_commit_hook: take strvec instead of varargs
 - commit: use config-based hooks
 - hook: replace run-command.h:find_hook
 - hook: add 'run' subcommand
 - parse-options: parse into strvec
 - hook: add --porcelain to list command
 - hook: add list command
 - hook: scaffolding for git-hook subcommand
 - doc: propose hooks managed by the config

 The "hooks defined in config" topic.

 Expecting a reroll.
 cf. <20201005212751.GH331156@google.com>


* mt/grep-sparse-checkout (2020-09-10) 9 commits
 - config: add setting to ignore sparsity patterns in some cmds
 - grep: honor sparse checkout patterns
 - config: correctly read worktree configs in submodules
 - config: make do_git_config_sequence receive a 'struct repository'
 - t/helper/test-config: unify exit labels
 - t/helper/test-config: diagnose missing arguments
 - t/helper/test-config: be consistent with exit codes
 - t1308-config-set: avoid false positives when using test-config
 - doc: grep: unify info on configuration variables

 "git grep" has been tweaked to be limited to the sparse checkout
 paths.


* ds/maintenance-part-2 (2020-09-25) 8 commits
  (merged to 'next' on 2020-10-04 at c2a46f390c)
 + maintenance: add incremental-repack auto condition
 + maintenance: auto-size incremental-repack batch
 + maintenance: add incremental-repack task
 + midx: use start_delayed_progress()
 + midx: enable core.multiPackIndex by default
 + maintenance: create auto condition for loose-objects
 + maintenance: add loose-objects task
 + maintenance: add prefetch task
 (this branch is used by ds/maintenance-part-3.)

 "git maintenance", an extended big brother of "git gc", continues
 to evolve.

 Will cook in 'next'.

^ permalink raw reply	[relevance 6%]

* [PATCH 01/10] tests: add missing &&, batch 2
  @ 2010-10-31  7:30  6%         ` Jonathan Nieder
  0 siblings, 0 replies; 200+ results
From: Jonathan Nieder @ 2010-10-31  7:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Elijah Newren, git, avarab

Same rules as before: this patch only adds " &&" to the end of
some lines in the test suite.

Intended to be applied on top of or squashed with the last
batch if they look okay.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 t/t0020-crlf.sh               |    2 +-
 t/t1400-update-ref.sh         |   20 ++++++++++----------
 t/t3301-notes.sh              |    6 +++---
 t/t3404-rebase-interactive.sh |    6 +++---
 t/t4124-apply-ws-rule.sh      |    6 +++---
 t/t5503-tagfollow.sh          |    6 +++---
 t/t5701-clone-local.sh        |    6 +++---
 t/t7001-mv.sh                 |    2 +-
 t/t7004-tag.sh                |   30 +++++++++++++++---------------
 t/t7300-clean.sh              |    2 +-
 t/t7502-commit.sh             |    2 +-
 t/t7700-repack.sh             |    6 +++---
 t/t9146-git-svn-empty-dirs.sh |    2 +-
 13 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh
index 234a94f..1a8f44c 100755
--- a/t/t0020-crlf.sh
+++ b/t/t0020-crlf.sh
@@ -439,7 +439,7 @@ test_expect_success 'checkout when deleting .gitattributes' '
 	git rm .gitattributes &&
 	echo "contentsQ" | q_to_cr > .file2 &&
 	git add .file2 &&
-	git commit -m third
+	git commit -m third &&
 
 	git checkout master~1 &&
 	git checkout master &&
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 54ba3df..d17551e 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -185,55 +185,55 @@ gd="Thu, 26 May 2005 18:33:00 -0500"
 ld="Thu, 26 May 2005 18:43:00 -0500"
 test_expect_success \
 	'Query "master@{May 25 2005}" (before history)' \
-	'rm -f o e
+	'rm -f o e &&
 	 git rev-parse --verify "master@{May 25 2005}" >o 2>e &&
 	 test '"$C"' = $(cat o) &&
 	 test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"'
 test_expect_success \
 	"Query master@{2005-05-25} (before history)" \
-	'rm -f o e
+	'rm -f o e &&
 	 git rev-parse --verify master@{2005-05-25} >o 2>e &&
 	 test '"$C"' = $(cat o) &&
 	 echo test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"'
 test_expect_success \
 	'Query "master@{May 26 2005 23:31:59}" (1 second before history)' \
-	'rm -f o e
+	'rm -f o e &&
 	 git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e &&
 	 test '"$C"' = $(cat o) &&
 	 test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"'
 test_expect_success \
 	'Query "master@{May 26 2005 23:32:00}" (exactly history start)' \
-	'rm -f o e
+	'rm -f o e &&
 	 git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
 	 test '"$C"' = $(cat o) &&
 	 test "" = "$(cat e)"'
 test_expect_success \
 	'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' \
-	'rm -f o e
+	'rm -f o e &&
 	 git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e &&
 	 test '"$A"' = $(cat o) &&
 	 test "" = "$(cat e)"'
 test_expect_success \
 	'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' \
-	'rm -f o e
+	'rm -f o e &&
 	 git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
 	 test '"$B"' = $(cat o) &&
 	 test "warning: Log .git/logs/'"$m has gap after $gd"'." = "$(cat e)"'
 test_expect_success \
 	'Query "master@{2005-05-26 23:38:00}" (middle of history)' \
-	'rm -f o e
+	'rm -f o e &&
 	 git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
 	 test '"$Z"' = $(cat o) &&
 	 test "" = "$(cat e)"'
 test_expect_success \
 	'Query "master@{2005-05-26 23:43:00}" (exact end of history)' \
-	'rm -f o e
+	'rm -f o e &&
 	 git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
 	 test '"$E"' = $(cat o) &&
 	 test "" = "$(cat e)"'
 test_expect_success \
 	'Query "master@{2005-05-28}" (past end of history)' \
-	'rm -f o e
+	'rm -f o e &&
 	 git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
 	 test '"$D"' = $(cat o) &&
 	 test "warning: Log .git/logs/'"$m unexpectedly ended on $ld"'." = "$(cat e)"'
@@ -247,7 +247,7 @@ test_expect_success \
      git add F &&
 	 GIT_AUTHOR_DATE="2005-05-26 23:30" \
 	 GIT_COMMITTER_DATE="2005-05-26 23:30" git commit -m add -a &&
-	 h_TEST=$(git rev-parse --verify HEAD)
+	 h_TEST=$(git rev-parse --verify HEAD) &&
 	 echo The other day this did not work. >M &&
 	 echo And then Bob told me how to fix it. >>M &&
 	 echo OTHER >F &&
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index a2b79a0..6931171 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -627,16 +627,16 @@ test_expect_success '--show-notes=ref accumulates' '
 
 test_expect_success 'Allow notes on non-commits (trees, blobs, tags)' '
 	git config core.notesRef refs/notes/other &&
-	echo "Note on a tree" > expect
+	echo "Note on a tree" > expect &&
 	git notes add -m "Note on a tree" HEAD: &&
 	git notes show HEAD: > actual &&
 	test_cmp expect actual &&
-	echo "Note on a blob" > expect
+	echo "Note on a blob" > expect &&
 	filename=$(git ls-tree --name-only HEAD | head -n1) &&
 	git notes add -m "Note on a blob" HEAD:$filename &&
 	git notes show HEAD:$filename > actual &&
 	test_cmp expect actual &&
-	echo "Note on a tag" > expect
+	echo "Note on a tag" > expect &&
 	git tag -a -m "This is an annotated tag" foobar HEAD^ &&
 	git notes add -m "Note on a tag" foobar &&
 	git notes show foobar > actual &&
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 7d20a74..c0e69f6 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -46,7 +46,7 @@ test_expect_success 'setup' '
 	test_commit G file1 &&
 	test_commit H file5 &&
 	git checkout -b branch2 F &&
-	test_commit I file6
+	test_commit I file6 &&
 	git checkout -b conflict-branch A &&
 	for n in one two three four
 	do
@@ -584,7 +584,7 @@ test_expect_success 'do "noop" when there is nothing to cherry-pick' '
 
 	git checkout -b branch4 HEAD &&
 	GIT_EDITOR=: git commit --amend \
-		--author="Somebody else <somebody@else.com>" 
+		--author="Somebody else <somebody@else.com>" &&
 	test $(git rev-parse branch3) != $(git rev-parse branch4) &&
 	git rebase -i branch3 &&
 	test $(git rev-parse branch3) = $(git rev-parse branch4)
@@ -599,7 +599,7 @@ test_expect_success 'submodule rebase setup' '
 		git add elif && git commit -m "submodule initial"
 	) &&
 	echo 1 >file1 &&
-	git add file1 sub
+	git add file1 sub &&
 	test_tick &&
 	git commit -m "One" &&
 	echo 2 >file1 &&
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index 8a676a5..414b09b 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -368,7 +368,7 @@ test_expect_success 'missing blanks at EOF must only match blank lines' '
 	git diff -- one >patch &&
 
 	echo a >one &&
-	test_must_fail git apply patch
+	test_must_fail git apply patch &&
 	test_must_fail git apply --whitespace=fix patch &&
 	test_must_fail git apply --ignore-space-change --whitespace=fix patch
 '
@@ -419,7 +419,7 @@ test_expect_success 'same, but with CR-LF line endings && cr-at-eol set' '
 	printf "b\r\n" >>one &&
 	printf "c\r\n" >>one &&
 	cp one save-one &&
-	printf "                 \r\n" >>one
+	printf "                 \r\n" >>one &&
 	git add one &&
 	printf "d\r\n" >>one &&
 	cp one expect &&
@@ -436,7 +436,7 @@ test_expect_success 'same, but with CR-LF line endings && cr-at-eol unset' '
 	printf "b\r\n" >>one &&
 	printf "c\r\n" >>one &&
 	cp one save-one &&
-	printf "                 \r\n" >>one
+	printf "                 \r\n" >>one &&
 	git add one &&
 	cp one expect &&
 	printf "d\r\n" >>one &&
diff --git a/t/t5503-tagfollow.sh b/t/t5503-tagfollow.sh
index 8a298a6..7f6d3d2 100755
--- a/t/t5503-tagfollow.sh
+++ b/t/t5503-tagfollow.sh
@@ -54,7 +54,7 @@ EOF
 '
 
 test_expect_success NOT_MINGW 'fetch A (new commit : 1 connection)' '
-	rm -f $U
+	rm -f $U &&
 	(
 		cd cloned &&
 		GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
@@ -87,7 +87,7 @@ EOF
 '
 
 test_expect_success NOT_MINGW 'fetch C, T (new branch, tag : 1 connection)' '
-	rm -f $U
+	rm -f $U &&
 	(
 		cd cloned &&
 		GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
@@ -126,7 +126,7 @@ EOF
 '
 
 test_expect_success NOT_MINGW 'fetch B, S (commit and tag : 1 connection)' '
-	rm -f $U
+	rm -f $U &&
 	(
 		cd cloned &&
 		GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh
index 8b4c356..0f4d487 100755
--- a/t/t5701-clone-local.sh
+++ b/t/t5701-clone-local.sh
@@ -10,11 +10,11 @@ test_expect_success 'preparing origin repository' '
 	git clone --bare . a.git &&
 	git clone --bare . x &&
 	test "$(GIT_CONFIG=a.git/config git config --bool core.bare)" = true &&
-	test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true
+	test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true &&
 	git bundle create b1.bundle --all &&
 	git bundle create b2.bundle master &&
 	mkdir dir &&
-	cp b1.bundle dir/b3
+	cp b1.bundle dir/b3 &&
 	cp b1.bundle b4
 '
 
@@ -112,7 +112,7 @@ test_expect_success 'bundle clone with nonexistent HEAD' '
 	cd "$D" &&
 	git clone b2.bundle b2 &&
 	cd b2 &&
-	git fetch
+	git fetch &&
 	test ! -e .git/refs/heads/master
 '
 
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 624e6d2..a845b15 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -207,7 +207,7 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 	git init &&
 	echo 1 >dirty &&
 	git add dirty &&
-	entry="$(git ls-files --stage dirty | cut -f 1)"
+	entry="$(git ls-files --stage dirty | cut -f 1)" &&
 	git mv dirty dirty2 &&
 	[ "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" ] &&
 	echo 2 >dirty2 &&
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index ac943f5..d05f421 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -1097,7 +1097,7 @@ hash1=$(git rev-parse HEAD)
 test_expect_success 'creating second commit and tag' '
 	echo foo-2.0 >foo &&
 	git add foo &&
-	git commit -m second
+	git commit -m second &&
 	git tag v2.0
 '
 
@@ -1122,18 +1122,18 @@ v2.0
 EOF
 
 test_expect_success 'checking that first commit is in all tags (hash)' "
-	git tag -l --contains $hash1 v* >actual
+	git tag -l --contains $hash1 v* >actual &&
 	test_cmp expected actual
 "
 
 # other ways of specifying the commit
 test_expect_success 'checking that first commit is in all tags (tag)' "
-	git tag -l --contains v1.0 v* >actual
+	git tag -l --contains v1.0 v* >actual &&
 	test_cmp expected actual
 "
 
 test_expect_success 'checking that first commit is in all tags (relative)' "
-	git tag -l --contains HEAD~2 v* >actual
+	git tag -l --contains HEAD~2 v* >actual &&
 	test_cmp expected actual
 "
 
@@ -1142,7 +1142,7 @@ v2.0
 EOF
 
 test_expect_success 'checking that second commit only has one tag' "
-	git tag -l --contains $hash2 v* >actual
+	git tag -l --contains $hash2 v* >actual &&
 	test_cmp expected actual
 "
 
@@ -1151,7 +1151,7 @@ cat > expected <<EOF
 EOF
 
 test_expect_success 'checking that third commit has no tags' "
-	git tag -l --contains $hash3 v* >actual
+	git tag -l --contains $hash3 v* >actual &&
 	test_cmp expected actual
 "
 
@@ -1161,7 +1161,7 @@ test_expect_success 'creating simple branch' '
 	git branch stable v2.0 &&
         git checkout stable &&
 	echo foo-3.0 > foo &&
-	git commit foo -m fourth
+	git commit foo -m fourth &&
 	git tag v3.0
 '
 
@@ -1172,7 +1172,7 @@ v3.0
 EOF
 
 test_expect_success 'checking that branch head only has one tag' "
-	git tag -l --contains $hash4 v* >actual
+	git tag -l --contains $hash4 v* >actual &&
 	test_cmp expected actual
 "
 
@@ -1186,7 +1186,7 @@ v4.0
 EOF
 
 test_expect_success 'checking that original branch head has one tag now' "
-	git tag -l --contains $hash3 v* >actual
+	git tag -l --contains $hash3 v* >actual &&
 	test_cmp expected actual
 "
 
@@ -1201,18 +1201,18 @@ v4.0
 EOF
 
 test_expect_success 'checking that initial commit is in all tags' "
-	git tag -l --contains $hash1 v* >actual
+	git tag -l --contains $hash1 v* >actual &&
 	test_cmp expected actual
 "
 
 # mixing modes and options:
 
 test_expect_success 'mixing incompatibles modes and options is forbidden' '
-	test_must_fail git tag -a
-	test_must_fail git tag -l -v
-	test_must_fail git tag -n 100
-	test_must_fail git tag -l -m msg
-	test_must_fail git tag -l -F some file
+	test_must_fail git tag -a &&
+	test_must_fail git tag -l -v &&
+	test_must_fail git tag -n 100 &&
+	test_must_fail git tag -l -m msg &&
+	test_must_fail git tag -l -F some file &&
 	test_must_fail git tag -v -s
 '
 
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 6c776e9..c802ef8 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -183,7 +183,7 @@ test_expect_success 'git clean symbolic link' '
 
 	mkdir -p build docs &&
 	touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
-	ln -s docs/manual.txt src/part4.c
+	ln -s docs/manual.txt src/part4.c &&
 	git clean &&
 	test -f Makefile &&
 	test -f README &&
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index c1c6645..50da034 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -390,7 +390,7 @@ try_commit_status_combo () {
 
 	test_expect_success 'commit --no-status' '
 		clear_config commit.status &&
-		try_commit --no-status
+		try_commit --no-status &&
 		! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
 	'
 
diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index c2f66ff..d954b84 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -56,7 +56,7 @@ test_expect_success 'loose objects in alternate ODB are not repacked' '
 '
 
 test_expect_success 'packed obs in alt ODB are repacked even when local repo is packless' '
-	mkdir alt_objects/pack
+	mkdir alt_objects/pack &&
 	mv .git/objects/pack/* alt_objects/pack &&
 	git repack -a &&
 	myidx=$(ls -1 .git/objects/pack/*.idx) &&
@@ -95,14 +95,14 @@ test_expect_success 'packed obs in alternate ODB kept pack are repacked' '
 	# swap the .keep so the commit object is in the pack with .keep
 	for p in alt_objects/pack/*.pack
 	do
-		base_name=$(basename $p .pack)
+		base_name=$(basename $p .pack) &&
 		if test -f alt_objects/pack/$base_name.keep
 		then
 			rm alt_objects/pack/$base_name.keep
 		else
 			touch alt_objects/pack/$base_name.keep
 		fi
-	done
+	done &&
 	git repack -a -d &&
 	myidx=$(ls -1 .git/objects/pack/*.idx) &&
 	test -f "$myidx" &&
diff --git a/t/t9146-git-svn-empty-dirs.sh b/t/t9146-git-svn-empty-dirs.sh
index 565365c..158c8e3 100755
--- a/t/t9146-git-svn-empty-dirs.sh
+++ b/t/t9146-git-svn-empty-dirs.sh
@@ -33,7 +33,7 @@ test_expect_success 'more emptiness' '
 '
 
 test_expect_success 'git svn rebase creates empty directory' '
-	( cd cloned && git svn rebase )
+	( cd cloned && git svn rebase ) &&
 	test -d cloned/"! !"
 '
 
-- 
1.7.2.3.557.gab647.dirty

^ permalink raw reply related	[relevance 6%]

* What's cooking in git.git (Sep 2020, #07; Fri, 25)
@ 2020-09-25 22:57  6% Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2020-09-25 22:57 UTC (permalink / raw)
  To: git

Here are the topics that have been cooking.  Commits prefixed with '-' are
only in 'seen' (formerly 'pu'---proposed updates) while commits prefixed
with '+' are in 'next'.  The ones marked with '.' do not appear in any of
the integration branches, but I am still holding onto them.

You can find the changes described here in the integration branches of the
repositories listed at

    http://git-blame.blogspot.com/p/git-public-repositories.html

--------------------------------------------------
[Graduated to 'master']

* ds/maintenance-part-1 (2020-09-17) 11 commits
  (merged to 'next' on 2020-09-18 at 4c367d3cf6)
 + maintenance: add trace2 regions for task execution
 + maintenance: add auto condition for commit-graph task
 + maintenance: use pointers to check --auto
 + maintenance: create maintenance.<task>.enabled config
 + maintenance: take a lock on the objects directory
 + maintenance: add --task option
 + maintenance: add commit-graph task
 + maintenance: initialize task array
 + maintenance: replace run_auto_gc()
 + maintenance: add --quiet option
 + maintenance: create basic maintenance runner
 (this branch is used by ds/maintenance-part-2 and ds/maintenance-part-3.)

 A "git gc"'s big brother has been introduced to take care of more
 repository maintenance tasks, not limited to the object database
 cleaning.


* hx/push-atomic-with-cert (2020-09-19) 1 commit
  (merged to 'next' on 2020-09-22 at 64561eea5b)
 + send-pack: run GPG after atomic push checking

 "git push" that wants to be atomic and wants to send push
 certificate learned not to prepare and sign the push certificate
 when it fails the local check (hence due to atomicity it is known
 that no certificate is needed).


* jk/diff-highlight-blank-match-fix (2020-09-21) 1 commit
  (merged to 'next' on 2020-09-22 at 03ac708501)
 + diff-highlight: correctly match blank lines for flush

 "diff-highlight" (in contrib/) had a logic to flush its output upon
 seeing a blank line but the way it detected a blank line was broken.


* jx/proc-receive-hook (2020-08-27) 10 commits
  (merged to 'next' on 2020-09-18 at 344c89be7e)
 + doc: add documentation for the proc-receive hook
 + transport: parse report options for tracking refs
 + t5411: test updates of remote-tracking branches
 + receive-pack: new config receive.procReceiveRefs
 + doc: add document for capability report-status-v2
 + New capability "report-status-v2" for git-push
 + receive-pack: feed report options to post-receive
 + receive-pack: add new proc-receive hook
 + t5411: add basic test cases for proc-receive hook
 + transport: not report a non-head push as a branch

 "git receive-pack" that accepts requests by "git push" learned to
 outsource most of the ref updates to the new "proc-receive" hook.


* ld/p4-unshelve-fix (2020-09-19) 2 commits
  (merged to 'next' on 2020-09-22 at c7709a34ec)
 + git-p4: use HEAD~$n to find parent commit for unshelve
 + git-p4 unshelve: adding a commit breaks git-p4 unshelve

 The "unshelve" subcommand of "git p4" used incorrectly used
 commit^N where it meant to say commit~N to name the Nth generation
 ancestor, which has been corrected.


* rs/misc-cleanups (2020-09-19) 1 commit
  (merged to 'next' on 2020-09-22 at d034fbfab0)
 + pack-write: use hashwrite_be32() in write_idx_file()

 Code cleanup.

--------------------------------------------------
[New Topics]

* cc/bisect-start-fix (2020-09-25) 1 commit
 - bisect: don't use invalid oid as rev when starting

 "git bisect start X Y", when X and Y are not valid committish
 object names, should take X and Y as pathspec, but didn't.

 Will merge to 'next'.


* dl/zero-oid-in-hooks (2020-09-23) 3 commits
  (merged to 'next' on 2020-09-25 at 3c7d03d61a)
 + hooks--update.sample: use hash-agnostic zero OID
 + hooks--pre-push.sample: use hash-agnostic zero OID
 + hooks--pre-push.sample: modernize script

 Adjust sample hooks for hash algorithm other than SHA-1.

 Will merge to 'master'.


* mt/parallel-checkout-part-1 (2020-09-22) 19 commits
 - ci: run test round with parallel-checkout enabled
 - parallel-checkout: add tests related to .gitattributes
 - parallel-checkout: add tests related to clone collisions
 - parallel-checkout: add tests for basic operations
 - checkout-index: add parallel checkout support
 - builtin/checkout.c: complete parallel checkout support
 - make_transient_cache_entry(): optionally alloc from mem_pool
 - parallel-checkout: support progress displaying
 - parallel-checkout: make it truly parallel
 - unpack-trees: add basic support for parallel checkout
 - entry: add checkout_entry_ca() which takes preloaded conv_attrs
 - entry: move conv_attrs lookup up to checkout_entry()
 - entry: extract cache_entry update from write_entry()
 - entry: make fstat_output() and read_blob_entry() public
 - entry: extract a header file for entry.c functions
 - convert: add conv_attrs classification
 - convert: add get_stream_filter_ca() variant
 - convert: add [async_]convert_to_working_tree_ca() variants
 - convert: make convert_attrs() and convert structs public

 Parallel checkout.


* jk/drop-unaligned-loads (2020-09-24) 2 commits
 - Revert "fast-export: use local array to store anonymized oid"
 - bswap.h: drop unaligned loads

 Compilation fix around type punning.

 Will merge to 'next'.


* tg/range-diff-same-file-fix (2020-09-24) 1 commit
  (merged to 'next' on 2020-09-25 at c2078e5505)
 + diff: fix modified lines stats with --stat and --numstat

 "git range-diff" showed incorrect diffstat, which has been
 corrected.

 Will merge to 'master'.


* ah/pull (2020-09-24) 1 commit
  (merged to 'next' on 2020-09-25 at b5ddf0cf8b)
 + pull: don't warn if pull.ff has been set

 Earlier we taught "git pull" to warn when the user does not say the
 histories need to be merged, rebased or accepts only fast-
 forwarding, but the warning triggered for those who have set the
 pull.ff configuration variable.

 Will merge to 'master'.


* jc/blame-ignore-fix (2020-09-24) 2 commits
 - blame: validate and peel the object names on the ignore list
 - t8013: minimum preparatory clean-up

 "git blame --ignore-rev/--ignore-revs-file" failed to validate
 their input are valid revision, and failed to take into account
 that the user may want to give an annotated tag instead of a
 commit, which has been corrected.

 Will merge to 'next'.


* jk/make-protocol-v2-the-default (2020-09-25) 1 commit
  (merged to 'next' on 2020-09-25 at 21a5f9e880)
 + protocol: re-enable v2 protocol by default

 The transport protocol v2 has become the default again.

 Will merge to 'master'.


* jk/shortlog-group-by-trailer (2020-09-25) 8 commits
 - shortlog: allow multiple groups to be specified
 - shortlog: parse trailer idents
 - shortlog: rename parse_stdin_ident()
 - shortlog: de-duplicate trailer values
 - shortlog: match commit trailers with --group
 - trailer: add interface for iterating over commit trailers
 - shortlog: refactor committer/author grouping
 - shortlog: change "author" variables to "ident"

 "git shortlog" has been taught to group commits by the contents of
 the trailer lines, like "Reviewed-by:", "Coauthored-by:", etc.

 Will merge to 'next'.


* js/cmake-vs (2020-09-25) 10 commits
 - hashmap_for_each_entry(): work around MSVC's run-time check failure #3
 - cmake (Windows): recommend using Visual Studio's built-in CMake support
 - cmake (Windows): initialize vcpkg/build dependencies automatically
 - cmake (Windows): complain when encountering an unknown compiler
 - cmake (Windows): let the `.dll` files are found when running the tests
 - cmake: quote the path accurately when editing `test-lib.sh`
 - cmake: fall back to using `vcpkg`'s `msgfmt.exe` on Windows
 - cmake: ensure that the `vcpkg` packages are found on Windows
 - cmake: do find Git for Windows' shell interpreter
 - cmake: ignore files generated by CMake as run in Visual Studio

 Using the CMake support we added some time ago for real with Visual
 Studio build revealed there were lot of usability improvements
 possible, which have been carried out.

 Expecting a reroll.
 cf. <CAKiG+9V=BGX4k_dM-5JzYmko0cZfYXuSxEk5-UuHZpAqaWoU_A@mail.gmail.com>
 cf. <CAPig+cTPi1yi7WQf_eWa+bFRJEdtULFO3yYqJh3nm=_CtEe6CQ@mail.gmail.com>
 cf. <xmqq8scxln10.fsf@gitster.c.googlers.com>


* sv/t7001-modernize (2020-09-25) 11 commits
 - t7001: move cleanup code from outside the tests into them
 - t7001: use `test` rather than `[`
 - t7001: use here-docs instead of echo
 - t7001: put each command on a separate line
 - t7001: use ': >' rather than 'touch'
 - t7001: change (cd <path> && git foo) to (git -C <path> foo)
 - t7001: remove whitespace after redirect operators
 - t7001: change the style for cd according to subshell
 - t7001: remove unnecessary blank lines
 - t7001: use TAB instead of spaces
 - t7001: convert tests from the old style to the current style

 Test script modernization.

 Expecting a reroll.
 cf. <20200925170256.11490-1-shubhunic@gmail.com>


* jc/sequencer-stopped-sha-simplify (2020-09-25) 1 commit
 - sequencer: stop abbreviating stopped-sha file


* jc/t1506-rev-parse-leaves-range-endpoint-unpeeled (2020-09-25) 1 commit
  (merged to 'next' on 2020-09-25 at e5233774ba)
 + t1506: rev-parse A..B and A...B

 Test update.

 Will merge to 'master'.


--------------------------------------------------
[Stalled]

* vv/send-email-with-less-secure-apps-access (2020-08-29) 1 commit
 - Documentation/git-send-email.txt: Mention less secure app access might need to enable.

 Doc update.

 Expecting a reroll.
 cf. <xmqqwo1hi9nv.fsf@gitster.c.googlers.com>
 cf. <xmqqft85i72s.fsf@gitster.c.googlers.com>


* jc/war-on-dashed-git (2020-08-27) 1 commit
 - git: catch an attempt to run "git-foo"

 The first step to remove on-disk binaries for built-in subcommands
 by soliciting objections.

 On hold for now.


* dr/push-remoteref-fix (2020-04-23) 1 commit
 - remote.c: fix handling of %(push:remoteref)

 The "%(push:remoteref)" placeholder in the "--format=" argument of
 "git format-patch" (and friends) only showed what got explicitly
 configured, not what ref at the receiving end would be updated when
 "git push" was used, as it ignored the default behaviour (e.g. update
 the same ref as the source).

 Discard for now.
 cf. <xmqqv9gu7c61.fsf@gitster.c.googlers.com>
 cf. <20200911214358.acl3hy2e763begoo@feanor>


* mk/use-size-t-in-zlib (2018-10-15) 1 commit
 - zlib.c: use size_t for size

 The wrapper to call into zlib followed our long tradition to use
 "unsigned long" for sizes of regions in memory, which have been
 updated to use "size_t".

--------------------------------------------------
[Cooking]

* rs/archive-add-file (2020-09-19) 3 commits
 - Makefile: use git-archive --add-file
 - archive: add --add-file
 - archive: read short blobs in archive.c::write_archive_entry()

 "git archive" learns the "--add-file" option to include untracked
 files into a snapshot from a tree-ish.


* js/default-branch-name-part-2 (2020-09-21) 5 commits
 - t9902: avoid using the branch name `master`
 - tests: avoid variations of the `master` branch name
 - t3200: avoid variations of the `master` branch name
 - fast-export: avoid using unnecessary language in a code comment
 - t/test-terminal: avoid non-inclusive language

 Update the tests to drop word 'master' from them


* jt/keep-partial-clone-filter-upon-lazy-fetch (2020-09-21) 2 commits
 - fetch: do not override partial clone filter
 - promisor-remote: remove unused variable

 The lazy fetching done internally to make missing objects available
 in a partial clone incorrectly made permanent damate to the partial
 clone filter in the repository, which has been corrected.


* dl/diff-merge-base (2020-09-21) 10 commits
 - contrib/completion: complete `git diff --merge-base`
 - builtin/diff-tree: learn --merge-base
 - builtin/diff-index: learn --merge-base
 - t4068: add --merge-base tests
 - diff-lib: define diff_get_merge_base()
 - diff-lib: accept option flags in run_diff_index()
 - contrib/completion: extract common diff/difftool options
 - git-diff.txt: backtick quote command text
 - git-diff-index.txt: make --cached description a proper sentence
 - t4068: remove unnecessary >tmp

 "git diff A...B" learned "git diff --merge-base A B", which is a
 longer short-hand to say the same thing.

 Expecting a reroll.
 cf. <xmqqblhyepup.fsf@gitster.c.googlers.com>


* bc/faq-misc (2020-09-20) 3 commits
  (merged to 'next' on 2020-09-22 at a81b728010)
 + docs: explain how to deal with files that are always modified
 + docs: explain why reverts are not always applied on merge
 + docs: explain why squash merges are broken with long-running branches

 More FAQ entries.

 Will merge to 'master'.


* sb/clone-origin (2020-09-11) 4 commits
 - clone: allow configurable default for `-o`/`--origin`
 - clone: validate --origin option before use
 - clone: call git_config before parse_options
 - clone: add tests for --template and some disallowed option pairs

 "git clone" learned clone.defaultremotename configuration variable
 to customize what nickname to use to call the remote the repository
 was cloned from.

 Expecting an update.


* sk/force-if-includes (2020-09-23) 3 commits
 - t, doc: update tests, reference for "--force-if-includes"
 - push: parse and set flag for "--force-if-includes"
 - push: add reflog check for "--force-if-includes"

 "git push --force-with-lease[=<ref>]" can easily be misused to lose
 commits unless the user takes good care of their own "git fetch".
 A new option "--force-if-includes" attempts to ensure that what is
 being force-pushed was created after examining the commit at the
 tip of the remote ref that is about to be force-replaced.

 Expecting a reroll.
 cf. <20200923112606.GA71705@mail.clickyotomy.dev>


* ab/mediawiki-fixes (2020-09-21) 18 commits
  (merged to 'next' on 2020-09-25 at 878693716e)
 + remote-mediawiki: use "sh" to eliminate unquoted commands
 + remote-mediawiki: annotate unquoted uses of run_git()
 + remote-mediawiki: convert to quoted run_git() invocation
 + remote-mediawiki: provide a list form of run_git()
 + remote-mediawiki tests: annotate failing tests
 + remote-mediawiki: fix duplicate revisions being imported
 + remote-mediawiki tests: use CLI installer
 + remote-mediawiki tests: use inline PerlIO for readability
 + remote-mediawiki tests: replace deprecated Perl construct
 + remote-mediawiki tests: use a more idiomatic dispatch table
 + remote-mediawiki tests: use "$dir/" instead of "$dir."
 + remote-mediawiki tests: change `[]` to `test`
 + remote-mediawiki tests: use test_cmp in tests
 + remote-mediawiki tests: use a 10 character password
 + remote-mediawiki tests: use the login/password variables
 + remote-mediawiki doc: don't hardcode Debian PHP versions
 + remote-mediawiki doc: link to MediaWiki's current version
 + remote-mediawiki doc: correct link to GitHub project

 Modernization and fixes to MediaWiki remote backend.

 Will merge to 'master'.


* ar/fetch-transfer-ipversion (2020-09-16) 1 commit
 - config: option transfer.ipversion to set transport protocol version for network fetches

 Adds transfer.ipversion configuration variable.

 Needs more work.


* bc/clone-with-git-default-hash-fix (2020-09-22) 1 commit
  (merged to 'next' on 2020-09-22 at 62ea45c20e)
 + builtin/clone: avoid failure with GIT_DEFAULT_HASH

 "git clone" that clones from SHA-1 repository, while
 GIT_DEFAULT_HASH set to use SHA-256 already, resulted in an
 unusable repository that half-claims to be SHA-256 repository
 with SHA-1 objects and refs.  This has been corrected.

 Will merge to 'master'.


* hn/reftable (2020-09-22) 14 commits
 - reftable: fix some sparse warnings
 - reftable: "test-tool dump-reftable" command.
 - reftable: rest of library
 - reftable: file level tests
 - reftable: read reftable files
 - reftable: write reftable files
 - reftable: a generic binary tree implementation
 - reftable: reading/writing blocks
 - reftable: (de)serialization for the polymorphic record type.
 - reftable: utility functions
 - reftable: add a barebones unittest framework
 - vcxproj: adjust for the reftable changes
 - reftable: define the public API
 - reftable: add LICENSE


* bc/rev-parse-path-format (2020-09-08) 1 commit
 - rev-parse: add option for absolute or relative path formatting

 "git rev-parse" can be explicitly told to give output as absolute
 or relative path.

 Expecting a reroll.
 cf. <20200909222333.GH241078@camp.crustytoothpaste.net>


* ds/maintenance-part-3 (2020-09-25) 7 commits
 - maintenance: add troubleshooting guide to docs
 - maintenance: recommended schedule in register/start
 - maintenance: add start/stop subcommands
 - maintenance: add [un]register subcommands
 - for-each-repo: run subcommands on configured repos
 - maintenance: add --schedule option and config
 - maintenance: optionally skip --auto process
 (this branch uses ds/maintenance-part-2.)

 Parts of "git maintenance" to ease writing crontab entries (and
 other scheduling system configuration) for it.


* tb/bloom-improvements (2020-09-18) 13 commits
  (merged to 'next' on 2020-09-22 at 520d531ad8)
 + commit-graph: introduce 'commitGraph.maxNewFilters'
 + builtin/commit-graph.c: introduce '--max-new-filters=<n>'
 + commit-graph: rename 'split_commit_graph_opts'
 + bloom: encode out-of-bounds filters as non-empty
 + bloom/diff: properly short-circuit on max_changes
 + bloom: use provided 'struct bloom_filter_settings'
 + bloom: split 'get_bloom_filter()' in two
 + commit-graph.c: store maximum changed paths
 + commit-graph: respect 'commitGraph.readChangedPaths'
 + t/helper/test-read-graph.c: prepare repo settings
 + commit-graph: pass a 'struct repository *' in more places
 + t4216: use an '&&'-chain
 + commit-graph: introduce 'get_bloom_filter_settings()'

 "git commit-graph write" learned to limit the number of bloom
 filters that are computed from scratch with the --max-new-filters
 option.

 Will merge to 'master'.


* es/config-hooks (2020-09-09) 9 commits
 - run_commit_hook: take strvec instead of varargs
 - commit: use config-based hooks
 - hook: replace run-command.h:find_hook
 - hook: add 'run' subcommand
 - parse-options: parse into strvec
 - hook: add --porcelain to list command
 - hook: add list command
 - hook: scaffolding for git-hook subcommand
 - doc: propose hooks managed by the config

 The "hooks defined in config" topic.


* mt/grep-sparse-checkout (2020-09-10) 9 commits
 - config: add setting to ignore sparsity patterns in some cmds
 - grep: honor sparse checkout patterns
 - config: correctly read worktree configs in submodules
 - config: make do_git_config_sequence receive a 'struct repository'
 - t/helper/test-config: unify exit labels
 - t/helper/test-config: diagnose missing arguments
 - t/helper/test-config: be consistent with exit codes
 - t1308-config-set: avoid false positives when using test-config
 - doc: grep: unify info on configuration variables

 "git grep" has been tweaked to be limited to the sparse checkout
 paths.


* ew/decline-core-abbrev (2020-09-01) 1 commit
 - core.abbrev <off|false|no> disables abbreviations

 Allow the configuration to specify no abbreviation regardless of
 the hash algorithm.

 Expecting a reroll.  The intent is very good.


* mr/bisect-in-c-2 (2020-09-24) 6 commits
 - bisect--helper: reimplement `bisect_next` and `bisect_auto_next` shell functions in C
 - bisect: call 'clear_commit_marks_all()' in 'bisect_next_all()'
 - bisect--helper: reimplement `bisect_autostart` shell function in C
 - bisect--helper: introduce new `write_in_file()` function
 - bisect--helper: use '-res' in 'cmd_bisect__helper' return
 - bisect--helper: BUG() in cmd_*() on invalid subcommand

 Rewrite of the "git bisect" script in C continues.

 Will merge to 'next'.
 At v9.  Looking good so far.


* js/no-builtins-on-disk-option (2020-09-21) 3 commits
  (merged to 'next' on 2020-09-25 at 6b976da4d2)
 + ci: stop linking built-ins to the dashed versions
 + Optionally skip linking/copying the built-ins
 + msvc: copy the correct `.pdb` files in the Makefile target `install`

 The installation procedure learned to optionally omit "git-foo"
 executable files for each 'foo' built-in subcommand, which are only
 required by old timers that still rely on the age old promise that
 prepending "git --exec-path" output to PATH early in their script
 will keep the "git-foo" calls they wrote working.

 The old attempt to remove these executables from the disk failed in
 the 1.6 era; it may be worth attempting again, but I think it is
 worth to keep this topic separate from such a policy change to help
 it graduate early.

 Will merge to 'master'.


* jk/refspecs-negative (2020-09-25) 1 commit
 - refspec: add support for negative refspecs

 "git fetch" and "git push" support negative refspecs.


* ds/maintenance-part-2 (2020-09-25) 8 commits
 - maintenance: add incremental-repack auto condition
 - maintenance: auto-size incremental-repack batch
 - maintenance: add incremental-repack task
 - midx: use start_delayed_progress()
 - midx: enable core.multiPackIndex by default
 - maintenance: create auto condition for loose-objects
 - maintenance: add loose-objects task
 - maintenance: add prefetch task
 (this branch is used by ds/maintenance-part-3.)

 "git maintenance", an extended big brother of "git gc", continues
 to evolve.

--------------------------------------------------
[Discarded]

* js/ignore-cmake-build-artifacts (2020-09-23) 1 commit
 . cmake: ignore generated files

 Running CMake based build with VS (in contrib/) from the top-level
 of the working tree leaves extra build crufts behind.  Add patterns
 to .gitignore

 Retracted.
 cf. <pull.738.git.1601044118.gitgitgadget@gmail.com>

^ permalink raw reply	[relevance 6%]

* [PATCH 00/10] use the $( ... ) construct for command substitution
@ 2016-01-07 13:51  6% Elia Pinto
  2016-01-07 13:51 18% ` [PATCH 07/10] t/t7001-mv.sh: " Elia Pinto
  0 siblings, 1 reply; 200+ results
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

This patch series continues the changes introduced with the merge
6753d8a85d543253d95184ec2faad6dc197f248:

    Merge branch 'ep/shell-command-substitution'

    Adjust shell scripts to use $(cmd) instead of `cmd`.


This is the  sixth  series, the other will be sent separately.

Elia Pinto (10):
  t/t5900-repo-selection.sh: use the $( ... ) construct for command
    substitution
  t/t6001-rev-list-graft.sh: use the $( ... ) construct for command
    substitution
  t/t6002-rev-list-bisect.sh: use the $( ... ) construct for command
    substitution
  t/t6015-rev-list-show-all-parents.sh: use the $( ... ) construct for
    command substitution
  t/t6032-merge-large-rename.sh: use the $( ... ) construct for command
    substitution
  t/t6132-pathspec-exclude.sh: use the $( ... ) construct for command
    substitution
  t/t7001-mv.sh: use the $( ... ) construct for command substitution
  t/t7003-filter-branch.sh: use the $( ... ) construct for command
    substitution
  t/t7004-tag.sh: use the $( ... ) construct for command substitution
  t/t7006-pager.sh: use the $( ... ) construct for command substitution

 t/t5900-repo-selection.sh            |  2 +-
 t/t6001-rev-list-graft.sh            | 12 ++++++------
 t/t6002-rev-list-bisect.sh           |  6 +++---
 t/t6015-rev-list-show-all-parents.sh |  6 +++---
 t/t6032-merge-large-rename.sh        |  2 +-
 t/t6132-pathspec-exclude.sh          |  2 +-
 t/t7001-mv.sh                        |  4 ++--
 t/t7003-filter-branch.sh             |  6 +++---
 t/t7004-tag.sh                       | 16 ++++++++--------
 t/t7006-pager.sh                     |  2 +-
 10 files changed, 29 insertions(+), 29 deletions(-)

-- 
2.3.3.GIT

^ permalink raw reply	[relevance 6%]

* [PATCH 2/2] tests: fix diff order arguments in test_cmp
  @ 2017-10-06 19:00  6% ` Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2017-10-06 19:00 UTC (permalink / raw)
  To: git; +Cc: Stefan Beller

Fix the argument order for test_cmp. When given the expected
result first the diff shows the actual output with '+' and the
expectation with '-', which is the convention for our tests.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 t/t1004-read-tree-m-u-wf.sh          |  2 +-
 t/t4015-diff-whitespace.sh           |  4 ++--
 t/t4205-log-pretty-formats.sh        |  2 +-
 t/t6007-rev-list-cherry-pick-file.sh | 32 ++++++++++++++++----------------
 t/t6013-rev-list-reverse-parents.sh  |  4 ++--
 t/t7001-mv.sh                        |  2 +-
 t/t7005-editor.sh                    |  6 +++---
 t/t7102-reset.sh                     |  4 ++--
 t/t7201-co.sh                        |  4 ++--
 t/t7400-submodule-basic.sh           |  2 +-
 t/t7405-submodule-merge.sh           |  2 +-
 t/t7506-status-submodule.sh          |  4 ++--
 t/t7600-merge.sh                     |  6 +++---
 t/t7610-mergetool.sh                 |  4 ++--
 t/t9001-send-email.sh                |  6 +++---
 15 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/t/t1004-read-tree-m-u-wf.sh b/t/t1004-read-tree-m-u-wf.sh
index c70cf42300..c7ce5d8bb5 100755
--- a/t/t1004-read-tree-m-u-wf.sh
+++ b/t/t1004-read-tree-m-u-wf.sh
@@ -218,7 +218,7 @@ test_expect_success 'D/F' '
 		echo "100644 $a 2	subdir/file2"
 		echo "100644 $b 3	subdir/file2/another"
 	) >expect &&
-	test_cmp actual expect
+	test_cmp expect actual
 
 '
 
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 12d182dc1b..1709e4578b 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -155,7 +155,7 @@ test_expect_success 'ignore-blank-lines: only new lines' '
 " >x &&
 	git diff --ignore-blank-lines >out &&
 	>expect &&
-	test_cmp out expect
+	test_cmp expect out
 '
 
 test_expect_success 'ignore-blank-lines: only new lines with space' '
@@ -165,7 +165,7 @@ test_expect_success 'ignore-blank-lines: only new lines with space' '
  " >x &&
 	git diff -w --ignore-blank-lines >out &&
 	>expect &&
-	test_cmp out expect
+	test_cmp expect out
 '
 
 test_expect_success 'ignore-blank-lines: after change' '
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index ec5f530102..42f584f8b3 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -590,7 +590,7 @@ test_expect_success '%(trailers:unfold) unfolds trailers' '
 test_expect_success ':only and :unfold work together' '
 	git log --no-walk --pretty="%(trailers:only:unfold)" >actual &&
 	git log --no-walk --pretty="%(trailers:unfold:only)" >reverse &&
-	test_cmp actual reverse &&
+	test_cmp reverse actual &&
 	{
 		grep -v patch.description <trailers | unfold &&
 		echo
diff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh
index 2959745196..f0268372d2 100755
--- a/t/t6007-rev-list-cherry-pick-file.sh
+++ b/t/t6007-rev-list-cherry-pick-file.sh
@@ -57,7 +57,7 @@ test_expect_success '--left-right' '
 	git rev-list --left-right B...C > actual &&
 	git name-rev --stdin --name-only --refs="*tags/*" \
 		< actual > actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 test_expect_success '--count' '
@@ -77,14 +77,14 @@ test_expect_success '--cherry-pick bar does not come up empty' '
 	git rev-list --left-right --cherry-pick B...C -- bar > actual &&
 	git name-rev --stdin --name-only --refs="*tags/*" \
 		< actual > actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 test_expect_success 'bar does not come up empty' '
 	git rev-list --left-right B...C -- bar > actual &&
 	git name-rev --stdin --name-only --refs="*tags/*" \
 		< actual > actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -96,14 +96,14 @@ test_expect_success '--cherry-pick bar does not come up empty (II)' '
 	git rev-list --left-right --cherry-pick F...E -- bar > actual &&
 	git name-rev --stdin --name-only --refs="*tags/*" \
 		< actual > actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 test_expect_success 'name-rev multiple --refs combine inclusive' '
 	git rev-list --left-right --cherry-pick F...E -- bar >actual &&
 	git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" \
 		<actual >actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -115,7 +115,7 @@ test_expect_success 'name-rev --refs excludes non-matched patterns' '
 	git rev-list --left-right --cherry-pick F...E -- bar >actual &&
 	git name-rev --stdin --name-only --refs="*tags/F" \
 		<actual >actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -127,14 +127,14 @@ test_expect_success 'name-rev --exclude excludes matched patterns' '
 	git rev-list --left-right --cherry-pick F...E -- bar >actual &&
 	git name-rev --stdin --name-only --refs="*tags/*" --exclude="*E" \
 		<actual >actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 test_expect_success 'name-rev --no-refs clears the refs list' '
 	git rev-list --left-right --cherry-pick F...E -- bar >expect &&
 	git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" --no-refs --refs="*tags/G" \
 		<expect >actual &&
-	test_cmp actual expect
+	test_cmp expect actual
 '
 
 cat >expect <<EOF
@@ -148,7 +148,7 @@ test_expect_success '--cherry-mark' '
 	git rev-list --cherry-mark F...E -- bar > actual &&
 	git name-rev --stdin --name-only --refs="*tags/*" \
 		< actual > actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -162,7 +162,7 @@ test_expect_success '--cherry-mark --left-right' '
 	git rev-list --cherry-mark --left-right F...E -- bar > actual &&
 	git name-rev --stdin --name-only --refs="*tags/*" \
 		< actual > actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -173,14 +173,14 @@ test_expect_success '--cherry-pick --right-only' '
 	git rev-list --cherry-pick --right-only F...E -- bar > actual &&
 	git name-rev --stdin --name-only --refs="*tags/*" \
 		< actual > actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 test_expect_success '--cherry-pick --left-only' '
 	git rev-list --cherry-pick --left-only E...F -- bar > actual &&
 	git name-rev --stdin --name-only --refs="*tags/*" \
 		< actual > actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -192,7 +192,7 @@ test_expect_success '--cherry' '
 	git rev-list --cherry F...E -- bar > actual &&
 	git name-rev --stdin --name-only --refs="*tags/*" \
 		< actual > actual.named &&
-	test_cmp actual.named expect
+	test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -201,7 +201,7 @@ EOF
 
 test_expect_success '--cherry --count' '
 	git rev-list --cherry --count F...E -- bar > actual &&
-	test_cmp actual expect
+	test_cmp expect actual
 '
 
 cat >expect <<EOF
@@ -210,7 +210,7 @@ EOF
 
 test_expect_success '--cherry-mark --count' '
 	git rev-list --cherry-mark --count F...E -- bar > actual &&
-	test_cmp actual expect
+	test_cmp expect actual
 '
 
 cat >expect <<EOF
@@ -219,7 +219,7 @@ EOF
 
 test_expect_success '--cherry-mark --left-right --count' '
 	git rev-list --cherry-mark --left-right --count F...E -- bar > actual &&
-	test_cmp actual expect
+	test_cmp expect actual
 '
 
 test_expect_success '--cherry-pick with independent, but identical branches' '
diff --git a/t/t6013-rev-list-reverse-parents.sh b/t/t6013-rev-list-reverse-parents.sh
index 59fc2f06e0..89458d370f 100755
--- a/t/t6013-rev-list-reverse-parents.sh
+++ b/t/t6013-rev-list-reverse-parents.sh
@@ -28,7 +28,7 @@ test_expect_success '--reverse --parents --full-history combines correctly' '
 		perl -e "print reverse <>" > expected &&
 	git rev-list --reverse --parents --full-history master -- foo \
 		> actual &&
-	test_cmp actual expected
+	test_cmp expected actual
 	'
 
 test_expect_success '--boundary does too' '
@@ -36,7 +36,7 @@ test_expect_success '--boundary does too' '
 		perl -e "print reverse <>" > expected &&
 	git rev-list --boundary --reverse --parents --full-history \
 		master ^root -- foo > actual &&
-	test_cmp actual expected
+	test_cmp expected actual
 	'
 
 test_done
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index cbc5fb37fe..f5929c46f3 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -488,7 +488,7 @@ test_expect_success 'moving a submodule in nested directories' '
 		git config -f ../.gitmodules submodule.deep/directory/hierarchy/sub.path >../actual &&
 		echo "directory/hierarchy/sub" >../expect
 	) &&
-	test_cmp actual expect
+	test_cmp expect actual
 '
 
 test_expect_failure 'moving nested submodules' '
diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh
index 1b530b5022..29e5043b94 100755
--- a/t/t7005-editor.sh
+++ b/t/t7005-editor.sh
@@ -38,7 +38,7 @@ test_expect_success setup '
 	test_commit "$msg" &&
 	echo "$msg" >expect &&
 	git show -s --format=%s > actual &&
-	test_cmp actual expect
+	test_cmp expect actual
 
 '
 
@@ -85,7 +85,7 @@ do
 		git --exec-path=. commit --amend &&
 		git show -s --pretty=oneline |
 		sed -e "s/^[0-9a-f]* //" >actual &&
-		test_cmp actual expect
+		test_cmp expect actual
 	'
 done
 
@@ -107,7 +107,7 @@ do
 		git --exec-path=. commit --amend &&
 		git show -s --pretty=oneline |
 		sed -e "s/^[0-9a-f]* //" >actual &&
-		test_cmp actual expect
+		test_cmp expect actual
 	'
 done
 
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 86f23be34a..95653a08ca 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -428,9 +428,9 @@ test_expect_success 'test --mixed <paths>' '
 	git reset HEAD -- file1 file2 file3 &&
 	test_must_fail git diff --quiet &&
 	git diff > output &&
-	test_cmp output expect &&
+	test_cmp expect output &&
 	git diff --cached > output &&
-	test_cmp output cached_expect
+	test_cmp cached_expect output
 '
 
 test_expect_success 'test resetting the index at give paths' '
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index d4b217b0ee..76c223c967 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -187,7 +187,7 @@ test_expect_success 'format of merge conflict from checkout -m' '
 	d
 	>>>>>>> local
 	EOF
-	test_cmp two expect
+	test_cmp expect two
 '
 
 test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
@@ -213,7 +213,7 @@ test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
 	d
 	>>>>>>> local
 	EOF
-	test_cmp two expect
+	test_cmp expect two
 '
 
 test_expect_success 'switch to another branch while carrying a deletion' '
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 6f8337ffb5..a39e69a3eb 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -1211,7 +1211,7 @@ test_expect_success 'clone --recurse-submodules with a pathspec works' '
 
 	git clone --recurse-submodules="sub0" multisuper multisuper_clone &&
 	git -C multisuper_clone submodule status |cut -c1,43- >actual &&
-	test_cmp actual expected
+	test_cmp expected actual
 '
 
 test_expect_success 'clone with multiple --recurse-submodules options' '
diff --git a/t/t7405-submodule-merge.sh b/t/t7405-submodule-merge.sh
index 0d5b42a25b..7bfb2f498d 100755
--- a/t/t7405-submodule-merge.sh
+++ b/t/t7405-submodule-merge.sh
@@ -119,7 +119,7 @@ test_expect_success 'merge with one side as a fast-forward of the other' '
 	 git ls-tree test-forward sub | cut -f1 | cut -f3 -d" " > actual &&
 	 (cd sub &&
 	  git rev-parse sub-d > ../expect) &&
-	 test_cmp actual expect)
+	 test_cmp expect actual)
 '
 
 test_expect_success 'merging should conflict for non fast-forward' '
diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
index 055c90736e..9edf6572ed 100755
--- a/t/t7506-status-submodule.sh
+++ b/t/t7506-status-submodule.sh
@@ -306,7 +306,7 @@ test_expect_success 'diff with merge conflict in .gitmodules' '
 		cd super &&
 		git diff >../diff_actual 2>&1
 	) &&
-	test_cmp diff_actual diff_expect
+	test_cmp diff_expect diff_actual
 '
 
 test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
@@ -314,7 +314,7 @@ test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
 		cd super &&
 		git diff --submodule >../diff_submodule_actual 2>&1
 	) &&
-	test_cmp diff_submodule_actual diff_submodule_expect
+	test_cmp diff_submodule_expect diff_submodule_actual
 '
 
 # We'll setup different cases for further testing:
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 80194b79f9..dfde6a675a 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -697,7 +697,7 @@ test_expect_success 'merge --no-ff --edit' '
 	git cat-file commit HEAD >raw &&
 	grep "work done on the side branch" raw &&
 	sed "1,/^$/d" >actual raw &&
-	test_cmp actual expected
+	test_cmp expected actual
 '
 
 test_expect_success GPG 'merge --ff-only tag' '
@@ -709,7 +709,7 @@ test_expect_success GPG 'merge --ff-only tag' '
 	git merge --ff-only signed &&
 	git rev-parse signed^0 >expect &&
 	git rev-parse HEAD >actual &&
-	test_cmp actual expect
+	test_cmp expect actual
 '
 
 test_expect_success GPG 'merge --no-edit tag should skip editor' '
@@ -721,7 +721,7 @@ test_expect_success GPG 'merge --no-edit tag should skip editor' '
 	EDITOR=false git merge --no-edit signed &&
 	git rev-parse signed^0 >expect &&
 	git rev-parse HEAD^2 >actual &&
-	test_cmp actual expect
+	test_cmp expect actual
 '
 
 test_expect_success 'set up mod-256 conflict scenario' '
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index 381b7df452..1a430b9c40 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -621,7 +621,7 @@ test_expect_success 'file with no base' '
 	test_must_fail git merge master &&
 	git mergetool --no-prompt --tool mybase -- both &&
 	>expected &&
-	test_cmp both expected
+	test_cmp expected both
 '
 
 test_expect_success 'custom commands override built-ins' '
@@ -632,7 +632,7 @@ test_expect_success 'custom commands override built-ins' '
 	test_must_fail git merge master &&
 	git mergetool --no-prompt --tool defaults -- both &&
 	echo master both added >expected &&
-	test_cmp both expected
+	test_cmp expected both
 '
 
 test_expect_success 'filenames seen by tools start with ./' '
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index f30980895c..4d261c2a9c 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1266,7 +1266,7 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
 	grep email-using-8bit stdout &&
 	grep "Which 8bit encoding" stdout &&
 	egrep "Content|MIME" msgtxt1 >actual &&
-	test_cmp actual content-type-decl
+	test_cmp content-type-decl actual
 '
 
 test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
@@ -1277,7 +1277,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
 			--smtp-server="$(pwd)/fake.sendmail" \
 			email-using-8bit >stdout &&
 	egrep "Content|MIME" msgtxt1 >actual &&
-	test_cmp actual content-type-decl
+	test_cmp content-type-decl actual
 '
 
 test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
@@ -1289,7 +1289,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
 			--8bit-encoding=UTF-8 \
 			email-using-8bit >stdout &&
 	egrep "Content|MIME" msgtxt1 >actual &&
-	test_cmp actual content-type-decl
+	test_cmp content-type-decl actual
 '
 
 test_expect_success $PREREQ 'setup expect' '
-- 
2.14.0.rc0.3.g6c2e499285


^ permalink raw reply related	[relevance 6%]

* [PATCH] Spelling fixes
@ 2016-08-09  8:53  6% Ville Skyttä
  0 siblings, 0 replies; 200+ results
From: Ville Skyttä @ 2016-08-09  8:53 UTC (permalink / raw)
  To: git

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
---
 Documentation/RelNotes/2.3.10.txt           | 2 +-
 Documentation/RelNotes/2.4.10.txt           | 2 +-
 Documentation/RelNotes/2.5.4.txt            | 2 +-
 Documentation/RelNotes/2.6.1.txt            | 2 +-
 Documentation/git-remote-fd.txt             | 2 +-
 Documentation/gitattributes.txt             | 2 +-
 Documentation/gitmodules.txt                | 2 +-
 contrib/hooks/multimail/README              | 4 ++--
 contrib/mw-to-git/.perlcriticrc             | 2 +-
 contrib/mw-to-git/git-remote-mediawiki.perl | 2 +-
 contrib/subtree/t/t7900-subtree.sh          | 2 +-
 git-p4.py                                   | 2 +-
 sha1_file.c                                 | 2 +-
 t/README                                    | 2 +-
 t/t1006-cat-file.sh                         | 2 +-
 t/t3101-ls-tree-dirname.sh                  | 2 +-
 t/t6018-rev-list-glob.sh                    | 2 +-
 t/t6030-bisect-porcelain.sh                 | 2 +-
 t/t7001-mv.sh                               | 8 ++++----
 t/t7810-grep.sh                             | 2 +-
 t/t9401-git-cvsserver-crlf.sh               | 2 +-
 upload-pack.c                               | 2 +-
 22 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/Documentation/RelNotes/2.3.10.txt b/Documentation/RelNotes/2.3.10.txt
index 9d425d8..20c2d2c 100644
--- a/Documentation/RelNotes/2.3.10.txt
+++ b/Documentation/RelNotes/2.3.10.txt
@@ -7,7 +7,7 @@ Fixes since v2.3.9
  * xdiff code we use to generate diffs is not prepared to handle
    extremely large files.  It uses "int" in many places, which can
    overflow if we have a very large number of lines or even bytes in
-   our input files, for example.  Cap the input size to soemwhere
+   our input files, for example.  Cap the input size to somewhere
    around 1GB for now.
 
  * Some protocols (like git-remote-ext) can execute arbitrary code
diff --git a/Documentation/RelNotes/2.4.10.txt b/Documentation/RelNotes/2.4.10.txt
index 8621199..702d8d4 100644
--- a/Documentation/RelNotes/2.4.10.txt
+++ b/Documentation/RelNotes/2.4.10.txt
@@ -7,7 +7,7 @@ Fixes since v2.4.9
  * xdiff code we use to generate diffs is not prepared to handle
    extremely large files.  It uses "int" in many places, which can
    overflow if we have a very large number of lines or even bytes in
-   our input files, for example.  Cap the input size to soemwhere
+   our input files, for example.  Cap the input size to somewhere
    around 1GB for now.
 
  * Some protocols (like git-remote-ext) can execute arbitrary code
diff --git a/Documentation/RelNotes/2.5.4.txt b/Documentation/RelNotes/2.5.4.txt
index a5e8477..b8a2f93 100644
--- a/Documentation/RelNotes/2.5.4.txt
+++ b/Documentation/RelNotes/2.5.4.txt
@@ -7,7 +7,7 @@ Fixes since v2.5.4
  * xdiff code we use to generate diffs is not prepared to handle
    extremely large files.  It uses "int" in many places, which can
    overflow if we have a very large number of lines or even bytes in
-   our input files, for example.  Cap the input size to soemwhere
+   our input files, for example.  Cap the input size to somewhere
    around 1GB for now.
 
  * Some protocols (like git-remote-ext) can execute arbitrary code
diff --git a/Documentation/RelNotes/2.6.1.txt b/Documentation/RelNotes/2.6.1.txt
index 1e51363..f37ea89 100644
--- a/Documentation/RelNotes/2.6.1.txt
+++ b/Documentation/RelNotes/2.6.1.txt
@@ -7,7 +7,7 @@ Fixes since v2.6
  * xdiff code we use to generate diffs is not prepared to handle
    extremely large files.  It uses "int" in many places, which can
    overflow if we have a very large number of lines or even bytes in
-   our input files, for example.  Cap the input size to soemwhere
+   our input files, for example.  Cap the input size to somewhere
    around 1GB for now.
 
  * Some protocols (like git-remote-ext) can execute arbitrary code
diff --git a/Documentation/git-remote-fd.txt b/Documentation/git-remote-fd.txt
index e700baf..80afca8 100644
--- a/Documentation/git-remote-fd.txt
+++ b/Documentation/git-remote-fd.txt
@@ -17,7 +17,7 @@ fetch, push or archive.
 
 If only <infd> is given, it is assumed to be a bidirectional socket connected
 to remote Git server (git-upload-pack, git-receive-pack or
-git-upload-achive). If both <infd> and <outfd> are given, they are assumed
+git-upload-archive). If both <infd> and <outfd> are given, they are assumed
 to be pipes connected to a remote Git server (<infd> being the inbound pipe
 and <outfd> being the outbound pipe.
 
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 34db3e2..807577a 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -133,7 +133,7 @@ Set to string value "auto"::
 	When `text` is set to "auto", the path is marked for automatic
 	end-of-line conversion.  If Git decides that the content is
 	text, its line endings are converted to LF on checkin.
-	When the file has been commited with CRLF, no conversion is done.
+	When the file has been committed with CRLF, no conversion is done.
 
 Unspecified::
 
diff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt
index 0849d28..10dcc08 100644
--- a/Documentation/gitmodules.txt
+++ b/Documentation/gitmodules.txt
@@ -81,7 +81,7 @@ submodule.<name>.ignore::
 
 submodule.<name>.shallow::
 	When set to true, a clone of this submodule will be performed as a
-	shallow clone unless the user explicitely asks for a non-shallow
+	shallow clone unless the user explicitly asks for a non-shallow
 	clone.
 
 
diff --git a/contrib/hooks/multimail/README b/contrib/hooks/multimail/README
index 0c91d19..22a23cd 100644
--- a/contrib/hooks/multimail/README
+++ b/contrib/hooks/multimail/README
@@ -294,7 +294,7 @@ multimailhook.htmlInIntro, multimailhook.htmlInFooter
     like ``<a href="foo">link</a>``, the reader will see the HTML
     source code and not a proper link.
 
-    Set ``multimailhook.htmlInIntro`` to true to allow writting HTML
+    Set ``multimailhook.htmlInIntro`` to true to allow writing HTML
     formatting in introduction templates. Similarly, set
     ``multimailhook.htmlInFooter`` for HTML in the footer.
 
@@ -516,7 +516,7 @@ multimailhook.commitLogOpts
 
 multimailhook.dateSubstitute
     String to use as a substitute for ``Date:`` in the output of ``git
-    log`` while formatting commit messages. This is usefull to avoid
+    log`` while formatting commit messages. This is useful to avoid
     emitting a line that can be interpreted by mailers as the start of
     a cited message (Zimbra webmail in particular). Defaults to
     ``CommitDate:``. Set to an empty string or ``none`` to deactivate
diff --git a/contrib/mw-to-git/.perlcriticrc b/contrib/mw-to-git/.perlcriticrc
index 5a9955d..158958d 100644
--- a/contrib/mw-to-git/.perlcriticrc
+++ b/contrib/mw-to-git/.perlcriticrc
@@ -19,7 +19,7 @@
 [InputOutput::RequireCheckedSyscalls]
 functions = open say close
 
-# This rules demands to add a dependancy for the Readonly module. This is not
+# This rule demands to add a dependency for the Readonly module. This is not
 # wished.
 [-ValuesAndExpressions::ProhibitConstantPragma]
 
diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index 8dd74a9..41e74fb 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -963,7 +963,7 @@ sub mw_upload_file {
 		print {*STDERR} "Check the configuration of file uploads in your mediawiki.\n";
 		return $newrevid;
 	}
-	# Deleting and uploading a file requires a priviledged user
+	# Deleting and uploading a file requires a privileged user
 	if ($file_deleted) {
 		$mediawiki = connect_maybe($mediawiki, $remotename, $url);
 		my $query = {
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 9751cfe..3c87eba 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -948,7 +948,7 @@ test_expect_success 'split a new subtree without --onto option' '
 
 		# also test that we still can split out an entirely new subtree
 		# if the parent of the first commit in the tree is not empty,
-		# then the new subtree has accidently been attached to something
+		# then the new subtree has accidentally been attached to something
 		git subtree split --prefix="sub dir2" --branch subproj2-br &&
 		check_equal "$(git log --pretty=format:%P -1 subproj2-br)" ""
 	)
diff --git a/git-p4.py b/git-p4.py
index ac6f4c1..fd5ca52 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1934,7 +1934,7 @@ class P4Submit(Command, P4UserMap):
         if self.useClientSpec:
             self.clientSpecDirs = getClientSpec()
 
-        # Check for the existance of P4 branches
+        # Check for the existence of P4 branches
         branchesDetected = (len(p4BranchesInGit().keys()) > 1)
 
         if self.useClientSpec and not branchesDetected:
diff --git a/sha1_file.c b/sha1_file.c
index 3066b5f..7026e4b 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1692,7 +1692,7 @@ static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,
 		strbuf_add(oi->typename, type_buf, type_len);
 	/*
 	 * Set type to 0 if its an unknown object and
-	 * we're obtaining the type using '--allow-unkown-type'
+	 * we're obtaining the type using '--allow-unknown-type'
 	 * option.
 	 */
 	if ((flags & LOOKUP_UNKNOWN_OBJECT) && (type < 0))
diff --git a/t/README b/t/README
index 76a0daa..0f764c0 100644
--- a/t/README
+++ b/t/README
@@ -265,7 +265,7 @@ right, so this:
     $ sh ./t9200-git-cvsexport-commit.sh --run='1-4 !3'
 
 will run tests 1, 2, and 4.  Items that comes later have higher
-precendence.  It means that this:
+precedence.  It means that this:
 
     $ sh ./t9200-git-cvsexport-commit.sh --run='!3 1-4'
 
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index 4f38078..b19f332 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -231,7 +231,7 @@ $tag_content
        | git cat-file --batch)"
 '
 
-test_expect_success "--batch-check for an emtpy line" '
+test_expect_success "--batch-check for an empty line" '
     test " missing" = "$(echo | git cat-file --batch-check)"
 '
 
diff --git a/t/t3101-ls-tree-dirname.sh b/t/t3101-ls-tree-dirname.sh
index 425d858..327ded4 100755
--- a/t/t3101-ls-tree-dirname.sh
+++ b/t/t3101-ls-tree-dirname.sh
@@ -16,7 +16,7 @@ This test runs git ls-tree with the following in a tree.
     path3/1.txt        - a file in a directory
     path3/2.txt        - a file in a directory
 
-Test the handling of mulitple directories which have matching file
+Test the handling of multiple directories which have matching file
 entries.  Also test odd filename and missing entries handling.
 '
 . ./test-lib.sh
diff --git a/t/t6018-rev-list-glob.sh b/t/t6018-rev-list-glob.sh
index d00f7db..381f35e 100755
--- a/t/t6018-rev-list-glob.sh
+++ b/t/t6018-rev-list-glob.sh
@@ -257,7 +257,7 @@ test_expect_success 'rev-list accumulates multiple --exclude' '
 
 
 # "git rev-list<ENTER>" is likely to be a bug in the calling script and may
-# deserve an error message, but do cases where set of refs programatically
+# deserve an error message, but do cases where set of refs programmatically
 # given using globbing and/or --stdin need to fail with the same error, or
 # are we better off reporting a success with no output?  The following few
 # tests document the current behaviour to remind us that we might want to
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 86d1380..5e5370f 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -721,7 +721,7 @@ git bisect good 3de952f2416b6084f557ec417709eac740c6818c
 # first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
 EOF
 
-test_expect_success 'bisect log: successfull result' '
+test_expect_success 'bisect log: successful result' '
 	git bisect reset &&
 	git bisect start $HASH4 $HASH2 &&
 	git bisect good &&
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4a2570e..e365d1f 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -292,8 +292,8 @@ test_expect_success 'setup submodule' '
 	echo content >file &&
 	git add file &&
 	git commit -m "added sub and file" &&
-	mkdir -p deep/directory/hierachy &&
-	git submodule add ./. deep/directory/hierachy/sub &&
+	mkdir -p deep/directory/hierarchy &&
+	git submodule add ./. deep/directory/hierarchy/sub &&
 	git commit -m "added another submodule" &&
 	git branch submodule
 '
@@ -485,8 +485,8 @@ test_expect_success 'moving a submodule in nested directories' '
 		# git status would fail if the update of linking git dir to
 		# work dir of the submodule failed.
 		git status &&
-		git config -f ../.gitmodules submodule.deep/directory/hierachy/sub.path >../actual &&
-		echo "directory/hierachy/sub" >../expect
+		git config -f ../.gitmodules submodule.deep/directory/hierarchy/sub.path >../actual &&
+		echo "directory/hierarchy/sub" >../expect
 	) &&
 	test_cmp actual expect
 '
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index cf3f9ec..de2405c 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -581,7 +581,7 @@ test_expect_success 'log grep (9)' '
 '
 
 test_expect_success 'log grep (9)' '
-	git log -g --grep-reflog="commit: third" --author="non-existant" --pretty=tformat:%s >actual &&
+	git log -g --grep-reflog="commit: third" --author="non-existent" --pretty=tformat:%s >actual &&
 	: >expect &&
 	test_cmp expect actual
 '
diff --git a/t/t9401-git-cvsserver-crlf.sh b/t/t9401-git-cvsserver-crlf.sh
index f324b9f..84787ee 100755
--- a/t/t9401-git-cvsserver-crlf.sh
+++ b/t/t9401-git-cvsserver-crlf.sh
@@ -154,7 +154,7 @@ test_expect_success 'adding files' '
     echo "more text" > src.c &&
     GIT_CONFIG="$git_config" cvs -Q add src.c >cvs.log 2>&1 &&
     marked_as . src.c "" &&
-    echo "psuedo-binary" > temp.bin
+    echo "pseudo-binary" > temp.bin
     ) &&
     GIT_CONFIG="$git_config" cvs -Q add subdir/temp.bin >cvs.log 2>&1 &&
     marked_as subdir temp.bin "-kb" &&
diff --git a/upload-pack.c b/upload-pack.c
index d4cc414..ca7f941 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -836,7 +836,7 @@ int cmd_main(int argc, const char **argv)
 		OPT_BOOL(0, "stateless-rpc", &stateless_rpc,
 			 N_("quit after a single request/response exchange")),
 		OPT_BOOL(0, "advertise-refs", &advertise_refs,
-			 N_("exit immediately after intial ref advertisement")),
+			 N_("exit immediately after initial ref advertisement")),
 		OPT_BOOL(0, "strict", &strict,
 			 N_("do not try <directory>/.git/ if <directory> is no Git directory")),
 		OPT_INTEGER(0, "timeout", &timeout,
-- 
2.5.5


^ permalink raw reply related	[relevance 6%]

* What's cooking in git.git (Oct 2020, #02; Fri, 9)
@ 2020-10-09 15:59  6% Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2020-10-09 15:59 UTC (permalink / raw)
  To: git

Here are the topics that have been cooking.  Commits prefixed with
'-' are only in 'seen' (formerly 'pu'---proposed updates) while
commits prefixed with '+' are in 'next'.  The ones marked with '.'
do not appear in any of the integration branches, but I am still
holding onto them.

The first release candidate for this cycle, Git v2.29.0-rc1, has
been tagged.  This -rc1 turned out to be a bit more ambitious than
usual in how I handled young-but-small topics.  I would have left
them out, saying "their benefit is low and don't have to be in the
upcoming release", in past cycles.  But this time, I tried to cram
them in -rc1, with an updated excluse "their scope is so small that
they cannot be so wrong to delay the release even if we later find
problems in them, so there is no point in delaying".

We'll see how well it turns out.

You can find the changes described here in the integration branches of the
repositories listed at

    http://git-blame.blogspot.com/p/git-public-repositories.html

--------------------------------------------------
[Graduated to 'master']

* dl/makefile-sort (2020-10-08) 1 commit
  (merged to 'next' on 2020-10-08 at a303ef6d14)
 + Makefile: ASCII-sort += lists

 Makefile clean-up.


* dl/mingw-header-cleanup (2020-10-07) 1 commit
  (merged to 'next' on 2020-10-08 at 35516a8b50)
 + compat/mingw.h: drop extern from function declaration

 Header clean-up.


* hx/push-atomic-with-cert (2020-10-06) 1 commit
  (merged to 'next' on 2020-10-08 at 0729586aa5)
 + t5534: split stdout and stderr redirection

 Hotfix to a recently added test script.


* ja/misc-doc-fixes (2020-10-08) 4 commits
  (merged to 'next' on 2020-10-08 at 167d6696bc)
 + doc: fix the bnf like style of some commands
 + doc: git-remote fix ups
 + doc: use linkgit macro where needed.
 + git-bisect-lk2009: make continuation of list indented

 Doc fixes.


* jk/index-pack-hotfixes (2020-10-07) 3 commits
  (merged to 'next' on 2020-10-08 at 46f5340c07)
 + index-pack: make get_base_data() comment clearer
 + index-pack: drop type_cas mutex
 + index-pack: restore "resolving deltas" progress meter

 Hotfix and clean-up for the jt/threaded-index-pack topic that has
 graduated to v2.29-rc0.


* js/ci-ghwf-dedup-tests (2020-10-08) 2 commits
  (merged to 'next' on 2020-10-08 at 83db2c0a89)
 + ci: do not skip tagged revisions in GitHub workflows
 + ci: skip GitHub workflow runs for already-tested commits/trees

 The logic to skip testing on the tagged commit and the tag itself
 was not quite consistent which led to failure of Windows test
 tasks.  It has been revamped to consistently skip revisions that
 have already been tested, based on the tree object of the revision.


* js/default-branch-name-part-3 (2020-10-08) 2 commits
  (merged to 'next' on 2020-10-08 at 1c02be024d)
 + tests: avoid using the branch name `main`
 + t1415: avoid using `main` as ref name

 Test preparation for the switch of default branch name continues.


* js/ghwf-setup-msbuild-update (2020-10-07) 1 commit
  (merged to 'next' on 2020-10-08 at d4c704f844)
 + GitHub workflow: automatically follow minor updates of setup-msbuild

 CI update.


* js/no-builtins-on-disk-option (2020-10-07) 1 commit
  (merged to 'next' on 2020-10-08 at 4033181bc4)
 + help: do not expect built-in commands to be hardlinked

 Hotfix to breakage introduced in the topic in v2.29-rc0

--------------------------------------------------
[New Topics]

* ag/merge-strategies-in-c (2020-10-06) 11 commits
 - sequencer: use the "octopus" merge strategy without forking
 - sequencer: use the "resolve" strategy without forking
 - merge: use the "octopus" strategy without forking
 - merge: use the "resolve" strategy without forking
 - merge-octopus: rewrite in C
 - merge-recursive: move better_branch_name() to merge.c
 - merge-resolve: rewrite in C
 - merge-index: don't fork if the requested program is `git-merge-one-file'
 - merge-index: libify merge_one_path() and merge_all()
 - merge-one-file: rewrite in C
 - t6027: modernise tests

 The resolve and octopus merge strategy backends have been rewritten
 in C.


* jk/symlinked-dotgitx-files (2020-10-06) 8 commits
  (merged to 'next' on 2020-10-08 at b9e128a280)
 + fsck: complain when .gitattributes or .gitignore is a symlink
 + verify_path(): disallow symlinks in .gitattributes and .gitignore
 + t0060: test obscured .gitattributes and .gitignore matching
 + t7450: test .gitmodules symlink matching against obscured names
 + t7450: test verify_path() handling of gitmodules
 + t7415: rename to expand scope
 + fsck_tree(): wrap some long lines
 + fsck_tree(): fix shadowed variable

 "git fsck" and the corresponding check done during the transport
 learned to ensure that in-tree files like `.gitignore` and
 `.gitattributes` are not symbolic links.

 Will cook in 'next'.


* dl/checkout-guess (2020-10-08) 2 commits
  (merged to 'next' on 2020-10-08 at c9a6bc9a54)
 + checkout: learn to respect checkout.guess
 + Documentation/config/checkout: replace sq with backticks

 "git checkout" learned to use checkout.guess configuration variable
 and enable/disable its "--[no-]guess" option accordingly.

 Will cook in 'next'.


* dl/checkout-p-merge-base (2020-10-07) 4 commits
  (merged to 'next' on 2020-10-08 at 807e047d68)
 + t2016: add a NEEDSWORK about the PERL prerequisite
 + add-patch: add NEEDSWORK about comparing commits
 + Doc: document "A...B" form for <tree-ish> in checkout and switch
 + builtin/checkout: fix `git checkout -p HEAD...` bug

 "git checkout -p A...B [-- <path>]" did not work, even though the
 same command without "-p" correctly used the merge-base between
 commits A and B.

 Will cook in 'next'.


* dl/resurrect-update-for-sha256 (2020-10-08) 2 commits
 - contrib/git-resurrect.sh: use hash-agnostic OID pattern
 - contrib/git-resurrect.sh: indent with tabs

 "git resurrect" script (in contrib/) learned that the object names
 may be longer than 40-hex depending on the hash function in use.


* ds/commit-graph-merging-fix (2020-10-08) 1 commit
 - commit-graph: ignore duplicates when merging layers

 When "git commit-graph" detects the same commit recorded more than
 once while it is merging the layers, it used to die.  The code now
 ignores all but one of them and continues.

 Shouldn't it make sure all copies match, or discard all of them, to
 avoid random corruptions kept in the repository?


* ds/maintenance-commit-graph-auto-fix (2020-10-08) 1 commit
 - maintenance: test commit-graph auto condition

 Test-coverage enhancement of running commit-graph task "git
 maintenance" as needed led to discovery and fix of a bug.


* js/userdiff-php (2020-10-07) 1 commit
  (merged to 'next' on 2020-10-08 at 988c7ea068)
 + userdiff: PHP: catch "abstract" and "final" functions

 Userdiff for PHP update.

 Will cook in 'next'.


* kb/userdiff-rust-macro-rules (2020-10-07) 1 commit
  (merged to 'next' on 2020-10-08 at 949063bcae)
 + userdiff: recognize 'macro_rules!' as starting a Rust function block

 Userdiff for Rust update.

 Will cook in 'next'.


* rk/completion-stash (2020-10-07) 2 commits
  (merged to 'next' on 2020-10-08 at ad60933f40)
 + git-completion.bash: stash-show: complete $__git_diff_common_options
 + git-completion.bash: __git_diff_common_options: add --[no-]patch

 The command line completion script (in contrib/) learned that "git
 stash show" takes the options "git diff" takes.

 Will cook in 'next'.


* sd/userdiff-css-update (2020-10-08) 1 commit
  (merged to 'next' on 2020-10-08 at 69b7e9df5d)
 + userdiff: expand detected chunk headers for css

 Userdiff for CSS update.

 Will cook in 'next'.


* ss/submodule-add-in-c (2020-10-07) 3 commits
 - t7400: add test to check 'submodule add' for tracked paths
 - submodule: port submodule subcommand 'add' from shell to C
 - dir: change the scope of function 'directory_exists_in_index()'

 "git submodule add" being rewritten in C.


* ak/corrected-commit-date (2020-10-08) 10 commits
 - doc: add corrected commit date info
 - commit-reach: use corrected commit dates in paint_down_to_common()
 - commit-graph: use generation v2 only if entire chain does
 - commit-graph: implement generation data chunk
 - commit-graph: implement corrected commit date
 - commit-graph: add a slab to store topological levels
 - commit-graph: return 64-bit generation number
 - commit-graph: consolidate fill_commit_graph_info
 - revision: parse parent in indegree_walk_step()
 - commit-graph: fix regression when computing Bloom filters

 The commit-graph learned to use corrected commit dates instead of
 the generation number to help topological revision traversal.

--------------------------------------------------
[Stalled]

* sv/t7001-modernize (2020-09-25) 11 commits
 - t7001: move cleanup code from outside the tests into them
 - t7001: use `test` rather than `[`
 - t7001: use here-docs instead of echo
 - t7001: put each command on a separate line
 - t7001: use ': >' rather than 'touch'
 - t7001: change (cd <path> && git foo) to (git -C <path> foo)
 - t7001: remove whitespace after redirect operators
 - t7001: change the style for cd according to subshell
 - t7001: remove unnecessary blank lines
 - t7001: use TAB instead of spaces
 - t7001: convert tests from the old style to the current style

 Test script modernization.

 Expecting a reroll.
 cf. <20200925170256.11490-1-shubhunic@gmail.com>


* ew/decline-core-abbrev (2020-09-01) 1 commit
 - core.abbrev <off|false|no> disables abbreviations

 Allow the configuration to specify no abbreviation regardless of
 the hash algorithm.

 Expecting a reroll.  The intent is very good.


* bc/rev-parse-path-format (2020-09-08) 1 commit
 - rev-parse: add option for absolute or relative path formatting

 "git rev-parse" can be explicitly told to give output as absolute
 or relative path.

 Expecting a reroll.
 cf. <20200909222333.GH241078@camp.crustytoothpaste.net>


* ar/fetch-transfer-ipversion (2020-09-16) 1 commit
 - config: option transfer.ipversion to set transport protocol version for network fetches

 Adds transfer.ipversion configuration variable.

 Needs more work.


* vv/send-email-with-less-secure-apps-access (2020-08-29) 1 commit
 - Documentation/git-send-email.txt: Mention less secure app access might need to enable.

 Doc update.

 Expecting a reroll.
 cf. <xmqqwo1hi9nv.fsf@gitster.c.googlers.com>
 cf. <xmqqft85i72s.fsf@gitster.c.googlers.com>


* jc/war-on-dashed-git (2020-08-27) 1 commit
 - git: catch an attempt to run "git-foo"

 The first step to remove on-disk binaries for built-in subcommands
 by soliciting objections.

 On hold for now.


* dr/push-remoteref-fix (2020-04-23) 1 commit
 - remote.c: fix handling of %(push:remoteref)

 The "%(push:remoteref)" placeholder in the "--format=" argument of
 "git format-patch" (and friends) only showed what got explicitly
 configured, not what ref at the receiving end would be updated when
 "git push" was used, as it ignored the default behaviour (e.g. update
 the same ref as the source).

 Discard for now.
 cf. <xmqqv9gu7c61.fsf@gitster.c.googlers.com>
 cf. <20200911214358.acl3hy2e763begoo@feanor>


* mk/use-size-t-in-zlib (2018-10-15) 1 commit
 - zlib.c: use size_t for size

 The wrapper to call into zlib followed our long tradition to use
 "unsigned long" for sizes of regions in memory, which have been
 updated to use "size_t".

--------------------------------------------------
[Cooking]

* mk/diff-ignore-regex (2020-10-01) 2 commits
 - t: add -I<regex> tests
 - diff: add -I<regex> that ignores matching changes

 "git diff" family of commands learned the "-I<regex>" option to
 ignore hunks whose changed lines all match the given pattern.

 Expecting a reroll.
 cf. <20201007194821.GA20549@larwa.hq.kempniu.pl>


* mt/parallel-checkout-part-1 (2020-10-05) 20 commits
  (merged to 'next' on 2020-10-05 at 571e16d68a)
 + parallel-checkout: drop unused checkout state parameter
  (merged to 'next' on 2020-10-04 at 20438c1143)
 + ci: run test round with parallel-checkout enabled
 + parallel-checkout: add tests related to .gitattributes
 + parallel-checkout: add tests related to clone collisions
 + parallel-checkout: add tests for basic operations
 + checkout-index: add parallel checkout support
 + builtin/checkout.c: complete parallel checkout support
 + make_transient_cache_entry(): optionally alloc from mem_pool
 + parallel-checkout: support progress displaying
 + parallel-checkout: make it truly parallel
 + unpack-trees: add basic support for parallel checkout
 + entry: add checkout_entry_ca() which takes preloaded conv_attrs
 + entry: move conv_attrs lookup up to checkout_entry()
 + entry: extract cache_entry update from write_entry()
 + entry: make fstat_output() and read_blob_entry() public
 + entry: extract a header file for entry.c functions
 + convert: add conv_attrs classification
 + convert: add get_stream_filter_ca() variant
 + convert: add [async_]convert_to_working_tree_ca() variants
 + convert: make convert_attrs() and convert structs public

 Parallel checkout.

 Will cook in 'next'.


* dl/diff-merge-base (2020-09-21) 10 commits
 - contrib/completion: complete `git diff --merge-base`
 - builtin/diff-tree: learn --merge-base
 - builtin/diff-index: learn --merge-base
 - t4068: add --merge-base tests
 - diff-lib: define diff_get_merge_base()
 - diff-lib: accept option flags in run_diff_index()
 - contrib/completion: extract common diff/difftool options
 - git-diff.txt: backtick quote command text
 - git-diff-index.txt: make --cached description a proper sentence
 - t4068: remove unnecessary >tmp

 "git diff A...B" learned "git diff --merge-base A B", which is a
 longer short-hand to say the same thing.


* sb/clone-origin (2020-09-30) 7 commits
  (merged to 'next' on 2020-10-06 at 7178c9af9c)
 + clone: allow configurable default for `-o`/`--origin`
 + clone: read new remote name from remote_name instead of option_origin
 + clone: validate --origin option before use
 + refs: consolidate remote name validation
 + remote: add tests for add and rename with invalid names
 + clone: use more conventional config/option layering
 + clone: add tests for --template and some disallowed option pairs

 "git clone" learned clone.defaultremotename configuration variable
 to customize what nickname to use to call the remote the repository
 was cloned from.

 Will cook in 'next'.


* sk/force-if-includes (2020-10-03) 4 commits
  (merged to 'next' on 2020-10-04 at 09c4c1e088)
 + t, doc: update tests, reference for "--force-if-includes"
 + push: parse and set flag for "--force-if-includes"
 + push: add reflog check for "--force-if-includes"
 + Merge branch 'ds/in-merge-bases-many-optim-bug' into sk/force-if-includes

 "git push --force-with-lease[=<ref>]" can easily be misused to lose
 commits unless the user takes good care of their own "git fetch".
 A new option "--force-if-includes" attempts to ensure that what is
 being force-pushed was created after examining the commit at the
 tip of the remote ref that is about to be force-replaced.

 Will cook in 'next'.


* hn/reftable (2020-10-01) 13 commits
 . reftable: "test-tool dump-reftable" command.
 . reftable: rest of library
 . reftable: file level tests
 . reftable: read reftable files
 . reftable: write reftable files
 . reftable: a generic binary tree implementation
 . reftable: reading/writing blocks
 . reftable: (de)serialization for the polymorphic record type.
 . reftable: utility functions
 . reftable: add a barebones unittest framework
 . vcxproj: adjust for the reftable changes
 . reftable: define the public API
 . reftable: add LICENSE

 The reftable backend for the refs API.

 Expecting a reroll.
 Seems not to build for Windows folks.
 cf. <nycvar.QRO.7.76.6.2010021555290.50@tvgsbejvaqbjf.bet>
 cf. <nycvar.QRO.7.76.6.2010021557570.50@tvgsbejvaqbjf.bet>


* ds/maintenance-part-3 (2020-10-05) 7 commits
 - maintenance: add troubleshooting guide to docs
 - maintenance: use default schedule if not configured
 - maintenance: add start/stop subcommands
 - maintenance: add [un]register subcommands
 - for-each-repo: run subcommands on configured repos
 - maintenance: add --schedule option and config
 - maintenance: optionally skip --auto process
 (this branch uses ds/maintenance-part-2.)

 Parts of "git maintenance" to ease writing crontab entries (and
 other scheduling system configuration) for it.

 cf. <20201005195701.14268-1-martin.agren@gmail.com>


* es/config-hooks (2020-09-09) 9 commits
 - run_commit_hook: take strvec instead of varargs
 - commit: use config-based hooks
 - hook: replace run-command.h:find_hook
 - hook: add 'run' subcommand
 - parse-options: parse into strvec
 - hook: add --porcelain to list command
 - hook: add list command
 - hook: scaffolding for git-hook subcommand
 - doc: propose hooks managed by the config

 The "hooks defined in config" topic.

 Expecting a reroll.
 cf. <20201005212751.GH331156@google.com>


* mt/grep-sparse-checkout (2020-09-10) 9 commits
 - config: add setting to ignore sparsity patterns in some cmds
 - grep: honor sparse checkout patterns
 - config: correctly read worktree configs in submodules
 - config: make do_git_config_sequence receive a 'struct repository'
 - t/helper/test-config: unify exit labels
 - t/helper/test-config: diagnose missing arguments
 - t/helper/test-config: be consistent with exit codes
 - t1308-config-set: avoid false positives when using test-config
 - doc: grep: unify info on configuration variables

 "git grep" has been tweaked to be limited to the sparse checkout
 paths.


* ds/maintenance-part-2 (2020-09-25) 8 commits
  (merged to 'next' on 2020-10-04 at c2a46f390c)
 + maintenance: add incremental-repack auto condition
 + maintenance: auto-size incremental-repack batch
 + maintenance: add incremental-repack task
 + midx: use start_delayed_progress()
 + midx: enable core.multiPackIndex by default
 + maintenance: create auto condition for loose-objects
 + maintenance: add loose-objects task
 + maintenance: add prefetch task
 (this branch is used by ds/maintenance-part-3.)

 "git maintenance", an extended big brother of "git gc", continues
 to evolve.

 Will cook in 'next'.

^ permalink raw reply	[relevance 6%]

* Re: [PATCHv2] git-mv: Keep moved index entries inact
  @ 2008-07-28 14:20  6%     ` SZEDER Gábor
  2008-07-28 15:06 13%       ` Johannes Schindelin
  0 siblings, 1 reply; 200+ results
From: SZEDER Gábor @ 2008-07-28 14:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, git

Hi,

there is a race somewhere in these 'git-mv: Keep moved index entries
inact' changes.

The test cases 'git mv should overwrite symlink to a file' or 'git mv
should overwrite file with a symlink' fail occasionaly.  It's quite
non-deterministic:  I have run t7001-mv.sh in a loop (see below) and
one or the other usually fails around 50 runs (but sometimes only
after 150).  Adding some tracing echos to the tests shows that both
tests fail when running 'git diff-files' at the end.

Regards,
Gábor


---
#!/bin/bash

ret=0
i=0
while test $ret = 0 ; do
        GIT_TEST_OPTS='--verbose --debug' make t7001-mv.sh
        ret=$?
        i=$((i+1))
done
echo "Failed at ${i}th run"

^ permalink raw reply	[relevance 6%]

* Re: What's cooking in git.git (Jul 2014, #04; Tue, 22)
  @ 2014-07-23 14:17  6% ` Karsten Blees
  0 siblings, 0 replies; 200+ results
From: Karsten Blees @ 2014-07-23 14:17 UTC (permalink / raw)
  To: Junio C Hamano, git

Am 22.07.2014 23:44, schrieb Junio C Hamano:
> 
> * sk/mingw-uni-fix-more (2014-07-21) 14 commits
>  - Win32: enable color output in Windows cmd.exe
>  - Win32: patch Windows environment on startup
>  - Win32: keep the environment sorted
>  - Win32: use low-level memory allocation during initialization
>  - Win32: reduce environment array reallocations
>  - Win32: don't copy the environment twice when spawning child processes
>  - Win32: factor out environment block creation
>  - Win32: unify environment function names
>  - Win32: unify environment case-sensitivity
>  - Win32: fix environment memory leaks
>  - Win32: Unicode environment (incoming)
>  - Win32: Unicode environment (outgoing)
>  - Revert "Windows: teach getenv to do a case-sensitive search"
>  - tests: do not pass iso8859-1 encoded parameter
> 
>  Most of these are battle-tested in msysgit and are needed to
>  complete what has been merged to 'master' already.
> 
>  A fix has been squashed into "Unicode environ (outgoing)"; is this
>  now ready to go?
> 
> 
> * sk/mingw-tests-workaround (2014-07-21) 6 commits
>  - t800[12]: work around MSys limitation
>  - t9902: mingw-specific fix for gitfile link files
>  - t4210: skip command-line encoding tests on mingw
>  - MinGW: disable legacy encoding tests
>  - t0110/MinGW: skip tests that pass arbitrary bytes on the command line
>  - MinGW: Skip test redirecting to fd 4
>  (this branch is used by jc/not-mingw-cygwin.)
> 
>  Make tests pass on msysgit by mostly disabling ones that are
>  infeasible on that platform.
> 
>  The t0110 one has been replaced; is this now ready to go?
> 

Yes, I think both series are ready.

Compiles with msysgit and MSVC (with NO_CURL=1).

With the version in pu, three tests fail. t7001 is fixed with a newer 'cp'.
The other two are unrelated (introduced by nd/multiple-work-trees topic).

* t1501-worktree: failed 1
  As of 5bbcb072 "setup.c: support multi-checkout repo setup"
  Using $TRASH_DIRECTORY doesn't work on Windows.
  
* t2026-prune-linked-checkouts: failed 1
  As of 404a45f1 "prune: strategies for linked checkouts"
  Dito.

* t7001-mv: failed 6
  'cp -P' doesn't work due to outdated cp.exe.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH] git mv: do not keep slash in `git mv dir non-existing-dir/`
  @ 2016-08-05 15:58  6%   ` Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2016-08-05 15:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

On Fri, 5 Aug 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > When calling `rename("dir", "non-existing-dir/")` on Linux, it silently
> > succeeds, stripping the trailing slash of the second argument.
> >
> > This is all good and dandy but this behavior disagrees with the specs at
> >
> > http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html
> >
> > that state clearly regarding the 2nd parameter (called `new`):
> >
> > 	If the `new` argument does not resolve to an existing directory
> > 	entry for a file of type directory and the `new` argument
> > 	contains at least one non- <slash> character and ends with one
> > 	or more trailing <slash> characters after all symbolic links
> > 	have been processed, `rename()` shall fail.
> 
> I agree with all of the above.  But
> 
> > Of course, we would like `git mv dir non-existing-dir/` to succeed (and
> > rename the directory "dir" to "non-existing-dir").
> 
> I do not think I want that.  When I say "mv A B/", I want it to fail
> if I made a typo for B; the trailing slash after B is an explicit
> statement "I expect B to exist and I want A to appear at B/A".

Please note that t7001 *specifically* tests for the opposite of what you
want, then ;-)

	https://github.com/git/git/blob/v2.9.2/t/t7001-mv.sh#L79-L80

> Current Git behaviour on Linux seems to allow "git mv dir no-such-dir/"
> but "dir" is renamed to "no-such-dir", which fails two expectations,
> and I think this is broken.  If Windows port does not share this
> breakage, that is a good thing.  We should fix Git behaviour on Linux
> instead, I would think.

To be precise, Git for Windows displays the same behavior as Git on Linux,
because rename("dir", "no-such-dir/") succeeds.

The breakage fixed by this here patch happens when running plain Linux Git
in "Bash on Windows" (i.e. Bash on Ubuntu on Windows, the new Linux
subsystem of Windows, allowing to run unmodified Linux binaries on Windows
without the need for a Virtual Machine).

Ciao,
Dscho

^ permalink raw reply	[relevance 6%]

* Re: [PATCH 02/14] lib-submodule-update.sh: define tests for recursing into submodules
  @ 2017-02-15 18:52  6%     ` Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2017-02-15 18:52 UTC (permalink / raw)
  To: Brandon Williams
  Cc: git@vger.kernel.org, Jonathan Nieder, brian m. carlson,
	Junio C Hamano

On Wed, Feb 15, 2017 at 8:51 AM, Brandon Williams <bmwill@google.com> wrote:
> On 02/14, Stefan Beller wrote:
>> diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
>> index 61c54f2098..7c8c557572 100755
>> --- a/t/lib-submodule-update.sh
>> +++ b/t/lib-submodule-update.sh
>> @@ -4,6 +4,7 @@
>>  # - New submodule (no_submodule => add_sub1)
>>  # - Removed submodule (add_sub1 => remove_sub1)
>>  # - Updated submodule (add_sub1 => modify_sub1)
>> +# - Updated submodule recursively (modify_sub1 => modify_sub1_recursively)
>>  # - Submodule updated to invalid commit (add_sub1 => invalid_sub1)
>>  # - Submodule updated from invalid commit (invalid_sub1 => valid_sub1)
>>  # - Submodule replaced by tracked files in directory (add_sub1 =>
>> @@ -19,8 +20,8 @@
>>  #                    /    ^
>>  #                   /     remove_sub1
>>  #                  /
>> -#       add_sub1  /-------O
>> -#             |  /        ^
>> +#       add_sub1  /-------O---------O
>> +#             |  /        ^         modify_sub1_recursive
>>  #             | /         modify_sub1
>>  #             v/
>>  #      O------O-----------O---------O
>> @@ -73,6 +74,14 @@ create_lib_submodule_repo () {
>>               git add sub1 &&
>>               git commit -m "Modify sub1" &&
>>
>> +             git checkout -b modify_sub1_recursively modify_sub1 &&
>> +             git -C sub1 checkout -b "add_nested_sub" &&
>> +             git -C sub1 submodule add --branch no_submodule ./. sub2 &&
>
> I thought we were trying to avoid './.' when adding submodules?
>

Yes we should; I'll fix that in a reroll.
It's also still on my long term fix list to remove the ./.
$ git grep 'add \./\.'
lib-submodule-update.sh:                git submodule add ./. sub1 &&
t7001-mv.sh:    git submodule add ./. sub &&
t7001-mv.sh:    git submodule add ./. deep/directory/hierarchy/sub &&
t7507-commit-verbose.sh:        git submodule add ./. sub &&
t7800-difftool.sh:      git submodule add ./. submod/ule &&

^ permalink raw reply	[relevance 6%]

* Re: [Outreachy] Introduction
  @ 2020-10-11  8:09  6% ` Christian Couder
  0 siblings, 0 replies; 200+ results
From: Christian Couder @ 2020-10-11  8:09 UTC (permalink / raw)
  To: Charvi Mendiratta; +Cc: git

Hi Charvi,

On Sun, Oct 11, 2020 at 1:13 AM Charvi Mendiratta <charvi077@gmail.com> wrote:
>
> Hello everyone !
>
> I am Charvi Mendiratta, one of the outreachy applicant. I would like
> to work on the project "Improve droping and rewording commits in Git
> interactive rebase".

Welcome to the Git project and its mailing list!

> Till now I have installed and built the project and going through the
> guidelines of patch submission and project details .
>
> Also, getting on micro projects
> https://git.github.io/Outreachy-21-Microprojects/
> Firstly to get familiar and hands on with the patch based submission I
> am looking to start with one of the micro projects that is "Modernize
> a test script".

Great!

> These are test scripts  t7001,t7101,t7102 ,t7201 that require the same
> changes of styling . I would like to once confirm if anyone else is
> not working on the same ?

Someone recently started working on modernizing t7001. You can see
that by searching the mailing list archive:

https://public-inbox.org/git/?q=t7001

You will find:

https://public-inbox.org/git/20200925170256.11490-1-shubhunic@gmail.com/

About t7101,t7102 and t7201, yeah, it looks like they could be
modernized a bit, and no one is working on that yet. So feel free to
do it!

Best,
Christian.

^ permalink raw reply	[relevance 6%]

* Re: [PATCH] t2080: fix cp invocation to copy symlinks instead of following them
  @ 2021-05-27  7:25  6% ` Christian Couder
  0 siblings, 0 replies; 200+ results
From: Christian Couder @ 2021-05-27  7:25 UTC (permalink / raw)
  To: Matheus Tavares
  Cc: Junio C Hamano, git, Ævar Arnfjörð Bjarmason

Just a few nits that you can take into account if you reroll the patch
for another reason, but I am not sure they are worth rerolling by
themselves.

On Thu, May 27, 2021 at 3:27 AM Matheus Tavares
<matheus.bernardino@usp.br> wrote:
>
> t2080 makes a few copies of a test repository and later performs a
> branch switch on each one of the copies to verify that parallel checkout
> and sequential checkout produce the same results. However, the
> repository is copied with `cp -R` which, on some systems, defaults to
> following symlinks on the directory hierarchy and copying their target
> files instead of copying the symlinks themselves. AIX is one example of
> system where this happens. Because the symlinks are not preserved, the
> copied repositories have paths that do not match what is in the index,
> causing git to abort the checkout operation that we want to test. This

s/git/Git/

> makes the test fail on these systems.
>
> Fix this by copying the repository with the POSIX flag '-P', which
> forces cp to copy the symlinks instead of following them. Note that we
> already use this flag for other cp invocations in our test suite (see
> t7001).

Maybe you could mention 00764ca10e (test: fix t7001 cp to use POSIX
options, 2014-04-11) that also fixed t7001 in a similar way.

> With this change, t2080 now passes on AIX.

Thanks!

^ permalink raw reply	[relevance 6%]

* [PATCH 0/3] dropping "verbose" test helper function
@ 2023-05-08 18:59  7% Jeff King
  2023-05-08 19:01 19% ` [PATCH 2/3] t7001: use "ls-files --format" instead of "cut" Jeff King
  2023-05-08 19:01 13% ` [PATCH 1/3] t7001: avoid git on upstream of pipe Jeff King
  0 siblings, 2 replies; 200+ results
From: Jeff King @ 2023-05-08 18:59 UTC (permalink / raw)
  To: git

I happened across an instance of the "verbose" helper function in a
test recently. I think it's clear we prefer the "-x" tracing to it these
days, and we've been slowly removing instances. This series gets rid of
the last few.

The actual change (and rationale) is in patch 3. Patch 1 just fixes pipe
problems on lines we'll be touching patch 3, and patch 2 is a cute
optimization enabled by patch 1. I don't think any of it should be very
controversial, but it can all be split up if need be.

  [1/3]: t7001: avoid git on upstream of pipe
  [2/3]: t7001: use "ls-files --format" instead of "cut"
  [3/3]: t: drop "verbose" helper function

 t/t0020-crlf.sh            | 38 +++++++++++++++++++-------------------
 t/t1301-shared-repo.sh     |  4 ++--
 t/t3427-rebase-subtree.sh  | 12 ++++++------
 t/t4022-diff-rewrite.sh    |  2 +-
 t/t4062-diff-pickaxe.sh    |  2 +-
 t/t5304-prune.sh           | 16 ++++++++--------
 t/t6006-rev-list-format.sh |  2 +-
 t/t6501-freshen-objects.sh |  2 +-
 t/t7001-mv.sh              | 37 +++++++++++++++++++++----------------
 t/t7300-clean.sh           |  4 ++--
 t/t9902-completion.sh      | 30 +++++++++++++++---------------
 t/test-lib-functions.sh    |  9 ---------
 12 files changed, 77 insertions(+), 81 deletions(-)

-Peff

^ permalink raw reply	[relevance 7%]

* Re: [JGIT PATCH 2/2] Make Repository.isValidRefName compatible with Git 1.6.3
  @ 2009-05-08  0:47  7%         ` Shawn O. Pearce
  0 siblings, 0 replies; 200+ results
From: Shawn O. Pearce @ 2009-05-08  0:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Linus Torvalds, Robin Rosenberg, Git Mailing List

Junio C Hamano <gitster@pobox.com> wrote:
> Linus Torvalds <torvalds@linux-foundation.org> writes:
> >> 
> >> In 3e262b95c509 I taught C Git to disallow refs whose names end in
> >> ".lock".
> >
> > Btw, I think we should revert that, and instead change our naming for 
> > lock-files.
> 
> '..lck' may be a good name to use here.

I agree.  So much so that I wrote a patch for you.

--8<--
Change .lock suffix to ..lck

In 3e262b95c509 I taught Git to deny creation of refs whose name
ends in ".lock", as the loose ref scanner skips over these under
the assumption that they are refs being modified by a concurrent
process operating on the same repository.

Linus pointed out that the name "fix.vm.lock" is an otherwise
perfectly valid branch name, except the ".lock" suffix conflicts
with the internal implementation detail of how Git manages doing
an atomic update.

Instead, change the name to "..lck", as suggested by Junio.

This uses the same storage space in memory as ".lock", so we can do
a fairly dumb search-replace to make the change, but the ".." prefix
has been forbidden in a ref name for ages, to prevent "a..b" from
being ambiguous as a single ref name, or as the pair "^a b".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 Documentation/git-check-ref-format.txt   |    2 --
 Documentation/technical/api-lockfile.txt |    4 ++--
 builtin-reflog.c                         |    2 +-
 config.c                                 |    2 +-
 lockfile.c                               |   10 +++++-----
 refs.c                                   |   11 ++++-------
 t/t3505-cherry-pick-empty.sh             |    2 +-
 t/t3600-rm.sh                            |    4 ++--
 t/t4123-apply-shrink.sh                  |    2 +-
 t/t7001-mv.sh                            |    4 ++--
 t/t7502-commit.sh                        |    2 +-
 t/test-lib.sh                            |    6 +++---
 12 files changed, 23 insertions(+), 28 deletions(-)

diff --git a/Documentation/git-check-ref-format.txt b/Documentation/git-check-ref-format.txt
index c1ce268..7c0f0ea 100644
--- a/Documentation/git-check-ref-format.txt
+++ b/Documentation/git-check-ref-format.txt
@@ -34,8 +34,6 @@ imposes the following rules on how references are named:
 
 . They cannot end with a slash `/` nor a dot `.`.
 
-. They cannot end with the sequence `.lock`.
-
 . They cannot contain a sequence `@{`.
 
 These rules make it easy for shell script based tools to parse
diff --git a/Documentation/technical/api-lockfile.txt b/Documentation/technical/api-lockfile.txt
index dd89404..982984f 100644
--- a/Documentation/technical/api-lockfile.txt
+++ b/Documentation/technical/api-lockfile.txt
@@ -4,9 +4,9 @@ lockfile API
 The lockfile API serves two purposes:
 
 * Mutual exclusion.  When we write out a new index file, first
-  we create a new file `$GIT_DIR/index.lock`, write the new
+  we create a new file `$GIT_DIR/index..lck`, write the new
   contents into it, and rename it to the final destination
-  `$GIT_DIR/index`.  We try to create the `$GIT_DIR/index.lock`
+  `$GIT_DIR/index`.  We try to create the `$GIT_DIR/index..lck`
   file with O_EXCL so that we can notice and fail when somebody
   else is already trying to update the index file.
 
diff --git a/builtin-reflog.c b/builtin-reflog.c
index ddfdf5a..19baf07 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -341,7 +341,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
 	if (!file_exists(log_file))
 		goto finish;
 	if (!cmd->dry_run) {
-		newlog_path = git_pathdup("logs/%s.lock", ref);
+		newlog_path = git_pathdup("logs/%s..lck", ref);
 		cb.newlog = fopen(newlog_path, "w");
 	}
 
diff --git a/config.c b/config.c
index 1682273..50ecc1e 100644
--- a/config.c
+++ b/config.c
@@ -925,7 +925,7 @@ int git_config_set(const char *key, const char *value)
  *
  * This function does this:
  *
- * - it locks the config file by creating ".git/config.lock"
+ * - it locks the config file by creating ".git/config..lck"
  *
  * - it then parses the config using store_aux() as validator to find
  *   the position on the key/value pair to replace. If it is to be unset,
diff --git a/lockfile.c b/lockfile.c
index 828d19f..61ff5cb 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -129,11 +129,11 @@ static int lock_file(struct lock_file *lk, const char *path, int flags)
 	strcpy(lk->filename, path);
 	/*
 	 * subtract 5 from size to make sure there's room for adding
-	 * ".lock" for the lock file name
+	 * "..lck" for the lock file name
 	 */
 	if (!(flags & LOCK_NODEREF))
 		resolve_symlink(lk->filename, sizeof(lk->filename)-5);
-	strcat(lk->filename, ".lock");
+	strcat(lk->filename, "..lck");
 	lk->fd = open(lk->filename, O_RDWR | O_CREAT | O_EXCL, 0666);
 	if (0 <= lk->fd) {
 		if (!lock_file_list) {
@@ -159,13 +159,13 @@ static int lock_file(struct lock_file *lk, const char *path, int flags)
 NORETURN void unable_to_lock_index_die(const char *path, int err)
 {
 	if (err == EEXIST) {
-		die("Unable to create '%s.lock': %s.\n\n"
+		die("Unable to create '%s..lck': %s.\n\n"
 		    "If no other git process is currently running, this probably means a\n"
 		    "git process crashed in this repository earlier. Make sure no other git\n"
 		    "process is running and remove the file manually to continue.",
 		    path, strerror(err));
 	} else {
-		die("Unable to create '%s.lock': %s", path, strerror(err));
+		die("Unable to create '%s..lck': %s", path, strerror(err));
 	}
 }
 
@@ -219,7 +219,7 @@ int commit_lock_file(struct lock_file *lk)
 	if (lk->fd >= 0 && close_lock_file(lk))
 		return -1;
 	strcpy(result_file, lk->filename);
-	i = strlen(result_file) - 5; /* .lock */
+	i = strlen(result_file) - 5; /* ..lck */
 	result_file[i] = 0;
 	if (rename(lk->filename, result_file))
 		return -1;
diff --git a/refs.c b/refs.c
index e65a3b4..b4ca305 100644
--- a/refs.c
+++ b/refs.c
@@ -266,7 +266,7 @@ static struct ref_list *get_ref_dir(const char *base, struct ref_list *list)
 			namelen = strlen(de->d_name);
 			if (namelen > 255)
 				continue;
-			if (has_extension(de->d_name, ".lock"))
+			if (has_extension(de->d_name, "..lck"))
 				continue;
 			memcpy(ref + baselen, de->d_name, namelen+1);
 			if (stat(git_path("%s", ref), &st) < 0)
@@ -681,7 +681,6 @@ int for_each_rawref(each_ref_fn fn, void *cb_data)
  * - it has double dots "..", or
  * - it has ASCII control character, "~", "^", ":" or SP, anywhere, or
  * - it ends with a "/".
- * - it ends with ".lock"
  */
 
 static inline int bad_ref_char(int ch)
@@ -743,8 +742,6 @@ int check_ref_format(const char *ref)
 				return CHECK_REF_FORMAT_ERROR;
 			if (level < 2)
 				return CHECK_REF_FORMAT_ONELEVEL;
-			if (has_extension(ref, ".lock"))
-				return CHECK_REF_FORMAT_ERROR;
 			return ret;
 		}
 	}
@@ -996,7 +993,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
 		const char *path;
 
 		if (!(delopt & REF_NODEREF)) {
-			i = strlen(lock->lk->filename) - 5; /* .lock */
+			i = strlen(lock->lk->filename) - 5; /* ..lck */
 			lock->lk->filename[i] = 0;
 			path = lock->lk->filename;
 		} else {
@@ -1363,7 +1360,7 @@ int create_symref(const char *ref_target, const char *refs_heads_master,
 		error("refname too long: %s", refs_heads_master);
 		goto error_free_return;
 	}
-	lockpath = mkpath("%s.lock", git_HEAD);
+	lockpath = mkpath("%s..lck", git_HEAD);
 	fd = open(lockpath, O_CREAT | O_EXCL | O_WRONLY, 0666);
 	if (fd < 0) {
 		error("Unable to open %s for writing", lockpath);
@@ -1593,7 +1590,7 @@ static int do_for_each_reflog(const char *base, each_ref_fn fn, void *cb_data)
 			namelen = strlen(de->d_name);
 			if (namelen > 255)
 				continue;
-			if (has_extension(de->d_name, ".lock"))
+			if (has_extension(de->d_name, "..lck"))
 				continue;
 			memcpy(log + baselen, de->d_name, namelen+1);
 			if (stat(git_path("logs/%s", log), &st) < 0)
diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh
index 9aaeabd..3b7aa6d 100755
--- a/t/t3505-cherry-pick-empty.sh
+++ b/t/t3505-cherry-pick-empty.sh
@@ -26,7 +26,7 @@ test_expect_code 1 'cherry-pick an empty commit' '
 
 test_expect_success 'index lockfile was removed' '
 
-	test ! -f .git/index.lock
+	test ! -f .git/index..lck
 
 '
 
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 76b1bb4..e437cf7 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -264,9 +264,9 @@ test_expect_success 'choking "git rm" should not let it die with cruft' '
 	    i=$(( $i + 1 ))
 	done | git update-index --index-info &&
 	git rm -n "some-file-*" | :;
-	test -f .git/index.lock
+	test -f .git/index..lck
 	status=$?
-	rm -f .git/index.lock
+	rm -f .git/index..lck
 	git reset -q --hard
 	test "$status" != 0
 '
diff --git a/t/t4123-apply-shrink.sh b/t/t4123-apply-shrink.sh
index 984157f..fcd6a67 100755
--- a/t/t4123-apply-shrink.sh
+++ b/t/t4123-apply-shrink.sh
@@ -47,7 +47,7 @@ test_expect_success 'apply should fail gracefully' '
 	else
 		status=$?
 		echo "Status was $status"
-		if test -f .git/index.lock
+		if test -f .git/index..lck
 		then
 			echo Oops, should not have crashed
 			false
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 10b8f8c..afe8240 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -62,14 +62,14 @@ test_expect_success \
     'checking -f on untracked file with existing target' \
     'touch path0/untracked1 &&
      git mv -f untracked1 path0
-     test ! -f .git/index.lock &&
+     test ! -f .git/index..lck &&
      test -f untracked1 &&
      test -f path0/untracked1'
 
 # clean up the mess in case bad things happen
 rm -f idontexist untracked1 untracked2 \
      path0/idontexist path0/untracked1 path0/untracked2 \
-     .git/index.lock
+     .git/index..lck
 
 test_expect_success \
     'adding another file' \
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index 56cd866..100da27 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -241,7 +241,7 @@ test_expect_success EXECKEEPSPID 'a SIGTERM should break locks' '
 	  GIT_EDITOR=.git/FAKE_EDITOR
 	  export GIT_EDITOR
 	  exec git commit -a'\'' &&
-	test ! -f .git/index.lock
+	test ! -f .git/index..lck
 '
 
 rm -f .git/MERGE_MSG .git/COMMIT_EDITMSG
diff --git a/t/test-lib.sh b/t/test-lib.sh
index dad1437..ecce338 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -558,13 +558,13 @@ else
 		test -h "$2" &&
 		test "$1" = "$(readlink "$2")" || {
 			# be super paranoid
-			if mkdir "$2".lock
+			if mkdir "$2"..lck
 			then
 				rm -f "$2" &&
 				ln -s "$1" "$2" &&
-				rm -r "$2".lock
+				rm -r "$2"..lck
 			else
-				while test -d "$2".lock
+				while test -d "$2"..lck
 				do
 					say "Waiting for lock on $2."
 					sleep 1
-- 
1.6.3.195.gad81


-- 
Shawn.

^ permalink raw reply related	[relevance 7%]

* Re: [PATCH] Adjust t5510 to put remotes in config
  @ 2006-12-18 23:27  8%             ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2006-12-18 23:27 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Junio C Hamano <junkio@cox.net> writes:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> On Mon, 18 Dec 2006, Johannes Schindelin wrote:
>>
>>> I don't install templates. Ever. I want to be sure that nothing slips in 
>>> by mistake, and so I install hooks manually.
>>
>> Side note: prior to installing the tests would fail anyway, no?
>
> They shouldn't.  At least the intent was to make the tests read
> from $SRCDIR/templates/blt/ as the source of templates.
>
> But maybe you spotted a bug in t/test-lib.sh; I don't know
> without digging.

Indeed it appears to be the case.  I am thinking about applying
this patch to fix it.

-- >8 --
fix testsuite: make sure they use templates freshly built from the source

The initial t/trash repository for testing was created properly
but over time we gained many tests that create secondary test
repositories with init-db or clone and they were not careful
enough.

This fixes it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/t/test-lib.sh b/t/test-lib.sh
index ac7be76..7e91497 100755
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -182,6 +182,16 @@ test_create_repo () {
 	cd "$owd"
 }
 	
+# Many tests do init-db and clone but they must be told about the freshly
+# built templates.
+git_init_db () {
+	git init-db --template="$GIT_EXEC_PATH/templates/blt/" "$@"
+}
+
+git_clone () {
+	git clone --template="$GIT_EXEC_PATH/templates/blt/" "$@"
+}
+
 test_done () {
 	trap - exit
 	case "$test_failure" in
diff --git a/t/t4116-apply-reverse.sh b/t/t4116-apply-reverse.sh
index 74f5c2a..a79c77a 100755
--- a/t/t4116-apply-reverse.sh
+++ b/t/t4116-apply-reverse.sh
@@ -50,12 +50,12 @@ test_expect_success 'setup separate repository lacking postimage' '
 
 	git tar-tree initial initial | tar xf - &&
 	(
-		cd initial && git init-db && git add .
+		cd initial && git_init_db && git add .
 	) &&
 
 	git tar-tree second second | tar xf - &&
 	(
-		cd second && git init-db && git add .
+		cd second && git_init_db && git add .
 	)
 
 '
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index de45ac4..8a8152b 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -44,7 +44,7 @@ test_expect_success \
     'unpack without delta' \
     "GIT_OBJECT_DIRECTORY=.git2/objects &&
      export GIT_OBJECT_DIRECTORY &&
-     git-init-db &&
+     git_init_db &&
      git-unpack-objects -n <test-1-${packname_1}.pack &&
      git-unpack-objects <test-1-${packname_1}.pack"
 
@@ -75,7 +75,7 @@ test_expect_success \
     'unpack with delta' \
     'GIT_OBJECT_DIRECTORY=.git2/objects &&
      export GIT_OBJECT_DIRECTORY &&
-     git-init-db &&
+     git_init_db &&
      git-unpack-objects -n <test-2-${packname_2}.pack &&
      git-unpack-objects <test-2-${packname_2}.pack'
 
@@ -100,7 +100,7 @@ test_expect_success \
     'use packed objects' \
     'GIT_OBJECT_DIRECTORY=.git2/objects &&
      export GIT_OBJECT_DIRECTORY &&
-     git-init-db &&
+     git_init_db &&
      cp test-1-${packname_1}.pack test-1-${packname_1}.idx .git2/objects/pack && {
 	 git-diff-tree --root -p $commit &&
 	 while read object
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index 28744b3..901da8c 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -24,7 +24,7 @@ test_expect_success setup '
 	    parent=$commit || return 1
 	done &&
 	git-update-ref HEAD "$commit" &&
-	git-clone -l ./. victim &&
+	git_clone -l ./. victim &&
 	cd victim &&
 	git-log &&
 	cd .. &&
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index f7625a6..61e2a55 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -97,7 +97,7 @@ pull_to_client () {
 (
 	mkdir client &&
 	cd client &&
-	git-init-db 2>> log2.txt
+	git_init_db 2>> log2.txt
 )
 
 add A1
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index a11ab0a..e2e8c89 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -15,12 +15,12 @@ test_expect_success setup '
 	git commit -a -m original'
 
 test_expect_success "clone and setup child repos" '
-	git clone . one &&
+	git_clone . one &&
 	cd one &&
 	echo >file updated by one &&
 	git commit -a -m "updated by one" &&
 	cd .. &&
-	git clone . two &&
+	git_clone . two &&
 	cd two &&
 	git repo-config branch.master.remote one &&
 	{
@@ -28,7 +28,7 @@ test_expect_success "clone and setup child repos" '
 		echo "Pull: refs/heads/master:refs/heads/one"
 	} >.git/remotes/one
 	cd .. &&
-	git clone . three &&
+	git_clone . three &&
 	cd three &&
 	git repo-config branch.master.remote two &&
 	git repo-config branch.master.merge refs/heads/one &&
@@ -74,7 +74,7 @@ test_expect_success 'fetch following tags' '
 
 	mkdir four &&
 	cd four &&
-	git init-db &&
+	git_init_db &&
 
 	git fetch .. :track &&
 	git show-ref --verify refs/tags/anno &&
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index f841574..66ef92f 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -17,7 +17,7 @@ test_expect_success setup '
 test_expect_success 'pulling into void' '
 	mkdir cloned &&
 	cd cloned &&
-	git init-db &&
+	git_init_db &&
 	git pull ..
 '
 
diff --git a/t/t5600-clone-fail-cleanup.sh b/t/t5600-clone-fail-cleanup.sh
index 041be04..1913a12 100755
--- a/t/t5600-clone-fail-cleanup.sh
+++ b/t/t5600-clone-fail-cleanup.sh
@@ -13,7 +13,7 @@ remove the directory before attempting a clone again.'
 
 test_expect_failure \
     'clone of non-existent source should fail' \
-    'git-clone foo bar'
+    'git_clone foo bar'
 
 test_expect_failure \
     'failed clone should not leave a directory' \
@@ -29,11 +29,11 @@ test_create_repo foo
 # current path not to the target dir
 test_expect_failure \
     'clone of non-existent (relative to $PWD) source should fail' \
-    'git-clone ../foo baz'
+    'git_clone ../foo baz'
 
 test_expect_success \
     'clone should work now that source exists' \
-    'git-clone foo bar'
+    'git_clone foo bar'
 
 test_expect_success \
     'successfull clone must leave the directory' \
diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh
index dd9caad..52dab2d 100755
--- a/t/t5700-clone-reference.sh
+++ b/t/t5700-clone-reference.sh
@@ -17,7 +17,7 @@ git commit -m initial'
 cd "$base_dir"
 
 test_expect_success 'preparing second repository' \
-'git clone A B && cd B &&
+'git_clone A B && cd B &&
 echo second > file2 &&
 git add file2 &&
 git commit -m addition &&
@@ -27,7 +27,7 @@ git prune'
 cd "$base_dir"
 
 test_expect_success 'cloning with reference' \
-'git clone -l -s --reference B A C'
+'git_clone -l -s --reference B A C'
 
 cd "$base_dir"
 
diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh
index b9f6d96..3c43554 100755
--- a/t/t5710-info-alternate.sh
+++ b/t/t5710-info-alternate.sh
@@ -34,7 +34,7 @@ git prune'
 cd "$base_dir"
 
 test_expect_success 'preparing second repository' \
-'git clone -l -s A B && cd B &&
+'git_clone -l -s A B && cd B &&
 echo "foo bar" > file2 &&
 git add file2 &&
 git commit -m "next commit" file2 &&
@@ -44,7 +44,7 @@ git prune'
 cd "$base_dir"
 
 test_expect_success 'preparing third repository' \
-'git clone -l -s B C && cd C &&
+'git_clone -l -s B C && cd C &&
 echo "Goodbye, cruel world" > file3 &&
 git add file3 &&
 git commit -m "one more" file3 &&
@@ -54,11 +54,11 @@ git prune'
 cd "$base_dir"
 
 test_expect_failure 'creating too deep nesting' \
-'git clone -l -s C D &&
-git clone -l -s D E &&
-git clone -l -s E F &&
-git clone -l -s F G &&
-git clone -l -s G H &&
+'git_clone -l -s C D &&
+git_clone -l -s D E &&
+git_clone -l -s E F &&
+git_clone -l -s F G &&
+git_clone -l -s G H &&
 cd H &&
 test_valid_repo'
 
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 2f4ff82..ae597e8 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -88,7 +88,7 @@ test_expect_success \
 
 test_expect_success "Michael Cassar's test case" '
 	rm -fr .git papers partA &&
-	git init-db &&
+	git_init_db &&
 	mkdir -p papers/unsorted papers/all-papers partA &&
 	echo a > papers/unsorted/Thesis.pdf &&
 	echo b > partA/outline.txt &&
@@ -109,7 +109,7 @@ rm -fr papers partA path?
 
 test_expect_success "Sergey Vlasov's test case" '
 	rm -fr .git &&
-	git init-db &&
+	git_init_db &&
 	mkdir ab &&
 	date >ab.c &&
 	date >ab/d &&

^ permalink raw reply related	[relevance 8%]

* [PATCH 2/2] Add sample ignore logic to git-run-with-user-path command.
@ 2005-05-16  6:06  8% Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2005-05-16  6:06 UTC (permalink / raw)
  To: pasky; +Cc: git, torvalds

This adds a sample ignore file logic to git-run-with-user-path
command.  This is primarily to serve as an example for plugging
ignore file logic to the previously introduced framework, and to
spur mailing list discussions on what the final ignore file
logic should be, and where the information should come from.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

Documentation/git-run-with-user-path.txt |   32 ++++++++
Makefile                                 |    6 +
paths.c                                  |  117 +++++++++++++++++++++++++++++--
t/t7001-git-run-with-user-path-ignore.sh |   67 +++++++++++++++++
4 files changed, 215 insertions(+), 7 deletions(-)
t/t7001-git-run-with-user-path-ignore.sh (. --> 100755)

--- a/Documentation/git-run-with-user-path.txt
+++ b/Documentation/git-run-with-user-path.txt
@@ -53,6 +53,38 @@
 	--no-ignore flag, there is no such filtering done.
 
 
+IGNORE FILES
+------------
+
+This command currently uses a pcre based implementation to express
+ignore patterns.  The purpose of this implementation is to primarily
+serve as an example and to start GIT mailing list discussions, and by no
+means is cast in stone.  This section describes what this sample
+implementation does.
+
+The information used to define which paths to ignore is read from two
+files.  Both files use the same syntax.
+
+First, $CIT_DIR/ignore is read.  Then, the file whose path (relative to
+the project top) recorded in $GIT_DIR/info/ignore-file is read next.
+The latter file is expected to be revision controlled with GIT.
+
+These two files should record one ignore record per line.  A line that
+is empty, and a line that starts with a '#' are ignored and used as
+comments.
+
+Each ignore record is a pcre regular expression, optionally prefixed
+with a '!'.  To determine if a path is to be ignored, the path is
+matched against each ignore record in the order they appear in the
+ignore file.  If the ignore record matches the path, and it does not
+have the optional '!', then the path is ignored.  Otherwise, the path is
+not ignored.  In either case, the rest of ignore records are not used
+after the first match.  This means (1) an earlier entry in an ignore
+file has precedence over later ones, and (2) the entries in
+$GIT_DIR/ignore file have precedence over the ones in the file named
+by $GIT_DIR/info/ignore-file.
+
+
 ENVIRONMENT VARIABLES
 ---------------------
 
--- a/Makefile
+++ b/Makefile
@@ -54,6 +54,12 @@
 LIBS = $(LIB_FILE)
 LIBS += -lz
 
+IGNORE_USING_PCRE=1
+
+ifdef IGNORE_USING_PCRE
+  LIBS += -lpcreposix
+endif
+
 ifdef MOZILLA_SHA1
   SHA1_HEADER="mozilla-sha1/sha1.h"
   LIB_OBJS += mozilla-sha1/sha1.o
--- a/paths.c
+++ b/paths.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2005 Junio C Hamano
  */
 #include <string.h>
+#include <pcreposix.h>
 #include "cache.h"
 #include "paths.h"
 
@@ -37,23 +38,125 @@
 	}
 }
 
+static struct ignore_entry {
+	int negate;
+	regex_t regexp;
+} **ignore_list;
+static int ignore_nr;
+static int ignore_alloc;
+
+static void add_ignore(const char *buf)
+{
+	struct ignore_entry *ie = xmalloc(sizeof(*ie));
+	if (buf[0] == '!') {
+		ie->negate = 1;
+		buf++;
+	}
+	else
+		ie->negate = 0;
+
+	if (regcomp(&(ie->regexp), buf, 0)) {
+		fprintf(stderr, "bad regexp <%s>\n", buf);
+		free(ie);
+		return;
+	}
+	if (ignore_alloc <= ignore_nr) {
+		ignore_alloc = alloc_nr(ignore_alloc);
+		ignore_list = xrealloc(ignore_list,
+				       ignore_alloc * sizeof(ie));
+	}
+	ignore_list[ignore_nr++] = ie;
+}
+
+static void read_ignore_list(const char *path)
+{
+	FILE *in;
+	char buf[1024];
+	in = fopen(path, "r");
+	if (!in)
+		return;
+	while (fgets(buf, sizeof(buf), in) != NULL) {
+		int l = strlen(buf);
+		/* An empty line and a line that starts with # is comment. */
+		if (buf[0] != '#' && buf[0] != '\n' && buf[l-1] == '\n') {
+			buf[l-1] = 0;
+			add_ignore(buf);
+		}
+	}
+	fclose(in);
+}
+
+static void read_ignore_list_from_file(const char *path)
+{
+	char filename[PATH_MAX];
+	int len;
+	FILE *in;
+
+	in = fopen(path, "r");
+	if (!in)
+		return;
+	strcpy(filename, git_project_top);
+	len = strlen(filename);
+	filename[len++] = '/';
+	if (fgets(filename + len, sizeof(filename) - len, in) == NULL) {
+		fclose(in);
+		return;
+	}
+	fclose(in);
+	len = strlen(filename);
+	if (filename[len-1] != '\n')
+		return;
+	filename[len-1] = 0;
+	read_ignore_list(filename);
+}
+
 static int initialize_ignore_list(void)
 {
-	/* Put the Porcelain layer ignore logic initialization here.
-	 * Return non-zero after issuing appropriate error message
-	 * if initialization fails.
-	 */
+	char *git_dir = gitenv("GIT_DIR");
+	char path[PATH_MAX];
+	int git_dir_len;
+
+	if (! git_dir)
+		sprintf(path, "%s/.git", git_project_top);
+	else
+		strcpy(path, git_dir);
+	git_dir_len = strlen(path);
+	path[git_dir_len++] = '/';
+
+	/* read private list first, and then shared list. */
+	strcpy(path + git_dir_len, "ignore");
+	read_ignore_list(path);
+
+	strcpy(path + git_dir_len, "info/ignore-file");
+	read_ignore_list_from_file(path);
+
 	return 0;
 }
 
 int path_ignored(const char *path)
 {
+	int i;
+
 	if (!verify_path(path))
 		return 1;
 
-	/* Put the Porcelain layer ignore logic here.
-	 * Return non-zero if path is to be ignored.
-	 */
+	for (i = 0; i < ignore_nr; i++) {
+		int status;
+		regmatch_t pmatch[10];
+		char errbuf[1024];
+
+		status = regexec(&(ignore_list[i]->regexp), path,
+				 sizeof(pmatch)/sizeof(pmatch[0]),
+				 pmatch, 0);
+		if (!status)
+			return !ignore_list[i]->negate;
+		if (status == REG_NOMATCH)
+			continue;
+
+		regerror(status, &(ignore_list[i]->regexp), errbuf,
+			 sizeof(errbuf));
+		fprintf(stderr, "pcre regexp execution error <%s>\n", errbuf);
+	}
 	return 0;
 }
 
--- a/t/t7001-git-run-with-user-path-ignore.sh
+++ b/t/t7001-git-run-with-user-path-ignore.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# Copyright (c) 2005, Junio C Hamano
+#
+
+test_description='git-run-with-user-path basic test (part #2).
+
+The command is used to help running core GIT commands that always
+expect to be run from the top level directory (i.e. the directory
+that corresponds to the top of tree GIT_INDEX_FILE describes).
+
+It knows how to handle ignore files convention used by the Porcelain
+layer implementation.
+'
+
+. ./test-lib.sh
+
+LF='
+'
+HERE=$(pwd)
+
+test_expect_success \
+setup '
+echo ".*1\$" >.git/ignore &&
+echo ".*0\$" >dontdiff &&
+mkdir .git/info &&
+echo "dontdiff" >.git/info/ignore-file &&
+mkdir path0 path1 path1/path2 &&
+for p in path0/file0 path1/file1 path1/path2/file2
+do
+    echo hello >$p || exit 1
+done
+'
+
+cd $HERE
+test_expect_success \
+'finding paths from a subdirectory' '
+    case "$(cd path0 &&
+            git-run-with-user-path echo -- \
+	    file0 ../path1/path2/file2)" in
+    "path1/path2/file2") : ;;
+    *) (exit 1) ;;
+    esac
+'
+
+cd $HERE
+test_expect_success \
+'feeding find output via xargs from a subdirectory' '
+    case "$(cd path0 &&
+	    find . ../path1 -type f -print0 |
+	    xargs -r -0 git-run-with-user-path ls -1 --)" in
+    "path1/path2/file2") : ;;
+    *) (exit 1) ;;
+    esac
+'
+
+cd $HERE
+test_expect_success \
+'using !negate pattern' '
+    echo "!path0/file0$" >>.git/ignore &&
+    case "$(git-run-with-user-path ls -1 -- path0/* path1/file1)" in
+    "path0/file0") : ;;
+    *) (exit 1) ;;
+    esac
+'
+
+test_done
------------------------------------------------


^ permalink raw reply	[relevance 8%]

* [PATCH 2/2] Add sample ignore logic to git-run-with-user-path command.
  @ 2005-05-16 23:41  8%   ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2005-05-16 23:41 UTC (permalink / raw)
  To: pasky, torvalds; +Cc: git

This adds a sample ignore file logic to git-run-with-user-path
command.  This is primarily to serve as an example for plugging
ignore file logic to the previously introduced framework, and to
spur mailing list discussions on what the final ignore file
logic should be, and where the information should come from.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

Documentation/git-run-with-user-path.txt |   32 ++++++++
Makefile                                 |    6 +
paths.c                                  |  117 +++++++++++++++++++++++++++++--
t/t7001-git-run-with-user-path-ignore.sh |   67 +++++++++++++++++
4 files changed, 215 insertions(+), 7 deletions(-)
t/t7001-git-run-with-user-path-ignore.sh (. --> 100755)

--- a/Documentation/git-run-with-user-path.txt
+++ b/Documentation/git-run-with-user-path.txt
@@ -75,6 +75,38 @@
 	output).
 
 
+IGNORE FILES
+------------
+
+This command currently uses a pcre based implementation to express
+ignore patterns.  The purpose of this implementation is to primarily
+serve as an example and to start GIT mailing list discussions, and by no
+means is cast in stone.  This section describes what this sample
+implementation does.
+
+The information used to define which paths to ignore is read from two
+files.  Both files use the same syntax.
+
+First, $CIT_DIR/ignore is read.  Then, the file whose path (relative to
+the project top) recorded in $GIT_DIR/info/ignore-file is read next.
+The latter file is expected to be revision controlled with GIT.
+
+These two files should record one ignore record per line.  A line that
+is empty, and a line that starts with a '#' are ignored and used as
+comments.
+
+Each ignore record is a pcre regular expression, optionally prefixed
+with a '!'.  To determine if a path is to be ignored, the path is
+matched against each ignore record in the order they appear in the
+ignore file.  If the ignore record matches the path, and it does not
+have the optional '!', then the path is ignored.  Otherwise, the path is
+not ignored.  In either case, the rest of ignore records are not used
+after the first match.  This means (1) an earlier entry in an ignore
+file has precedence over later ones, and (2) the entries in
+$GIT_DIR/ignore file have precedence over the ones in the file named
+by $GIT_DIR/info/ignore-file.
+
+
 ENVIRONMENT VARIABLES
 ---------------------
 
--- a/Makefile
+++ b/Makefile
@@ -54,6 +54,12 @@
 LIBS = $(LIB_FILE)
 LIBS += -lz
 
+IGNORE_USING_PCRE=1
+
+ifdef IGNORE_USING_PCRE
+  LIBS += -lpcreposix
+endif
+
 ifdef MOZILLA_SHA1
   SHA1_HEADER="mozilla-sha1/sha1.h"
   LIB_OBJS += mozilla-sha1/sha1.o
--- a/paths.c
+++ b/paths.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2005 Junio C Hamano
  */
 #include <string.h>
+#include <pcreposix.h>
 #include "cache.h"
 #include "paths.h"
 
@@ -37,23 +38,125 @@
 	}
 }
 
+static struct ignore_entry {
+	int negate;
+	regex_t regexp;
+} **ignore_list;
+static int ignore_nr;
+static int ignore_alloc;
+
+static void add_ignore(const char *buf)
+{
+	struct ignore_entry *ie = xmalloc(sizeof(*ie));
+	if (buf[0] == '!') {
+		ie->negate = 1;
+		buf++;
+	}
+	else
+		ie->negate = 0;
+
+	if (regcomp(&(ie->regexp), buf, 0)) {
+		fprintf(stderr, "bad regexp <%s>\n", buf);
+		free(ie);
+		return;
+	}
+	if (ignore_alloc <= ignore_nr) {
+		ignore_alloc = alloc_nr(ignore_alloc);
+		ignore_list = xrealloc(ignore_list,
+				       ignore_alloc * sizeof(ie));
+	}
+	ignore_list[ignore_nr++] = ie;
+}
+
+static void read_ignore_list(const char *path)
+{
+	FILE *in;
+	char buf[1024];
+	in = fopen(path, "r");
+	if (!in)
+		return;
+	while (fgets(buf, sizeof(buf), in) != NULL) {
+		int l = strlen(buf);
+		/* An empty line and a line that starts with # is comment. */
+		if (buf[0] != '#' && buf[0] != '\n' && buf[l-1] == '\n') {
+			buf[l-1] = 0;
+			add_ignore(buf);
+		}
+	}
+	fclose(in);
+}
+
+static void read_ignore_list_from_file(const char *path)
+{
+	char filename[PATH_MAX];
+	int len;
+	FILE *in;
+
+	in = fopen(path, "r");
+	if (!in)
+		return;
+	strcpy(filename, git_project_top);
+	len = strlen(filename);
+	filename[len++] = '/';
+	if (fgets(filename + len, sizeof(filename) - len, in) == NULL) {
+		fclose(in);
+		return;
+	}
+	fclose(in);
+	len = strlen(filename);
+	if (filename[len-1] != '\n')
+		return;
+	filename[len-1] = 0;
+	read_ignore_list(filename);
+}
+
 static int initialize_ignore_list(void)
 {
-	/* Put the Porcelain layer ignore logic initialization here.
-	 * Return non-zero after issuing appropriate error message
-	 * if initialization fails.
-	 */
+	char *git_dir = gitenv("GIT_DIR");
+	char path[PATH_MAX];
+	int git_dir_len;
+
+	if (! git_dir)
+		sprintf(path, "%s/.git", git_project_top);
+	else
+		strcpy(path, git_dir);
+	git_dir_len = strlen(path);
+	path[git_dir_len++] = '/';
+
+	/* read private list first, and then shared list. */
+	strcpy(path + git_dir_len, "ignore");
+	read_ignore_list(path);
+
+	strcpy(path + git_dir_len, "info/ignore-file");
+	read_ignore_list_from_file(path);
+
 	return 0;
 }
 
 int path_ignored(const char *path)
 {
+	int i;
+
 	if (!verify_path(path))
 		return 1;
 
-	/* Put the Porcelain layer ignore logic here.
-	 * Return non-zero if path is to be ignored.
-	 */
+	for (i = 0; i < ignore_nr; i++) {
+		int status;
+		regmatch_t pmatch[10];
+		char errbuf[1024];
+
+		status = regexec(&(ignore_list[i]->regexp), path,
+				 sizeof(pmatch)/sizeof(pmatch[0]),
+				 pmatch, 0);
+		if (!status)
+			return !ignore_list[i]->negate;
+		if (status == REG_NOMATCH)
+			continue;
+
+		regerror(status, &(ignore_list[i]->regexp), errbuf,
+			 sizeof(errbuf));
+		fprintf(stderr, "pcre regexp execution error <%s>\n", errbuf);
+	}
 	return 0;
 }
 
--- /dev/null
+++ b/t/t7001-git-run-with-user-path-ignore.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# Copyright (c) 2005, Junio C Hamano
+#
+
+test_description='git-run-with-user-path basic test (part #2).
+
+The command is used to help running core GIT commands that always
+expect to be run from the top level directory (i.e. the directory
+that corresponds to the top of tree GIT_INDEX_FILE describes).
+
+It knows how to handle ignore files convention used by the Porcelain
+layer implementation.
+'
+
+. ./test-lib.sh
+
+LF='
+'
+HERE=$(pwd)
+
+test_expect_success \
+setup '
+echo ".*1\$" >.git/ignore &&
+echo ".*0\$" >dontdiff &&
+mkdir .git/info &&
+echo "dontdiff" >.git/info/ignore-file &&
+mkdir path0 path1 path1/path2 &&
+for p in path0/file0 path1/file1 path1/path2/file2
+do
+    echo hello >$p || exit 1
+done
+'
+
+cd $HERE
+test_expect_success \
+'finding paths from a subdirectory' '
+    case "$(cd path0 &&
+            git-run-with-user-path echo -- \
+	    file0 ../path1/path2/file2)" in
+    "path1/path2/file2") : ;;
+    *) (exit 1) ;;
+    esac
+'
+
+cd $HERE
+test_expect_success \
+'feeding find output via xargs from a subdirectory' '
+    case "$(cd path0 &&
+	    find . ../path1 -type f -print0 |
+	    xargs -r -0 git-run-with-user-path ls -1 --)" in
+    "path1/path2/file2") : ;;
+    *) (exit 1) ;;
+    esac
+'
+
+cd $HERE
+test_expect_success \
+'using !negate pattern' '
+    echo "!path0/file0$" >>.git/ignore &&
+    case "$(git-run-with-user-path ls -1 -- path0/* path1/file1)" in
+    "path0/file0") : ;;
+    *) (exit 1) ;;
+    esac
+'
+
+test_done
------------------------------------------------


^ permalink raw reply	[relevance 8%]

* Re: [PATCH v4 4/5] Teach mv to update the path entry in .gitmodules for moved submodules
  2013-07-30 19:51  8% ` [PATCH v3 4/5] Teach mv to update the path entry in .gitmodules for moved submodules Jens Lehmann
@ 2013-08-06 19:15  8%   ` Jens Lehmann
  0 siblings, 0 replies; 200+ results
From: Jens Lehmann @ 2013-08-06 19:15 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Junio C Hamano, Heiko Voigt, Nguyen Thai Ngoc Duy,
	Fredrik Gustafsson

Currently using "git mv" on a submodule moves the submodule's work tree in
that of the superproject. But the submodule's path setting in .gitmodules
is left untouched, which is now inconsistent with the work tree and makes
git commands that rely on the proper path -> name mapping (like status and
diff) behave strangely.

Let "git mv" help here by not only moving the submodule's work tree but
also updating the "submodule.<submodule name>.path" setting from the
.gitmodules file and stage both. This doesn't happen when no .gitmodules
file is found and only issues a warning when it doesn't have a section for
this submodule. This is because the user might just use plain gitlinks
without the .gitmodules file or has already updated the path setting by
hand before issuing the "git mv" command (in which case the warning
reminds him that mv would have done that for him). Only when .gitmodules
is found and contains merge conflicts the mv command will fail and tell
the user to resolve the conflict before trying again.

Also extend the man page to inform the user about this new feature.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---

This version fixes the missing strbuf_release() noticed by Frederik.


 Documentation/git-mv.txt |  2 ++
 builtin/mv.c             | 10 ++++++-
 submodule.c              | 34 ++++++++++++++++++++++
 submodule.h              |  1 +
 t/t7001-mv.sh            | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 121 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt
index 1f6fce0..b1f7988 100644
--- a/Documentation/git-mv.txt
+++ b/Documentation/git-mv.txt
@@ -49,6 +49,8 @@ SUBMODULES
 Moving a submodule using a gitfile (which means they were cloned
 with a Git version 1.7.8 or newer) will update the gitfile and
 core.worktree setting to make the submodule work in the new location.
+It also will attempt to update the submodule.<name>.path setting in
+the linkgit:gitmodules[5] file and stage that file (unless -n is used).

 GIT
 ---
diff --git a/builtin/mv.c b/builtin/mv.c
index 68b7060..7dd6bb4 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -58,7 +58,7 @@ static struct lock_file lock_file;

 int cmd_mv(int argc, const char **argv, const char *prefix)
 {
-	int i, newfd;
+	int i, newfd, gitmodules_modified = 0;
 	int verbose = 0, show_only = 0, force = 0, ignore_errors = 0;
 	struct option builtin_mv_options[] = {
 		OPT__VERBOSE(&verbose, N_("be verbose")),
@@ -72,6 +72,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	struct stat st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;

+	gitmodules_config();
 	git_config(git_default_config, NULL);

 	argc = parse_options(argc, argv, prefix, builtin_mv_options,
@@ -125,6 +126,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				struct strbuf submodule_dotgit = STRBUF_INIT;
 				if (!S_ISGITLINK(active_cache[first]->ce_mode))
 					die (_("Huh? Directory %s is in index and no submodule?"), src);
+				if (!is_staging_gitmodules_ok())
+					die (_("Please, stage your changes to .gitmodules or stash them to proceed"));
 				strbuf_addf(&submodule_dotgit, "%s/.git", src);
 				submodule_gitfile[i] = read_gitfile(submodule_dotgit.buf);
 				if (submodule_gitfile[i])
@@ -229,6 +232,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				die_errno (_("renaming '%s' failed"), src);
 			if (submodule_gitfile[i])
 				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
+			if (!update_path_in_gitmodules(src, dst))
+				gitmodules_modified = 1;
 		}

 		if (mode == WORKING_DIRECTORY)
@@ -240,6 +245,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			rename_cache_entry_at(pos, dst);
 	}

+	if (gitmodules_modified)
+		stage_updated_gitmodules();
+
 	if (active_cache_changed) {
 		if (write_cache(newfd, active_cache, active_nr) ||
 		    commit_locked_index(&lock_file))
diff --git a/submodule.c b/submodule.c
index 5874d08..1c2714f 100644
--- a/submodule.c
+++ b/submodule.c
@@ -47,6 +47,40 @@ int is_staging_gitmodules_ok(void)
 	return !gitmodules_is_modified;
 }

+/*
+ * Try to update the "path" entry in the "submodule.<name>" section of the
+ * .gitmodules file. Return 0 only if a .gitmodules file was found, a section
+ * with the correct path=<oldpath> setting was found and we could update it.
+ */
+int update_path_in_gitmodules(const char *oldpath, const char *newpath)
+{
+	struct strbuf entry = STRBUF_INIT;
+	struct string_list_item *path_option;
+
+	if (!file_exists(".gitmodules")) /* Do nothing without .gitmodules */
+		return -1;
+
+	if (gitmodules_is_unmerged)
+		die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first"));
+
+	path_option = unsorted_string_list_lookup(&config_name_for_path, oldpath);
+	if (!path_option) {
+		warning(_("Could not find section in .gitmodules where path=%s"), oldpath);
+		return -1;
+	}
+	strbuf_addstr(&entry, "submodule.");
+	strbuf_addstr(&entry, path_option->util);
+	strbuf_addstr(&entry, ".path");
+	if (git_config_set_in_file(".gitmodules", entry.buf, newpath) < 0) {
+		/* Maybe the user already did that, don't error out here */
+		warning(_("Could not update .gitmodules entry %s"), entry.buf);
+		strbuf_release(&entry);
+		return -1;
+	}
+	strbuf_release(&entry);
+	return 0;
+}
+
 void stage_updated_gitmodules(void)
 {
 	struct strbuf buf = STRBUF_INIT;
diff --git a/submodule.h b/submodule.h
index 5501354..e339891 100644
--- a/submodule.h
+++ b/submodule.h
@@ -12,6 +12,7 @@ enum {
 };

 int is_staging_gitmodules_ok(void);
+int update_path_in_gitmodules(const char *oldpath, const char *newpath);
 void stage_updated_gitmodules(void);
 void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
 		const char *path);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b99177f..d432f42 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -308,8 +308,83 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 		cd mod/sub &&
 		git status
 	) &&
+	echo mod/sub >expected &&
+	git config -f .gitmodules submodule.sub.path >actual &&
+	test_cmp expected actual &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '

+test_expect_success 'mv does not complain when no .gitmodules file is found' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	git rm .gitmodules &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	git mv sub mod/sub 2>actual.err &&
+	! test -s actual.err &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
+test_expect_success 'mv will error out on a modified .gitmodules file unless staged' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	git config -f .gitmodules foo.bar true &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	test_must_fail git mv sub mod/sub 2>actual.err &&
+	test -s actual.err &&
+	test -e sub &&
+	git diff-files --quiet -- sub &&
+	git add .gitmodules &&
+	git mv sub mod/sub 2>actual.err &&
+	! test -s actual.err &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
+test_expect_success 'mv issues a warning when section is not found in .gitmodules' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	git config -f .gitmodules --remove-section submodule.sub &&
+	git add .gitmodules &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	echo "warning: Could not find section in .gitmodules where path=sub" >expect.err &&
+	git mv sub mod/sub 2>actual.err &&
+	test_i18ncmp expect.err actual.err &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
+test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	git mv -n sub mod/sub 2>actual.err &&
+	test -f sub/.git &&
+	git diff-index --exit-code HEAD &&
+	git update-index --refresh &&
+	git diff-files --quiet -- sub .gitmodules
+'
+
 test_done
-- 
1.8.4.rc0.199.g3f237fc

^ permalink raw reply related	[relevance 8%]

* [PATCH v3 4/5] Teach mv to update the path entry in .gitmodules for moved submodules
  2013-07-30 19:48  6% [PATCH v3 0/5] Teach mv to move submodules Jens Lehmann
  2013-07-30 19:49 10% ` [PATCH v3 1/5] Teach mv to move submodules together with their work trees Jens Lehmann
  2013-07-30 19:50  9% ` [PATCH v3 2/5] Teach mv to move submodules using a gitfile Jens Lehmann
@ 2013-07-30 19:51  8% ` Jens Lehmann
  2013-08-06 19:15  8%   ` [PATCH v4 " Jens Lehmann
  2 siblings, 1 reply; 200+ results
From: Jens Lehmann @ 2013-07-30 19:51 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Heiko Voigt, Nguyen Thai Ngoc Duy

Currently using "git mv" on a submodule moves the submodule's work tree in
that of the superproject. But the submodule's path setting in .gitmodules
is left untouched, which is now inconsistent with the work tree and makes
git commands that rely on the proper path -> name mapping (like status and
diff) behave strangely.

Let "git mv" help here by not only moving the submodule's work tree but
also updating the "submodule.<submodule name>.path" setting from the
.gitmodules file and stage both. This doesn't happen when no .gitmodules
file is found and only issues a warning when it doesn't have a section for
this submodule. This is because the user might just use plain gitlinks
without the .gitmodules file or has already updated the path setting by
hand before issuing the "git mv" command (in which case the warning
reminds him that mv would have done that for him). Only when .gitmodules
is found and contains merge conflicts the mv command will fail and tell
the user to resolve the conflict before trying again.

Also extend the man page to inform the user about this new feature.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
 Documentation/git-mv.txt |  2 ++
 builtin/mv.c             | 10 ++++++-
 submodule.c              | 33 +++++++++++++++++++++
 submodule.h              |  1 +
 t/t7001-mv.sh            | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 120 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt
index 1f6fce0..b1f7988 100644
--- a/Documentation/git-mv.txt
+++ b/Documentation/git-mv.txt
@@ -49,6 +49,8 @@ SUBMODULES
 Moving a submodule using a gitfile (which means they were cloned
 with a Git version 1.7.8 or newer) will update the gitfile and
 core.worktree setting to make the submodule work in the new location.
+It also will attempt to update the submodule.<name>.path setting in
+the linkgit:gitmodules[5] file and stage that file (unless -n is used).

 GIT
 ---
diff --git a/builtin/mv.c b/builtin/mv.c
index 68b7060..7dd6bb4 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -58,7 +58,7 @@ static struct lock_file lock_file;

 int cmd_mv(int argc, const char **argv, const char *prefix)
 {
-	int i, newfd;
+	int i, newfd, gitmodules_modified = 0;
 	int verbose = 0, show_only = 0, force = 0, ignore_errors = 0;
 	struct option builtin_mv_options[] = {
 		OPT__VERBOSE(&verbose, N_("be verbose")),
@@ -72,6 +72,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	struct stat st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;

+	gitmodules_config();
 	git_config(git_default_config, NULL);

 	argc = parse_options(argc, argv, prefix, builtin_mv_options,
@@ -125,6 +126,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				struct strbuf submodule_dotgit = STRBUF_INIT;
 				if (!S_ISGITLINK(active_cache[first]->ce_mode))
 					die (_("Huh? Directory %s is in index and no submodule?"), src);
+				if (!is_staging_gitmodules_ok())
+					die (_("Please, stage your changes to .gitmodules or stash them to proceed"));
 				strbuf_addf(&submodule_dotgit, "%s/.git", src);
 				submodule_gitfile[i] = read_gitfile(submodule_dotgit.buf);
 				if (submodule_gitfile[i])
@@ -229,6 +232,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				die_errno (_("renaming '%s' failed"), src);
 			if (submodule_gitfile[i])
 				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
+			if (!update_path_in_gitmodules(src, dst))
+				gitmodules_modified = 1;
 		}

 		if (mode == WORKING_DIRECTORY)
@@ -240,6 +245,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			rename_cache_entry_at(pos, dst);
 	}

+	if (gitmodules_modified)
+		stage_updated_gitmodules();
+
 	if (active_cache_changed) {
 		if (write_cache(newfd, active_cache, active_nr) ||
 		    commit_locked_index(&lock_file))
diff --git a/submodule.c b/submodule.c
index 584f7de..b210685 100644
--- a/submodule.c
+++ b/submodule.c
@@ -47,6 +47,39 @@ int is_staging_gitmodules_ok()
 	return !gitmodules_is_modified;
 }

+/*
+ * Try to update the "path" entry in the "submodule.<name>" section of the
+ * .gitmodules file. Return 0 only if a .gitmodules file was found, a section
+ * with the correct path=<oldpath> setting was found and we could update it.
+ */
+int update_path_in_gitmodules(const char *oldpath, const char *newpath)
+{
+	struct strbuf entry = STRBUF_INIT;
+	struct string_list_item *path_option;
+
+	if (!file_exists(".gitmodules")) /* Do nothing without .gitmodules */
+		return -1;
+
+	if (gitmodules_is_unmerged)
+		die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first"));
+
+	path_option = unsorted_string_list_lookup(&config_name_for_path, oldpath);
+	if (!path_option) {
+		warning(_("Could not find section in .gitmodules where path=%s"), oldpath);
+		return -1;
+	}
+	strbuf_addstr(&entry, "submodule.");
+	strbuf_addstr(&entry, path_option->util);
+	strbuf_addstr(&entry, ".path");
+	if (git_config_set_in_file(".gitmodules", entry.buf, newpath) < 0) {
+		/* Maybe the user already did that, don't error out here */
+		warning(_("Could not update .gitmodules entry %s"), entry.buf);
+		return -1;
+	}
+	strbuf_release(&entry);
+	return 0;
+}
+
 void stage_updated_gitmodules(void)
 {
 	struct strbuf buf = STRBUF_INIT;
diff --git a/submodule.h b/submodule.h
index 244d5f5..570d4d0 100644
--- a/submodule.h
+++ b/submodule.h
@@ -12,6 +12,7 @@ enum {
 };

 int is_staging_gitmodules_ok();
+int update_path_in_gitmodules(const char *oldpath, const char *newpath);
 void stage_updated_gitmodules(void);
 void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
 		const char *path);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b99177f..d432f42 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -308,8 +308,83 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 		cd mod/sub &&
 		git status
 	) &&
+	echo mod/sub >expected &&
+	git config -f .gitmodules submodule.sub.path >actual &&
+	test_cmp expected actual &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '

+test_expect_success 'mv does not complain when no .gitmodules file is found' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	git rm .gitmodules &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	git mv sub mod/sub 2>actual.err &&
+	! test -s actual.err &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
+test_expect_success 'mv will error out on a modified .gitmodules file unless staged' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	git config -f .gitmodules foo.bar true &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	test_must_fail git mv sub mod/sub 2>actual.err &&
+	test -s actual.err &&
+	test -e sub &&
+	git diff-files --quiet -- sub &&
+	git add .gitmodules &&
+	git mv sub mod/sub 2>actual.err &&
+	! test -s actual.err &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
+test_expect_success 'mv issues a warning when section is not found in .gitmodules' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	git config -f .gitmodules --remove-section submodule.sub &&
+	git add .gitmodules &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	echo "warning: Could not find section in .gitmodules where path=sub" >expect.err &&
+	git mv sub mod/sub 2>actual.err &&
+	test_i18ncmp expect.err actual.err &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
+test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	git mv -n sub mod/sub 2>actual.err &&
+	test -f sub/.git &&
+	git diff-index --exit-code HEAD &&
+	git update-index --refresh &&
+	git diff-files --quiet -- sub .gitmodules
+'
+
 test_done
-- 
1.8.4.rc0.199.g7079aac

^ permalink raw reply related	[relevance 8%]

* [PATCH] git-mv: Keep moved index entries inact
  @ 2008-07-17 22:31  8% ` Petr Baudis
  0 siblings, 0 replies; 200+ results
From: Petr Baudis @ 2008-07-17 22:31 UTC (permalink / raw)
  To: git; +Cc: gitster

The rewrite of git-mv from a shell script to a builtin was perhaps
a little too straightforward: the git add and git rm queues were
emulated directly, which resulted in a rather complicated code and
caused an inconsistent behaviour when moving dirty index entries;
git mv would update the entry based on working tree state,
except in case of overwrites, where the new entry would still have
sha1 of the old file.

This patch introduces rename_index_entry_at() into the index toolkit,
which will rename an entry while removing any entries the new entry
might render duplicate. This is then used in git mv instead
of all the file queues, resulting in a major simplification
of the code and an inevitable change in git mv -n output format.

A new test has been added to the testsuite to reflect this change.
Also, based on suggestion by Junio about desired symlink behaviour
of git mv, I have added two tests for that; however, I do not have
need or desire to spend time fixing this, so they are expected
to fail for now until someone gets around to fixing that.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

  This patch might depend on git-mv: Remove dead code branch.

 builtin-mv.c  |   62 ++++++++-------------------------------------------------
 cache.h       |    2 ++
 read-cache.c  |   15 ++++++++++++++
 t/t7001-mv.sh |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 83 insertions(+), 53 deletions(-)

diff --git a/builtin-mv.c b/builtin-mv.c
index 33ad082..28ebc9c 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -36,17 +36,6 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
 	return get_pathspec(prefix, result);
 }
 
-static void show_list(const char *label, struct path_list *list)
-{
-	if (list->nr > 0) {
-		int i;
-		printf("%s", label);
-		for (i = 0; i < list->nr; i++)
-			printf("%s%s", i > 0 ? ", " : "", list->items[i].path);
-		putchar('\n');
-	}
-}
-
 static const char *add_slash(const char *path)
 {
 	int len = strlen(path);
@@ -75,11 +64,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	const char **source, **destination, **dest_path;
 	enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
 	struct stat st;
-	struct path_list overwritten = {NULL, 0, 0, 0};
 	struct path_list src_for_dst = {NULL, 0, 0, 0};
-	struct path_list added = {NULL, 0, 0, 0};
-	struct path_list deleted = {NULL, 0, 0, 0};
-	struct path_list changed = {NULL, 0, 0, 0};
 
 	git_config(git_default_config, NULL);
 
@@ -189,7 +174,6 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 							" will overwrite!\n",
 							bad);
 					bad = NULL;
-					path_list_insert(dst, &overwritten);
 				} else
 					bad = "Cannot overwrite";
 			}
@@ -218,6 +202,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	for (i = 0; i < argc; i++) {
 		const char *src = source[i], *dst = destination[i];
 		enum update_mode mode = modes[i];
+		int pos;
 		if (show_only || verbose)
 			printf("Renaming %s to %s\n", src, dst);
 		if (!show_only && mode != INDEX &&
@@ -227,45 +212,16 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		if (mode == WORKING_DIRECTORY)
 			continue;
 
-		assert(cache_name_pos(src, strlen(src)) >= 0);
-
-		path_list_insert(src, &deleted);
-		/* destination can be a directory with 1 file inside */
-		if (path_list_has_path(&overwritten, dst))
-			path_list_insert(dst, &changed);
-		else
-			path_list_insert(dst, &added);
+		pos = cache_name_pos(src, strlen(src));
+		assert(pos >= 0);
+		if (!show_only)
+			rename_cache_entry_at(pos, dst);
 	}
 
-	if (show_only) {
-		show_list("Changed  : ", &changed);
-		show_list("Adding   : ", &added);
-		show_list("Deleting : ", &deleted);
-	} else {
-		for (i = 0; i < changed.nr; i++) {
-			const char *path = changed.items[i].path;
-			int j = cache_name_pos(path, strlen(path));
-			struct cache_entry *ce = active_cache[j];
-
-			if (j < 0)
-				die ("Huh? Cache entry for %s unknown?", path);
-			refresh_cache_entry(ce, 0);
-		}
-
-		for (i = 0; i < added.nr; i++) {
-			const char *path = added.items[i].path;
-			if (add_file_to_cache(path, verbose ? ADD_CACHE_VERBOSE : 0))
-				die("updating index entries failed");
-		}
-
-		for (i = 0; i < deleted.nr; i++)
-			remove_file_from_cache(deleted.items[i].path);
-
-		if (active_cache_changed) {
-			if (write_cache(newfd, active_cache, active_nr) ||
-			    commit_locked_index(&lock_file))
-				die("Unable to write new index file");
-		}
+	if (active_cache_changed) {
+		if (write_cache(newfd, active_cache, active_nr) ||
+		    commit_locked_index(&lock_file))
+			die("Unable to write new index file");
 	}
 
 	return 0;
diff --git a/cache.h b/cache.h
index a779d92..6f1d003 100644
--- a/cache.h
+++ b/cache.h
@@ -260,6 +260,7 @@ static inline void remove_name_hash(struct cache_entry *ce)
 #define unmerged_cache() unmerged_index(&the_index)
 #define cache_name_pos(name, namelen) index_name_pos(&the_index,(name),(namelen))
 #define add_cache_entry(ce, option) add_index_entry(&the_index, (ce), (option))
+#define rename_cache_entry_at(pos, new_name) rename_index_entry_at(&the_index, (pos), (new_name))
 #define remove_cache_entry_at(pos) remove_index_entry_at(&the_index, (pos))
 #define remove_file_from_cache(path) remove_file_from_index(&the_index, (path))
 #define add_to_cache(path, st, flags) add_to_index(&the_index, (path), (st), (flags))
@@ -370,6 +371,7 @@ extern int index_name_pos(const struct index_state *, const char *name, int name
 #define ADD_CACHE_JUST_APPEND 8		/* Append only; tree.c::read_tree() */
 extern int add_index_entry(struct index_state *, struct cache_entry *ce, int option);
 extern struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really);
+extern void rename_index_entry_at(struct index_state *, int pos, const char *new_name);
 extern int remove_index_entry_at(struct index_state *, int pos);
 extern int remove_file_from_index(struct index_state *, const char *path);
 #define ADD_CACHE_VERBOSE 1
diff --git a/read-cache.c b/read-cache.c
index 1648428..70e5f57 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -38,6 +38,21 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache
 	istate->cache_changed = 1;
 }
 
+void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
+{
+	struct cache_entry *old = istate->cache[nr], *new;
+	int namelen = strlen(new_name);
+
+	new = xmalloc(cache_entry_size(namelen));
+	copy_cache_entry(new, old);
+	new->ce_flags = (new->ce_flags & ~CE_NAMEMASK) | namelen;
+	memcpy(new->name, new_name, namelen);
+
+	cache_tree_invalidate_path(istate->cache_tree, old->name);
+	remove_index_entry_at(istate, nr);
+	add_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
+}
+
 /*
  * This only updates the "non-critical" parts of the directory
  * cache, ie the parts that aren't tracked by GIT, and only used
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 336cfaa..6b615f8 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -156,4 +156,61 @@ test_expect_success 'absolute pathname outside should fail' '(
 
 )'
 
+# git mv meets angry Git maintainer
+
+test_expect_success 'git mv should not change sha1 of moved cache entry' '
+
+	rm -fr .git &&
+	git init &&
+	echo 1 >dirty &&
+	git add dirty &&
+	entry="$(git ls-files --stage dirty | cut -f 1)"
+	git mv dirty dirty2 &&
+	[ "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" ] &&
+	echo 2 >dirty2 &&
+	git mv dirty2 dirty &&
+	[ "$entry" = "$(git ls-files --stage dirty | cut -f 1)" ]
+
+'
+
+rm -f dirty dirty2
+
+test_expect_failure 'git mv should overwrite symlink to a file' '
+
+	rm -fr .git &&
+	git init &&
+	echo 1 >moved &&
+	ln -s moved symlink &&
+	git add moved symlink &&
+	! git mv moved symlink &&
+	git mv -f moved symlink &&
+	[ ! -e moved ] &&
+	[ -f symlink ] &&
+	[ $(cat symlink) = 1 ] &&
+	git diff-files --quiet
+
+'
+
+rm -f moved symlink
+
+test_expect_failure 'git mv should follow symlink to a directory' '
+
+	rm -fr .git &&
+	git init &&
+	echo 1 >moved &&
+	mkdir -p dir &&
+	touch dir/.keep &&
+	ln -s dir symlink &&
+	git add moved dir/.keep symlink &&
+	git mv moved symlink &&
+	[ ! -e moved ] &&
+	[ -f symlink/moved ] &&
+	[ $(cat symlink/moved) = 1 ] &&
+	[ "$(ls dir)" = "$(ls symlink)" ] &&
+	git diff-files --quiet
+
+'
+
+rm -rf moved symlink dir
+
 test_done

^ permalink raw reply related	[relevance 8%]

* [PATCH 23/25] t7000-t7999: fix broken &&-chains
  @ 2018-07-02  0:24  8% ` Eric Sunshine
  0 siblings, 0 replies; 200+ results
From: Eric Sunshine @ 2018-07-02  0:24 UTC (permalink / raw)
  To: git
  Cc: Elijah Newren, Johannes Sixt, Jonathan Nieder, Jonathan Tan,
	Stefan Beller, Junio C Hamano, Luke Diamand, Jeff King,
	Eric Sunshine

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---
 t/t7001-mv.sh                  |  2 +-
 t/t7201-co.sh                  | 40 +++++++++++++-------------
 t/t7400-submodule-basic.sh     |  2 +-
 t/t7406-submodule-update.sh    |  6 ++--
 t/t7408-submodule-reference.sh |  2 +-
 t/t7501-commit.sh              | 52 +++++++++++++++++-----------------
 t/t7506-status-submodule.sh    | 10 +++----
 7 files changed, 57 insertions(+), 57 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index cc3fd2baf2..9e59e5a5dd 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -509,7 +509,7 @@ test_expect_success 'moving nested submodules' '
 		touch nested_level1 &&
 		git init &&
 		git add . &&
-		git commit -m "nested level 1"
+		git commit -m "nested level 1" &&
 		git submodule add ../sub_nested_nested &&
 		git commit -m "add nested level 2"
 	) &&
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 8d8a63a24b..94cb039a03 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -528,10 +528,10 @@ test_expect_success 'checkout with --merge' '
 	cat sample >filf &&
 	git checkout -m -- fild file filf &&
 	(
-		echo "<<<<<<< ours"
-		echo ourside
-		echo "======="
-		echo theirside
+		echo "<<<<<<< ours" &&
+		echo ourside &&
+		echo "=======" &&
+		echo theirside &&
 		echo ">>>>>>> theirs"
 	) >merged &&
 	test_cmp expect fild &&
@@ -549,12 +549,12 @@ test_expect_success 'checkout with --merge, in diff3 -m style' '
 	cat sample >filf &&
 	git checkout -m -- fild file filf &&
 	(
-		echo "<<<<<<< ours"
-		echo ourside
-		echo "||||||| base"
-		echo original
-		echo "======="
-		echo theirside
+		echo "<<<<<<< ours" &&
+		echo ourside &&
+		echo "||||||| base" &&
+		echo original &&
+		echo "=======" &&
+		echo theirside &&
 		echo ">>>>>>> theirs"
 	) >merged &&
 	test_cmp expect fild &&
@@ -572,10 +572,10 @@ test_expect_success 'checkout --conflict=merge, overriding config' '
 	cat sample >filf &&
 	git checkout --conflict=merge -- fild file filf &&
 	(
-		echo "<<<<<<< ours"
-		echo ourside
-		echo "======="
-		echo theirside
+		echo "<<<<<<< ours" &&
+		echo ourside &&
+		echo "=======" &&
+		echo theirside &&
 		echo ">>>>>>> theirs"
 	) >merged &&
 	test_cmp expect fild &&
@@ -593,12 +593,12 @@ test_expect_success 'checkout --conflict=diff3' '
 	cat sample >filf &&
 	git checkout --conflict=diff3 -- fild file filf &&
 	(
-		echo "<<<<<<< ours"
-		echo ourside
-		echo "||||||| base"
-		echo original
-		echo "======="
-		echo theirside
+		echo "<<<<<<< ours" &&
+		echo ourside &&
+		echo "||||||| base" &&
+		echo original &&
+		echo "=======" &&
+		echo theirside &&
 		echo ">>>>>>> theirs"
 	) >merged &&
 	test_cmp expect fild &&
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 401adaed32..76cf522a08 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -818,7 +818,7 @@ test_expect_success '../bar/a/b/c works with relative local path - ../foo/bar.gi
 		cp pristine-.git-config .git/config &&
 		cp pristine-.gitmodules .gitmodules &&
 		mkdir -p a/b/c &&
-		(cd a/b/c; git init) &&
+		(cd a/b/c && git init) &&
 		git config remote.origin.url ../foo/bar.git &&
 		git submodule add ../bar/a/b/c ./a/b/c &&
 		git submodule init &&
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 9e0d31700e..f604ef7a72 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -865,9 +865,9 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re
 	 (cd submodule/subsubmodule &&
 	  git log > ../../expected
 	 ) &&
-	 (cd .git/modules/submodule/modules/subsubmodule
+	 (cd .git/modules/submodule/modules/subsubmodule &&
 	  git log > ../../../../../actual
-	 )
+	 ) &&
 	 test_cmp actual expected
 	)
 '
@@ -886,7 +886,7 @@ test_expect_success 'submodule update properly revives a moved submodule' '
 	 git commit -am "pre move" &&
 	 H2=$(git rev-parse --short HEAD) &&
 	 git status | sed "s/$H/XXX/" >expect &&
-	 H=$(cd submodule2; git rev-parse HEAD) &&
+	 H=$(cd submodule2 && git rev-parse HEAD) &&
 	 git rm --cached submodule2 &&
 	 rm -rf submodule2 &&
 	 mkdir -p "moved/sub module" &&
diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh
index 08d9add05e..34ac28c056 100755
--- a/t/t7408-submodule-reference.sh
+++ b/t/t7408-submodule-reference.sh
@@ -148,7 +148,7 @@ test_expect_success 'preparing second superproject with a nested submodule plus
 		cd supersuper &&
 		echo "I am super super." >file &&
 		git add file &&
-		git commit -m B-super-super-initial
+		git commit -m B-super-super-initial &&
 		git submodule add "file://$base_dir/super" subwithsub &&
 		git commit -m B-super-super-added &&
 		git submodule update --init --recursive &&
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 282ff42331..51646d8019 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -411,8 +411,8 @@ test_expect_success 'sign off (1)' '
 	git commit -s -m "thank you" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
 	(
-		echo thank you
-		echo
+		echo thank you &&
+		echo &&
 		git var GIT_COMMITTER_IDENT |
 		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
 	) >expected &&
@@ -430,9 +430,9 @@ test_expect_success 'sign off (2)' '
 $existing" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
 	(
-		echo thank you
-		echo
-		echo $existing
+		echo thank you &&
+		echo &&
+		echo $existing &&
 		git var GIT_COMMITTER_IDENT |
 		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
 	) >expected &&
@@ -450,9 +450,9 @@ test_expect_success 'signoff gap' '
 $alt" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
 	(
-		echo welcome
-		echo
-		echo $alt
+		echo welcome &&
+		echo &&
+		echo $alt &&
 		git var GIT_COMMITTER_IDENT |
 		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
 	) >expected &&
@@ -470,11 +470,11 @@ We have now
 $alt" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
 	(
-		echo welcome
-		echo
-		echo We have now
-		echo $alt
-		echo
+		echo welcome &&
+		echo &&
+		echo We have now &&
+		echo $alt &&
+		echo &&
 		git var GIT_COMMITTER_IDENT |
 		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
 	) >expected &&
@@ -491,11 +491,11 @@ non-trailer line
 Myfooter: x" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
 	(
-		echo subject
-		echo
-		echo non-trailer line
-		echo Myfooter: x
-		echo
+		echo subject &&
+		echo &&
+		echo non-trailer line &&
+		echo Myfooter: x &&
+		echo &&
 		echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
 	) >expected &&
 	test_cmp expected actual &&
@@ -508,10 +508,10 @@ non-trailer line
 Myfooter: x" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
 	(
-		echo subject
-		echo
-		echo non-trailer line
-		echo Myfooter: x
+		echo subject &&
+		echo &&
+		echo non-trailer line &&
+		echo Myfooter: x &&
 		echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
 	) >expected &&
 	test_cmp expected actual
@@ -524,10 +524,10 @@ test_expect_success 'multiple -m' '
 	git commit -m "one" -m "two" -m "three" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
 	(
-		echo one
-		echo
-		echo two
-		echo
+		echo one &&
+		echo &&
+		echo two &&
+		echo &&
 		echo three
 	) >expected &&
 	test_cmp expected actual
diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
index b4b74dbe29..943708fb04 100755
--- a/t/t7506-status-submodule.sh
+++ b/t/t7506-status-submodule.sh
@@ -193,9 +193,9 @@ test_expect_success 'status with added and untracked file in modified submodule
 
 test_expect_success 'setup .git file for sub' '
 	(cd sub &&
-	 rm -f new-file
+	 rm -f new-file &&
 	 REAL="$(pwd)/../.real" &&
-	 mv .git "$REAL"
+	 mv .git "$REAL" &&
 	 echo "gitdir: $REAL" >.git) &&
 	 echo .real >>.gitignore &&
 	 git commit -m "added .real to .gitignore" .gitignore
@@ -209,12 +209,12 @@ test_expect_success 'status with added file in modified submodule with .git file
 
 test_expect_success 'status with a lot of untracked files in the submodule' '
 	(
-		cd sub
+		cd sub &&
 		i=0 &&
 		while test $i -lt 1024
 		do
-			>some-file-$i
-			i=$(( $i + 1 ))
+			>some-file-$i &&
+			i=$(( $i + 1 )) || exit 1
 		done
 	) &&
 	git status --porcelain sub 2>err.actual &&
-- 
2.18.0.203.gfac676dfb9


^ permalink raw reply related	[relevance 8%]

* [PATCHv2] git-mv: Keep moved index entries inact
  @ 2008-07-21  0:25  8% ` Petr Baudis
    0 siblings, 1 reply; 200+ results
From: Petr Baudis @ 2008-07-21  0:25 UTC (permalink / raw)
  To: gitster; +Cc: git

The rewrite of git-mv from a shell script to a builtin was perhaps
a little too straightforward: the git add and git rm queues were
emulated directly, which resulted in a rather complicated code and
caused an inconsistent behaviour when moving dirty index entries;
git mv would update the entry based on working tree state,
except in case of overwrites, where the new entry would still have
sha1 of the old file.

This patch introduces rename_index_entry_at() into the index toolkit,
which will rename an entry while removing any entries the new entry
might render duplicate. This is then used in git mv instead
of all the file queues, resulting in a major simplification
of the code and an inevitable change in git mv -n output format.

A new test has been added to the testsuite to reflect this change.
Also, based on suggestion by Junio about desired symlink behaviour
of git mv, I have added two tests for that; however, I do not have
need or desire to spend time fixing this, so they are expected
to fail for now until someone gets around to fixing that.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 builtin-mv.c  |   62 ++++++++-------------------------------------------------
 cache.h       |    2 ++
 read-cache.c  |   17 ++++++++++++++++
 t/t7001-mv.sh |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 83 insertions(+), 53 deletions(-)

diff --git a/builtin-mv.c b/builtin-mv.c
index 33ad082..28ebc9c 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -36,17 +36,6 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
 	return get_pathspec(prefix, result);
 }
 
-static void show_list(const char *label, struct path_list *list)
-{
-	if (list->nr > 0) {
-		int i;
-		printf("%s", label);
-		for (i = 0; i < list->nr; i++)
-			printf("%s%s", i > 0 ? ", " : "", list->items[i].path);
-		putchar('\n');
-	}
-}
-
 static const char *add_slash(const char *path)
 {
 	int len = strlen(path);
@@ -75,11 +64,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	const char **source, **destination, **dest_path;
 	enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
 	struct stat st;
-	struct path_list overwritten = {NULL, 0, 0, 0};
 	struct path_list src_for_dst = {NULL, 0, 0, 0};
-	struct path_list added = {NULL, 0, 0, 0};
-	struct path_list deleted = {NULL, 0, 0, 0};
-	struct path_list changed = {NULL, 0, 0, 0};
 
 	git_config(git_default_config, NULL);
 
@@ -189,7 +174,6 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 							" will overwrite!\n",
 							bad);
 					bad = NULL;
-					path_list_insert(dst, &overwritten);
 				} else
 					bad = "Cannot overwrite";
 			}
@@ -218,6 +202,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	for (i = 0; i < argc; i++) {
 		const char *src = source[i], *dst = destination[i];
 		enum update_mode mode = modes[i];
+		int pos;
 		if (show_only || verbose)
 			printf("Renaming %s to %s\n", src, dst);
 		if (!show_only && mode != INDEX &&
@@ -227,45 +212,16 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		if (mode == WORKING_DIRECTORY)
 			continue;
 
-		assert(cache_name_pos(src, strlen(src)) >= 0);
-
-		path_list_insert(src, &deleted);
-		/* destination can be a directory with 1 file inside */
-		if (path_list_has_path(&overwritten, dst))
-			path_list_insert(dst, &changed);
-		else
-			path_list_insert(dst, &added);
+		pos = cache_name_pos(src, strlen(src));
+		assert(pos >= 0);
+		if (!show_only)
+			rename_cache_entry_at(pos, dst);
 	}
 
-	if (show_only) {
-		show_list("Changed  : ", &changed);
-		show_list("Adding   : ", &added);
-		show_list("Deleting : ", &deleted);
-	} else {
-		for (i = 0; i < changed.nr; i++) {
-			const char *path = changed.items[i].path;
-			int j = cache_name_pos(path, strlen(path));
-			struct cache_entry *ce = active_cache[j];
-
-			if (j < 0)
-				die ("Huh? Cache entry for %s unknown?", path);
-			refresh_cache_entry(ce, 0);
-		}
-
-		for (i = 0; i < added.nr; i++) {
-			const char *path = added.items[i].path;
-			if (add_file_to_cache(path, verbose ? ADD_CACHE_VERBOSE : 0))
-				die("updating index entries failed");
-		}
-
-		for (i = 0; i < deleted.nr; i++)
-			remove_file_from_cache(deleted.items[i].path);
-
-		if (active_cache_changed) {
-			if (write_cache(newfd, active_cache, active_nr) ||
-			    commit_locked_index(&lock_file))
-				die("Unable to write new index file");
-		}
+	if (active_cache_changed) {
+		if (write_cache(newfd, active_cache, active_nr) ||
+		    commit_locked_index(&lock_file))
+			die("Unable to write new index file");
 	}
 
 	return 0;
diff --git a/cache.h b/cache.h
index a779d92..6f1d003 100644
--- a/cache.h
+++ b/cache.h
@@ -260,6 +260,7 @@ static inline void remove_name_hash(struct cache_entry *ce)
 #define unmerged_cache() unmerged_index(&the_index)
 #define cache_name_pos(name, namelen) index_name_pos(&the_index,(name),(namelen))
 #define add_cache_entry(ce, option) add_index_entry(&the_index, (ce), (option))
+#define rename_cache_entry_at(pos, new_name) rename_index_entry_at(&the_index, (pos), (new_name))
 #define remove_cache_entry_at(pos) remove_index_entry_at(&the_index, (pos))
 #define remove_file_from_cache(path) remove_file_from_index(&the_index, (path))
 #define add_to_cache(path, st, flags) add_to_index(&the_index, (path), (st), (flags))
@@ -370,6 +371,7 @@ extern int index_name_pos(const struct index_state *, const char *name, int name
 #define ADD_CACHE_JUST_APPEND 8		/* Append only; tree.c::read_tree() */
 extern int add_index_entry(struct index_state *, struct cache_entry *ce, int option);
 extern struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really);
+extern void rename_index_entry_at(struct index_state *, int pos, const char *new_name);
 extern int remove_index_entry_at(struct index_state *, int pos);
 extern int remove_file_from_index(struct index_state *, const char *path);
 #define ADD_CACHE_VERBOSE 1
diff --git a/read-cache.c b/read-cache.c
index 1648428..e93ee3c 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -38,6 +38,23 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache
 	istate->cache_changed = 1;
 }
 
+void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
+{
+	struct cache_entry *old = istate->cache[nr], *new;
+	int namelen = strlen(new_name);
+
+	new = xmalloc(cache_entry_size(namelen));
+	copy_cache_entry(new, old);
+	new->ce_flags = (new->ce_flags & ~CE_HASHED) | CE_UNHASHED;
+	new->ce_flags = (new->ce_flags & ~CE_NAMEMASK)
+	                | (namelen >= CE_NAMEMASK ? CE_NAMEMASK : namelen);
+	memcpy(new->name, new_name, namelen);
+
+	cache_tree_invalidate_path(istate->cache_tree, old->name);
+	remove_index_entry_at(istate, nr);
+	add_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
+}
+
 /*
  * This only updates the "non-critical" parts of the directory
  * cache, ie the parts that aren't tracked by GIT, and only used
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 336cfaa..7e47931 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -156,4 +156,59 @@ test_expect_success 'absolute pathname outside should fail' '(
 
 )'
 
+test_expect_success 'git mv should not change sha1 of moved cache entry' '
+
+	rm -fr .git &&
+	git init &&
+	echo 1 >dirty &&
+	git add dirty &&
+	entry="$(git ls-files --stage dirty | cut -f 1)"
+	git mv dirty dirty2 &&
+	[ "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" ] &&
+	echo 2 >dirty2 &&
+	git mv dirty2 dirty &&
+	[ "$entry" = "$(git ls-files --stage dirty | cut -f 1)" ]
+
+'
+
+rm -f dirty dirty2
+
+test_expect_failure 'git mv should overwrite symlink to a file' '
+
+	rm -fr .git &&
+	git init &&
+	echo 1 >moved &&
+	ln -s moved symlink &&
+	git add moved symlink &&
+	! git mv moved symlink &&
+	git mv -f moved symlink &&
+	[ ! -e moved ] &&
+	[ -f symlink ] &&
+	[ $(cat symlink) = 1 ] &&
+	git diff-files --quiet
+
+'
+
+rm -f moved symlink
+
+test_expect_failure 'git mv should follow symlink to a directory' '
+
+	rm -fr .git &&
+	git init &&
+	echo 1 >moved &&
+	mkdir -p dir &&
+	touch dir/.keep &&
+	ln -s dir symlink &&
+	git add moved dir/.keep symlink &&
+	git mv moved symlink &&
+	[ ! -e moved ] &&
+	[ -f symlink/moved ] &&
+	[ $(cat symlink/moved) = 1 ] &&
+	[ "$(ls dir)" = "$(ls symlink)" ] &&
+	git diff-files --quiet
+
+'
+
+rm -rf moved symlink dir
+
 test_done

^ permalink raw reply related	[relevance 8%]

* [PATCHv3 6/6] submodule: fixup nested submodules after moving the submodule
  @ 2018-03-28 22:35  8%   ` Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2018-03-28 22:35 UTC (permalink / raw)
  To: jonathantanmy; +Cc: bmwill, git, gitster, hvoigt, sbeller, seanwbehan

connect_work_tree_and_git_dir is used to connect a submodule worktree with
its git directory and vice versa after events that require a reconnection
such as moving around the working tree. As submodules can have nested
submodules themselves, we'd also want to fix the nested submodules when
asked to. Add an option to recurse into the nested submodules and connect
them as well.

As submodules are identified by their name (which determines their git
directory in relation to their superproject's git directory) internally
and by their path in the working tree of the superproject, we need to
make sure that the mapping of name <-> path is kept intact. We can do
that in the git-mv command by writing out the gitmodules file first
and then forcing a reload of the submodule config machinery.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/mv.c                |  6 ++--
 builtin/submodule--helper.c |  3 +-
 dir.c                       | 60 +++++++++++++++++++++++++++++++++++--
 dir.h                       | 12 +++++++-
 repository.c                |  6 ++--
 repository.h                |  3 ++
 submodule.c                 |  6 ++--
 t/t7001-mv.sh               |  2 +-
 8 files changed, 83 insertions(+), 15 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index cf3684d907..b0c5178e0d 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -275,10 +275,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			die_errno(_("renaming '%s' failed"), src);
 		}
 		if (submodule_gitfile[i]) {
-			if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
-				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
 			if (!update_path_in_gitmodules(src, dst))
 				gitmodules_modified = 1;
+			if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
+				connect_work_tree_and_git_dir(dst,
+							      submodule_gitfile[i],
+							      1);
 		}
 
 		if (mode == WORKING_DIRECTORY)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 5551cf19c3..ffdc51f426 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1260,8 +1260,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
 		strbuf_reset(&sb);
 	}
 
-	/* Connect module worktree and git dir */
-	connect_work_tree_and_git_dir(path, sm_gitdir);
+	connect_work_tree_and_git_dir(path, sm_gitdir, 0);
 
 	p = git_pathdup_submodule(path, "config");
 	if (!p)
diff --git a/dir.c b/dir.c
index ce6e50d2a2..4f401b6a3c 100644
--- a/dir.c
+++ b/dir.c
@@ -19,6 +19,7 @@
 #include "varint.h"
 #include "ewah/ewok.h"
 #include "fsmonitor.h"
+#include "submodule-config.h"
 
 /*
  * Tells read_directory_recursive how a file or directory should be treated.
@@ -2988,8 +2989,57 @@ void untracked_cache_add_to_index(struct index_state *istate,
 	untracked_cache_invalidate_path(istate, path);
 }
 
-/* Update gitfile and core.worktree setting to connect work tree and git dir */
-void connect_work_tree_and_git_dir(const char *work_tree_, const char *git_dir_)
+static void connect_wt_gitdir_in_nested(const char *sub_worktree,
+					const char *sub_gitdir)
+{
+	int i;
+	struct repository subrepo;
+	struct strbuf sub_wt = STRBUF_INIT;
+	struct strbuf sub_gd = STRBUF_INIT;
+
+	const struct submodule *sub;
+
+	/* If the submodule has no working tree, we can ignore it. */
+	if (repo_init(&subrepo, sub_gitdir, sub_worktree))
+		return;
+
+	if (repo_read_index(&subrepo) < 0)
+		die("index file corrupt in repo %s", subrepo.gitdir);
+
+	for (i = 0; i < subrepo.index->cache_nr; i++) {
+		const struct cache_entry *ce = subrepo.index->cache[i];
+
+		if (!S_ISGITLINK(ce->ce_mode))
+			continue;
+
+		while (i + 1 < subrepo.index->cache_nr &&
+		       !strcmp(ce->name, subrepo.index->cache[i + 1]->name))
+			/*
+			 * Skip entries with the same name in different stages
+			 * to make sure an entry is returned only once.
+			 */
+			i++;
+
+		sub = submodule_from_path(&subrepo, &null_oid, ce->name);
+		if (!sub || !is_submodule_active(&subrepo, ce->name))
+			/* .gitmodules broken or inactive sub */
+			continue;
+
+		strbuf_reset(&sub_wt);
+		strbuf_reset(&sub_gd);
+		strbuf_addf(&sub_wt, "%s/%s", sub_worktree, sub->path);
+		strbuf_addf(&sub_gd, "%s/modules/%s", sub_gitdir, sub->name);
+
+		connect_work_tree_and_git_dir(sub_wt.buf, sub_gd.buf, 1);
+	}
+	strbuf_release(&sub_wt);
+	strbuf_release(&sub_gd);
+	repo_clear(&subrepo);
+}
+
+void connect_work_tree_and_git_dir(const char *work_tree_,
+				   const char *git_dir_,
+				   int recurse_into_nested)
 {
 	struct strbuf gitfile_sb = STRBUF_INIT;
 	struct strbuf cfg_sb = STRBUF_INIT;
@@ -3019,6 +3069,10 @@ void connect_work_tree_and_git_dir(const char *work_tree_, const char *git_dir_)
 	strbuf_release(&gitfile_sb);
 	strbuf_release(&cfg_sb);
 	strbuf_release(&rel_path);
+
+	if (recurse_into_nested)
+		connect_wt_gitdir_in_nested(work_tree, git_dir);
+
 	free(work_tree);
 	free(git_dir);
 }
@@ -3032,5 +3086,5 @@ void relocate_gitdir(const char *path, const char *old_git_dir, const char *new_
 		die_errno(_("could not migrate git directory from '%s' to '%s'"),
 			old_git_dir, new_git_dir);
 
-	connect_work_tree_and_git_dir(path, new_git_dir);
+	connect_work_tree_and_git_dir(path, new_git_dir, 0);
 }
diff --git a/dir.h b/dir.h
index 11a047ba48..d2545a7685 100644
--- a/dir.h
+++ b/dir.h
@@ -359,7 +359,17 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned long
 void write_untracked_extension(struct strbuf *out, struct untracked_cache *untracked);
 void add_untracked_cache(struct index_state *istate);
 void remove_untracked_cache(struct index_state *istate);
-extern void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir);
+
+/*
+ * Connect a worktree to a git directory by creating (or overwriting) a
+ * '.git' file containing the location of the git directory. In the git
+ * directory set the core.worktree setting to indicate where the worktree is.
+ * When `recurse_into_nested` is set, recurse into any nested submodules,
+ * connecting them as well.
+ */
+extern void connect_work_tree_and_git_dir(const char *work_tree,
+					  const char *git_dir,
+					  int recurse_into_nested);
 extern void relocate_gitdir(const char *path,
 			    const char *old_git_dir,
 			    const char *new_git_dir);
diff --git a/repository.c b/repository.c
index eb5b8e9f5a..beff3caa9e 100644
--- a/repository.c
+++ b/repository.c
@@ -135,9 +135,9 @@ static int read_and_verify_repository_format(struct repository_format *format,
  * Initialize 'repo' based on the provided 'gitdir'.
  * Return 0 upon success and a non-zero value upon failure.
  */
-static int repo_init(struct repository *repo,
-		     const char *gitdir,
-		     const char *worktree)
+int repo_init(struct repository *repo,
+	      const char *gitdir,
+	      const char *worktree)
 {
 	struct repository_format format;
 	memset(repo, 0, sizeof(*repo));
diff --git a/repository.h b/repository.h
index 09df94a472..6041367f08 100644
--- a/repository.h
+++ b/repository.h
@@ -97,6 +97,9 @@ extern void repo_set_gitdir(struct repository *repo,
 extern void repo_set_worktree(struct repository *repo, const char *path);
 extern void repo_set_hash_algo(struct repository *repo, int algo);
 extern void initialize_the_repository(void);
+extern int repo_init(struct repository *r,
+		     const char *gitdir,
+		     const char *worktree);
 extern int repo_submodule_init(struct repository *submodule,
 			       struct repository *superproject,
 			       const char *path);
diff --git a/submodule.c b/submodule.c
index dac73d10a7..53c45e49d0 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1625,7 +1625,7 @@ int submodule_move_head(const char *path,
 		} else {
 			char *gitdir = xstrfmt("%s/modules/%s",
 				    get_git_common_dir(), sub->name);
-			connect_work_tree_and_git_dir(path, gitdir);
+			connect_work_tree_and_git_dir(path, gitdir, 0);
 			free(gitdir);
 
 			/* make sure the index is clean as well */
@@ -1635,7 +1635,7 @@ int submodule_move_head(const char *path,
 		if (old && (flags & SUBMODULE_MOVE_HEAD_FORCE)) {
 			char *gitdir = xstrfmt("%s/modules/%s",
 				    get_git_common_dir(), sub->name);
-			connect_work_tree_and_git_dir(path, gitdir);
+			connect_work_tree_and_git_dir(path, gitdir, 1);
 			free(gitdir);
 		}
 	}
@@ -1948,7 +1948,7 @@ void absorb_git_dir_into_superproject(const char *prefix,
 		if (!sub)
 			die(_("could not lookup name for submodule '%s'"), path);
 		connect_work_tree_and_git_dir(path,
-			git_path("modules/%s", sub->name));
+			git_path("modules/%s", sub->name), 0);
 	} else {
 		/* Is it already absorbed into the superprojects git dir? */
 		char *real_sub_git_dir = real_pathdup(sub_git_dir, 1);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 6e5031f56f..bfe2c427f1 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -491,7 +491,7 @@ test_expect_success 'moving a submodule in nested directories' '
 	test_cmp expect actual
 '
 
-test_expect_failure 'moving nested submodules' '
+test_expect_success 'moving nested submodules' '
 	git commit -am "cleanup commit" &&
 	mkdir sub_nested_nested &&
 	(cd sub_nested_nested &&
-- 
2.17.0.rc1.321.gba9d0f2565-goog


^ permalink raw reply related	[relevance 8%]

* [PATCH 26/29] t7000-t7999: fix broken &&-chains in subshells
  @ 2018-06-26  7:29  8% ` Eric Sunshine
  0 siblings, 0 replies; 200+ results
From: Eric Sunshine @ 2018-06-26  7:29 UTC (permalink / raw)
  To: git
  Cc: Jeff King, Jonathan Nieder, SZEDER Gábor, Stefan Beller,
	Elijah Newren, Jonathan Tan, Eric Sunshine

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---
 t/t7001-mv.sh                  |  2 +-
 t/t7201-co.sh                  | 40 +++++++++++++-------------
 t/t7400-submodule-basic.sh     |  2 +-
 t/t7406-submodule-update.sh    |  4 +--
 t/t7408-submodule-reference.sh |  2 +-
 t/t7501-commit.sh              | 52 +++++++++++++++++-----------------
 t/t7506-status-submodule.sh    | 10 +++----
 7 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index cc3fd2baf2..9e59e5a5dd 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -509,7 +509,7 @@ test_expect_success 'moving nested submodules' '
 		touch nested_level1 &&
 		git init &&
 		git add . &&
-		git commit -m "nested level 1"
+		git commit -m "nested level 1" &&
 		git submodule add ../sub_nested_nested &&
 		git commit -m "add nested level 2"
 	) &&
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 8d8a63a24b..94cb039a03 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -528,10 +528,10 @@ test_expect_success 'checkout with --merge' '
 	cat sample >filf &&
 	git checkout -m -- fild file filf &&
 	(
-		echo "<<<<<<< ours"
-		echo ourside
-		echo "======="
-		echo theirside
+		echo "<<<<<<< ours" &&
+		echo ourside &&
+		echo "=======" &&
+		echo theirside &&
 		echo ">>>>>>> theirs"
 	) >merged &&
 	test_cmp expect fild &&
@@ -549,12 +549,12 @@ test_expect_success 'checkout with --merge, in diff3 -m style' '
 	cat sample >filf &&
 	git checkout -m -- fild file filf &&
 	(
-		echo "<<<<<<< ours"
-		echo ourside
-		echo "||||||| base"
-		echo original
-		echo "======="
-		echo theirside
+		echo "<<<<<<< ours" &&
+		echo ourside &&
+		echo "||||||| base" &&
+		echo original &&
+		echo "=======" &&
+		echo theirside &&
 		echo ">>>>>>> theirs"
 	) >merged &&
 	test_cmp expect fild &&
@@ -572,10 +572,10 @@ test_expect_success 'checkout --conflict=merge, overriding config' '
 	cat sample >filf &&
 	git checkout --conflict=merge -- fild file filf &&
 	(
-		echo "<<<<<<< ours"
-		echo ourside
-		echo "======="
-		echo theirside
+		echo "<<<<<<< ours" &&
+		echo ourside &&
+		echo "=======" &&
+		echo theirside &&
 		echo ">>>>>>> theirs"
 	) >merged &&
 	test_cmp expect fild &&
@@ -593,12 +593,12 @@ test_expect_success 'checkout --conflict=diff3' '
 	cat sample >filf &&
 	git checkout --conflict=diff3 -- fild file filf &&
 	(
-		echo "<<<<<<< ours"
-		echo ourside
-		echo "||||||| base"
-		echo original
-		echo "======="
-		echo theirside
+		echo "<<<<<<< ours" &&
+		echo ourside &&
+		echo "||||||| base" &&
+		echo original &&
+		echo "=======" &&
+		echo theirside &&
 		echo ">>>>>>> theirs"
 	) >merged &&
 	test_cmp expect fild &&
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 401adaed32..76cf522a08 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -818,7 +818,7 @@ test_expect_success '../bar/a/b/c works with relative local path - ../foo/bar.gi
 		cp pristine-.git-config .git/config &&
 		cp pristine-.gitmodules .gitmodules &&
 		mkdir -p a/b/c &&
-		(cd a/b/c; git init) &&
+		(cd a/b/c && git init) &&
 		git config remote.origin.url ../foo/bar.git &&
 		git submodule add ../bar/a/b/c ./a/b/c &&
 		git submodule init &&
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 9e0d31700e..b141145fc2 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -865,9 +865,9 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re
 	 (cd submodule/subsubmodule &&
 	  git log > ../../expected
 	 ) &&
-	 (cd .git/modules/submodule/modules/subsubmodule
+	 (cd .git/modules/submodule/modules/subsubmodule &&
 	  git log > ../../../../../actual
-	 )
+	 ) &&
 	 test_cmp actual expected
 	)
 '
diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh
index 08d9add05e..34ac28c056 100755
--- a/t/t7408-submodule-reference.sh
+++ b/t/t7408-submodule-reference.sh
@@ -148,7 +148,7 @@ test_expect_success 'preparing second superproject with a nested submodule plus
 		cd supersuper &&
 		echo "I am super super." >file &&
 		git add file &&
-		git commit -m B-super-super-initial
+		git commit -m B-super-super-initial &&
 		git submodule add "file://$base_dir/super" subwithsub &&
 		git commit -m B-super-super-added &&
 		git submodule update --init --recursive &&
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 589b6cea23..39b14b2bdb 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -411,8 +411,8 @@ test_expect_success 'sign off (1)' '
 	git commit -s -m "thank you" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
 	(
-		echo thank you
-		echo
+		echo thank you &&
+		echo &&
 		git var GIT_COMMITTER_IDENT |
 		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
 	) >expected &&
@@ -430,9 +430,9 @@ test_expect_success 'sign off (2)' '
 $existing" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
 	(
-		echo thank you
-		echo
-		echo $existing
+		echo thank you &&
+		echo &&
+		echo $existing &&
 		git var GIT_COMMITTER_IDENT |
 		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
 	) >expected &&
@@ -450,9 +450,9 @@ test_expect_success 'signoff gap' '
 $alt" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
 	(
-		echo welcome
-		echo
-		echo $alt
+		echo welcome &&
+		echo &&
+		echo $alt &&
 		git var GIT_COMMITTER_IDENT |
 		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
 	) >expected &&
@@ -470,11 +470,11 @@ We have now
 $alt" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
 	(
-		echo welcome
-		echo
-		echo We have now
-		echo $alt
-		echo
+		echo welcome &&
+		echo &&
+		echo We have now &&
+		echo $alt &&
+		echo &&
 		git var GIT_COMMITTER_IDENT |
 		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
 	) >expected &&
@@ -491,11 +491,11 @@ non-trailer line
 Myfooter: x" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
 	(
-		echo subject
-		echo
-		echo non-trailer line
-		echo Myfooter: x
-		echo
+		echo subject &&
+		echo &&
+		echo non-trailer line &&
+		echo Myfooter: x &&
+		echo &&
 		echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
 	) >expected &&
 	test_cmp expected actual &&
@@ -508,10 +508,10 @@ non-trailer line
 Myfooter: x" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
 	(
-		echo subject
-		echo
-		echo non-trailer line
-		echo Myfooter: x
+		echo subject &&
+		echo &&
+		echo non-trailer line &&
+		echo Myfooter: x &&
 		echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
 	) >expected &&
 	test_cmp expected actual
@@ -524,10 +524,10 @@ test_expect_success 'multiple -m' '
 	git commit -m "one" -m "two" -m "three" &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
 	(
-		echo one
-		echo
-		echo two
-		echo
+		echo one &&
+		echo &&
+		echo two &&
+		echo &&
 		echo three
 	) >expected &&
 	test_cmp expected actual
diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
index b4b74dbe29..943708fb04 100755
--- a/t/t7506-status-submodule.sh
+++ b/t/t7506-status-submodule.sh
@@ -193,9 +193,9 @@ test_expect_success 'status with added and untracked file in modified submodule
 
 test_expect_success 'setup .git file for sub' '
 	(cd sub &&
-	 rm -f new-file
+	 rm -f new-file &&
 	 REAL="$(pwd)/../.real" &&
-	 mv .git "$REAL"
+	 mv .git "$REAL" &&
 	 echo "gitdir: $REAL" >.git) &&
 	 echo .real >>.gitignore &&
 	 git commit -m "added .real to .gitignore" .gitignore
@@ -209,12 +209,12 @@ test_expect_success 'status with added file in modified submodule with .git file
 
 test_expect_success 'status with a lot of untracked files in the submodule' '
 	(
-		cd sub
+		cd sub &&
 		i=0 &&
 		while test $i -lt 1024
 		do
-			>some-file-$i
-			i=$(( $i + 1 ))
+			>some-file-$i &&
+			i=$(( $i + 1 )) || exit 1
 		done
 	) &&
 	git status --porcelain sub 2>err.actual &&
-- 
2.18.0.419.gfe4b301394


^ permalink raw reply related	[relevance 8%]

* [PATCH v2] mv: refresh stat info for moved entry
  2022-03-25  1:56 11% [PATCH] mv: refresh stat info for moved entry Victoria Dye via GitGitGadget
@ 2022-03-29  1:07  9% ` Victoria Dye via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Victoria Dye via GitGitGadget @ 2022-03-29  1:07 UTC (permalink / raw)
  To: git; +Cc: reichemn, gitster, Derrick Stolee, Victoria Dye, Victoria Dye

From: Victoria Dye <vdye@github.com>

Update the stat info of the moved index entry in 'rename_index_entry_at()'
if the entry is up-to-date with the index. Internally, 'git mv' uses
'rename_index_entry_at()' to move the source index entry to the destination.
However, it directly copies the stat info of the original cache entry, which
will not reflect the 'ctime' of the file renaming operation that happened as
part of the move. If a file is otherwise up-to-date with the index, that
difference in 'ctime' will make the entry appear out-of-date until the next
index-refreshing operation (e.g., 'git status').

Some commands, such as 'git reset', use the cached stat information to
determine whether a file is up-to-date; if this information is incorrect,
the command will fail when it should pass. In order to ensure a moved entry
is evaluated as 'up-to-date' when appropriate, refresh the destination index
entry's stat info in 'git mv' if and only if the file is up-to-date.

Note that the test added in 't7001-mv.sh' requires a "sleep 1" to ensure the
'ctime' of the file creation will be definitively older than the 'ctime' of
the renamed file in 'git mv'.

Reported-by: Maximilian Reichel <reichemn@icloud.com>
Signed-off-by: Victoria Dye <vdye@github.com>
---
    mv: refresh stat info for moved entry
    
    This patch fixes a bug [1] encountered when executing 'git reset --merge
    HEAD' immediately after 'git mv'. Because the stat info of the original
    entry is copied to the new one, including all cached stat information,
    the 'ctime' isn't updated corresponding to the rename. If the index
    entry is otherwise up-to-date with the contents on-disk, the incorrect
    'ctime' makes subsequent operations (e.g., 'git reset --merge') identify
    the index entry as out-of-date, failing when they should succeed.
    
    Note, however, that we use 'refresh_cache_entry()' to refresh the stat
    information rather than 'fill_stat_cache_info()' directly because the
    stat information should only be updated if the index entry is up-to-date
    with the file on-disk. If we ignored this distinction, the stat info
    would match the state of unstaged changes on-disk, not the entry in the
    index as it should.
    
    To avoid exiting 'git mv' with a stale index that may affect subsequent
    commands, 'rename_index_entry_at()' (used internally by 'git mv') is
    updated to refresh the destination index entry's stat information after
    the move is complete.
    
    [1]
    https://lore.kernel.org/git/84FF8F9A-3A9A-4F2A-8D8E-5D50F2F06203@icloud.com/
    
    
    Changes since V1
    ================
    
     * Determined the exact cause of the failure (the mismatched 'ctime'),
       as well as the reasoning for why the stat information cannot always
       be updated; revised the implementation accordingly.
     * Fixed usage of 'refresh_cache_entry()'; because it does not update
       cache entries in-place, insert its return value into the index (if
       valid), and discard the no-longer-needed 'new_entry' cache entry.
     * Updated the test for the bug report scenario to wait long enough such
       that the 'ctime' of the 'mv' is distinct from the original file
       creation time.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1187%2Fvdye%2Freset%2Fmerge-inconsistency-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1187/vdye/reset/merge-inconsistency-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1187

Range-diff vs v1:

 1:  fe9f5f0d8ec ! 1:  bde58070eda mv: refresh stat info for moved entry
     @@ Metadata
       ## Commit message ##
          mv: refresh stat info for moved entry
      
     -    Add 'refresh_cache_entry()' after moving the index entry in
     -    'rename_index_entry_at()'. Internally, 'git mv' uses
     -    'rename_index_entry_at()' to move the source index entry to the destination,
     -    overwriting the old entry if '-f' is specified. However, it does not refresh
     -    the stat information on destination index entry, making its 'CE_UPTODATE'
     -    flag out-of-date until the index is refreshed (e.g., by 'git status').
     +    Update the stat info of the moved index entry in 'rename_index_entry_at()'
     +    if the entry is up-to-date with the index. Internally, 'git mv' uses
     +    'rename_index_entry_at()' to move the source index entry to the destination.
     +    However, it directly copies the stat info of the original cache entry, which
     +    will not reflect the 'ctime' of the file renaming operation that happened as
     +    part of the move. If a file is otherwise up-to-date with the index, that
     +    difference in 'ctime' will make the entry appear out-of-date until the next
     +    index-refreshing operation (e.g., 'git status').
      
     -    Some commands, such as 'git reset', assume the 'CE_UPTODATE' information
     -    they read from the index is accurate, and use that information to determine
     -    whether the operation can be done successfully or not. In order to ensure
     -    the index is correct for commands such as these, explicitly refresh the
     -    destination index entry in 'git mv' before exiting.
     +    Some commands, such as 'git reset', use the cached stat information to
     +    determine whether a file is up-to-date; if this information is incorrect,
     +    the command will fail when it should pass. In order to ensure a moved entry
     +    is evaluated as 'up-to-date' when appropriate, refresh the destination index
     +    entry's stat info in 'git mv' if and only if the file is up-to-date.
     +
     +    Note that the test added in 't7001-mv.sh' requires a "sleep 1" to ensure the
     +    'ctime' of the file creation will be definitively older than the 'ctime' of
     +    the renamed file in 'git mv'.
      
          Reported-by: Maximilian Reichel <reichemn@icloud.com>
          Signed-off-by: Victoria Dye <vdye@github.com>
      
       ## read-cache.c ##
     +@@ read-cache.c: static void replace_index_entry(struct index_state *istate, int nr, struct cache
     + 
     + void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
     + {
     +-	struct cache_entry *old_entry = istate->cache[nr], *new_entry;
     ++	struct cache_entry *old_entry = istate->cache[nr], *new_entry, *refreshed;
     + 	int namelen = strlen(new_name);
     + 
     + 	new_entry = make_empty_cache_entry(istate, namelen);
      @@ read-cache.c: void rename_index_entry_at(struct index_state *istate, int nr, const char *new_n
     + 	cache_tree_invalidate_path(istate, old_entry->name);
       	untracked_cache_remove_from_index(istate, old_entry->name);
       	remove_index_entry_at(istate, nr);
     - 	add_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
     -+	refresh_cache_entry(istate, new_entry, CE_MATCH_REFRESH);
     +-	add_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
     ++
     ++	/*
     ++	 * Refresh the new index entry. Using 'refresh_cache_entry' ensures
     ++	 * we only update stat info if the entry is otherwise up-to-date (i.e.,
     ++	 * the contents/mode haven't changed). This ensures that we reflect the
     ++	 * 'ctime' of the rename in the index without (incorrectly) updating
     ++	 * the cached stat info to reflect unstaged changes on disk.
     ++	 */
     ++	refreshed = refresh_cache_entry(istate, new_entry, CE_MATCH_REFRESH);
     ++	if (refreshed && refreshed != new_entry) {
     ++		add_index_entry(istate, refreshed, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
     ++		discard_cache_entry(new_entry);
     ++	} else
     ++		add_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
       }
       
       void fill_stat_data(struct stat_data *sd, struct stat *st)
     @@ t/t7001-mv.sh: test_description='git mv in subdirs'
      +
      +	echo foo >foo &&
      +	git add foo &&
     ++
     ++	# Wait one second to ensure ctime of rename will differ from original
     ++	# file creation ctime.
     ++	sleep 1 &&
      +	git mv -f foo bar &&
     -+	git reset --merge HEAD
     ++	git reset --merge HEAD &&
     ++
     ++	# Verify the index has been reset
     ++	git diff-files >out &&
     ++	test_must_be_empty out
      +'
      +
       test_expect_success 'prepare reference tree' '


 read-cache.c  | 17 +++++++++++++++--
 t/t7001-mv.sh | 19 +++++++++++++++++++
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index 3e0e7d41837..4df97e185e9 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -134,7 +134,7 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache
 
 void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
 {
-	struct cache_entry *old_entry = istate->cache[nr], *new_entry;
+	struct cache_entry *old_entry = istate->cache[nr], *new_entry, *refreshed;
 	int namelen = strlen(new_name);
 
 	new_entry = make_empty_cache_entry(istate, namelen);
@@ -147,7 +147,20 @@ void rename_index_entry_at(struct index_state *istate, int nr, const char *new_n
 	cache_tree_invalidate_path(istate, old_entry->name);
 	untracked_cache_remove_from_index(istate, old_entry->name);
 	remove_index_entry_at(istate, nr);
-	add_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
+
+	/*
+	 * Refresh the new index entry. Using 'refresh_cache_entry' ensures
+	 * we only update stat info if the entry is otherwise up-to-date (i.e.,
+	 * the contents/mode haven't changed). This ensures that we reflect the
+	 * 'ctime' of the rename in the index without (incorrectly) updating
+	 * the cached stat info to reflect unstaged changes on disk.
+	 */
+	refreshed = refresh_cache_entry(istate, new_entry, CE_MATCH_REFRESH);
+	if (refreshed && refreshed != new_entry) {
+		add_index_entry(istate, refreshed, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
+		discard_cache_entry(new_entry);
+	} else
+		add_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
 }
 
 void fill_stat_data(struct stat_data *sd, struct stat *st)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 963356ba5f9..a402908142d 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -4,6 +4,25 @@ test_description='git mv in subdirs'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-diff-data.sh
 
+test_expect_success 'mv -f refreshes updated index entry' '
+	echo test >bar &&
+	git add bar &&
+	git commit -m test &&
+
+	echo foo >foo &&
+	git add foo &&
+
+	# Wait one second to ensure ctime of rename will differ from original
+	# file creation ctime.
+	sleep 1 &&
+	git mv -f foo bar &&
+	git reset --merge HEAD &&
+
+	# Verify the index has been reset
+	git diff-files >out &&
+	test_must_be_empty out
+'
+
 test_expect_success 'prepare reference tree' '
 	mkdir path0 path1 &&
 	COPYING_test_data >path0/COPYING &&

base-commit: abf474a5dd901f28013c52155411a48fd4c09922
-- 
gitgitgadget

^ permalink raw reply related	[relevance 9%]

* [PATCH v2] fix `git mv existing-dir non-existing-dir` in some environments.
  2023-08-08 14:53 10% [PATCH] fix `git mv existing-dir non-existing-dir`* Sebastian Thiel via GitGitGadget
@ 2023-08-09  7:47  9% ` Sebastian Thiel via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Sebastian Thiel via GitGitGadget @ 2023-08-09  7:47 UTC (permalink / raw)
  To: git; +Cc: Torsten Bögershausen, Sebastian Thiel, Sebastian Thiel

From: Sebastian Thiel <sebastian.thiel@icloud.com>

When moving a directory onto another with `git mv` various checks are
performed. One of of these validates that the destination is not existing.

When calling `lstat` on the destination path and it fails as the path
doesn't exist, some environments seem to overwrite the passed  in
`stat` memory nonetheless (I observed this issue on debian 12 of x86_64,
running on OrbStack on ARM, emulated with Rosetta).

This would affect the code that followed as it would still acccess a now
modified `st` structure, which now seems to contain uninitialized memory.
`S_ISDIR(st_dir_mode)` would then typically return false causing the code
to run into a bad case.

The fix avoids overwriting the existing `st` structure, providing an
alternative that exists only for that purpose.

Note that this patch minimizes complexity instead of stack-frame size.

Signed-off-by: Sebastian Thiel <sebastian.thiel@icloud.com>
---
    [PATCH] mv: handle lstat() failure correctly
    
    When moving a directory onto another with git mv various checks are
    performed. One of of these validates that the destination is not
    existing.
    
    When calling lstat on the destination path and it fails as the path
    doesn't exist, some environments seem to overwrite the passed in stat
    memory nonetheless (I observed this issue on debian 12 of x86_64,
    running on OrbStack on ARM, emulated with Rosetta).
    
    This would affect the code that followed as it would still acccess a now
    modified st structure, which now seems to contain uninitialized memory.
    S_ISDIR(st_dir_mode) would then typically return false causing the code
    to run into a bad case.
    
    The fix avoids overwriting the existing st structure, providing an
    alternative that exists only for that purpose.
    
    
    Note that this patch minimizes complexity instead of stack-frame size.
    ======================================================================
    
    It's worth pointing out that the test demonstrates this case only if one
    happens to execute it in one of the environments that happen to have an
    lstat that writes into stat even on error. Thus it already worked for me
    on MacOS, even without the patch applied, which matches my observation
    that a certain script works there but doesn't work on the VM.
    
    Even though the patch now minimizes size, I can imagine one might
    instead want to rather copy st.st_mode to protect only the relevant
    field from being affected by potential rewrites of st later on.
    
    Changes since v1:
    
     * replaced previous title with recommendation by Junio C Hermano
     * improved formatting of commit message and renamed gix to git. Let's
       call that a typo
     * apply Junio C Hermano's suggestions to test-case
     * I refrained from changing the error message as this would mean all
       translations need adjustment (and I don't know how this is tracked
       then)
    
    I also want to apologise for the possibly terrible formatting and the
    repetition - it feels strange but is what gitgadget seems to suggests.
    Further, it's my honour to submit a patch to git and interact with the
    maintainers, it's like meeting my idols!

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1561%2FByron%2Ffix-mv-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1561/Byron/fix-mv-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1561

Range-diff vs v1:

 1:  ad0e6754e2d ! 1:  8908fd228fe fix `git mv existing-dir non-existing-dir`*
     @@ Metadata
      Author: Sebastian Thiel <sebastian.thiel@icloud.com>
      
       ## Commit message ##
     -    fix `git mv existing-dir non-existing-dir`*
     +    fix `git mv existing-dir non-existing-dir` in some environments.
      
     -    *in some environments.
     +    When moving a directory onto another with `git mv` various checks are
     +    performed. One of of these validates that the destination is not existing.
      
     -    When moving a directory onto another with `gix mv`
     -    various checks are performed. One of of these
     -    validates that the destination is not an existing
     -    file.
     +    When calling `lstat` on the destination path and it fails as the path
     +    doesn't exist, some environments seem to overwrite the passed  in
     +    `stat` memory nonetheless (I observed this issue on debian 12 of x86_64,
     +    running on OrbStack on ARM, emulated with Rosetta).
      
     -    When calling `lstat` on the destination path and
     -    it fails as the path doesn't exist, some
     -    environments seem to overwrite the passed  in
     -    `stat` memory nonetheless.
     -    (I observed this issue on debian 12 of x86_64,
     -    running on OrbStack on ARM, emulated with Rosetta)
     +    This would affect the code that followed as it would still acccess a now
     +    modified `st` structure, which now seems to contain uninitialized memory.
     +    `S_ISDIR(st_dir_mode)` would then typically return false causing the code
     +    to run into a bad case.
      
     -    This would affect the code that followed as it
     -    would still acccess a now
     -    modified `st` structure, which now seems to
     -    contain uninitialized memory.
     -    `S_ISDIR(st_dir_mode)` would then typically
     -    return false causing the code to run into a bad
     -    case.
     +    The fix avoids overwriting the existing `st` structure, providing an
     +    alternative that exists only for that purpose.
      
     -    The fix avoids overwriting the existing `st`
     -    structure, providing an alternative that exists
     -    only for that purpose.
     -
     -    Note that this patch minimizes complexity instead of stack-size.
     +    Note that this patch minimizes complexity instead of stack-frame size.
      
          Signed-off-by: Sebastian Thiel <sebastian.thiel@icloud.com>
      
     @@ t/t7001-mv.sh: test_expect_success 'do not move directory over existing director
       '
       
      +test_expect_success 'rename directory to non-existing directory' '
     -+	mkdir dir-a && touch dir-a/f &&
     ++	mkdir dir-a &&
     ++	>dir-a/f &&
      +	git add dir-a &&
      +	git mv dir-a non-existing-dir
      +'


 builtin/mv.c  | 4 ++--
 t/t7001-mv.sh | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index fa84fcb20d8..05e7156034e 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -184,7 +184,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	int src_dir_nr = 0, src_dir_alloc = 0;
 	struct strbuf a_src_dir = STRBUF_INIT;
 	enum update_mode *modes, dst_mode = 0;
-	struct stat st;
+	struct stat st, dest_st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
 	struct lock_file lock_file = LOCK_INIT;
 	struct cache_entry *ce;
@@ -304,7 +304,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			goto act_on_entry;
 		}
 		if (S_ISDIR(st.st_mode)
-		    && lstat(dst, &st) == 0) {
+		    && lstat(dst, &dest_st) == 0) {
 			bad = _("cannot move directory over file");
 			goto act_on_entry;
 		}
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 898a9205328..f136ea76f7f 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -174,6 +174,13 @@ test_expect_success 'do not move directory over existing directory' '
 	test_must_fail git mv path2 path0
 '
 
+test_expect_success 'rename directory to non-existing directory' '
+	mkdir dir-a &&
+	>dir-a/f &&
+	git add dir-a &&
+	git mv dir-a non-existing-dir
+'
+
 test_expect_success 'move into "."' '
 	git mv path1/path2/ .
 '

base-commit: 1b0a5129563ebe720330fdc8f5c6843d27641137
-- 
gitgitgadget

^ permalink raw reply related	[relevance 9%]

* [PATCH/RFC 3/3] Teach mv to update the path entry in .gitmodules for moved submodules
    2013-04-03 19:56 10% ` [PATCH/RFC 1/3] Teach mv to move submodules together with their work trees Jens Lehmann
  2013-04-03 19:56  9% ` [PATCH/RFC 2/3] Teach mv to move submodules using a gitfile Jens Lehmann
@ 2013-04-03 19:57  9% ` Jens Lehmann
  2 siblings, 0 replies; 200+ results
From: Jens Lehmann @ 2013-04-03 19:57 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Junio C Hamano, Phil Hord, Heiko Voigt, W. Trevor King,
	Peter Collingbourne

Currently using "git mv" on a submodule moves the submodule's work tree in
that of the superproject. But the submodule's path setting in .gitmodules
is left untouched, which is now inconsistent with the work tree and makes
git commands that rely on the proper path -> name mapping (like status and
diff) behave strangely.

Let "git mv" help here by not only moving the submodule's work tree but
also updating the "submodule.<submodule name>.path" setting from the
.gitmodules file and stage both. This doesn't happen when no .gitmodules
file is found and only issues a warning when it doesn't have a section for
this submodule. This is because the user might just use plain gitlinks
without the .gitmodules file or has already updated the path setting by
hand before issuing the "git mv" command (in which case the warning
reminds him that mv would have done that for him). Only when .gitmodules
is found and contains merge conflicts the mv command will fail and tell
the user to resolve the conflict before trying again.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
 builtin/mv.c  |  8 +++++++-
 submodule.c   | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 submodule.h   |  2 ++
 t/t7001-mv.sh | 41 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 112 insertions(+), 1 deletion(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 609bbb8..36e5605 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -57,7 +57,7 @@ static struct lock_file lock_file;

 int cmd_mv(int argc, const char **argv, const char *prefix)
 {
-	int i, newfd;
+	int i, newfd, gitmodules_modified = 0;
 	int verbose = 0, show_only = 0, force = 0, ignore_errors = 0;
 	struct option builtin_mv_options[] = {
 		OPT__VERBOSE(&verbose, N_("be verbose")),
@@ -71,6 +71,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	struct stat st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;

+	gitmodules_config();
 	git_config(git_default_config, NULL);

 	argc = parse_options(argc, argv, prefix, builtin_mv_options,
@@ -228,6 +229,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				die_errno (_("renaming '%s' failed"), src);
 			if (submodule_gitfile[i])
 				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
+			if (!update_path_in_gitmodules(src, dst))
+				gitmodules_modified = 1;
 		}

 		if (mode == WORKING_DIRECTORY)
@@ -239,6 +242,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			rename_cache_entry_at(pos, dst);
 	}

+	if (gitmodules_modified)
+		stage_updated_gitmodules();
+
 	if (active_cache_changed) {
 		if (write_cache(newfd, active_cache, active_nr) ||
 		    commit_locked_index(&lock_file))
diff --git a/submodule.c b/submodule.c
index eba9b42..fb742b4 100644
--- a/submodule.c
+++ b/submodule.c
@@ -10,6 +10,7 @@
 #include "string-list.h"
 #include "sha1-array.h"
 #include "argv-array.h"
+#include "blob.h"

 static struct string_list config_name_for_path;
 static struct string_list config_fetch_recurse_submodules_for_name;
@@ -30,6 +31,67 @@ static struct sha1_array ref_tips_after_fetch;
  */
 static int gitmodules_is_unmerged;

+/*
+ * Try to update the "path" entry in the "submodule.<name>" section of the
+ * .gitmodules file.
+ */
+int update_path_in_gitmodules(const char *oldpath, const char *newpath)
+{
+	struct strbuf entry = STRBUF_INIT;
+	struct string_list_item *path_option;
+
+	if (!file_exists(".gitmodules")) /* Do nothing whithout .gitmodules */
+		return -1;
+
+	if (gitmodules_is_unmerged)
+		die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first"));
+
+	path_option = unsorted_string_list_lookup(&config_name_for_path, oldpath);
+	if (!path_option) {
+		warning(_("Could not find section in .gitmodules where path=%s"), oldpath);
+		return -1;
+	}
+	strbuf_addstr(&entry, "submodule.");
+	strbuf_addstr(&entry, path_option->util);
+	strbuf_addstr(&entry, ".path");
+	if (git_config_set_in_file(".gitmodules", entry.buf, newpath) < 0) {
+		/* Maybe the user already did that, don't error out here */
+		warning(_("Could not update .gitmodules entry %s"), entry.buf);
+		return -1;
+	}
+	strbuf_release(&entry);
+	return 0;
+}
+
+void stage_updated_gitmodules(void)
+{
+	struct strbuf buf = STRBUF_INIT;
+	struct stat st;
+	int pos;
+	struct cache_entry *ce;
+	int namelen = strlen(".gitmodules");
+
+	pos = cache_name_pos(".gitmodules", strlen(".gitmodules"));
+	if (pos < 0) {
+		warning(_("could not find .gitmodules in index"));
+		return;
+	}
+	ce = active_cache[pos];
+	ce->ce_flags = namelen;
+	if (strbuf_read_file(&buf, ".gitmodules", 0) < 0)
+		die(_("reading updated .gitmodules failed"));
+	if (lstat(".gitmodules", &st) < 0)
+		die_errno(_("unable to stat updated .gitmodules"));
+	fill_stat_cache_info(ce, &st);
+	ce->ce_mode = ce_mode_from_stat(ce, st.st_mode);
+	if (remove_file_from_cache(".gitmodules") < 0)
+		die(_("unable to remove .gitmodules from index"));
+	if (write_sha1_file(buf.buf, buf.len, blob_type, ce->sha1))
+		die(_("adding updated .gitmodules failed"));
+	if (add_cache_entry(ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE))
+		die(_("staging updated .gitmodules failed"));
+}
+
 static int add_submodule_odb(const char *path)
 {
 	struct strbuf objects_directory = STRBUF_INIT;
diff --git a/submodule.h b/submodule.h
index 0c27c53..39c0321 100644
--- a/submodule.h
+++ b/submodule.h
@@ -11,6 +11,8 @@ enum {
 	RECURSE_SUBMODULES_ON = 2
 };

+int update_path_in_gitmodules(const char *oldpath, const char *newpath);
+void stage_updated_gitmodules(void);
 void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
 		const char *path);
 int submodule_config(const char *var, const char *value, void *cb);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index d824464..c144d21 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -304,6 +304,47 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 		cd mod/sub &&
 		git status
 	) &&
+	echo mod/sub >expected &&
+	git config -f .gitmodules submodule.sub.path >actual &&
+	test_cmp expected actual &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
+test_expect_success 'mv does not complain when no .gitmodules file is found' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	git rm .gitmodules &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	git mv sub mod/sub 2>actual.err &&
+	! test -s actual.err &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
+test_expect_success 'mv issues a warning when section is not found in .gitmodules' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	git config -f .gitmodules --remove-section submodule.sub &&
+	git add .gitmodules &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	echo "warning: Could not find section in .gitmodules where path=sub" >expect.err &&
+	git mv sub mod/sub 2>actual.err &&
+	test_i18ncmp expect.err actual.err &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
-- 
1.8.2.377.g1bdb7d0

^ permalink raw reply related	[relevance 9%]

* [PATCH 5/5] submodule: fixup nested submodules after moving the submodule
  @ 2018-03-27 21:39  9% ` Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2018-03-27 21:39 UTC (permalink / raw)
  To: git; +Cc: seanwbehan, bmwill, hvoigt, Stefan Beller

connect_work_tree_and_git_dir is used to connect a submodule worktree with
its git directory and vice versa after events that require a reconnection
such as moving around the working tree. As submodules can have nested
submoduled themselves, we'd also want to fix the nested submodules when
asked to. Add an option to recurse into the nested submodules and connect
them as well.

As submodules are identified by their name (which determines their git
directory in relation to their superprojects git directory) internally
and by their path in the working tree of the superproject, we need to
make sure that the mapping of name <-> path is kept intact. We can do
that in the git-mv command by writing out the gitmodules file and first
and then force a reload of the submodule config machinery.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/mv.c                |  6 ++--
 builtin/submodule--helper.c |  3 +-
 dir.c                       | 70 +++++++++++++++++++++++++++++++++++--
 dir.h                       | 12 ++++++-
 submodule.c                 |  6 ++--
 t/t7001-mv.sh               |  2 +-
 6 files changed, 87 insertions(+), 12 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 6d141f7a53..7a63667d64 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -276,10 +276,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			die_errno(_("renaming '%s' failed"), src);
 		}
 		if (submodule_gitfile[i]) {
-			if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
-				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
 			if (!update_path_in_gitmodules(src, dst))
 				gitmodules_modified = 1;
+			if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
+				connect_work_tree_and_git_dir(dst,
+							      submodule_gitfile[i],
+							      1);
 		}
 
 		if (mode == WORKING_DIRECTORY)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index a921fbbf56..05fd657f99 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1259,8 +1259,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
 		strbuf_reset(&sb);
 	}
 
-	/* Connect module worktree and git dir */
-	connect_work_tree_and_git_dir(path, sm_gitdir);
+	connect_work_tree_and_git_dir(path, sm_gitdir, 0);
 
 	p = git_pathdup_submodule(path, "config");
 	if (!p)
diff --git a/dir.c b/dir.c
index dedbf5d476..313176e291 100644
--- a/dir.c
+++ b/dir.c
@@ -19,6 +19,7 @@
 #include "varint.h"
 #include "ewah/ewok.h"
 #include "fsmonitor.h"
+#include "submodule-config.h"
 
 /*
  * Tells read_directory_recursive how a file or directory should be treated.
@@ -3010,8 +3011,67 @@ void untracked_cache_add_to_index(struct index_state *istate,
 	untracked_cache_invalidate_path(istate, path, 1);
 }
 
-/* Update gitfile and core.worktree setting to connect work tree and git dir */
-void connect_work_tree_and_git_dir(const char *work_tree_, const char *git_dir_)
+static void connect_wt_gitdir_in_nested(const char *sub_worktree,
+					const char *sub_gitdir,
+					struct repository *superproject)
+{
+	int i;
+	struct repository subrepo;
+	struct strbuf sub_wt = STRBUF_INIT;
+	struct strbuf sub_gd = STRBUF_INIT;
+	const struct submodule *sub;
+	const char *super_worktree,
+		   *sub_path; /* path inside the superproject */
+
+	/* subrepo got moved, so superproject has outdated information */
+	submodule_free(superproject);
+
+	super_worktree = real_pathdup(superproject->worktree, 1);
+
+	sub_path = sub_worktree + strlen(super_worktree) + 1;
+
+	if (repo_submodule_init(&subrepo, superproject, sub_path))
+		return;
+
+	repo_read_index(&subrepo);
+
+	for (i = 0; i < subrepo.index->cache_nr; i++) {
+		const struct cache_entry *ce = subrepo.index->cache[i];
+
+		if (!S_ISGITLINK(ce->ce_mode))
+			continue;
+
+		while (i + 1 < subrepo.index->cache_nr &&
+		       !strcmp(ce->name, subrepo.index->cache[i + 1]->name))
+			/*
+			 * Skip entries with the same name in different stages
+			 * to make sure an entry is returned only once.
+			 */
+			i++;
+
+		sub = submodule_from_path(&subrepo, &null_oid, ce->name);
+		if (!sub)
+			/* submodule not checked out? */
+			continue;
+
+		strbuf_reset(&sub_wt);
+		strbuf_addf(&sub_wt, "%s/%s/.git", sub_worktree, sub->path);
+
+		strbuf_reset(&sub_gd);
+		strbuf_addf(&sub_gd, "%s/modules/%s", sub_gitdir, sub->name);
+
+		strbuf_setlen(&sub_wt, sub_wt.len - strlen("/.git"));
+
+		if (is_submodule_active(&subrepo, ce->name)) {
+			connect_work_tree_and_git_dir(sub_wt.buf, sub_gd.buf, 0);
+			connect_wt_gitdir_in_nested(sub_wt.buf, sub_gd.buf, &subrepo);
+		}
+	}
+}
+
+void connect_work_tree_and_git_dir(const char *work_tree_,
+				   const char *git_dir_,
+				   int recurse_into_nested)
 {
 	struct strbuf gitfile_sb = STRBUF_INIT;
 	struct strbuf cfg_sb = STRBUF_INIT;
@@ -3041,6 +3101,10 @@ void connect_work_tree_and_git_dir(const char *work_tree_, const char *git_dir_)
 	strbuf_release(&gitfile_sb);
 	strbuf_release(&cfg_sb);
 	strbuf_release(&rel_path);
+
+	if (recurse_into_nested)
+		connect_wt_gitdir_in_nested(work_tree, git_dir, the_repository);
+
 	free(work_tree);
 	free(git_dir);
 }
@@ -3054,5 +3118,5 @@ void relocate_gitdir(const char *path, const char *old_git_dir, const char *new_
 		die_errno(_("could not migrate git directory from '%s' to '%s'"),
 			old_git_dir, new_git_dir);
 
-	connect_work_tree_and_git_dir(path, new_git_dir);
+	connect_work_tree_and_git_dir(path, new_git_dir, 0);
 }
diff --git a/dir.h b/dir.h
index b0758b82a2..3870193e52 100644
--- a/dir.h
+++ b/dir.h
@@ -359,7 +359,17 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned long
 void write_untracked_extension(struct strbuf *out, struct untracked_cache *untracked);
 void add_untracked_cache(struct index_state *istate);
 void remove_untracked_cache(struct index_state *istate);
-extern void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir);
+
+/*
+ * Connect a worktree to a git directory by creating (or overwriting) a
+ * '.git' file containing the location of the git directory. In the git
+ * directory set the core.worktree setting to indicate where the worktree is.
+ * When `recurse_into_nested` is set, recurse into any nested submodules,
+ * connecting them as well.
+ */
+extern void connect_work_tree_and_git_dir(const char *work_tree,
+					  const char *git_dir,
+					  int recurse_into_nested);
 extern void relocate_gitdir(const char *path,
 			    const char *old_git_dir,
 			    const char *new_git_dir);
diff --git a/submodule.c b/submodule.c
index 89d0aee086..c2dac6c00f 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1624,7 +1624,7 @@ int submodule_move_head(const char *path,
 		} else {
 			char *gitdir = xstrfmt("%s/modules/%s",
 				    get_git_common_dir(), sub->name);
-			connect_work_tree_and_git_dir(path, gitdir);
+			connect_work_tree_and_git_dir(path, gitdir, 0);
 			free(gitdir);
 
 			/* make sure the index is clean as well */
@@ -1634,7 +1634,7 @@ int submodule_move_head(const char *path,
 		if (old_head && (flags & SUBMODULE_MOVE_HEAD_FORCE)) {
 			char *gitdir = xstrfmt("%s/modules/%s",
 				    get_git_common_dir(), sub->name);
-			connect_work_tree_and_git_dir(path, gitdir);
+			connect_work_tree_and_git_dir(path, gitdir, 1);
 			free(gitdir);
 		}
 	}
@@ -1947,7 +1947,7 @@ void absorb_git_dir_into_superproject(const char *prefix,
 		if (!sub)
 			die(_("could not lookup name for submodule '%s'"), path);
 		connect_work_tree_and_git_dir(path,
-			git_path("modules/%s", sub->name));
+			git_path("modules/%s", sub->name), 0);
 	} else {
 		/* Is it already absorbed into the superprojects git dir? */
 		char *real_sub_git_dir = real_pathdup(sub_git_dir, 1);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index d4e6485a26..ff70244620 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -497,7 +497,7 @@ test_expect_success 'moving a submodule in nested directories' '
 	test_cmp expect actual
 '
 
-test_expect_failure 'moving nested submodules' '
+test_expect_success 'moving nested submodules' '
 	git commit -am "cleanup commit" &&
 	mkdir sub_nested_nested &&
 	(cd sub_nested_nested &&
-- 
2.17.0.rc1.321.gba9d0f2565-goog


^ permalink raw reply related	[relevance 9%]

* [PATCH 5/6] submodule: fixup nested submodules after moving the submodule
  @ 2018-03-28 17:24  9%   ` Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2018-03-28 17:24 UTC (permalink / raw)
  To: sbeller, gitster; +Cc: bmwill, git, hvoigt, jonathantanmy, seanwbehan

connect_work_tree_and_git_dir is used to connect a submodule worktree with
its git directory and vice versa after events that require a reconnection
such as moving around the working tree. As submodules can have nested
submodules themselves, we'd also want to fix the nested submodules when
asked to. Add an option to recurse into the nested submodules and connect
them as well.

As submodules are identified by their name (which determines their git
directory in relation to their superproject's git directory) internally
and by their path in the working tree of the superproject, we need to
make sure that the mapping of name <-> path is kept intact. We can do
that in the git-mv command by writing out the gitmodules file first
and then forcing a reload of the submodule config machinery.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/mv.c                |  6 ++--
 builtin/submodule--helper.c |  3 +-
 dir.c                       | 63 +++++++++++++++++++++++++++++++++++--
 dir.h                       | 12 ++++++-
 submodule.c                 |  6 ++--
 t/t7001-mv.sh               |  2 +-
 6 files changed, 80 insertions(+), 12 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 6d141f7a53..7a63667d64 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -276,10 +276,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			die_errno(_("renaming '%s' failed"), src);
 		}
 		if (submodule_gitfile[i]) {
-			if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
-				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
 			if (!update_path_in_gitmodules(src, dst))
 				gitmodules_modified = 1;
+			if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
+				connect_work_tree_and_git_dir(dst,
+							      submodule_gitfile[i],
+							      1);
 		}
 
 		if (mode == WORKING_DIRECTORY)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index a921fbbf56..05fd657f99 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1259,8 +1259,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
 		strbuf_reset(&sb);
 	}
 
-	/* Connect module worktree and git dir */
-	connect_work_tree_and_git_dir(path, sm_gitdir);
+	connect_work_tree_and_git_dir(path, sm_gitdir, 0);
 
 	p = git_pathdup_submodule(path, "config");
 	if (!p)
diff --git a/dir.c b/dir.c
index dedbf5d476..71947c0ef3 100644
--- a/dir.c
+++ b/dir.c
@@ -19,6 +19,7 @@
 #include "varint.h"
 #include "ewah/ewok.h"
 #include "fsmonitor.h"
+#include "submodule-config.h"
 
 /*
  * Tells read_directory_recursive how a file or directory should be treated.
@@ -3010,8 +3011,60 @@ void untracked_cache_add_to_index(struct index_state *istate,
 	untracked_cache_invalidate_path(istate, path, 1);
 }
 
-/* Update gitfile and core.worktree setting to connect work tree and git dir */
-void connect_work_tree_and_git_dir(const char *work_tree_, const char *git_dir_)
+static void connect_wt_gitdir_in_nested(const char *sub_worktree,
+					const char *sub_gitdir)
+{
+	int i;
+	struct repository subrepo;
+	struct strbuf sub_wt = STRBUF_INIT;
+	struct strbuf sub_gd = STRBUF_INIT;
+
+	const struct submodule *sub;
+
+	if (repo_init(&subrepo, sub_gitdir, sub_worktree))
+		return;
+
+	if (repo_read_index(&subrepo) < 0)
+		die("index file corrupt in repo %s", subrepo.gitdir);
+
+	for (i = 0; i < subrepo.index->cache_nr; i++) {
+		const struct cache_entry *ce = subrepo.index->cache[i];
+
+		if (!S_ISGITLINK(ce->ce_mode))
+			continue;
+
+		while (i + 1 < subrepo.index->cache_nr &&
+		       !strcmp(ce->name, subrepo.index->cache[i + 1]->name))
+			/*
+			 * Skip entries with the same name in different stages
+			 * to make sure an entry is returned only once.
+			 */
+			i++;
+
+		sub = submodule_from_path(&subrepo, &null_oid, ce->name);
+		if (!sub)
+			/* submodule not checked out? */
+			continue;
+
+		if (is_submodule_active(&subrepo, ce->name)) {
+			strbuf_addf(&sub_wt, "%s/%s", sub_worktree, sub->path);
+			strbuf_addf(&sub_gd, "%s/modules/%s", sub_gitdir, sub->name);
+
+			connect_work_tree_and_git_dir(sub_wt.buf, sub_gd.buf, 0);
+			connect_wt_gitdir_in_nested(sub_wt.buf, sub_gd.buf);
+
+			strbuf_reset(&sub_wt);
+			strbuf_reset(&sub_gd);
+		}
+	}
+	strbuf_release(&sub_wt);
+	strbuf_release(&sub_gd);
+	repo_clear(&subrepo);
+}
+
+void connect_work_tree_and_git_dir(const char *work_tree_,
+				   const char *git_dir_,
+				   int recurse_into_nested)
 {
 	struct strbuf gitfile_sb = STRBUF_INIT;
 	struct strbuf cfg_sb = STRBUF_INIT;
@@ -3041,6 +3094,10 @@ void connect_work_tree_and_git_dir(const char *work_tree_, const char *git_dir_)
 	strbuf_release(&gitfile_sb);
 	strbuf_release(&cfg_sb);
 	strbuf_release(&rel_path);
+
+	if (recurse_into_nested)
+		connect_wt_gitdir_in_nested(work_tree, git_dir);
+
 	free(work_tree);
 	free(git_dir);
 }
@@ -3054,5 +3111,5 @@ void relocate_gitdir(const char *path, const char *old_git_dir, const char *new_
 		die_errno(_("could not migrate git directory from '%s' to '%s'"),
 			old_git_dir, new_git_dir);
 
-	connect_work_tree_and_git_dir(path, new_git_dir);
+	connect_work_tree_and_git_dir(path, new_git_dir, 0);
 }
diff --git a/dir.h b/dir.h
index b0758b82a2..3870193e52 100644
--- a/dir.h
+++ b/dir.h
@@ -359,7 +359,17 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned long
 void write_untracked_extension(struct strbuf *out, struct untracked_cache *untracked);
 void add_untracked_cache(struct index_state *istate);
 void remove_untracked_cache(struct index_state *istate);
-extern void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir);
+
+/*
+ * Connect a worktree to a git directory by creating (or overwriting) a
+ * '.git' file containing the location of the git directory. In the git
+ * directory set the core.worktree setting to indicate where the worktree is.
+ * When `recurse_into_nested` is set, recurse into any nested submodules,
+ * connecting them as well.
+ */
+extern void connect_work_tree_and_git_dir(const char *work_tree,
+					  const char *git_dir,
+					  int recurse_into_nested);
 extern void relocate_gitdir(const char *path,
 			    const char *old_git_dir,
 			    const char *new_git_dir);
diff --git a/submodule.c b/submodule.c
index 89d0aee086..c2dac6c00f 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1624,7 +1624,7 @@ int submodule_move_head(const char *path,
 		} else {
 			char *gitdir = xstrfmt("%s/modules/%s",
 				    get_git_common_dir(), sub->name);
-			connect_work_tree_and_git_dir(path, gitdir);
+			connect_work_tree_and_git_dir(path, gitdir, 0);
 			free(gitdir);
 
 			/* make sure the index is clean as well */
@@ -1634,7 +1634,7 @@ int submodule_move_head(const char *path,
 		if (old_head && (flags & SUBMODULE_MOVE_HEAD_FORCE)) {
 			char *gitdir = xstrfmt("%s/modules/%s",
 				    get_git_common_dir(), sub->name);
-			connect_work_tree_and_git_dir(path, gitdir);
+			connect_work_tree_and_git_dir(path, gitdir, 1);
 			free(gitdir);
 		}
 	}
@@ -1947,7 +1947,7 @@ void absorb_git_dir_into_superproject(const char *prefix,
 		if (!sub)
 			die(_("could not lookup name for submodule '%s'"), path);
 		connect_work_tree_and_git_dir(path,
-			git_path("modules/%s", sub->name));
+			git_path("modules/%s", sub->name), 0);
 	} else {
 		/* Is it already absorbed into the superprojects git dir? */
 		char *real_sub_git_dir = real_pathdup(sub_git_dir, 1);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index d4e6485a26..ff70244620 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -497,7 +497,7 @@ test_expect_success 'moving a submodule in nested directories' '
 	test_cmp expect actual
 '
 
-test_expect_failure 'moving nested submodules' '
+test_expect_success 'moving nested submodules' '
 	git commit -am "cleanup commit" &&
 	mkdir sub_nested_nested &&
 	(cd sub_nested_nested &&
-- 
2.17.0.rc1.321.gba9d0f2565-goog


^ permalink raw reply related	[relevance 9%]

* [PATCH] Allow git mv FILENAME Filename when core.ignorecase = true
@ 2011-04-10  5:50  9% Torsten Bögershausen
  0 siblings, 0 replies; 200+ results
From: Torsten Bögershausen @ 2011-04-10  5:50 UTC (permalink / raw)
  To: git; +Cc: tboegi

Motivation:
The typical use case is when a file named "FILENAME" should be
renamed into "Filename" and we are on a case ignoring file system
(core.ignorecase = true).

Using "mv FILENAME Filename" outside git succeeds,
(on Windows and MAC OS X, under Linux the mv command rejects
"mv: `Filename' and `FILENAME' are the same file").

"git mv FILENAME Filename" is refused, "fatal: destination exists",
unless "git mv --forced FILENAME Filename" is used.
The underlying file system makes git think that the
destination "Filename" exists.

The following discussion assumes, that we are on a
"case ignoring" file system, and core.ignorecase = true.

This change allows "git mv FILENAME Filename".
Using non ASCII works as well, like "git mv MÄRCHEN Märchen".
The ambition is that "git mv FILENAME Filename" changes both
the git index and the filename in the working tree,
in the same way how "git mv Filename NewFile" works.
Note: Under Linux+vfat The rename() function does not the rename
in the working directory.

Implementation details:
A possible approach to allow the "git mv FILENAME Filename"
is to compare both file names using strcasecmp().

This works for filenames where all characters are ASCII,
It will fail for "git mv MÄRCHEN Märchen".

Git has now idea about the encoding of filenames
(like UTF-8, ISO-8859-1 or any other).
Neither has strcasecmp() an idea how to handle non ASCII characters.

With this patch git lets the underlying file system decide
if 2 file names refer to the same file.

Remember that the file system does this already, by returning the
same values for lstat("FILENAME") and lstat("Filename").

By comparing all members in "struct stat" we can be sure that
both filenames point out the same file.
This is done in the function "equivalent_filenames()".

As lstat() on Windows (mingw.c or cygwin.c) sets st_ino to 0,
(and st_dev and other fields in struct stat)
we need other checks when running under Windows.

Therefore a different implementation of equivalent_filenames() is used
under Windows.
It uses GetFileInformationByHandle() to get and compare
dwVolumeSerialNumber, nFileIndexLow and nFileIndexHigh.
It uses even lstat(), since Windows reports the same nFileIndexLow/High for
a file and a softlink (under cygwin) pointing to it.

To summarize:
equivalent_filenames() is OS specific and checks under Windows:
dwVolumeSerialNumber, nFileIndexLow/High, st_mode, st_size,
st_atime and st_mtime.
All other OS check
st_mode, st_dev, st_ino, st_uid, st_gid, st_size, st_atime, st_mtime.

As a bonus (or regression), a file name can be renamed to a file name
which is already hard-linked to the same inode.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 builtin/mv.c      |   10 +++++++-
 compat/cygwin.c   |   44 ++++++++++++++++++++++++++++++++++++++++
 compat/cygwin.h   |    3 ++
 compat/mingw.c    |   33 ++++++++++++++++++++++++++++++
 compat/mingw.h    |    3 ++
 git-compat-util.h |   17 +++++++++++++++
 t/t7001-mv.sh     |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 t/test-lib.sh     |    4 +++
 8 files changed, 169 insertions(+), 2 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 40f33ca..7be7d8a 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -165,14 +165,20 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		} else if (cache_name_pos(src, length) < 0)
 			bad = _("not under version control");
 		else if (lstat(dst, &st) == 0) {
+			int allow_force = force;
 			bad = _("destination exists");
-			if (force) {
+			if (!force && ignore_case && equivalent_filenames(src, dst)) {
+				allow_force = 1;
+				bad = NULL;
+			}
+			if (allow_force) {
 				/*
 				 * only files can overwrite each other:
 				 * check both source and destination
 				 */
 				if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
-					warning(_("%s; will overwrite!"), bad);
+					if (bad)
+						warning(_("%s; will overwrite!"), bad);
 					bad = NULL;
 				} else
 					bad = _("Cannot overwrite");
diff --git a/compat/cygwin.c b/compat/cygwin.c
index b4a51b9..4fdd94a 100644
--- a/compat/cygwin.c
+++ b/compat/cygwin.c
@@ -1,6 +1,7 @@
 #define WIN32_LEAN_AND_MEAN
 #include "../git-compat-util.h"
 #include "win32.h"
+#include <io.h>
 #include "../cache.h" /* to read configuration */
 
 static inline void filetime_to_timespec(const FILETIME *ft, struct timespec *ts)
@@ -85,6 +86,49 @@ static int cygwin_stat(const char *path, struct stat *buf)
 	return do_stat(path, buf, stat);
 }
 
+int cygwin_equivalent_filenames(const char *a, const char *b)
+{
+	int fd;
+	BY_HANDLE_FILE_INFORMATION hia, hib;
+	HANDLE h;
+	struct stat st_a, st_b;
+
+	if (lstat(a, &st_a) || lstat(b, &st_b))
+		return 0;
+
+	fd = open(a, O_RDONLY);
+	if (-1 == fd)
+		return 0;
+
+	h = (HANDLE)get_osfhandle(fd);
+	if (INVALID_HANDLE_VALUE == h)
+		return 0;
+
+	if (!(GetFileInformationByHandle(h,&hia)))
+		return 0;
+	CloseHandle(h);
+	close(fd);
+
+	fd = open(b, O_RDONLY);
+	if (-1 == fd)
+		return 0;
+
+	h = (HANDLE)get_osfhandle(fd);
+	if (INVALID_HANDLE_VALUE == h)
+		return 0;
+	if (!(GetFileInformationByHandle(h,&hib)))
+		return 0;
+	CloseHandle(h);
+	close(fd);
+
+	return st_a.st_mode == st_b.st_mode &&
+	       st_a.st_size == st_b.st_size &&
+	       st_a.st_atime == st_b.st_atime &&
+	       st_a.st_mtime == st_b.st_mtime &&
+	       hia.dwVolumeSerialNumber == hib.dwVolumeSerialNumber &&
+	       hia.nFileIndexLow == hib.nFileIndexLow &&
+	       hia.nFileIndexHigh == hib.nFileIndexHigh;
+}
 
 /*
  * At start up, we are trying to determine whether Win32 API or cygwin stat
diff --git a/compat/cygwin.h b/compat/cygwin.h
index a3229f5..04cc17e 100644
--- a/compat/cygwin.h
+++ b/compat/cygwin.h
@@ -7,3 +7,6 @@ extern stat_fn_t cygwin_lstat_fn;
 
 #define stat(path, buf) (*cygwin_stat_fn)(path, buf)
 #define lstat(path, buf) (*cygwin_lstat_fn)(path, buf)
+
+int cygwin_equivalent_filenames(const char *a, const char *b);
+#define equivalent_filenames cygwin_equivalent_filenames
diff --git a/compat/mingw.c b/compat/mingw.c
index 878b1de..56be81a 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -474,6 +474,39 @@ int mingw_fstat(int fd, struct stat *buf)
 	return -1;
 }
 
+int mingw_equivalent_filenames(const char *a, const char *b)
+{
+	BY_HANDLE_FILE_INFORMATION hia, hib;
+	HANDLE h;
+	struct stat st_a, st_b;
+
+	if (lstat(a, &st_a) || lstat(b, &st_b))
+		return 0;
+
+	h = CreateFile(a, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+	if (INVALID_HANDLE_VALUE == h)
+		return 0;
+
+	if (!(GetFileInformationByHandle(h,&hia)))
+		return 0;
+	CloseHandle(h);
+
+	h = CreateFile(b, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+	if (INVALID_HANDLE_VALUE == h)
+		return 0;
+	if (!(GetFileInformationByHandle(h,&hib)))
+		return 0;
+	CloseHandle(h);
+
+	return st_a.st_mode == st_b.st_mode &&
+	       st_a.st_size == st_b.st_size &&
+	       st_a.st_atime == st_b.st_atime &&
+	       st_a.st_mtime == st_b.st_mtime &&
+	       hia.dwVolumeSerialNumber == hib.dwVolumeSerialNumber &&
+	       hia.nFileIndexLow == hib.nFileIndexLow &&
+	       hia.nFileIndexHigh == hib.nFileIndexHigh;
+}
+
 static inline void time_t_to_filetime(time_t t, FILETIME *ft)
 {
 	long long winTime = t * 10000000LL + 116444736000000000LL;
diff --git a/compat/mingw.h b/compat/mingw.h
index 62eccd3..3445104 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -303,6 +303,9 @@ int winansi_fprintf(FILE *stream, const char *format, ...) __attribute__((format
 void mingw_open_html(const char *path);
 #define open_html mingw_open_html
 
+int mingw_equivalent_filenames(const char *a, const char *b);
+#define equivalent_filenames mingw_equivalent_filenames
+
 /*
  * helpers
  */
diff --git a/git-compat-util.h b/git-compat-util.h
index 40498b3..d66cffe 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -567,4 +567,21 @@ int rmdir_or_warn(const char *path);
  */
 int remove_or_warn(unsigned int mode, const char *path);
 
+#ifndef equivalent_filenames
+static inline int equivalent_filenames(const char *a, const char *b) {
+	struct stat st_a, st_b;
+	if (lstat(a, &st_a) || lstat(b, &st_b))
+		return 0;
+
+	return st_a.st_mode == st_b.st_mode &&
+	       st_a.st_dev == st_b.st_dev &&
+	       st_a.st_ino == st_b.st_ino &&
+	       st_a.st_uid == st_b.st_uid &&
+	       st_a.st_gid == st_b.st_gid &&
+	       st_a.st_size == st_b.st_size &&
+	       st_a.st_atime == st_b.st_atime &&
+	       st_a.st_mtime == st_b.st_mtime;
+}
+#endif
+
 #endif
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index a845b15..0c4b96a 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -255,4 +255,61 @@ test_expect_success SYMLINKS 'git mv should overwrite file with a symlink' '
 
 rm -f moved symlink
 
+unset encoding
+ae_upper_asc=AE
+ae_lower_asc=ae
+ae_upper_utf8=$(printf '\303\206')
+ae_lower_utf8=$(printf '\303\246')
+
+for enc in utf8 asc ; do
+	eval ae_lower=\$ae_lower_$enc
+	eval ae_upper=\$ae_upper_$enc
+	if (>./$ae_lower && echo broken > ./$ae_upper && test x"$(cat $ae_lower)" = xbroken ) 2>/dev/null ; then
+		if err=$(mv $ae_lower $ae_upper 2>&1); then
+			unset err
+			encoding=$enc
+			break
+		fi
+	else
+		err="case sensitive file system"
+	fi
+done
+
+if test -n "$encoding"; then
+	test_expect_success "git mv AE ae $encoding" '
+		rm -fr .git * &&
+		git init &&
+		echo $encoding > $ae_upper &&
+		git add $ae_upper &&
+		git commit -m "add AE" &&
+		git mv $ae_upper $ae_lower &&
+		git commit -m "mv AE ae" &&
+		rm -f $ae_upper $ae_lower &&
+		git reset --hard &&
+		test "$(echo *)" = $ae_lower
+	'
+else
+	say "Skipping 'git mv AE ae' $err ($enc)"
+fi
+
+test_expect_success HARDLINKS 'git mv FILE File HARDLINKED' '
+	rm -fr .git * &&
+	git init &&
+	git config core.ignorecase true &&
+	echo FILE > FILE &&
+	git add FILE &&
+	git commit -m add FILE &&
+	{
+		if ! test -f File; then
+			ln FILE File
+		fi
+	} &&
+	git mv FILE File &&
+	git commit -m "mv FILE File" &&
+	rm -f FILE File &&
+	git reset --hard &&
+	test "$(echo *)" = File
+'
+
+
 test_done
diff --git a/t/test-lib.sh b/t/test-lib.sh
index abc47f3..8c71583 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1080,6 +1080,10 @@ fi
 # test whether the filesystem supports symbolic links
 ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
 rm -f y
+# test whether the filesystem supports hard links
+>x
+ln x y 2>/dev/null && test -f y 2>/dev/null && test_set_prereq HARDLINKS
+rm -f x y
 
 # When the tests are run as root, permission tests will report that
 # things are writable when they shouldn't be.
-- 
1.7.4.3

^ permalink raw reply related	[relevance 9%]

* [PATCH v3 2/5] Teach mv to move submodules using a gitfile
  2013-07-30 19:48  6% [PATCH v3 0/5] Teach mv to move submodules Jens Lehmann
  2013-07-30 19:49 10% ` [PATCH v3 1/5] Teach mv to move submodules together with their work trees Jens Lehmann
@ 2013-07-30 19:50  9% ` Jens Lehmann
  2013-07-30 19:51  8% ` [PATCH v3 4/5] Teach mv to update the path entry in .gitmodules for moved submodules Jens Lehmann
  2 siblings, 0 replies; 200+ results
From: Jens Lehmann @ 2013-07-30 19:50 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Heiko Voigt, Nguyen Thai Ngoc Duy

When moving a submodule which uses a gitfile to point to the git directory
stored in .git/modules/<name> of the superproject two changes must be made
to make the submodule work: the .git file and the core.worktree setting
must be adjusted to point from work tree to git directory and back.

Achieve that by remembering which submodule uses a gitfile by storing the
result of read_gitfile() of each submodule. If that is not NULL the new
function connect_work_tree_and_git_dir() is called after renaming the
submodule's work tree which updates the two settings to the new values.

Extend the man page to inform the user about that feature (and while at it
change the description to not talk about a script anymore, as mv is a
builtin for quite some time now).

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
 Documentation/git-mv.txt |  8 +++++++-
 builtin/mv.c             | 19 +++++++++++++++----
 submodule.c              | 31 +++++++++++++++++++++++++++++++
 submodule.h              |  1 +
 t/t7001-mv.sh            | 19 +++++++++++++++++++
 5 files changed, 73 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt
index e93fcb4..1f6fce0 100644
--- a/Documentation/git-mv.txt
+++ b/Documentation/git-mv.txt
@@ -13,7 +13,7 @@ SYNOPSIS

 DESCRIPTION
 -----------
-This script is used to move or rename a file, directory or symlink.
+Move or rename a file, directory or symlink.

  git mv [-v] [-f] [-n] [-k] <source> <destination>
  git mv [-v] [-f] [-n] [-k] <source> ... <destination directory>
@@ -44,6 +44,12 @@ OPTIONS
 --verbose::
 	Report the names of files as they are moved.

+SUBMODULES
+----------
+Moving a submodule using a gitfile (which means they were cloned
+with a Git version 1.7.8 or newer) will update the gitfile and
+core.worktree setting to make the submodule work in the new location.
+
 GIT
 ---
 Part of the linkgit:git[1] suite
diff --git a/builtin/mv.c b/builtin/mv.c
index 1d3ef63..68b7060 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -9,6 +9,7 @@
 #include "cache-tree.h"
 #include "string-list.h"
 #include "parse-options.h"
+#include "submodule.h"

 static const char * const builtin_mv_usage[] = {
 	N_("git mv [options] <source>... <destination>"),
@@ -66,7 +67,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		OPT_BOOLEAN('k', NULL, &ignore_errors, N_("skip move/rename errors")),
 		OPT_END(),
 	};
-	const char **source, **destination, **dest_path;
+	const char **source, **destination, **dest_path, **submodule_gitfile;
 	enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
 	struct stat st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
@@ -85,6 +86,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	source = internal_copy_pathspec(prefix, argv, argc, 0);
 	modes = xcalloc(argc, sizeof(enum update_mode));
 	dest_path = internal_copy_pathspec(prefix, argv + argc, 1, 0);
+	submodule_gitfile = xcalloc(argc, sizeof(char *));

 	if (dest_path[0][0] == '\0')
 		/* special case: "." was normalized to "" */
@@ -120,8 +122,14 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		else if (src_is_dir) {
 			int first = cache_name_pos(src, length);
 			if (first >= 0) {
+				struct strbuf submodule_dotgit = STRBUF_INIT;
 				if (!S_ISGITLINK(active_cache[first]->ce_mode))
 					die (_("Huh? Directory %s is in index and no submodule?"), src);
+				strbuf_addf(&submodule_dotgit, "%s/.git", src);
+				submodule_gitfile[i] = read_gitfile(submodule_dotgit.buf);
+				if (submodule_gitfile[i])
+					submodule_gitfile[i] = xstrdup(submodule_gitfile[i]);
+				strbuf_release(&submodule_dotgit);
 			} else {
 				const char *src_w_slash = add_slash(src);
 				int last, len_w_slash = length + 1;
@@ -216,9 +224,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		int pos;
 		if (show_only || verbose)
 			printf(_("Renaming %s to %s\n"), src, dst);
-		if (!show_only && mode != INDEX &&
-				rename(src, dst) < 0 && !ignore_errors)
-			die_errno (_("renaming '%s' failed"), src);
+		if (!show_only && mode != INDEX) {
+			if (rename(src, dst) < 0 && !ignore_errors)
+				die_errno (_("renaming '%s' failed"), src);
+			if (submodule_gitfile[i])
+				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
+		}

 		if (mode == WORKING_DIRECTORY)
 			continue;
diff --git a/submodule.c b/submodule.c
index 3f0a3f9..d96d187 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1004,3 +1004,34 @@ int merge_submodule(unsigned char result[20], const char *path,
 	free(merges.objects);
 	return 0;
 }
+
+/* Update gitfile and core.worktree setting to connect work tree and git dir */
+void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir)
+{
+	struct strbuf file_name = STRBUF_INIT;
+	struct strbuf rel_path = STRBUF_INIT;
+	const char *real_work_tree = xstrdup(real_path(work_tree));
+	FILE *fp;
+
+	/* Update gitfile */
+	strbuf_addf(&file_name, "%s/.git", work_tree);
+	fp = fopen(file_name.buf, "w");
+	if (!fp)
+		die(_("Could not create git link %s"), file_name.buf);
+	fprintf(fp, "gitdir: %s\n", relative_path(git_dir, real_work_tree,
+						  &rel_path));
+	fclose(fp);
+
+	/* Update core.worktree setting */
+	strbuf_reset(&file_name);
+	strbuf_addf(&file_name, "%s/config", git_dir);
+	if (git_config_set_in_file(file_name.buf, "core.worktree",
+				   relative_path(real_work_tree, git_dir,
+						 &rel_path)))
+		die(_("Could not set core.worktree in %s"),
+		    file_name.buf);
+
+	strbuf_release(&file_name);
+	strbuf_release(&rel_path);
+	free((void *)real_work_tree);
+}
diff --git a/submodule.h b/submodule.h
index c7ffc7c..29e9658 100644
--- a/submodule.h
+++ b/submodule.h
@@ -36,5 +36,6 @@ int merge_submodule(unsigned char result[20], const char *path, const unsigned c
 int find_unpushed_submodules(unsigned char new_sha1[20], const char *remotes_name,
 		struct string_list *needs_pushing);
 int push_unpushed_submodules(unsigned char new_sha1[20], const char *remotes_name);
+void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir);

 #endif
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 15c18b6..b99177f 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -293,4 +293,23 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	git diff-files --quiet
 '

+test_expect_success 'git mv moves a submodule with gitfile' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	(
+		cd mod &&
+		git mv ../sub/ .
+	) &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
 test_done
-- 
1.8.4.rc0.199.g7079aac

^ permalink raw reply related	[relevance 9%]

* [PATCH] Handle rename of case only, for Windows
@ 2011-01-29 23:45  9% Tim Abell
  0 siblings, 0 replies; 200+ results
From: Tim Abell @ 2011-01-29 23:45 UTC (permalink / raw)
  To: git; +Cc: Erik Faye-Lund, Nguyen Thai Ngoc Duy, msysGit

>From ddab003ede9f25d93f4e7eea833523a0aa29d16d Mon Sep 17 00:00:00 2001
From: Tim Abell <tim@timwise.co.uk>
Date: Thu, 27 Jan 2011 22:53:31 +0000
Subject: [PATCH] Handle rename of case only, for Windows

Added test to show rename failing in windows.
Added test to show that this patch doesn't break protection against overwriting
an existing file, and another to show that "mv --force" still works.

Altered mv.c to check whether the source and destination file are actually
the same file based on inode number before failing.
If the inode is zero then the data is no use so old behaviour is maintained.

A message from Linus on the subject:
 http://kerneltrap.org/mailarchive/git/2008/3/21/1220814
 (apparently he never got the energy :-)

Signed-off-by: Tim Abell <tim@timwise.co.uk>
---

Hi folks, this is my second attempt at providing a useful patch for this issue.
Thanks for all the great feedback from my first attempt. I've attempted to address the problems raised.

Hopefully my commit message is more like what is needed this time.
I hadn't realised before that you can split the commit message from this bit with the "---".

>Hmm, not so good. st_ino is always 0 on Windows, so this would make
>false positives, no?

I tested this on windows 7 under cygwin (which is what I have available) and st_ino reports real numbers for me, I also tested that attempting to overwrite another file without --force still fails and added a new test case for this scenario. I have now made sure that if zero is returned then git won't accidentally overwrite other files as I hadn't thought of this before. So this patch shouldn't be regressive even if other versions of windows or other filesystems don't provide valid inode data.

Adding the following line after "lstat(src, &src_st);" shows the inode numbers when calling git mv:
 printf("src inode: %lu, dst inode: %lu", (unsigned long) src_st.st_ino, (unsigned long) st.st_ino);
And here is my ouput showing it in action:

$ git mv foo.txt bar.txt
  fatal: destination exists, source=foo.txt, destination=bar.txt
  src inode: 67064, dst inode: 229369
$ git mv foo.txt Foo.txt
  src inode: 67064, dst inode: 67064

>I wonder if we can make lstat_case() that would only return 0 if it
>matches exactly the filename, even on FAT. FindFirstFile/FindNextFile
>should return true file name, I think. If not, we can make
>lstat_case() take two paths (src and dst) and move all inode
>comparison code in there. Much cleaner.

I'm afraid this is a bit beyond me at the moment, but I'm fairly happy with the solution I have. Thanks for the feedback though.

>Couldn't this be moved inside the scope around "cache_name_pos"?
>That's the only scope it is valid inside anyway...

Done. I wasn't sure about this initially as I'm not very experienced with C programming. Thanks for the pointer.

>Perhaps you could use the full URL (and maybe put it in the commit
>message insted)? It'd be nice if we could reach this information even
>if is.gd disappears...

Good point. I've put the full url in the commit message instead.

>Uhm, is this debug-leftovers? #warning is a preprocessor-construct,
>and it can't understand varaibles in c. Especially not formatted as
>strings. Can #warning even do varags? :P

Yes, it was a debug line. Doh! Complete chance that it compiled, I've been doing too much bash scripting recently it seems. I've stripped it out. A better version is available above should anyone want to see the inode numbers.

Thanks all, I welcome any more feedback.

Does this now look like something that anyone on the git project would like to pick up as a contribution?

Yours

Tim Abell


 builtin/mv.c  |   32 +++++++++++++++++++++-----------
 t/t7001-mv.sh |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index cdbb094..c2f726a 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -165,17 +165,27 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		} else if (cache_name_pos(src, length) < 0)
 			bad = "not under version control";
 		else if (lstat(dst, &st) == 0) {
-			bad = "destination exists";
-			if (force) {
-				/*
-				 * only files can overwrite each other:
-				 * check both source and destination
-				 */
-				if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
-					warning("%s; will overwrite!", bad);
-					bad = NULL;
-				} else
-					bad = "Cannot overwrite";
+			/* If we are on a case insensitive file system (windows) and we are only
+			 * changing the case of the file then lstat for the destination will
+			 * return != 0 because it sees the source file.
+			 * To prevent this causing failure, lstat is used to get the inode of the src
+			 * and see if it's actually the same file as dst. If the inode == 0 then
+			 * we can't tell whether it is the same file so we fail regardless. */
+			struct stat src_st;
+			lstat(src, &src_st);
+			if (src_st.st_ino == 0 || src_st.st_ino != st.st_ino) {
+				bad = "destination exists";
+				if (force) {
+					/*
+					 * only files can overwrite each other:
+					 * check both source and destination
+					 */
+					if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
+						warning("%s; will overwrite!", bad);
+						bad = NULL;
+					} else
+						bad = "Cannot overwrite";
+				}
 			}
 		} else if (string_list_has_string(&src_for_dst, dst))
 			bad = "multiple sources for the same target";
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 65a35d9..abaecb6 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -255,4 +255,39 @@ test_expect_success SYMLINKS 'git mv should overwrite file with a symlink' '
 
 rm -f moved symlink
 
+test_expect_success 'git mv should not fail when only changing case' '
+
+	rm -fr .git &&
+	git init &&
+	>foo.txt &&
+	git add foo.txt &&
+	git mv foo.txt Foo.txt
+'
+
+rm *.txt
+
+test_expect_success 'git mv should not overwrite existing file' '
+
+	rm -fr .git &&
+	git init &&
+	>foo.txt &&
+	>bar.txt &&
+	git add foo.txt &&
+	test_must_fail git mv foo.txt bar.txt
+'
+
+rm *.txt
+
+test_expect_success 'git mv -f should overwrite existing file' '
+
+	rm -fr .git &&
+	git init &&
+	>foo.txt &&
+	>bar.txt &&
+	git add foo.txt &&
+	git mv -f foo.txt bar.txt
+'
+
+rm *.txt
+
 test_done
-- 
1.7.3.5.3.g2b35a

^ permalink raw reply related	[relevance 9%]

* [PATCH v2 2/3] Teach mv to move submodules using a gitfile
  @ 2013-04-10 21:06  9%       ` Jens Lehmann
  0 siblings, 0 replies; 200+ results
From: Jens Lehmann @ 2013-04-10 21:06 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git Mailing List, Phil Hord, Heiko Voigt, W. Trevor King,
	Peter Collingbourne

When moving a submodule which uses a gitfile to point to the git directory
stored in .git/modules/<name> of the superproject two changes must be made
to make the submodule work: the .git file and the core.worktree setting
must be adjusted to point from work tree to git directory and back.

Achieve that by remembering which submodule uses a gitfile by storing the
result of read_gitfile() of each submodule. If that is not NULL the new
function connect_work_tree_and_git_dir() is called after renaming the
submodule's work tree which updates the two settings to the new values.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---

Am 10.04.2013 18:59, schrieb Jens Lehmann:
> Am 10.04.2013 01:08, schrieb Junio C Hamano:
>> Jens Lehmann <Jens.Lehmann@web.de> writes:
>>
>>> diff --git a/submodule.c b/submodule.c
>>> index 975bc87..eba9b42 100644
>>> --- a/submodule.c
>>> +++ b/submodule.c
>>> @@ -1001,3 +1001,67 @@ int merge_submodule(unsigned char result[20], const char *path,
>>> ...
>>> +	if (!fp)
>>> +		die(_("Could not create git link %s"), gitfile_name.buf);
>>> +	fprintf(fp, gitfile_content.buf);
>>
>> Perhaps.
>>
>> 	fprintf(fp, "%s", gitfile_content.buf);
> 
> Sure. Will fix in v2.

Here we go.


 builtin/mv.c  | 19 ++++++++++++++----
 submodule.c   | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 submodule.h   |  1 +
 t/t7001-mv.sh | 19 ++++++++++++++++++
 4 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 361028d..609bbb8 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -9,6 +9,7 @@
 #include "cache-tree.h"
 #include "string-list.h"
 #include "parse-options.h"
+#include "submodule.h"

 static const char * const builtin_mv_usage[] = {
 	N_("git mv [options] <source>... <destination>"),
@@ -65,7 +66,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		OPT_BOOLEAN('k', NULL, &ignore_errors, N_("skip move/rename errors")),
 		OPT_END(),
 	};
-	const char **source, **destination, **dest_path;
+	const char **source, **destination, **dest_path, **submodule_gitfile;
 	enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
 	struct stat st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
@@ -84,6 +85,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	source = copy_pathspec(prefix, argv, argc, 0);
 	modes = xcalloc(argc, sizeof(enum update_mode));
 	dest_path = copy_pathspec(prefix, argv + argc, 1, 0);
+	submodule_gitfile = xcalloc(argc, sizeof(char *));

 	if (dest_path[0][0] == '\0')
 		/* special case: "." was normalized to "" */
@@ -119,8 +121,14 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		else if (src_is_dir) {
 			int first = cache_name_pos(src, length);
 			if (first >= 0) {
+				struct strbuf submodule_dotgit = STRBUF_INIT;
 				if (!S_ISGITLINK(active_cache[first]->ce_mode))
 					die (_("Huh? Directory %s is in index and no submodule?"), src);
+				strbuf_addf(&submodule_dotgit, "%s/.git", src);
+				submodule_gitfile[i] = read_gitfile(submodule_dotgit.buf);
+				if (submodule_gitfile[i])
+					submodule_gitfile[i] = xstrdup(submodule_gitfile[i]);
+				strbuf_release(&submodule_dotgit);
 			} else {
 				const char *src_w_slash = add_slash(src);
 				int last, len_w_slash = length + 1;
@@ -215,9 +223,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		int pos;
 		if (show_only || verbose)
 			printf(_("Renaming %s to %s\n"), src, dst);
-		if (!show_only && mode != INDEX &&
-				rename(src, dst) < 0 && !ignore_errors)
-			die_errno (_("renaming '%s' failed"), src);
+		if (!show_only && mode != INDEX) {
+			if (rename(src, dst) < 0 && !ignore_errors)
+				die_errno (_("renaming '%s' failed"), src);
+			if (submodule_gitfile[i])
+				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
+		}

 		if (mode == WORKING_DIRECTORY)
 			continue;
diff --git a/submodule.c b/submodule.c
index 975bc87..9a3eb85 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1001,3 +1001,67 @@ int merge_submodule(unsigned char result[20], const char *path,
 	free(merges.objects);
 	return 0;
 }
+
+/* Update gitfile and core.worktree setting to connect work tree and git dir */
+void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir)
+{
+	struct strbuf core_worktree_setting = STRBUF_INIT;
+	struct strbuf configfile_name = STRBUF_INIT;
+	struct strbuf gitfile_content = STRBUF_INIT;
+	struct strbuf gitfile_name = STRBUF_INIT;
+	const char *real_work_tree = real_path(work_tree);
+	const char *pathspec[] = { real_work_tree, git_dir, NULL };
+	const char *max_prefix = common_prefix(pathspec);
+	FILE *fp;
+
+	if (max_prefix) {       /* skip common prefix */
+		size_t max_prefix_len = strlen(max_prefix);
+		real_work_tree += max_prefix_len;
+		git_dir += max_prefix_len;
+	}
+
+	/*
+	 * Update gitfile
+	 */
+	strbuf_addstr(&gitfile_content, "gitdir: ");
+	if (real_work_tree[0]) {
+		const char *s = real_work_tree;
+		do {
+			strbuf_addstr(&gitfile_content, "../");
+			s++;
+		} while ((s = strchr(s, '/')));
+	}
+	strbuf_addstr(&gitfile_content, git_dir);
+	strbuf_addch(&gitfile_content, '\n');
+
+	strbuf_addf(&gitfile_name, "%s/.git", work_tree);
+	fp = fopen(gitfile_name.buf, "w");
+	if (!fp)
+		die(_("Could not create git link %s"), gitfile_name.buf);
+	fprintf(fp, "%s", gitfile_content.buf);
+	fclose(fp);
+
+	strbuf_release(&gitfile_content);
+	strbuf_release(&gitfile_name);
+
+	/*
+	 * Update core.worktree setting
+	 */
+	if (git_dir[0]) {
+		const char *s = git_dir;
+		do {
+			strbuf_addstr(&core_worktree_setting, "../");
+			s++;
+		} while ((s = strchr(s, '/')));
+	}
+	strbuf_addstr(&core_worktree_setting, real_work_tree);
+
+	strbuf_addf(&configfile_name, "%s/config", git_dir);
+	if (git_config_set_in_file(configfile_name.buf, "core.worktree",
+				   core_worktree_setting.buf))
+		die(_("Could not set core.worktree in %s"),
+		    configfile_name.buf);
+
+	strbuf_release(&core_worktree_setting);
+	strbuf_release(&configfile_name);
+}
diff --git a/submodule.h b/submodule.h
index 3dc1b3f..0c27c53 100644
--- a/submodule.h
+++ b/submodule.h
@@ -35,5 +35,6 @@ int merge_submodule(unsigned char result[20], const char *path, const unsigned c
 int find_unpushed_submodules(unsigned char new_sha1[20], const char *remotes_name,
 		struct string_list *needs_pushing);
 int push_unpushed_submodules(unsigned char new_sha1[20], const char *remotes_name);
+void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir);

 #endif
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4c57f61..d824464 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -289,4 +289,23 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	git diff-files --quiet
 '

+test_expect_success 'git mv moves a submodule with gitfile' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	(
+		cd mod &&
+		git mv ../sub/ .
+	) &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
 test_done
-- 
1.8.2.1.345.gb37ac0e

^ permalink raw reply related	[relevance 9%]

* [PATCH/RFC 2/3] Teach mv to move submodules using a gitfile
    2013-04-03 19:56 10% ` [PATCH/RFC 1/3] Teach mv to move submodules together with their work trees Jens Lehmann
@ 2013-04-03 19:56  9% ` Jens Lehmann
    2013-04-03 19:57  9% ` [PATCH/RFC 3/3] Teach mv to update the path entry in .gitmodules for moved submodules Jens Lehmann
  2 siblings, 1 reply; 200+ results
From: Jens Lehmann @ 2013-04-03 19:56 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Junio C Hamano, Phil Hord, Heiko Voigt, W. Trevor King,
	Peter Collingbourne

When moving a submodule which uses a gitfile to point to the git directory
stored in .git/modules/<name> of the superproject two changes must be made
to make the submodule work: the .git file and the core.worktree setting
must be adjusted to point from work tree to git directory and back.

Achieve that by remembering which submodule uses a gitfile by storing the
result of read_gitfile() of each submodule. If that is not NULL the new
function connect_work_tree_and_git_dir() is called after renaming the
submodule's work tree which updates the two settings to the new values.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
 builtin/mv.c  | 19 ++++++++++++++----
 submodule.c   | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 submodule.h   |  1 +
 t/t7001-mv.sh | 19 ++++++++++++++++++
 4 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 361028d..609bbb8 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -9,6 +9,7 @@
 #include "cache-tree.h"
 #include "string-list.h"
 #include "parse-options.h"
+#include "submodule.h"

 static const char * const builtin_mv_usage[] = {
 	N_("git mv [options] <source>... <destination>"),
@@ -65,7 +66,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		OPT_BOOLEAN('k', NULL, &ignore_errors, N_("skip move/rename errors")),
 		OPT_END(),
 	};
-	const char **source, **destination, **dest_path;
+	const char **source, **destination, **dest_path, **submodule_gitfile;
 	enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
 	struct stat st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
@@ -84,6 +85,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	source = copy_pathspec(prefix, argv, argc, 0);
 	modes = xcalloc(argc, sizeof(enum update_mode));
 	dest_path = copy_pathspec(prefix, argv + argc, 1, 0);
+	submodule_gitfile = xcalloc(argc, sizeof(char *));

 	if (dest_path[0][0] == '\0')
 		/* special case: "." was normalized to "" */
@@ -119,8 +121,14 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		else if (src_is_dir) {
 			int first = cache_name_pos(src, length);
 			if (first >= 0) {
+				struct strbuf submodule_dotgit = STRBUF_INIT;
 				if (!S_ISGITLINK(active_cache[first]->ce_mode))
 					die (_("Huh? Directory %s is in index and no submodule?"), src);
+				strbuf_addf(&submodule_dotgit, "%s/.git", src);
+				submodule_gitfile[i] = read_gitfile(submodule_dotgit.buf);
+				if (submodule_gitfile[i])
+					submodule_gitfile[i] = xstrdup(submodule_gitfile[i]);
+				strbuf_release(&submodule_dotgit);
 			} else {
 				const char *src_w_slash = add_slash(src);
 				int last, len_w_slash = length + 1;
@@ -215,9 +223,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		int pos;
 		if (show_only || verbose)
 			printf(_("Renaming %s to %s\n"), src, dst);
-		if (!show_only && mode != INDEX &&
-				rename(src, dst) < 0 && !ignore_errors)
-			die_errno (_("renaming '%s' failed"), src);
+		if (!show_only && mode != INDEX) {
+			if (rename(src, dst) < 0 && !ignore_errors)
+				die_errno (_("renaming '%s' failed"), src);
+			if (submodule_gitfile[i])
+				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
+		}

 		if (mode == WORKING_DIRECTORY)
 			continue;
diff --git a/submodule.c b/submodule.c
index 975bc87..eba9b42 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1001,3 +1001,67 @@ int merge_submodule(unsigned char result[20], const char *path,
 	free(merges.objects);
 	return 0;
 }
+
+/* Update gitfile and core.worktree setting to connect work tree and git dir */
+void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir)
+{
+	struct strbuf core_worktree_setting = STRBUF_INIT;
+	struct strbuf configfile_name = STRBUF_INIT;
+	struct strbuf gitfile_content = STRBUF_INIT;
+	struct strbuf gitfile_name = STRBUF_INIT;
+	const char *real_work_tree = real_path(work_tree);
+	const char *pathspec[] = { real_work_tree, git_dir, NULL };
+	const char *max_prefix = common_prefix(pathspec);
+	FILE *fp;
+
+	if (max_prefix) {       /* skip common prefix */
+		size_t max_prefix_len = strlen(max_prefix);
+		real_work_tree += max_prefix_len;
+		git_dir += max_prefix_len;
+	}
+
+	/*
+	 * Update gitfile
+	 */
+	strbuf_addstr(&gitfile_content, "gitdir: ");
+	if (real_work_tree[0]) {
+		const char *s = real_work_tree;
+		do {
+			strbuf_addstr(&gitfile_content, "../");
+			s++;
+		} while ((s = strchr(s, '/')));
+	}
+	strbuf_addstr(&gitfile_content, git_dir);
+	strbuf_addch(&gitfile_content, '\n');
+
+	strbuf_addf(&gitfile_name, "%s/.git", work_tree);
+	fp = fopen(gitfile_name.buf, "w");
+	if (!fp)
+		die(_("Could not create git link %s"), gitfile_name.buf);
+	fprintf(fp, gitfile_content.buf);
+	fclose(fp);
+
+	strbuf_release(&gitfile_content);
+	strbuf_release(&gitfile_name);
+
+	/*
+	 * Update core.worktree setting
+	 */
+	if (git_dir[0]) {
+		const char *s = git_dir;
+		do {
+			strbuf_addstr(&core_worktree_setting, "../");
+			s++;
+		} while ((s = strchr(s, '/')));
+	}
+	strbuf_addstr(&core_worktree_setting, real_work_tree);
+
+	strbuf_addf(&configfile_name, "%s/config", git_dir);
+	if (git_config_set_in_file(configfile_name.buf, "core.worktree",
+				   core_worktree_setting.buf))
+		die(_("Could not set core.worktree in %s"),
+		    configfile_name.buf);
+
+	strbuf_release(&core_worktree_setting);
+	strbuf_release(&configfile_name);
+}
diff --git a/submodule.h b/submodule.h
index 3dc1b3f..0c27c53 100644
--- a/submodule.h
+++ b/submodule.h
@@ -35,5 +35,6 @@ int merge_submodule(unsigned char result[20], const char *path, const unsigned c
 int find_unpushed_submodules(unsigned char new_sha1[20], const char *remotes_name,
 		struct string_list *needs_pushing);
 int push_unpushed_submodules(unsigned char new_sha1[20], const char *remotes_name);
+void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir);

 #endif
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4c57f61..d824464 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -289,4 +289,23 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	git diff-files --quiet
 '

+test_expect_success 'git mv moves a submodule with gitfile' '
+	rm -rf mod/sub &&
+	git reset --hard &&
+	git submodule update &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	(
+		cd mod &&
+		git mv ../sub/ .
+	) &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
 test_done
-- 
1.8.2.377.g1bdb7d0

^ permalink raw reply related	[relevance 9%]

* [PATCH v2 2/5] tests: stop using top-level "README" and "COPYING" files
  @ 2021-10-05 17:01 10%   ` Ævar Arnfjörð Bjarmason
    1 sibling, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2021-10-05 17:01 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Linus Torvalds, Greg Kroah-Hartman,
	Mauro Carvalho Chehab, Han-Wen Nienhuys,
	Ævar Arnfjörð Bjarmason

In 459b8d22e54 (tests: do not borrow from COPYING and README from the
real source, 2015-02-15) tests that used "lib-diff.sh" (called
"diff-lib.sh" then) were made to stop relying on the top-level COPYING
file, but we still had other tests that referenced it.

Let's move them over to use the "COPYING_test_data" utility function
introduced in the preceding commit, and in the case of the one test
that needed the "README" file use a ROT 13 version of that "COPYING"
test data. That test added in afd222967c6 (Extend testing git-mv for
renaming of subdirectories, 2006-07-26) just needs more test data that's not the same as the "COPYING" test data, so a ROT 13 version will do.

This change removes the last references to ../{README,COPYING} in the
test suite.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t4022-diff-rewrite.sh           |  6 ++++--
 t/t4023-diff-rename-typechange.sh | 11 ++++++-----
 t/t7001-mv.sh                     |  5 +++--
 t/t7101-reset-empty-subdirs.sh    | 11 ++++++-----
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/t/t4022-diff-rewrite.sh b/t/t4022-diff-rewrite.sh
index 6d1c3d949c7..1c89050a974 100755
--- a/t/t4022-diff-rewrite.sh
+++ b/t/t4022-diff-rewrite.sh
@@ -3,15 +3,17 @@
 test_description='rewrite diff'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success setup '
 
-	cat "$TEST_DIRECTORY"/../COPYING >test &&
+	COPYING_test_data >test.data &&
+	cp test.data test &&
 	git add test &&
 	tr \
 	  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
 	  "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
-	  <"$TEST_DIRECTORY"/../COPYING >test &&
+	  <test.data >test &&
 	echo "to be deleted" >test2 &&
 	blob=$(git hash-object test2) &&
 	blob=$(git rev-parse --short $blob) &&
diff --git a/t/t4023-diff-rename-typechange.sh b/t/t4023-diff-rename-typechange.sh
index 8c9823765e6..47d6f35dcc4 100755
--- a/t/t4023-diff-rename-typechange.sh
+++ b/t/t4023-diff-rename-typechange.sh
@@ -3,25 +3,26 @@
 test_description='typechange rename detection'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 test_expect_success setup '
 
 	rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	test_ln_s_add linklink bar &&
 	git add foo &&
 	git commit -a -m Initial &&
 	git tag one &&
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >bar &&
+	COPYING_test_data >bar &&
 	test_ln_s_add linklink foo &&
 	git add bar &&
 	git commit -a -m Second &&
 	git tag two &&
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	git add foo &&
 	git commit -a -m Third &&
 	git tag three &&
@@ -35,7 +36,7 @@ test_expect_success setup '
 	# This is purely for sanity check
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	cat "$TEST_DIRECTORY"/../Makefile >bar &&
 	git add foo bar &&
 	git commit -a -m Fifth &&
@@ -43,7 +44,7 @@ test_expect_success setup '
 
 	git rm -f foo bar &&
 	cat "$TEST_DIRECTORY"/../Makefile >foo &&
-	cat "$TEST_DIRECTORY"/../COPYING >bar &&
+	COPYING_test_data >bar &&
 	git add foo bar &&
 	git commit -a -m Sixth &&
 	git tag six
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 25bb9bbb899..963356ba5f9 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -2,10 +2,11 @@
 
 test_description='git mv in subdirs'
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success 'prepare reference tree' '
 	mkdir path0 path1 &&
-	cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+	COPYING_test_data >path0/COPYING &&
 	git add path0/COPYING &&
 	git commit -m add -a
 '
@@ -107,7 +108,7 @@ test_expect_success 'clean up' '
 '
 
 test_expect_success 'adding another file' '
-	cp "$TEST_DIRECTORY"/../README.md path0/README &&
+	COPYING_test_data | tr A-Za-z N-ZA-Mn-za-m >path0/README &&
 	git add path0/README &&
 	git commit -m add2 -a
 '
diff --git a/t/t7101-reset-empty-subdirs.sh b/t/t7101-reset-empty-subdirs.sh
index bfce05ac5de..5530651eea4 100755
--- a/t/t7101-reset-empty-subdirs.sh
+++ b/t/t7101-reset-empty-subdirs.sh
@@ -5,10 +5,11 @@
 
 test_description='git reset should cull empty subdirs'
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success 'creating initial files' '
      mkdir path0 &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+     COPYING_test_data >path0/COPYING &&
      git add path0/COPYING &&
      git commit -m add -a
 '
@@ -16,10 +17,10 @@ test_expect_success 'creating initial files' '
 test_expect_success 'creating second files' '
      mkdir path1 &&
      mkdir path1/path2 &&
-     cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING-TOO &&
+     COPYING_test_data >path1/path2/COPYING &&
+     COPYING_test_data >path1/COPYING &&
+     COPYING_test_data >COPYING &&
+     COPYING_test_data >path0/COPYING-TOO &&
      git add path1/path2/COPYING &&
      git add path1/COPYING &&
      git add COPYING &&
-- 
2.33.0.1441.gbbcdb4c3c66


^ permalink raw reply related	[relevance 10%]

* [PATCH 2/5] tests: stop using top-level "README" and "COPYING" files
  @ 2021-10-02  9:19 10% ` Ævar Arnfjörð Bjarmason
    1 sibling, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2021-10-02  9:19 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Linus Torvalds, Greg Kroah-Hartman,
	Mauro Carvalho Chehab, Han-Wen Nienhuys,
	Ævar Arnfjörð Bjarmason

In 459b8d22e54 (tests: do not borrow from COPYING and README from the
real source, 2015-02-15) tests that used "lib-diff.sh" (called
"diff-lib.sh" then) were made to stop relying on the top-level COPYING
file, but we still had other tests that referenced it.

Let's move them over to use the "COPYING_test_data" utility function
introduced in the preceding commit, and in the case of the one test
that needed the "README" file use a ROT 13 version of that "COPYING"
test data. That test added in afd222967c6 (Extend testing git-mv for
renaming of subdirectories, 2006-07-26) just needs more test data that's not the same as the "COPYING" test data, so a ROT 13 version will do.

This change removes the last references to ../{README,COPYING} in the
test suite.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t4022-diff-rewrite.sh           |  6 ++++--
 t/t4023-diff-rename-typechange.sh | 11 ++++++-----
 t/t7001-mv.sh                     |  5 +++--
 t/t7101-reset-empty-subdirs.sh    | 11 ++++++-----
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/t/t4022-diff-rewrite.sh b/t/t4022-diff-rewrite.sh
index 6d1c3d949c7..1c89050a974 100755
--- a/t/t4022-diff-rewrite.sh
+++ b/t/t4022-diff-rewrite.sh
@@ -3,15 +3,17 @@
 test_description='rewrite diff'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success setup '
 
-	cat "$TEST_DIRECTORY"/../COPYING >test &&
+	COPYING_test_data >test.data &&
+	cp test.data test &&
 	git add test &&
 	tr \
 	  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
 	  "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
-	  <"$TEST_DIRECTORY"/../COPYING >test &&
+	  <test.data >test &&
 	echo "to be deleted" >test2 &&
 	blob=$(git hash-object test2) &&
 	blob=$(git rev-parse --short $blob) &&
diff --git a/t/t4023-diff-rename-typechange.sh b/t/t4023-diff-rename-typechange.sh
index 8c9823765e6..47d6f35dcc4 100755
--- a/t/t4023-diff-rename-typechange.sh
+++ b/t/t4023-diff-rename-typechange.sh
@@ -3,25 +3,26 @@
 test_description='typechange rename detection'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 test_expect_success setup '
 
 	rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	test_ln_s_add linklink bar &&
 	git add foo &&
 	git commit -a -m Initial &&
 	git tag one &&
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >bar &&
+	COPYING_test_data >bar &&
 	test_ln_s_add linklink foo &&
 	git add bar &&
 	git commit -a -m Second &&
 	git tag two &&
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	git add foo &&
 	git commit -a -m Third &&
 	git tag three &&
@@ -35,7 +36,7 @@ test_expect_success setup '
 	# This is purely for sanity check
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	cat "$TEST_DIRECTORY"/../Makefile >bar &&
 	git add foo bar &&
 	git commit -a -m Fifth &&
@@ -43,7 +44,7 @@ test_expect_success setup '
 
 	git rm -f foo bar &&
 	cat "$TEST_DIRECTORY"/../Makefile >foo &&
-	cat "$TEST_DIRECTORY"/../COPYING >bar &&
+	COPYING_test_data >bar &&
 	git add foo bar &&
 	git commit -a -m Sixth &&
 	git tag six
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 25bb9bbb899..963356ba5f9 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -2,10 +2,11 @@
 
 test_description='git mv in subdirs'
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success 'prepare reference tree' '
 	mkdir path0 path1 &&
-	cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+	COPYING_test_data >path0/COPYING &&
 	git add path0/COPYING &&
 	git commit -m add -a
 '
@@ -107,7 +108,7 @@ test_expect_success 'clean up' '
 '
 
 test_expect_success 'adding another file' '
-	cp "$TEST_DIRECTORY"/../README.md path0/README &&
+	COPYING_test_data | tr A-Za-z N-ZA-Mn-za-m >path0/README &&
 	git add path0/README &&
 	git commit -m add2 -a
 '
diff --git a/t/t7101-reset-empty-subdirs.sh b/t/t7101-reset-empty-subdirs.sh
index bfce05ac5de..5530651eea4 100755
--- a/t/t7101-reset-empty-subdirs.sh
+++ b/t/t7101-reset-empty-subdirs.sh
@@ -5,10 +5,11 @@
 
 test_description='git reset should cull empty subdirs'
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success 'creating initial files' '
      mkdir path0 &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+     COPYING_test_data >path0/COPYING &&
      git add path0/COPYING &&
      git commit -m add -a
 '
@@ -16,10 +17,10 @@ test_expect_success 'creating initial files' '
 test_expect_success 'creating second files' '
      mkdir path1 &&
      mkdir path1/path2 &&
-     cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING-TOO &&
+     COPYING_test_data >path1/path2/COPYING &&
+     COPYING_test_data >path1/COPYING &&
+     COPYING_test_data >COPYING &&
+     COPYING_test_data >path0/COPYING-TOO &&
      git add path1/path2/COPYING &&
      git add path1/COPYING &&
      git add COPYING &&
-- 
2.33.0.1380.g193143c62ce


^ permalink raw reply related	[relevance 10%]

* [PATCH 1/2] submodule tests: don't use itself as a submodule
  @ 2017-01-04  1:48 10% ` Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2017-01-04  1:48 UTC (permalink / raw)
  To: gitster; +Cc: git, peff, bmwill, Stefan Beller

In reality nobody would run "git submodule add ./. <submodule-path>"
to add the repository to itself as a submodule as this comes with some
nasty surprises, such as infinite recursion when cloning that repository.
However we do this all the time in the test suite, because most of the
time this was the most convenient way to test a very specific thing
for submodule behavior.

This provides an easier way to have submodules in tests, by just setting
TEST_CREATE_SUBMODULE to a non empty string, similar to
TEST_NO_CREATE_REPO.

Make use of it in those tests that add a submodule from ./. except for
the occurrence in create_lib_submodule_repo as there it seems we craft
a repository deliberately for both inside as well as outside use.

The name "pretzel.[non]bare" was chosen deliberate to not introduce
more strings to the test suite containing "sub[module]" as searching for
"sub" already yields a lot of hits from different contexts. "pretzel"
doesn't occur in the test suite yet, so it is a good candidate for
a potential remote for a submodule.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 t/lib-submodule-update.sh |  2 ++
 t/t7001-mv.sh             |  5 +++--
 t/t7507-commit-verbose.sh |  4 +++-
 t/t7800-difftool.sh       |  4 +++-
 t/test-lib-functions.sh   | 16 ++++++++++++++++
 5 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
index 79cdd34a54..58d76d9df8 100755
--- a/t/lib-submodule-update.sh
+++ b/t/lib-submodule-update.sh
@@ -44,6 +44,8 @@ create_lib_submodule_repo () {
 		git branch "no_submodule" &&
 
 		git checkout -b "add_sub1" &&
+		# Adding the repo itself as a submodule is a hack.
+		# Do not imitate this.
 		git submodule add ./. sub1 &&
 		git config -f .gitmodules submodule.sub1.ignore all &&
 		git config submodule.sub1.ignore all &&
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e365d1ff77..6cb32f3a3a 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 test_description='git mv in subdirs'
+TEST_CREATE_SUBMODULE=yes
 . ./test-lib.sh
 
 test_expect_success \
@@ -288,12 +289,12 @@ rm -f moved symlink
 test_expect_success 'setup submodule' '
 	git commit -m initial &&
 	git reset --hard &&
-	git submodule add ./. sub &&
+	git submodule add ./pretzel.bare sub &&
 	echo content >file &&
 	git add file &&
 	git commit -m "added sub and file" &&
 	mkdir -p deep/directory/hierarchy &&
-	git submodule add ./. deep/directory/hierarchy/sub &&
+	git submodule add ./pretzel.bare deep/directory/hierarchy/sub &&
 	git commit -m "added another submodule" &&
 	git branch submodule
 '
diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
index ed2653d46f..d269900afa 100755
--- a/t/t7507-commit-verbose.sh
+++ b/t/t7507-commit-verbose.sh
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 test_description='verbose commit template'
+TEST_CREATE_SUBMODULE=yes
 . ./test-lib.sh
 
 write_script "check-for-diff" <<\EOF &&
@@ -74,11 +75,12 @@ test_expect_success 'diff in message is retained with -v' '
 
 test_expect_success 'submodule log is stripped out too with -v' '
 	git config diff.submodule log &&
-	git submodule add ./. sub &&
+	git submodule add ./pretzel.bare sub &&
 	git commit -m "sub added" &&
 	(
 		cd sub &&
 		echo "more" >>file &&
+		git add file &&
 		git commit -a -m "submodule commit"
 	) &&
 	(
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 70a2de461a..d13a5d0453 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -7,6 +7,7 @@ test_description='git-difftool
 
 Testing basic diff tool invocation
 '
+TEST_CREATE_SUBMODULE=Yes
 
 . ./test-lib.sh
 
@@ -534,7 +535,8 @@ test_expect_success PERL 'difftool --no-symlinks detects conflict ' '
 '
 
 test_expect_success PERL 'difftool properly honors gitlink and core.worktree' '
-	git submodule add ./. submod/ule &&
+	git submodule add ./pretzel.bare submod/ule &&
+	test_commit -C submod/ule second_commit &&
 	test_config -C submod/ule diff.tool checktrees &&
 	test_config -C submod/ule difftool.checktrees.cmd '\''
 		test -d "$LOCAL" && test -d "$REMOTE" && echo good
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 579e812506..aa327a7dff 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -800,6 +800,22 @@ test_create_repo () {
 		error "cannot run git init -- have you built things yet?"
 		mv .git/hooks .git/hooks-disabled
 	) || exit
+	if test -n "$TEST_CREATE_SUBMODULE"
+	then
+		(
+			cd "$repo"
+			TEST_CREATE_SUBMODULE=
+			export TEST_CREATE_SUBMODULE
+			test_create_repo "pretzel.nonbare"
+			test_commit -C "pretzel.nonbare" \
+				"create submodule" "submodule-file" \
+				"submodule-content" "submodule-tag" >&3 2>&4 ||
+				error "cannot run test_commit"
+			git clone --bare "pretzel.nonbare" \
+				  "pretzel.bare" >&3 2>&4 ||
+				  error "cannot clone into bare"
+		)
+	fi
 }
 
 # This function helps on symlink challenged file systems when it is not
-- 
2.11.0.rc2.31.g2cc886f


^ permalink raw reply related	[relevance 10%]

* [PATCHv6 1/2] submodule tests: don't use itself as a submodule
  @ 2017-01-05 19:29 10% ` Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2017-01-05 19:29 UTC (permalink / raw)
  To: bmwill, peff, gitster; +Cc: git, Stefan Beller

In reality nobody would run "git submodule add ./. <submodule-path>"
to add the repository to itself as a submodule as this comes with some
nasty surprises, such as infinite recursion when cloning that repository.
However we do this all the time in the test suite, because most of the
time this was the most convenient way to test a very specific thing
for submodule behavior.

This provides an easier way to have submodules in tests, by just setting
TEST_CREATE_SUBMODULE to a non empty string, similar to
TEST_NO_CREATE_REPO.

Make use of it in those tests that add a submodule from ./. except for
the occurrence in create_lib_submodule_repo as there it seems we craft
a repository deliberately for both inside as well as outside use.

The name "pretzel.[non]bare" was chosen deliberate to not introduce
more strings to the test suite containing "sub[module]" as searching for
"sub" already yields a lot of hits from different contexts. "pretzel"
doesn't occur in the test suite yet, so it is a good candidate for
a potential remote for a submodule.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 t/lib-submodule-update.sh |  2 ++
 t/t7001-mv.sh             |  5 +++--
 t/t7507-commit-verbose.sh |  4 +++-
 t/t7800-difftool.sh       |  4 +++-
 t/test-lib-functions.sh   | 16 ++++++++++++++++
 5 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
index 79cdd34a54..58d76d9df8 100755
--- a/t/lib-submodule-update.sh
+++ b/t/lib-submodule-update.sh
@@ -44,6 +44,8 @@ create_lib_submodule_repo () {
 		git branch "no_submodule" &&
 
 		git checkout -b "add_sub1" &&
+		# Adding the repo itself as a submodule is a hack.
+		# Do not imitate this.
 		git submodule add ./. sub1 &&
 		git config -f .gitmodules submodule.sub1.ignore all &&
 		git config submodule.sub1.ignore all &&
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e365d1ff77..6cb32f3a3a 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 test_description='git mv in subdirs'
+TEST_CREATE_SUBMODULE=yes
 . ./test-lib.sh
 
 test_expect_success \
@@ -288,12 +289,12 @@ rm -f moved symlink
 test_expect_success 'setup submodule' '
 	git commit -m initial &&
 	git reset --hard &&
-	git submodule add ./. sub &&
+	git submodule add ./pretzel.bare sub &&
 	echo content >file &&
 	git add file &&
 	git commit -m "added sub and file" &&
 	mkdir -p deep/directory/hierarchy &&
-	git submodule add ./. deep/directory/hierarchy/sub &&
+	git submodule add ./pretzel.bare deep/directory/hierarchy/sub &&
 	git commit -m "added another submodule" &&
 	git branch submodule
 '
diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
index ed2653d46f..d269900afa 100755
--- a/t/t7507-commit-verbose.sh
+++ b/t/t7507-commit-verbose.sh
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 test_description='verbose commit template'
+TEST_CREATE_SUBMODULE=yes
 . ./test-lib.sh
 
 write_script "check-for-diff" <<\EOF &&
@@ -74,11 +75,12 @@ test_expect_success 'diff in message is retained with -v' '
 
 test_expect_success 'submodule log is stripped out too with -v' '
 	git config diff.submodule log &&
-	git submodule add ./. sub &&
+	git submodule add ./pretzel.bare sub &&
 	git commit -m "sub added" &&
 	(
 		cd sub &&
 		echo "more" >>file &&
+		git add file &&
 		git commit -a -m "submodule commit"
 	) &&
 	(
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 70a2de461a..d13a5d0453 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -7,6 +7,7 @@ test_description='git-difftool
 
 Testing basic diff tool invocation
 '
+TEST_CREATE_SUBMODULE=Yes
 
 . ./test-lib.sh
 
@@ -534,7 +535,8 @@ test_expect_success PERL 'difftool --no-symlinks detects conflict ' '
 '
 
 test_expect_success PERL 'difftool properly honors gitlink and core.worktree' '
-	git submodule add ./. submod/ule &&
+	git submodule add ./pretzel.bare submod/ule &&
+	test_commit -C submod/ule second_commit &&
 	test_config -C submod/ule diff.tool checktrees &&
 	test_config -C submod/ule difftool.checktrees.cmd '\''
 		test -d "$LOCAL" && test -d "$REMOTE" && echo good
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 579e812506..aa327a7dff 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -800,6 +800,22 @@ test_create_repo () {
 		error "cannot run git init -- have you built things yet?"
 		mv .git/hooks .git/hooks-disabled
 	) || exit
+	if test -n "$TEST_CREATE_SUBMODULE"
+	then
+		(
+			cd "$repo"
+			TEST_CREATE_SUBMODULE=
+			export TEST_CREATE_SUBMODULE
+			test_create_repo "pretzel.nonbare"
+			test_commit -C "pretzel.nonbare" \
+				"create submodule" "submodule-file" \
+				"submodule-content" "submodule-tag" >&3 2>&4 ||
+				error "cannot run test_commit"
+			git clone --bare "pretzel.nonbare" \
+				  "pretzel.bare" >&3 2>&4 ||
+				  error "cannot clone into bare"
+		)
+	fi
 }
 
 # This function helps on symlink challenged file systems when it is not
-- 
2.11.0.31.g919a8d0.dirty


^ permalink raw reply related	[relevance 10%]

* [PATCH v3 2/2] tests: stop using top-level "README" and "COPYING" files
  @ 2021-10-15  9:30 10%     ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2021-10-15  9:30 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Han-Wen Nienhuys,
	Ævar Arnfjörð Bjarmason

In 459b8d22e54 (tests: do not borrow from COPYING and README from the
real source, 2015-02-15) tests that used "lib-diff.sh" (called
"diff-lib.sh" then) were made to stop relying on the top-level COPYING
file, but we still had other tests that referenced it.

Let's move them over to use the "COPYING_test_data" utility function
introduced in the preceding commit, and in the case of the one test
that needed the "README" file use a ROT 13 version of that "COPYING"
test data. That test added in afd222967c6 (Extend testing git-mv for
renaming of subdirectories, 2006-07-26) just needs more test data that's not the same as the "COPYING" test data, so a ROT 13 version will do.

This change removes the last references to ../{README,COPYING} in the
test suite.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t4022-diff-rewrite.sh           |  6 ++++--
 t/t4023-diff-rename-typechange.sh | 11 ++++++-----
 t/t7001-mv.sh                     |  5 +++--
 t/t7101-reset-empty-subdirs.sh    | 11 ++++++-----
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/t/t4022-diff-rewrite.sh b/t/t4022-diff-rewrite.sh
index 6d1c3d949c7..1c89050a974 100755
--- a/t/t4022-diff-rewrite.sh
+++ b/t/t4022-diff-rewrite.sh
@@ -3,15 +3,17 @@
 test_description='rewrite diff'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success setup '
 
-	cat "$TEST_DIRECTORY"/../COPYING >test &&
+	COPYING_test_data >test.data &&
+	cp test.data test &&
 	git add test &&
 	tr \
 	  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
 	  "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
-	  <"$TEST_DIRECTORY"/../COPYING >test &&
+	  <test.data >test &&
 	echo "to be deleted" >test2 &&
 	blob=$(git hash-object test2) &&
 	blob=$(git rev-parse --short $blob) &&
diff --git a/t/t4023-diff-rename-typechange.sh b/t/t4023-diff-rename-typechange.sh
index 8c9823765e6..47d6f35dcc4 100755
--- a/t/t4023-diff-rename-typechange.sh
+++ b/t/t4023-diff-rename-typechange.sh
@@ -3,25 +3,26 @@
 test_description='typechange rename detection'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 test_expect_success setup '
 
 	rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	test_ln_s_add linklink bar &&
 	git add foo &&
 	git commit -a -m Initial &&
 	git tag one &&
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >bar &&
+	COPYING_test_data >bar &&
 	test_ln_s_add linklink foo &&
 	git add bar &&
 	git commit -a -m Second &&
 	git tag two &&
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	git add foo &&
 	git commit -a -m Third &&
 	git tag three &&
@@ -35,7 +36,7 @@ test_expect_success setup '
 	# This is purely for sanity check
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	cat "$TEST_DIRECTORY"/../Makefile >bar &&
 	git add foo bar &&
 	git commit -a -m Fifth &&
@@ -43,7 +44,7 @@ test_expect_success setup '
 
 	git rm -f foo bar &&
 	cat "$TEST_DIRECTORY"/../Makefile >foo &&
-	cat "$TEST_DIRECTORY"/../COPYING >bar &&
+	COPYING_test_data >bar &&
 	git add foo bar &&
 	git commit -a -m Sixth &&
 	git tag six
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 25bb9bbb899..963356ba5f9 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -2,10 +2,11 @@
 
 test_description='git mv in subdirs'
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success 'prepare reference tree' '
 	mkdir path0 path1 &&
-	cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+	COPYING_test_data >path0/COPYING &&
 	git add path0/COPYING &&
 	git commit -m add -a
 '
@@ -107,7 +108,7 @@ test_expect_success 'clean up' '
 '
 
 test_expect_success 'adding another file' '
-	cp "$TEST_DIRECTORY"/../README.md path0/README &&
+	COPYING_test_data | tr A-Za-z N-ZA-Mn-za-m >path0/README &&
 	git add path0/README &&
 	git commit -m add2 -a
 '
diff --git a/t/t7101-reset-empty-subdirs.sh b/t/t7101-reset-empty-subdirs.sh
index bfce05ac5de..5530651eea4 100755
--- a/t/t7101-reset-empty-subdirs.sh
+++ b/t/t7101-reset-empty-subdirs.sh
@@ -5,10 +5,11 @@
 
 test_description='git reset should cull empty subdirs'
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success 'creating initial files' '
      mkdir path0 &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+     COPYING_test_data >path0/COPYING &&
      git add path0/COPYING &&
      git commit -m add -a
 '
@@ -16,10 +17,10 @@ test_expect_success 'creating initial files' '
 test_expect_success 'creating second files' '
      mkdir path1 &&
      mkdir path1/path2 &&
-     cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING-TOO &&
+     COPYING_test_data >path1/path2/COPYING &&
+     COPYING_test_data >path1/COPYING &&
+     COPYING_test_data >COPYING &&
+     COPYING_test_data >path0/COPYING-TOO &&
      git add path1/path2/COPYING &&
      git add path1/COPYING &&
      git add COPYING &&
-- 
2.33.1.1338.g20da966911a


^ permalink raw reply related	[relevance 10%]

* [PATCH v2] git-mv: improve error message for conflicted file
  2020-07-17 23:24 10% [PATCH] git-mv: improve error message for conflicted file Chris Torek via GitGitGadget
@ 2020-07-20  6:17 10% ` Chris Torek via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Chris Torek via GitGitGadget @ 2020-07-20  6:17 UTC (permalink / raw)
  To: git; +Cc: Chris Torek, Chris Torek

From: Chris Torek <chris.torek@gmail.com>

'git mv' has always complained about renaming a conflicted
file, as it cannot handle multiple index entries for one file.
However, the error message it uses has been the same as the
one for an untracked file:

    fatal: not under version control, src=...

which is patently wrong.  Distinguish the two cases and
add a test to make sure we produce the correct message.

Signed-off-by: Chris Torek <chris.torek@gmail.com>
---
    git-mv: improve error message for conflicted file
    
    'git mv' has always complained about renaming a conflicted file, as it
    cannot handle multiple index entries for one file. However, the error
    message it uses has been the same as the one for an untracked file:
    
    fatal: not under version control, src=...
    
    which is patently wrong. Distinguish the two cases and add a test to
    make sure we produce the correct message.
    
    Signed-off-by: Chris Torek chris.torek@gmail.com [chris.torek@gmail.com]
    
    
    ------------------------------------------------------------------------
    
    Tests updated, and took Junio's suggestion to reduce the cache lookup to
    one call.
    
    I put in the shortened "conflicted" here but did not shorten the
    existing "not under version control" message (to minimize the visible
    and translations-required changes).
    
    I like the idea of renaming all stages and keeping them at their current
    stages, but that's too much for this patch.
    
    I'll be traveling next week and not sure if I will get to any followups
    for a while.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-678%2Fchris3torek%2Fgit-mv-message-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-678/chris3torek/git-mv-message-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/678

Range-diff vs v1:

 1:  0b617e74f7 ! 1:  f2e251a7ea git-mv: improve error message for conflicted file
     @@ Commit message
          Signed-off-by: Chris Torek <chris.torek@gmail.com>
      
       ## builtin/mv.c ##
     +@@ builtin/mv.c: int cmd_mv(int argc, const char **argv, const char *prefix)
     + 	struct stat st;
     + 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
     + 	struct lock_file lock_file = LOCK_INIT;
     ++	struct cache_entry *ce;
     + 
     + 	git_config(git_default_config, NULL);
     + 
      @@ builtin/mv.c: int cmd_mv(int argc, const char **argv, const char *prefix)
       				}
       				argc += last - first;
       			}
      -		} else if (cache_name_pos(src, length) < 0)
     --			bad = _("not under version control");
     ++		} else if (!(ce = cache_file_exists(src, length, ignore_case))) {
     + 			bad = _("not under version control");
      -		else if (lstat(dst, &st) == 0 &&
     -+		} else if (cache_name_pos(src, length) < 0) {
     -+			/*
     -+			 * This occurs for both untracked files *and*
     -+			 * files that are in merge-conflict state, so
     -+			 * let's distinguish between those two.
     -+			 */
     -+			struct cache_entry *ce = cache_file_exists(src, length, ignore_case);
     -+			if (ce == NULL)
     -+				bad = _("not under version control");
     -+			else
     -+				bad = _("must resolve merge conflict first");
     ++		} else if (ce_stage(ce)) {
     ++			bad = _("conflicted");
      +		} else if (lstat(dst, &st) == 0 &&
       			 (!ignore_case || strcasecmp(src, dst))) {
       			bad = _("destination exists");
     @@ t/t7001-mv.sh: test_expect_success 'git mv should not change sha1 of moved cache
      +test_expect_success 'git mv error on conflicted file' '
      +	rm -fr .git &&
      +	git init &&
     -+	touch conflicted &&
     -+	cfhash=$(git hash-object -w conflicted) &&
     -+	git update-index --index-info <<-EOF &&
     -+	$(printf "0 $cfhash 0\tconflicted\n")
     -+	$(printf "100644 $cfhash 1\tconflicted\n")
     ++	>conflict &&
     ++	test_when_finished "rm -f conflict" &&
     ++	cfhash=$(git hash-object -w conflict) &&
     ++	q_to_tab <<-EOF | git update-index --index-info &&
     ++	0 $cfhash 0Qconflict
     ++	100644 $cfhash 1Qconflict
      +	EOF
      +
     -+	test_must_fail git mv conflicted newname 2>actual &&
     -+	test_i18ngrep "merge.conflict" actual
     ++	test_must_fail git mv conflict newname 2>actual &&
     ++	test_i18ngrep "conflicted" actual
      +'
     -+
     -+rm -f conflicted
      +
       test_expect_success 'git mv should overwrite symlink to a file' '
       


 builtin/mv.c  |  7 +++++--
 t/t7001-mv.sh | 17 +++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index be15ba7044..7dac714af9 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -132,6 +132,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	struct stat st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
 	struct lock_file lock_file = LOCK_INIT;
+	struct cache_entry *ce;
 
 	git_config(git_default_config, NULL);
 
@@ -220,9 +221,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				}
 				argc += last - first;
 			}
-		} else if (cache_name_pos(src, length) < 0)
+		} else if (!(ce = cache_file_exists(src, length, ignore_case))) {
 			bad = _("not under version control");
-		else if (lstat(dst, &st) == 0 &&
+		} else if (ce_stage(ce)) {
+			bad = _("conflicted");
+		} else if (lstat(dst, &st) == 0 &&
 			 (!ignore_case || strcasecmp(src, dst))) {
 			bad = _("destination exists");
 			if (force) {
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 36b50d0b4c..c978b6dee4 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -248,6 +248,23 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 
 rm -f dirty dirty2
 
+# NB: This test is about the error message
+# as well as the failure.
+test_expect_success 'git mv error on conflicted file' '
+	rm -fr .git &&
+	git init &&
+	>conflict &&
+	test_when_finished "rm -f conflict" &&
+	cfhash=$(git hash-object -w conflict) &&
+	q_to_tab <<-EOF | git update-index --index-info &&
+	0 $cfhash 0Qconflict
+	100644 $cfhash 1Qconflict
+	EOF
+
+	test_must_fail git mv conflict newname 2>actual &&
+	test_i18ngrep "conflicted" actual
+'
+
 test_expect_success 'git mv should overwrite symlink to a file' '
 
 	rm -fr .git &&

base-commit: ae46588be0cd730430dded4491246dfb4eac5557
-- 
gitgitgadget

^ permalink raw reply related	[relevance 10%]

* [PATCH] handle rename of case only, for windows (resend)
@ 2011-01-14 13:54 10% Tim Abell
  0 siblings, 0 replies; 200+ results
From: Tim Abell @ 2011-01-14 13:54 UTC (permalink / raw)
  To: git

Sorry folks, resending because my mail client wrapped the lines in my
patch on my first attempt.

If there's any more problems with the way I've sent it you can grab a
copy from http://is.gd/iWupI8

Tim

--------

Hi folks,

I've never contributed to git before so be gentle :-)

Would someone have the time to help me get this patch into mailine git?

I tripped over a failure to rename files on windows when only the case
has changed. I've created a patch which fixes it for me and doesn't seem
to break on linux or windows. I also created a test to demonstrate the
issue (part of this patch). This test passes on linux and fails on
windows before my patch for mv.c is applied, and passes on both windows
and linux for me after my patch is applied.

The problem with changing the case of a file happens because git mv
checks if the destination filename exists before performing a
move/rename, and on windows lstat reports that the destination file
*does* already exist because it ignores case for this check and
semi-erroneously finds the source file.

The way I've attempted to fix it in my patch is by checking if the inode
of the source and destination are the same before deciding to fail with
a "destination exists" error.

When using "git mv" it is possible to work around the error by using
--force.

I've also seen a problem with windows users pulling from remotes where a
case only rename has been performed which is more problematic as you
have to tell every user how to handle the issue. I'm not sure if I've
managed to fix that case or not.

The fault exists in both the current cygwin git and the current msysgit,
so I figured it would be good to get a patch to upstream (you) so that
it could work everywhere. 

I found an email from Linus relating to this issue here:
http://marc.info/?l=git&m=120612172706823 so it's a known problem.

Thanks

Tim Abell

---
 builtin/mv.c  |   33 ++++++++++++++++++++++-----------
 t/t7001-mv.sh |    9 +++++++++
 2 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 93e8995..6bb262e 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -63,6 +63,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	const char **source, **destination, **dest_path;
 	enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
 	struct stat st;
+	struct stat src_st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
 
 	git_config(git_default_config, NULL);
@@ -165,17 +166,27 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		} else if (cache_name_pos(src, length) < 0)
 			bad = "not under version control";
 		else if (lstat(dst, &st) == 0) {
-			bad = "destination exists";
-			if (force) {
-				/*
-				 * only files can overwrite each other:
-				 * check both source and destination
-				 */
-				if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
-					warning("%s; will overwrite!", bad);
-					bad = NULL;
-				} else
-					bad = "Cannot overwrite";
+			/* If we are on a case insensitive files= system (windows) http://is.gd/kyxgg
+			 * and we are only changing the case of the file then lstat for the
+			 * destination will return != 0 because it sees the source file.
+			 * To prevent this causing failure, lstat is used to get the inode of the src
+			 * and see if it's actually the same file.
+			 */
+			lstat(src, &src_st); //get file serial number (inode) for source
+			#warning("src inode: %s, dst inode: %s", src_st.st_ino, st.st_ino);
+			if (src_st.st_ino != st.st_ino) {
+				bad = "destination exists";
+				if (force) {
+					/*
+					 * only files can overwrite each other:
+					 * check both source and destination
+					 */
+					if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
+						warning("%s; will overwrite!", bad);
+						bad = NULL;
+					} else
+						bad = "Cannot overwrite";
+				}
 			}
 		} else if (string_list_has_string(&src_for_dst, dst))
 			bad = "multiple sources for the same target";
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index a845b15..95146bf 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -255,4 +255,13 @@ test_expect_success SYMLINKS 'git mv should overwrite file with a symlink' '
 
 rm -f moved symlink
 
+test_expect_success 'git mv should not fail when only changing case' '
+
+	rm -fr .git &&
+	git init &&
+	>foo.txt &&
+	git add foo.txt &&
+	git mv foo.txt Foo.txt
+'
+
 test_done
-- 
1.5.6.5

^ permalink raw reply related	[relevance 10%]

* [PATCH/RFC 1/3] Teach mv to move submodules together with their work trees
  @ 2013-04-03 19:56 10% ` Jens Lehmann
  2013-04-03 19:56  9% ` [PATCH/RFC 2/3] Teach mv to move submodules using a gitfile Jens Lehmann
  2013-04-03 19:57  9% ` [PATCH/RFC 3/3] Teach mv to update the path entry in .gitmodules for moved submodules Jens Lehmann
  2 siblings, 0 replies; 200+ results
From: Jens Lehmann @ 2013-04-03 19:56 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Junio C Hamano, Phil Hord, Heiko Voigt, W. Trevor King,
	Peter Collingbourne

Currently the attempt to use "git mv" on a submodule errors out with:
  fatal: source directory is empty, source=<src>, destination=<dest>
The reason is that mv searches for the submodule with a trailing slash in
the index, which it doesn't find (because it is stored without a trailing
slash). As it doesn't find any index entries inside the submodule it
claims the directory would be empty even though it isn't.

Fix that by searching for the name without a trailing slash and continue
if it is a submodule. Then rename() will move the submodule work tree just
like it moves a file.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
 builtin/mv.c  | 99 +++++++++++++++++++++++++++++++----------------------------
 t/t7001-mv.sh | 34 ++++++++++++++++++++
 2 files changed, 86 insertions(+), 47 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 034fec9..361028d 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -117,55 +117,60 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				&& lstat(dst, &st) == 0)
 			bad = _("cannot move directory over file");
 		else if (src_is_dir) {
-			const char *src_w_slash = add_slash(src);
-			int len_w_slash = length + 1;
-			int first, last;
-
-			modes[i] = WORKING_DIRECTORY;
-
-			first = cache_name_pos(src_w_slash, len_w_slash);
-			if (first >= 0)
-				die (_("Huh? %.*s is in index?"),
-						len_w_slash, src_w_slash);
-
-			first = -1 - first;
-			for (last = first; last < active_nr; last++) {
-				const char *path = active_cache[last]->name;
-				if (strncmp(path, src_w_slash, len_w_slash))
-					break;
-			}
-			free((char *)src_w_slash);
-
-			if (last - first < 1)
-				bad = _("source directory is empty");
-			else {
-				int j, dst_len;
-
-				if (last - first > 0) {
-					source = xrealloc(source,
-							(argc + last - first)
-							* sizeof(char *));
-					destination = xrealloc(destination,
-							(argc + last - first)
-							* sizeof(char *));
-					modes = xrealloc(modes,
-							(argc + last - first)
-							* sizeof(enum update_mode));
+			int first = cache_name_pos(src, length);
+			if (first >= 0) {
+				if (!S_ISGITLINK(active_cache[first]->ce_mode))
+					die (_("Huh? Directory %s is in index and no submodule?"), src);
+			} else {
+				const char *src_w_slash = add_slash(src);
+				int last, len_w_slash = length + 1;
+
+				modes[i] = WORKING_DIRECTORY;
+
+				first = cache_name_pos(src_w_slash, len_w_slash);
+				if (first >= 0)
+					die (_("Huh? %.*s is in index?"),
+							len_w_slash, src_w_slash);
+
+				first = -1 - first;
+				for (last = first; last < active_nr; last++) {
+					const char *path = active_cache[last]->name;
+					if (strncmp(path, src_w_slash, len_w_slash))
+						break;
 				}
-
-				dst = add_slash(dst);
-				dst_len = strlen(dst);
-
-				for (j = 0; j < last - first; j++) {
-					const char *path =
-						active_cache[first + j]->name;
-					source[argc + j] = path;
-					destination[argc + j] =
-						prefix_path(dst, dst_len,
-							path + length + 1);
-					modes[argc + j] = INDEX;
+				free((char *)src_w_slash);
+
+				if (last - first < 1)
+					bad = _("source directory is empty");
+				else {
+					int j, dst_len;
+
+					if (last - first > 0) {
+						source = xrealloc(source,
+								(argc + last - first)
+								* sizeof(char *));
+						destination = xrealloc(destination,
+								(argc + last - first)
+								* sizeof(char *));
+						modes = xrealloc(modes,
+								(argc + last - first)
+								* sizeof(enum update_mode));
+					}
+
+					dst = add_slash(dst);
+					dst_len = strlen(dst);
+
+					for (j = 0; j < last - first; j++) {
+						const char *path =
+							active_cache[first + j]->name;
+						source[argc + j] = path;
+						destination[argc + j] =
+							prefix_path(dst, dst_len,
+								path + length + 1);
+						modes[argc + j] = INDEX;
+					}
+					argc += last - first;
 				}
-				argc += last - first;
 			}
 		} else if (cache_name_pos(src, length) < 0)
 			bad = _("not under version control");
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index a845b15..4c57f61 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -255,4 +255,38 @@ test_expect_success SYMLINKS 'git mv should overwrite file with a symlink' '

 rm -f moved symlink

+test_expect_success 'setup submodule' '
+	git commit -m initial &&
+	git reset --hard &&
+	git submodule add ./. sub &&
+	echo content >file &&
+	git add file &&
+	git commit -m "added sub and file"
+'
+
+test_expect_success 'git mv cannot move a submodule in a file' '
+	test_must_fail git mv sub file
+'
+
+test_expect_success 'git mv moves a submodule with a .git directory and no .gitmodules' '
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	git rm .gitmodules &&
+	(
+		cd sub &&
+		rm -f .git &&
+		cp -a ../.git/modules/sub .git &&
+		GIT_WORK_TREE=. git config --unset core.worktree
+	) &&
+	mkdir mod &&
+	git mv sub mod/sub &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
 test_done
-- 
1.8.2.377.g1bdb7d0

^ permalink raw reply related	[relevance 10%]

* [PATCH 2/2] builtin git-mv: support moving directories
@ 2006-07-26 17:47 10% Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2006-07-26 17:47 UTC (permalink / raw)
  To: Jon Smirl, git, junkio, Josef Weidendorfer


This fixes the builtin mv for the test which Josef provided, and also
fixes moving directories into existing directories, as noted by Jon Smirl.
In case the destination exists, fail early (this cannot be overridden
by -f).

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---

	Josef, this passes your test.

	Jon, if I understood your problem, then this fixes that, too.

	Everyone: it would be cleaner to use "goto next" everywhere, 
	instead of all these "if (!bad && ..." constructs, but I'll leave 
	that for other people ;-)

 builtin-mv.c  |   87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 t/t7001-mv.sh |    4 +++
 2 files changed, 86 insertions(+), 5 deletions(-)

diff --git a/builtin-mv.c b/builtin-mv.c
index 593ff9e..e660a9f 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -42,6 +42,18 @@ static void show_list(const char *label,
 	}
 }
 
+static const char *add_slash(const char *path)
+{
+	int len = strlen(path);
+	if (path[len - 1] != '/') {
+		char *with_slash = xmalloc(len + 2);
+		memcpy(with_slash, path, len);
+		strcat(with_slash + len, "/");
+		return with_slash;
+	}
+	return path;
+}
+
 static struct lock_file lock_file;
 
 int cmd_mv(int argc, const char **argv, char **envp)
@@ -50,6 +62,7 @@ int cmd_mv(int argc, const char **argv, 
 	int verbose = 0, show_only = 0, force = 0, ignore_errors = 0;
 	const char *prefix = setup_git_directory();
 	const char **source, **destination, **dest_path;
+	enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
 	struct stat st;
 	struct path_list overwritten = {NULL, 0, 0, 0};
 	struct path_list src_for_dst = {NULL, 0, 0, 0};
@@ -94,11 +107,14 @@ int cmd_mv(int argc, const char **argv, 
 		usage(builtin_mv_usage);
 
 	source = copy_pathspec(prefix, argv + i, count, 0);
+ 	modes = xcalloc(count, sizeof(enum update_mode));
 	dest_path = copy_pathspec(prefix, argv + argc - 1, 1, 0);
 
-	if (!lstat(dest_path[0], &st) && S_ISDIR(st.st_mode))
+	if (!lstat(dest_path[0], &st) &&
+			S_ISDIR(st.st_mode)) {
+ 		dest_path[0] = add_slash(dest_path[0]);
 		destination = copy_pathspec(dest_path[0], argv + i, count, 1);
-	else {
+	} else {
 		if (count != 1)
 			usage(builtin_mv_usage);
 		destination = dest_path;
@@ -114,7 +130,64 @@ int cmd_mv(int argc, const char **argv, 
 
 		if (lstat(source[i], &st) < 0)
 			bad = "bad source";
-		else if (lstat(destination[i], &st) == 0) {
+
+		if (S_ISDIR(st.st_mode)) {
+			const char *dir = source[i], *dest_dir = destination[i];
+			int first, last, len = strlen(dir);
+
+			if (lstat(dest_dir, &st) == 0) {
+				bad = "cannot move directory over file";
+				goto next;
+			}
+
+			modes[i] = WORKING_DIRECTORY;
+
+			first = cache_name_pos(source[i], len);
+			if (first >= 0)
+				die ("Huh? %s/ is in index?", dir);
+
+			first = -1 - first;
+			for (last = first; last < active_nr; last++) {
+				const char *path = active_cache[last]->name;
+				if (strncmp(path, dir, len) || path[len] != '/')
+					break;
+			}
+
+			if (last - first < 1)
+				bad = "source directory is empty";
+			else if (!bad) {
+				int j, dst_len = strlen(dest_dir);
+
+				if (last - first > 0) {
+					source = realloc(source,
+							(count + last - first)
+							* sizeof(char *));
+					destination = realloc(destination,
+							(count + last - first)
+							* sizeof(char *));
+					modes = realloc(modes,
+							(count + last - first)
+							* sizeof(enum update_mode));
+				}
+
+				dest_dir = add_slash(dest_dir);
+
+				for (j = 0; j < last - first; j++) {
+					const char *path =
+						active_cache[first + j]->name;
+					source[count + j] = path;
+					destination[count + j] =
+						prefix_path(dest_dir, dst_len,
+							path + len);
+					modes[count + j] = INDEX;
+				}
+				count += last - first;
+			}
+
+			goto next;
+		}
+
+		if (!bad && lstat(destination[i], &st) == 0) {
 			bad = "destination exists";
 			if (force) {
 				/*
@@ -147,6 +220,7 @@ int cmd_mv(int argc, const char **argv, 
 				path_list_insert(destination[i], &src_for_dst);
 		}
 
+next:
 		if (bad) {
 			if (ignore_errors) {
 				if (--count > 0) {
@@ -157,7 +231,7 @@ int cmd_mv(int argc, const char **argv, 
 						(count - i) * sizeof(char *));
 				}
 			} else
-				die ("Error: %s, source=%s, destination=%s",
+				die ("%s, source=%s, destination=%s",
 				     bad, source[i], destination[i]);
 		}
 	}
@@ -166,12 +240,15 @@ int cmd_mv(int argc, const char **argv, 
 		if (show_only || verbose)
 			printf("Renaming %s to %s\n",
 			       source[i], destination[i]);
-		if (!show_only &&
+		if (!show_only && modes[i] != INDEX &&
 		    rename(source[i], destination[i]) < 0 &&
 		    !ignore_errors)
 			die ("renaming %s failed: %s",
 			     source[i], strerror(errno));
 
+ 		if (modes[i] == WORKING_DIRECTORY)
+ 			continue;
+ 
 		if (cache_name_pos(source[i], strlen(source[i])) >= 0) {
 			path_list_insert(source[i], &deleted);
 
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 322eaad..900ca93 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -74,4 +74,8 @@ test_expect_success \
      git-diff-tree -r -M --name-status  HEAD^ HEAD | \
      grep -E "^R100.+path2/README.+path1/path2/README"'
 
+test_expect_failure \
+    'do not move directory over existing directory' \
+    'mkdir path0 && mkdir path0/path2 && git-mv path2 path0'
+
 test_done
-- 
1.4.2.rc2.g96f2-dirty

^ permalink raw reply related	[relevance 10%]

* [PATCH v3 1/5] Teach mv to move submodules together with their work trees
  2013-07-30 19:48  6% [PATCH v3 0/5] Teach mv to move submodules Jens Lehmann
@ 2013-07-30 19:49 10% ` Jens Lehmann
  2013-07-30 19:50  9% ` [PATCH v3 2/5] Teach mv to move submodules using a gitfile Jens Lehmann
  2013-07-30 19:51  8% ` [PATCH v3 4/5] Teach mv to update the path entry in .gitmodules for moved submodules Jens Lehmann
  2 siblings, 0 replies; 200+ results
From: Jens Lehmann @ 2013-07-30 19:49 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Heiko Voigt, Nguyen Thai Ngoc Duy

Currently the attempt to use "git mv" on a submodule errors out with:
  fatal: source directory is empty, source=<src>, destination=<dest>
The reason is that mv searches for the submodule with a trailing slash in
the index, which it doesn't find (because it is stored without a trailing
slash). As it doesn't find any index entries inside the submodule it
claims the directory would be empty even though it isn't.

Fix that by searching for the name without a trailing slash and continue
if it is a submodule. Then rename() will move the submodule work tree just
like it moves a file.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
 builtin/mv.c  | 99 +++++++++++++++++++++++++++++++----------------------------
 t/t7001-mv.sh | 34 ++++++++++++++++++++
 2 files changed, 86 insertions(+), 47 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 16ce99b..1d3ef63 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -118,55 +118,60 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				&& lstat(dst, &st) == 0)
 			bad = _("cannot move directory over file");
 		else if (src_is_dir) {
-			const char *src_w_slash = add_slash(src);
-			int len_w_slash = length + 1;
-			int first, last;
-
-			modes[i] = WORKING_DIRECTORY;
-
-			first = cache_name_pos(src_w_slash, len_w_slash);
-			if (first >= 0)
-				die (_("Huh? %.*s is in index?"),
-						len_w_slash, src_w_slash);
-
-			first = -1 - first;
-			for (last = first; last < active_nr; last++) {
-				const char *path = active_cache[last]->name;
-				if (strncmp(path, src_w_slash, len_w_slash))
-					break;
-			}
-			free((char *)src_w_slash);
-
-			if (last - first < 1)
-				bad = _("source directory is empty");
-			else {
-				int j, dst_len;
-
-				if (last - first > 0) {
-					source = xrealloc(source,
-							(argc + last - first)
-							* sizeof(char *));
-					destination = xrealloc(destination,
-							(argc + last - first)
-							* sizeof(char *));
-					modes = xrealloc(modes,
-							(argc + last - first)
-							* sizeof(enum update_mode));
+			int first = cache_name_pos(src, length);
+			if (first >= 0) {
+				if (!S_ISGITLINK(active_cache[first]->ce_mode))
+					die (_("Huh? Directory %s is in index and no submodule?"), src);
+			} else {
+				const char *src_w_slash = add_slash(src);
+				int last, len_w_slash = length + 1;
+
+				modes[i] = WORKING_DIRECTORY;
+
+				first = cache_name_pos(src_w_slash, len_w_slash);
+				if (first >= 0)
+					die (_("Huh? %.*s is in index?"),
+							len_w_slash, src_w_slash);
+
+				first = -1 - first;
+				for (last = first; last < active_nr; last++) {
+					const char *path = active_cache[last]->name;
+					if (strncmp(path, src_w_slash, len_w_slash))
+						break;
 				}
-
-				dst = add_slash(dst);
-				dst_len = strlen(dst);
-
-				for (j = 0; j < last - first; j++) {
-					const char *path =
-						active_cache[first + j]->name;
-					source[argc + j] = path;
-					destination[argc + j] =
-						prefix_path(dst, dst_len,
-							path + length + 1);
-					modes[argc + j] = INDEX;
+				free((char *)src_w_slash);
+
+				if (last - first < 1)
+					bad = _("source directory is empty");
+				else {
+					int j, dst_len;
+
+					if (last - first > 0) {
+						source = xrealloc(source,
+								(argc + last - first)
+								* sizeof(char *));
+						destination = xrealloc(destination,
+								(argc + last - first)
+								* sizeof(char *));
+						modes = xrealloc(modes,
+								(argc + last - first)
+								* sizeof(enum update_mode));
+					}
+
+					dst = add_slash(dst);
+					dst_len = strlen(dst);
+
+					for (j = 0; j < last - first; j++) {
+						const char *path =
+							active_cache[first + j]->name;
+						source[argc + j] = path;
+						destination[argc + j] =
+							prefix_path(dst, dst_len,
+								path + length + 1);
+						modes[argc + j] = INDEX;
+					}
+					argc += last - first;
 				}
-				argc += last - first;
 			}
 		} else if (cache_name_pos(src, length) < 0)
 			bad = _("not under version control");
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 101816e..15c18b6 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -259,4 +259,38 @@ test_expect_success SYMLINKS 'check moved symlink' '

 rm -f moved symlink

+test_expect_success 'setup submodule' '
+	git commit -m initial &&
+	git reset --hard &&
+	git submodule add ./. sub &&
+	echo content >file &&
+	git add file &&
+	git commit -m "added sub and file"
+'
+
+test_expect_success 'git mv cannot move a submodule in a file' '
+	test_must_fail git mv sub file
+'
+
+test_expect_success 'git mv moves a submodule with a .git directory and no .gitmodules' '
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	git rm .gitmodules &&
+	(
+		cd sub &&
+		rm -f .git &&
+		cp -a ../.git/modules/sub .git &&
+		GIT_WORK_TREE=. git config --unset core.worktree
+	) &&
+	mkdir mod &&
+	git mv sub mod/sub &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
 test_done
-- 
1.8.4.rc0.199.g7079aac

^ permalink raw reply related	[relevance 10%]

* [PATCH] fix `git mv existing-dir non-existing-dir`*
@ 2023-08-08 14:53 10% Sebastian Thiel via GitGitGadget
  2023-08-09  7:47  9% ` [PATCH v2] fix `git mv existing-dir non-existing-dir` in some environments Sebastian Thiel via GitGitGadget
  0 siblings, 1 reply; 200+ results
From: Sebastian Thiel via GitGitGadget @ 2023-08-08 14:53 UTC (permalink / raw)
  To: git; +Cc: Sebastian Thiel, Sebastian Thiel

From: Sebastian Thiel <sebastian.thiel@icloud.com>

*in some environments.

When moving a directory onto another with `gix mv`
various checks are performed. One of of these
validates that the destination is not an existing
file.

When calling `lstat` on the destination path and
it fails as the path doesn't exist, some
environments seem to overwrite the passed  in
`stat` memory nonetheless.
(I observed this issue on debian 12 of x86_64,
running on OrbStack on ARM, emulated with Rosetta)

This would affect the code that followed as it
would still acccess a now
modified `st` structure, which now seems to
contain uninitialized memory.
`S_ISDIR(st_dir_mode)` would then typically
return false causing the code to run into a bad
case.

The fix avoids overwriting the existing `st`
structure, providing an alternative that exists
only for that purpose.

Note that this patch minimizes complexity instead of stack-size.

Signed-off-by: Sebastian Thiel <sebastian.thiel@icloud.com>
---
    fix git mv existing-dir non-existing-dir*
    
    fix git mv existing-dir non-existing-dir*
    
    *in some environments.
    
    When moving a directory onto another with gix mv various checks are
    performed. One of of these validates that the destination is not an
    existing file.
    
    When calling lstat on the destination path and it fails as the path
    doesn't exist, some environments seem to overwrite the passed in stat
    memory nonetheless. (I observed this issue on debian 12 of x86_64,
    running on OrbStack on ARM, emulated with Rosetta)
    
    This would affect the code that followed as it would still acccess a now
    modified st structure, which now seems to contain uninitialized memory.
    S_ISDIR(st_dir_mode) would then typically return false causing the code
    to run into a bad case.
    
    The fix avoids overwriting the existing st structure, providing an
    alternative that exists only for that purpose.
    
    ------------------------------------------------------------------------
    
    It's worth pointing out that the test demonstrates this case only if one
    happens to execute it in one of the environments that happen to have an
    lstat that writes into stat even on error. Thus it already worked for me
    on MacOS, even without the patch applied, which matches my observation
    that a certain script works there but doesn't work on the VM.
    
    Even though the patch now minimizes size, I can imagine one might
    instead want to rather copy st.st_mode to protect only the relevant
    field from being affected by potential rewrites of st later on.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1561%2FByron%2Ffix-mv-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1561/Byron/fix-mv-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1561

 builtin/mv.c  | 4 ++--
 t/t7001-mv.sh | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index fa84fcb20d8..05e7156034e 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -184,7 +184,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	int src_dir_nr = 0, src_dir_alloc = 0;
 	struct strbuf a_src_dir = STRBUF_INIT;
 	enum update_mode *modes, dst_mode = 0;
-	struct stat st;
+	struct stat st, dest_st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
 	struct lock_file lock_file = LOCK_INIT;
 	struct cache_entry *ce;
@@ -304,7 +304,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			goto act_on_entry;
 		}
 		if (S_ISDIR(st.st_mode)
-		    && lstat(dst, &st) == 0) {
+		    && lstat(dst, &dest_st) == 0) {
 			bad = _("cannot move directory over file");
 			goto act_on_entry;
 		}
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 898a9205328..9894bc45ee6 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -174,6 +174,12 @@ test_expect_success 'do not move directory over existing directory' '
 	test_must_fail git mv path2 path0
 '
 
+test_expect_success 'rename directory to non-existing directory' '
+	mkdir dir-a && touch dir-a/f &&
+	git add dir-a &&
+	git mv dir-a non-existing-dir
+'
+
 test_expect_success 'move into "."' '
 	git mv path1/path2/ .
 '

base-commit: 1b0a5129563ebe720330fdc8f5c6843d27641137
-- 
gitgitgadget

^ permalink raw reply related	[relevance 10%]

* [PATCH] handle rename of case only, for windows
@ 2011-01-14 13:41 10% Tim Abell
  0 siblings, 0 replies; 200+ results
From: Tim Abell @ 2011-01-14 13:41 UTC (permalink / raw)
  To: git

Hi folks,

I've never contributed to git before so be gentle :-)

Would someone have the time to help me get this patch into mailine git?

I tripped over a failure to rename files on windows when only the case
has changed. I've created a patch which fixes it for me and doesn't seem
to break on linux or windows. I also created a test to demonstrate the
issue (part of this patch). This test passes on linux and fails on
windows before my patch for mv.c is applied, and passes on both windows
and linux for me after my patch is applied.

The problem with changing the case of a file happens because git mv
checks if the destination filename exists before performing a
move/rename, and on windows lstat reports that the destination file
*does* already exist because it ignores case for this check and
semi-erroneously finds the source file.

The way I've attempted to fix it in my patch is by checking if the inode
of the source and destination are the same before deciding to fail with
a "destination exists" error.

When using "git mv" it is possible to work around the error by using
--force.

I've also seen a problem with windows users pulling from remotes where a
case only rename has been performed which is more problematic as you
have to tell every user how to handle the issue. I'm not sure if I've
managed to fix that case or not.

The fault exists in both the current cygwin git and the current msysgit,
so I figured it would be good to get a patch to upstream (you) so that
it could work everywhere. 

I found an email from Linus relating to this issue here:
http://marc.info/?l=git&m=120612172706823 so it's a known problem.

Thanks

Tim Abell

---
 builtin/mv.c  |   33 ++++++++++++++++++++++-----------
 t/t7001-mv.sh |    9 +++++++++
 2 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 93e8995..6bb262e 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -63,6 +63,7 @@ int cmd_mv(int argc, const char **argv, const char
*prefix)
 	const char **source, **destination, **dest_path;
 	enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
 	struct stat st;
+       struct stat src_st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
 
 	git_config(git_default_config, NULL);
@@ -165,17 +166,27 @@ int cmd_mv(int argc, const char **argv, const char
*prefix)
 		} else if (cache_name_pos(src, length) < 0)
 			bad = "not under version control";
 		else if (lstat(dst, &st) == 0) {
-                       bad = "destination exists";
-                       if (force) {
-                               /*
-                                * only files can overwrite each other:
-                                * check both source and destination
-                                */
-                               if (S_ISREG(st.st_mode) ||
S_ISLNK(st.st_mode)) {
-                                       warning("%s; will overwrite!",
bad);
-                                       bad = NULL;
-                               } else
-                                       bad = "Cannot overwrite";
+                       /* If we are on a case insensitive files= system
(windows) http://is.gd/kyxgg
+                        * and we are only changing the case of the file
then lstat for the
+                        * destination will return != 0 because it sees
the source file.
+                        * To prevent this causing failure, lstat is
used to get the inode of the src
+                        * and see if it's actually the same file.
+                        */
+                       lstat(src, &src_st); //get file serial number
(inode) for source
+                       #warning("src inode: %s, dst inode: %s",
src_st.st_ino, st.st_ino);
+                       if (src_st.st_ino != st.st_ino) {
+                               bad = "destination exists";
+                               if (force) {
+                                       /*
+                                        * only files can overwrite each
other:
+                                        * check both source and
destination
+                                        */
+                                       if (S_ISREG(st.st_mode) ||
S_ISLNK(st.st_mode)) {
+                                               warning("%s; will
overwrite!", bad);
+                                               bad = NULL;
+                                       } else
+                                               bad = "Cannot
overwrite";
+                               }
 			}
 		} else if (string_list_has_string(&src_for_dst, dst))
 			bad = "multiple sources for the same target";
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index a845b15..95146bf 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -255,4 +255,13 @@ test_expect_success SYMLINKS 'git mv should
overwrite file with a symlink' '
 
 rm -f moved symlink
 
+test_expect_success 'git mv should not fail when only changing case' '
+
+       rm -fr .git &&
+       git init &&
+       >foo.txt &&
+       git add foo.txt &&
+       git mv foo.txt Foo.txt
+'
+
 test_done
-- 
1.5.6.5

^ permalink raw reply related	[relevance 10%]

* [PATCH] handle rename of case only, for windows
@ 2011-01-14 13:44 10% Tim Abell
  0 siblings, 0 replies; 200+ results
From: Tim Abell @ 2011-01-14 13:44 UTC (permalink / raw)
  To: git

Hi folks,

I've never contributed to git before so be gentle :-)

Would someone have the time to help me get this patch into mailine git?

I tripped over a failure to rename files on windows when only the case
has changed. I've created a patch which fixes it for me and doesn't seem
to break on linux or windows. I also created a test to demonstrate the
issue (part of this patch). This test passes on linux and fails on
windows before my patch for mv.c is applied, and passes on both windows
and linux for me after my patch is applied.

The problem with changing the case of a file happens because git mv
checks if the destination filename exists before performing a
move/rename, and on windows lstat reports that the destination file
*does* already exist because it ignores case for this check and
semi-erroneously finds the source file.

The way I've attempted to fix it in my patch is by checking if the inode
of the source and destination are the same before deciding to fail with
a "destination exists" error.

When using "git mv" it is possible to work around the error by using
--force.

I've also seen a problem with windows users pulling from remotes where a
case only rename has been performed which is more problematic as you
have to tell every user how to handle the issue. I'm not sure if I've
managed to fix that case or not.

The fault exists in both the current cygwin git and the current msysgit,
so I figured it would be good to get a patch to upstream (you) so that
it could work everywhere. 

I found an email from Linus relating to this issue here:
http://marc.info/?l=git&m=120612172706823 so it's a known problem.

Thanks

Tim Abell

---
 builtin/mv.c  |   33 ++++++++++++++++++++++-----------
 t/t7001-mv.sh |    9 +++++++++
 2 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 93e8995..6bb262e 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -63,6 +63,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	const char **source, **destination, **dest_path;
 	enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
 	struct stat st;
+	struct stat src_st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
 
 	git_config(git_default_config, NULL);
@@ -165,17 +166,27 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		} else if (cache_name_pos(src, length) < 0)
 			bad = "not under version control";
 		else if (lstat(dst, &st) == 0) {
-			bad = "destination exists";
-			if (force) {
-				/*
-				 * only files can overwrite each other:
-				 * check both source and destination
-				 */
-				if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
-					warning("%s; will overwrite!", bad);
-					bad = NULL;
-				} else
-					bad = "Cannot overwrite";
+			/* If we are on a case insensitive files= system (windows) http://is.gd/kyxgg
+			 * and we are only changing the case of the file then lstat for the
+			 * destination will return != 0 because it sees the source file.
+			 * To prevent this causing failure, lstat is used to get the inode of the src
+			 * and see if it's actually the same file.
+			 */
+			lstat(src, &src_st); //get file serial number (inode) for source
+			#warning("src inode: %s, dst inode: %s", src_st.st_ino, st.st_ino);
+			if (src_st.st_ino != st.st_ino) {
+				bad = "destination exists";
+				if (force) {
+					/*
+					 * only files can overwrite each other:
+					 * check both source and destination
+					 */
+					if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
+						warning("%s; will overwrite!", bad);
+						bad = NULL;
+					} else
+						bad = "Cannot overwrite";
+				}
 			}
 		} else if (string_list_has_string(&src_for_dst, dst))
 			bad = "multiple sources for the same target";
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index a845b15..95146bf 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -255,4 +255,13 @@ test_expect_success SYMLINKS 'git mv should overwrite file with a symlink' '
 
 rm -f moved symlink
 
+test_expect_success 'git mv should not fail when only changing case' '
+
+	rm -fr .git &&
+	git init &&
+	>foo.txt &&
+	git add foo.txt &&
+	git mv foo.txt Foo.txt
+'
+
 test_done
-- 
1.5.6.5

^ permalink raw reply related	[relevance 10%]

* [PATCH 01/25] mv test: recreate mod/ directory instead of relying on stale copy
  @ 2014-10-15  0:46 10% ` Jonathan Nieder
  0 siblings, 0 replies; 200+ results
From: Jonathan Nieder @ 2014-10-15  0:46 UTC (permalink / raw)
  To: Michael Haggerty; +Cc: git, Ronnie Sahlberg, Junio C Hamano

From: Jonathan Nieder <jrnieder@gmail.com>
Date: Wed, 10 Sep 2014 14:01:46 -0700

The tests for 'git mv moves a submodule' functionality often run
commands like

	git mv sub mod/sub

to move a submodule into a subdirectory.  Just like plain /bin/mv,
this is supposed to succeed if the mod/ parent directory exists
and fail if it doesn't exist.

Usually these tests mkdir the parent directory beforehand, but some
instead rely on it being left behind by previous tests.

More precisely, when 'git reset --hard' tries to move to a state where
mod/sub is not present any more, it would perform the following
operations:

	rmdir("mod/sub")
	rmdir("mod")

The first fails with ENOENT because the test script removed mod/sub
with "rm -rf" already, so 'reset --hard' doesn't bother to move on to
the second, and the mod/ directory is kept around.

Better to explicitly remove and re-create the mod/ directory so later
tests don't have to depend on the directory left behind by the earlier
ones at all (making it easier to rearrange or skip some tests in the
file or to tweak 'reset --hard' behavior without breaking unrelated
tests).

Noticed while testing a patch that fixes the reset --hard behavior
described above.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Ronnie Sahlberg <sahlberg@google.com>
---
 t/t7001-mv.sh | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 54d7807..69f11bd 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -350,10 +350,11 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 '
 
 test_expect_success 'git mv moves a submodule with gitfile' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	mkdir mod &&
 	(
 		cd mod &&
 		git mv ../sub/ .
@@ -372,11 +373,12 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 '
 
 test_expect_success 'mv does not complain when no .gitmodules file is found' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	git rm .gitmodules &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	! test -s actual.err &&
 	! test -e sub &&
@@ -390,11 +392,12 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 '
 
 test_expect_success 'mv will error out on a modified .gitmodules file unless staged' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	git config -f .gitmodules foo.bar true &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	mkdir mod &&
 	test_must_fail git mv sub mod/sub 2>actual.err &&
 	test -s actual.err &&
 	test -e sub &&
@@ -413,13 +416,14 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 '
 
 test_expect_success 'mv issues a warning when section is not found in .gitmodules' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	git config -f .gitmodules --remove-section submodule.sub &&
 	git add .gitmodules &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	echo "warning: Could not find section in .gitmodules where path=sub" >expect.err &&
+	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	test_i18ncmp expect.err actual.err &&
 	! test -e sub &&
@@ -433,9 +437,10 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 '
 
 test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
+	mkdir mod &&
 	git mv -n sub mod/sub 2>actual.err &&
 	test -f sub/.git &&
 	git diff-index --exit-code HEAD &&
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[relevance 10%]

* [PATCH 01/24] mv test: recreate mod/ directory instead of relying on stale copy
  @ 2014-10-02  1:50 10%             ` Jonathan Nieder
  0 siblings, 0 replies; 200+ results
From: Jonathan Nieder @ 2014-10-02  1:50 UTC (permalink / raw)
  To: Ronnie Sahlberg; +Cc: git@vger.kernel.org, Michael Haggerty

Date: Wed, 10 Sep 2014 14:01:46 -0700

The tests for 'git mv moves a submodule' functionality often run
commands like

	git mv sub mod/sub

to move a submodule into a subdirectory.  Just like plain /bin/mv,
this is supposed to succeed if the mod/ parent directory exists
and fail if it doesn't exist.

Usually these tests mkdir the parent directory beforehand, but some
instead rely on it being left behind by previous tests.

More precisely, when 'git reset --hard' tries to move to a state where
mod/sub is not present any more, it would perform the following
operations:

	rmdir("mod/sub")
	rmdir("mod")

The first fails with ENOENT because the test script removed mod/sub
with "rm -rf" already, so 'reset --hard' doesn't bother to move on to
the second, and the mod/ directory is kept around.

Better to explicitly remove and re-create the mod/ directory so later
tests don't have to depend on the directory left behind by the earlier
ones at all (making it easier to rearrange or skip some tests in the
file or to tweak 'reset --hard' behavior without breaking unrelated
tests).

Noticed while testing a patch that fixes the reset --hard behavior
described above.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Ronnie Sahlberg <sahlberg@google.com>
---
As before.

 t/t7001-mv.sh | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 54d7807..69f11bd 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -350,10 +350,11 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 '
 
 test_expect_success 'git mv moves a submodule with gitfile' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	mkdir mod &&
 	(
 		cd mod &&
 		git mv ../sub/ .
@@ -372,11 +373,12 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 '
 
 test_expect_success 'mv does not complain when no .gitmodules file is found' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	git rm .gitmodules &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	! test -s actual.err &&
 	! test -e sub &&
@@ -390,11 +392,12 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 '
 
 test_expect_success 'mv will error out on a modified .gitmodules file unless staged' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	git config -f .gitmodules foo.bar true &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	mkdir mod &&
 	test_must_fail git mv sub mod/sub 2>actual.err &&
 	test -s actual.err &&
 	test -e sub &&
@@ -413,13 +416,14 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 '
 
 test_expect_success 'mv issues a warning when section is not found in .gitmodules' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	git config -f .gitmodules --remove-section submodule.sub &&
 	git add .gitmodules &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	echo "warning: Could not find section in .gitmodules where path=sub" >expect.err &&
+	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	test_i18ncmp expect.err actual.err &&
 	! test -e sub &&
@@ -433,9 +437,10 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 '
 
 test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
+	mkdir mod &&
 	git mv -n sub mod/sub 2>actual.err &&
 	test -f sub/.git &&
 	git diff-index --exit-code HEAD &&
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[relevance 10%]

* [PATCH 01/19] mv test: recreate mod/ directory instead of relying on stale copy
  @ 2014-09-11  3:04 10%           ` Jonathan Nieder
    1 sibling, 0 replies; 200+ results
From: Jonathan Nieder @ 2014-09-11  3:04 UTC (permalink / raw)
  To: Ronnie Sahlberg; +Cc: git@vger.kernel.org, Michael Haggerty

The tests for 'git mv moves a submodule' functionality often run
commands like

	git mv sub mod/sub

to move a submodule into a subdirectory.  Just like plain /bin/mv,
this is supposed to succeed if the mod/ parent directory exists
and fail if it doesn't exist.

Usually these tests mkdir the parent directory beforehand, but some
instead rely on it being left behind by previous tests.

More precisely, when 'git reset --hard' tries to move to a state where
mod/sub is not present any more, it would perform the following
operations:

	rmdir("mod/sub")
	rmdir("mod")

The first fails with ENOENT because the test script removed mod/sub
with "rm -rf" already, so 'reset --hard' doesn't bother to move on to
the second, and the mod/ directory is kept around.

Better to explicitly remove and re-create the mod/ directory so later
tests don't have to depend on the directory left behind by the earlier
ones at all (making it easier to rearrange or skip some tests in the
file or to tweak 'reset --hard' behavior without breaking unrelated
tests).

Noticed while testing a patch that fixes the reset --hard behavior
described above.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Ronnie Sahlberg <sahlberg@google.com>
---
 t/t7001-mv.sh | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 54d7807..69f11bd 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -350,10 +350,11 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 '
 
 test_expect_success 'git mv moves a submodule with gitfile' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	mkdir mod &&
 	(
 		cd mod &&
 		git mv ../sub/ .
@@ -372,11 +373,12 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 '
 
 test_expect_success 'mv does not complain when no .gitmodules file is found' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	git rm .gitmodules &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	! test -s actual.err &&
 	! test -e sub &&
@@ -390,11 +392,12 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 '
 
 test_expect_success 'mv will error out on a modified .gitmodules file unless staged' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	git config -f .gitmodules foo.bar true &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	mkdir mod &&
 	test_must_fail git mv sub mod/sub 2>actual.err &&
 	test -s actual.err &&
 	test -e sub &&
@@ -413,13 +416,14 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 '
 
 test_expect_success 'mv issues a warning when section is not found in .gitmodules' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
 	git config -f .gitmodules --remove-section submodule.sub &&
 	git add .gitmodules &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	echo "warning: Could not find section in .gitmodules where path=sub" >expect.err &&
+	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	test_i18ncmp expect.err actual.err &&
 	! test -e sub &&
@@ -433,9 +437,10 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 '
 
 test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
-	rm -rf mod/sub &&
+	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
+	mkdir mod &&
 	git mv -n sub mod/sub 2>actual.err &&
 	test -f sub/.git &&
 	git diff-index --exit-code HEAD &&
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[relevance 10%]

* Re: [PATCH] t7001-mv.sh:modernizing test script using function
  2022-10-30 17:20 13% [PATCH] t7001-mv.sh:modernizing test script using function Debra Obondo via GitGitGadget
  2022-11-03 18:39 13% ` [PATCH v2] t7001-mv.sh: modernizing test script using functions Debra Obondo via GitGitGadget
@ 2022-10-31 18:04 10% ` Martin Ågren
  2022-11-01  1:14  6%   ` Taylor Blau
  2022-10-30 18:00  6% ` Taylor Blau
  2 siblings, 1 reply; 200+ results
From: Martin Ågren @ 2022-10-31 18:04 UTC (permalink / raw)
  To: Debra Obondo via GitGitGadget; +Cc: Git Mailing List, Debra Obondo

Hi Debra,

On Sun, 30 Oct 2022 at 18:35, Debra Obondo via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Debra Obondo <debraobondo@gmail.com>
>
> Test script to verify the presence/absence of files, paths, directories,
> symlinks and other features in 'git mv' command are using the command
> format:
>
> 'test (-e|f|d|h|...)'
>
> Replace them with helper functions of format:
>
> 'test_path_is_*'

This is a good idea.

The subject of this patch could use a space after the colon. You could
also write "modernize" to give an order to the code base. So something
like

  t7001-mv.sh: modernize test script using function

perhaps. "Function" is a bit vague, perhaps.

I wanted to comment on this:

>  test_expect_success 'mv --dry-run does not move file' '
>         git mv -n path0/COPYING MOVED &&
> -       test -f path0/COPYING &&
> -       test ! -f MOVED
> +       test_path_is_file path0/COPYING &&
> +       ! test_path_is_file MOVED
>  '

It is my understanding that we prefer to only use such a helper when we
really expect the file to exist. If the path is not a file, this helper
prints a helpful message before returning with an error.

Here, this means we will emit this 'helpful'

  File MOVED doesn't exist

on every test run, when really everything is as it should. And if the
file is actually there, i.e., we have a bug, we'll emit nothing -- but
that is precisely when we would want some diagnostics such as

  Path exists:
  ... MOVED ...

to show us that the file actually exists, contrary to the test's
expectations.

Such output is precisely what `test_path_is_missing` would give us. :-)

My gut feeling is that where this patch adds "! test_path_foo", it
should use "test_path_bar" instead, for various values of "foo" and
"bar". What do you think about that?


Martin

^ permalink raw reply	[relevance 10%]

* [PATCH] git-mv: improve error message for conflicted file
@ 2020-07-17 23:24 10% Chris Torek via GitGitGadget
  2020-07-20  6:17 10% ` [PATCH v2] " Chris Torek via GitGitGadget
  0 siblings, 1 reply; 200+ results
From: Chris Torek via GitGitGadget @ 2020-07-17 23:24 UTC (permalink / raw)
  To: git; +Cc: Chris Torek, Chris Torek

From: Chris Torek <chris.torek@gmail.com>

'git mv' has always complained about renaming a conflicted
file, as it cannot handle multiple index entries for one file.
However, the error message it uses has been the same as the
one for an untracked file:

    fatal: not under version control, src=...

which is patently wrong.  Distinguish the two cases and
add a test to make sure we produce the correct message.

Signed-off-by: Chris Torek <chris.torek@gmail.com>
---
    git-mv: improve error message for conflicted file
    
    'git mv' has always complained about renaming a conflicted file, as it
    cannot handle multiple index entries for one file. However, the error
    message it uses has been the same as the one for an untracked file:
    
    fatal: not under version control, src=...
    
    which is patently wrong. Distinguish the two cases and add a test to
    make sure we produce the correct message.
    
    Signed-off-by: Chris Torek chris.torek@gmail.com [chris.torek@gmail.com]
    
    
    ------------------------------------------------------------------------
    
    A small note on the test: I originally had a different message text, so
    the grep is slightly more general than necessary here. This leaves room
    for a better message, though; I'm not sure mine is that great.
    
    The error messages in general from 'git mv' could probably stand a lot
    of cleanup. This is just a minimal fix for some particularly bad
    behavior.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-678%2Fchris3torek%2Fgit-mv-message-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-678/chris3torek/git-mv-message-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/678

 builtin/mv.c  | 15 ++++++++++++---
 t/t7001-mv.sh | 18 ++++++++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index be15ba7044..7dff121629 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -220,9 +220,18 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				}
 				argc += last - first;
 			}
-		} else if (cache_name_pos(src, length) < 0)
-			bad = _("not under version control");
-		else if (lstat(dst, &st) == 0 &&
+		} else if (cache_name_pos(src, length) < 0) {
+			/*
+			 * This occurs for both untracked files *and*
+			 * files that are in merge-conflict state, so
+			 * let's distinguish between those two.
+			 */
+			struct cache_entry *ce = cache_file_exists(src, length, ignore_case);
+			if (ce == NULL)
+				bad = _("not under version control");
+			else
+				bad = _("must resolve merge conflict first");
+		} else if (lstat(dst, &st) == 0 &&
 			 (!ignore_case || strcasecmp(src, dst))) {
 			bad = _("destination exists");
 			if (force) {
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 36b50d0b4c..b4974f9385 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -248,6 +248,24 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 
 rm -f dirty dirty2
 
+# NB: This test is about the error message
+# as well as the failure.
+test_expect_success 'git mv error on conflicted file' '
+	rm -fr .git &&
+	git init &&
+	touch conflicted &&
+	cfhash=$(git hash-object -w conflicted) &&
+	git update-index --index-info <<-EOF &&
+	$(printf "0 $cfhash 0\tconflicted\n")
+	$(printf "100644 $cfhash 1\tconflicted\n")
+	EOF
+
+	test_must_fail git mv conflicted newname 2>actual &&
+	test_i18ngrep "merge.conflict" actual
+'
+
+rm -f conflicted
+
 test_expect_success 'git mv should overwrite symlink to a file' '
 
 	rm -fr .git &&

base-commit: b6a658bd00c9c29e07f833cabfc0ef12224e277a
-- 
gitgitgadget

^ permalink raw reply related	[relevance 10%]

* [PATCH v2] mv: let 'git mv file no-such-dir/' error out
  @ 2013-12-04 17:37 10% ` Matthieu Moy
  0 siblings, 0 replies; 200+ results
From: Matthieu Moy @ 2013-12-04 17:37 UTC (permalink / raw)
  To: git, gitster; +Cc: Duy Nguyen, Matthieu Moy

Git used to trim the trailing slash, and make the command equivalent to
'git mv file no-such-dir', which created the file no-such-dir (while the
trailing slash explicitly stated that it could only be a directory).

This patch skips the trailing slash removal for the destination path. The
path with its trailing slash is passed to rename(2), which errors out
with the appropriate message:

  $ git mv file no-such-dir/
  fatal: renaming 'file' failed: Not a directory

Original-patch-by: Duy Nguyen <pclouds@gmail.com>
Tests, tweaks and commit message by: Matthieu Moy <Matthieu.Moy@imag.fr>

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
So, this patch adds more tests, as suggested by Duy. They all pass
without modifying the code.

 builtin/mv.c  | 23 ++++++++++++++++-------
 t/t7001-mv.sh | 29 +++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 2e0e61b..08fbc03 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -16,9 +16,12 @@ static const char * const builtin_mv_usage[] = {
 	NULL
 };
 
+#define DUP_BASENAME 1
+#define KEEP_TRAILING_SLASH 2
+
 static const char **internal_copy_pathspec(const char *prefix,
 					   const char **pathspec,
-					   int count, int base_name)
+					   int count, unsigned flags)
 {
 	int i;
 	const char **result = xmalloc((count + 1) * sizeof(const char *));
@@ -27,11 +30,12 @@ static const char **internal_copy_pathspec(const char *prefix,
 	for (i = 0; i < count; i++) {
 		int length = strlen(result[i]);
 		int to_copy = length;
-		while (to_copy > 0 && is_dir_sep(result[i][to_copy - 1]))
+		while (!(flags & KEEP_TRAILING_SLASH) &&
+		       to_copy > 0 && is_dir_sep(result[i][to_copy - 1]))
 			to_copy--;
-		if (to_copy != length || base_name) {
+		if (to_copy != length || flags & DUP_BASENAME) {
 			char *it = xmemdupz(result[i], to_copy);
-			if (base_name) {
+			if (flags & DUP_BASENAME) {
 				result[i] = xstrdup(basename(it));
 				free(it);
 			} else
@@ -87,16 +91,21 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 	source = internal_copy_pathspec(prefix, argv, argc, 0);
 	modes = xcalloc(argc, sizeof(enum update_mode));
-	dest_path = internal_copy_pathspec(prefix, argv + argc, 1, 0);
+	/*
+	 * Keep trailing slash, needed to let
+	 * "git mv file no-such-dir/" error out.
+	 */
+	dest_path = internal_copy_pathspec(prefix, argv + argc, 1,
+					   KEEP_TRAILING_SLASH);
 	submodule_gitfile = xcalloc(argc, sizeof(char *));
 
 	if (dest_path[0][0] == '\0')
 		/* special case: "." was normalized to "" */
-		destination = internal_copy_pathspec(dest_path[0], argv, argc, 1);
+		destination = internal_copy_pathspec(dest_path[0], argv, argc, DUP_BASENAME);
 	else if (!lstat(dest_path[0], &st) &&
 			S_ISDIR(st.st_mode)) {
 		dest_path[0] = add_slash(dest_path[0]);
-		destination = internal_copy_pathspec(dest_path[0], argv, argc, 1);
+		destination = internal_copy_pathspec(dest_path[0], argv, argc, DUP_BASENAME);
 	} else {
 		if (argc != 1)
 			die("destination '%s' is not a directory", dest_path[0]);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b90e985..2f82478 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -70,6 +70,35 @@ test_expect_success \
 rm -f idontexist untracked1 untracked2 \
      path0/idontexist path0/untracked1 path0/untracked2 \
      .git/index.lock
+rmdir path1
+
+test_expect_success \
+    'moving to absent target with trailing slash' \
+    'test_must_fail git mv path0/COPYING no-such-dir/ &&
+     test_must_fail git mv path0/COPYING no-such-dir// &&
+     git mv path0/ no-such-dir/ &&
+     test_path_is_dir no-such-dir/'
+
+test_expect_success \
+    'clean up' \
+    'git reset --hard'
+
+test_expect_success \
+    'moving to existing untracked target with trailing slash' \
+    'mkdir path1 &&
+     git mv path0/ path1/ &&
+     test_path_is_dir path1/path0/'
+
+test_expect_success \
+    'moving to existing tracked target with trailing slash' \
+    'mkdir path2 &&
+     >path2/file && git add path2/file &&
+     git mv path1/path0/ path2/ &&
+     test_path_is_dir path2/path0/'
+
+test_expect_success \
+    'clean up' \
+    'git reset --hard'
 
 test_expect_success \
     'adding another file' \
-- 
1.8.5.rc3.4.g8bd3721

^ permalink raw reply related	[relevance 10%]

* [PATCH 06/25] t: use verbose instead of hand-rolled errors
  @ 2015-03-20 10:09 10% ` Jeff King
  0 siblings, 0 replies; 200+ results
From: Jeff King @ 2015-03-20 10:09 UTC (permalink / raw)
  To: git

Many tests that predate the "verbose" helper function use a
pattern like:

  test ... || {
	  echo ...
	  false
  }

to give more verbose output. Using the helper, we can do
this with a single line, and avoid a || which interacts
badly with &&-chaining (besides fooling --chain-lint, we hit
the error block no matter which command in the chain failed,
so we may often show useless results).

In most cases, the messages printed by "verbose" are equally
good (in some cases better; t6006 accidentally redirects the
message to a file!). The exception is t7001, whose output
suffers slightly. However, it's still enough to show the
user which part failed, given that we will have just printed
the test script to stderr.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t4022-diff-rewrite.sh    |  5 +----
 t/t4202-log.sh             | 30 +++++-------------------------
 t/t6006-rev-list-format.sh |  5 +----
 t/t7001-mv.sh              |  5 +----
 t/t7300-clean.sh           | 10 ++--------
 5 files changed, 10 insertions(+), 45 deletions(-)

diff --git a/t/t4022-diff-rewrite.sh b/t/t4022-diff-rewrite.sh
index 2d030a4..cb51d9f 100755
--- a/t/t4022-diff-rewrite.sh
+++ b/t/t4022-diff-rewrite.sh
@@ -20,10 +20,7 @@ test_expect_success setup '
 test_expect_success 'detect rewrite' '
 
 	actual=$(git diff-files -B --summary test) &&
-	expr "$actual" : " rewrite test ([0-9]*%)$" || {
-		echo "Eh? <<$actual>>"
-		false
-	}
+	verbose expr "$actual" : " rewrite test ([0-9]*%)$"
 
 '
 
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index a22ac7c..85230a8 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -113,11 +113,7 @@ test_expect_success 'diff-filter=M' '
 
 	actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
 	expect=$(echo second) &&
-	test "$actual" = "$expect" || {
-		echo Oops
-		echo "Actual: $actual"
-		false
-	}
+	verbose test "$actual" = "$expect"
 
 '
 
@@ -125,11 +121,7 @@ test_expect_success 'diff-filter=D' '
 
 	actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
 	expect=$(echo sixth ; echo third) &&
-	test "$actual" = "$expect" || {
-		echo Oops
-		echo "Actual: $actual"
-		false
-	}
+	verbose test "$actual" = "$expect"
 
 '
 
@@ -137,11 +129,7 @@ test_expect_success 'diff-filter=R' '
 
 	actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
 	expect=$(echo third) &&
-	test "$actual" = "$expect" || {
-		echo Oops
-		echo "Actual: $actual"
-		false
-	}
+	verbose test "$actual" = "$expect"
 
 '
 
@@ -149,11 +137,7 @@ test_expect_success 'diff-filter=C' '
 
 	actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
 	expect=$(echo fourth) &&
-	test "$actual" = "$expect" || {
-		echo Oops
-		echo "Actual: $actual"
-		false
-	}
+	verbose test "$actual" = "$expect"
 
 '
 
@@ -161,11 +145,7 @@ test_expect_success 'git log --follow' '
 
 	actual=$(git log --follow --pretty="format:%s" ichi) &&
 	expect=$(echo third ; echo second ; echo initial) &&
-	test "$actual" = "$expect" || {
-		echo Oops
-		echo "Actual: $actual"
-		false
-	}
+	verbose test "$actual" = "$expect"
 
 '
 
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index 2b7c0f0..b77d4c9 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -358,10 +358,7 @@ test_expect_success 'empty email' '
 	test_tick &&
 	C=$(GIT_AUTHOR_EMAIL= git commit-tree HEAD^{tree} </dev/null) &&
 	A=$(git show --pretty=format:%an,%ae,%ad%n -s $C) &&
-	test "$A" = "A U Thor,,Thu Apr 7 15:14:13 2005 -0700" || {
-		echo "Eh? $A" >failure
-		false
-	}
+	verbose test "$A" = "A U Thor,,Thu Apr 7 15:14:13 2005 -0700"
 '
 
 test_expect_success 'del LF before empty (1)' '
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 69f11bd..7b56081 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -161,10 +161,7 @@ test_expect_success "Michael Cassar's test case" '
 	git mv papers/unsorted/Thesis.pdf papers/all-papers/moo-blah.pdf &&
 
 	T=`git write-tree` &&
-	git ls-tree -r $T | grep partA/outline.txt || {
-		git ls-tree -r $T
-		(exit 1)
-	}
+	git ls-tree -r $T | verbose grep partA/outline.txt
 '
 
 rm -fr papers partA path?
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 04118ad..99be5d9 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -119,10 +119,7 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with relative prefix' '
 		git clean -n ../src |
 		sed -n -e "s|^Would remove ||p"
 	) &&
-	test "$would_clean" = ../src/part3.c || {
-		echo "OOps <$would_clean>"
-		false
-	}
+	verbose test "$would_clean" = ../src/part3.c
 '
 
 test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' '
@@ -134,10 +131,7 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' '
 		git clean -n "$(pwd)/../src" |
 		sed -n -e "s|^Would remove ||p"
 	) &&
-	test "$would_clean" = ../src/part3.c || {
-		echo "OOps <$would_clean>"
-		false
-	}
+	verbose test "$would_clean" = ../src/part3.c
 '
 
 test_expect_success 'git clean with out of work tree relative path' '
-- 
2.3.3.520.g3cfbb5d

^ permalink raw reply related	[relevance 10%]

* Re: [PATCH 06/11] t7001: change (cd <path> && git foo) to (git -C <path> foo)
  2020-09-25 17:02 15% ` [PATCH 06/11] t7001: change (cd <path> && git foo) to (git -C <path> foo) shubham verma
@ 2020-09-25 18:53 11%   ` Eric Sunshine
  0 siblings, 0 replies; 200+ results
From: Eric Sunshine @ 2020-09-25 18:53 UTC (permalink / raw)
  To: shubham verma; +Cc: Git List

On Fri, Sep 25, 2020 at 1:03 PM shubham verma <shubhunic@gmail.com> wrote:
> t7001: change (cd <path> && git foo) to (git -C <path> foo)

This is misleading. We don't want the `git -C` form in a subshell, so
it shouldn't be enclosed in parentheses. Perhaps write it like this:

    t7001 use `git -C` to avoid `cd` outside of subshells

> Let's avoid the use of `cd` outside subshells by encapsulating them
> inside subshells or by using `git -C <dir> ...`.

This is misleading in two ways. First, none of the changes made by
this patch add subshell encapsulation. Second, many of the changes
drop the subhsell in favor of `git -C`, so describing them as "`cd`
outside of subshells" is wrong.

It's also important for the commit message to explain _why_ this
change is important when `cd` is used outside of a subshell. A
possible rewrite might be:

    t7001: avoid using `cd` outside of subshells

    Avoid using `cd` outside of subshells since, if the test fails,
    there is no guarantee that the current working directory is the
    expected one, which may cause subsequent tests to run in the wrong
    directory.

    While at it, make some other tests more concise by replacing
    simple subshells with `git -C`.

In fact, fixing the cases in which `cd` is used outside of a subshell
is much more important than the mere mechanical conversion made to the
other tests by replacing a subshell with `git -C`. As such, I'm
tempted to suggest splitting this patch into two: one which fixes the
cases of `cd` outside of subshell, and another which converts the
simple subshell cases to use `git -C`.

> Signed-off-by: shubham verma <shubhunic@gmail.com>
> ---
> diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
> @@ -11,12 +11,11 @@ test_expect_success 'prepare reference tree' '
>  test_expect_success 'moving the file out of subdirectory' '
> -       cd path0 && git mv COPYING ../path1/COPYING
> +       git -C path0 mv COPYING ../path1/COPYING
>  '
>
> -# in path0 currently
>  test_expect_success 'commiting the change' '
> -       cd .. && git commit -m move-out -a
> +       git commit -m move-out -a
>  '

This transformation looks fine, as do the following two tests which
get the same transformation.

I do have a very slight hesitation, though, that these changes go
against the grain of the tests. In particular, at the top of this
script, we see:

    test_description='git mv in subdirs'

which suggests that the tests really want to test the bare `git mv`
command while actually running in a subdirectory. This would imply
that these test should be rewritten as:

    test_expect_success 'title' '
        (
            cd path0 &&
            ...
        )
    '

However, it's such a minor misgiving that it's probably not worth considering.

> @@ -364,16 +356,10 @@ test_expect_success 'git mv moves a submodule with gitfile' '
> -       (
> -               cd mod &&
> -               git mv ../sub/ .
> -       ) &&
> +       git -C mod mv ../sub/ . &&

Okay. At first glance one might expect you to strip the `../` from the
argument, but indeed `../sub/` is correct since `-C mod` really does
change to the new directory, so the argument is interpreted relative
to `mod`.

^ permalink raw reply	[relevance 11%]

* [PATCH v2 21/21] builtin/mv: fix leaks for submodule gitfile paths
  @ 2024-05-24 10:04 11%   ` Patrick Steinhardt
  0 siblings, 0 replies; 200+ results
From: Patrick Steinhardt @ 2024-05-24 10:04 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 7494 bytes --]

Similar to the preceding commit, we have effectively given tracking
memory ownership of submodule gitfile paths. Refactor the code to start
tracking allocated strings in a separate `struct strvec` such that we
can easily plug those leaks. Mark now-passing tests as leak free.

Note that ideally, we wouldn't require two separate data structures to
track those paths. But we do need to store `NULL` pointers for the
gitfile paths such that we can indicate that its corresponding entries
in the other arrays do not have such a path at all. And given that
`struct strvec`s cannot store `NULL` pointers we cannot use them to
store this information.

There is another small gotcha that is easy to miss: you may be wondering
why we don't want to store `SUBMODULE_WITH_GITDIR` in the strvec. This
is because this is a mere sentinel value and not actually a string at
all.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 builtin/mv.c                              | 44 +++++++++++++----------
 t/t4059-diff-submodule-not-initialized.sh |  1 +
 t/t7001-mv.sh                             |  2 ++
 t/t7417-submodule-path-url.sh             |  1 +
 t/t7421-submodule-summary-add.sh          |  1 +
 5 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index e461d29ca1..81ca910de6 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -82,21 +82,23 @@ static char *add_slash(const char *path)
 
 #define SUBMODULE_WITH_GITDIR ((const char *)1)
 
-static void prepare_move_submodule(const char *src, int first,
-				   const char **submodule_gitfile)
+static const char *submodule_gitfile_path(const char *src, int first)
 {
 	struct strbuf submodule_dotgit = STRBUF_INIT;
+	const char *path;
+
 	if (!S_ISGITLINK(the_repository->index->cache[first]->ce_mode))
 		die(_("Directory %s is in index and no submodule?"), src);
 	if (!is_staging_gitmodules_ok(the_repository->index))
 		die(_("Please stage your changes to .gitmodules or stash them to proceed"));
+
 	strbuf_addf(&submodule_dotgit, "%s/.git", src);
-	*submodule_gitfile = read_gitfile(submodule_dotgit.buf);
-	if (*submodule_gitfile)
-		*submodule_gitfile = xstrdup(*submodule_gitfile);
-	else
-		*submodule_gitfile = SUBMODULE_WITH_GITDIR;
+
+	path = read_gitfile(submodule_dotgit.buf);
 	strbuf_release(&submodule_dotgit);
+	if (path)
+		return path;
+	return SUBMODULE_WITH_GITDIR;
 }
 
 static int index_range_of_same_dir(const char *src, int length,
@@ -170,7 +172,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	struct strvec sources = STRVEC_INIT;
 	struct strvec dest_paths = STRVEC_INIT;
 	struct strvec destinations = STRVEC_INIT;
-	const char **submodule_gitfile;
+	struct strvec submodule_gitfiles_to_free = STRVEC_INIT;
+	const char **submodule_gitfiles;
 	char *dst_w_slash = NULL;
 	const char **src_dir = NULL;
 	int src_dir_nr = 0, src_dir_alloc = 0;
@@ -208,7 +211,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		flags = 0;
 	internal_prefix_pathspec(&dest_paths, prefix, argv + argc, 1, flags);
 	dst_w_slash = add_slash(dest_paths.v[0]);
-	submodule_gitfile = xcalloc(argc, sizeof(char *));
+	submodule_gitfiles = xcalloc(argc, sizeof(char *));
 
 	if (dest_paths.v[0][0] == '\0')
 		/* special case: "." was normalized to "" */
@@ -306,8 +309,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			int first = index_name_pos(the_repository->index, src, length), last;
 
 			if (first >= 0) {
-				prepare_move_submodule(src, first,
-						       submodule_gitfile + i);
+				const char *path = submodule_gitfile_path(src, first);
+				if (path != SUBMODULE_WITH_GITDIR)
+					path = strvec_push(&submodule_gitfiles_to_free, path);
+				submodule_gitfiles[i] = path;
 				goto act_on_entry;
 			} else if (index_range_of_same_dir(src, length,
 							   &first, &last) < 1) {
@@ -323,7 +328,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 			n = argc + last - first;
 			REALLOC_ARRAY(modes, n);
-			REALLOC_ARRAY(submodule_gitfile, n);
+			REALLOC_ARRAY(submodule_gitfiles, n);
 
 			dst_with_slash = add_slash(dst);
 			dst_with_slash_len = strlen(dst_with_slash);
@@ -338,7 +343,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 				memset(modes + argc + j, 0, sizeof(enum update_mode));
 				modes[argc + j] |= ce_skip_worktree(ce) ? SPARSE : INDEX;
-				submodule_gitfile[argc + j] = NULL;
+				submodule_gitfiles[argc + j] = NULL;
 
 				free(prefixed_path);
 			}
@@ -427,8 +432,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			strvec_remove(&sources, i);
 			strvec_remove(&destinations, i);
 			MOVE_ARRAY(modes + i, modes + i + 1, n);
-			MOVE_ARRAY(submodule_gitfile + i,
-				   submodule_gitfile + i + 1, n);
+			MOVE_ARRAY(submodule_gitfiles + i,
+				   submodule_gitfiles + i + 1, n);
 			i--;
 		}
 	}
@@ -462,12 +467,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				continue;
 			die_errno(_("renaming '%s' failed"), src);
 		}
-		if (submodule_gitfile[i]) {
+		if (submodule_gitfiles[i]) {
 			if (!update_path_in_gitmodules(src, dst))
 				gitmodules_modified = 1;
-			if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
+			if (submodule_gitfiles[i] != SUBMODULE_WITH_GITDIR)
 				connect_work_tree_and_git_dir(dst,
-							      submodule_gitfile[i],
+							      submodule_gitfiles[i],
 							      1);
 		}
 
@@ -573,7 +578,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	strvec_clear(&sources);
 	strvec_clear(&dest_paths);
 	strvec_clear(&destinations);
-	free(submodule_gitfile);
+	strvec_clear(&submodule_gitfiles_to_free);
+	free(submodule_gitfiles);
 	free(modes);
 	return ret;
 }
diff --git a/t/t4059-diff-submodule-not-initialized.sh b/t/t4059-diff-submodule-not-initialized.sh
index d489230df8..668f526303 100755
--- a/t/t4059-diff-submodule-not-initialized.sh
+++ b/t/t4059-diff-submodule-not-initialized.sh
@@ -9,6 +9,7 @@ This test tries to verify that add_submodule_odb works when the submodule was
 initialized previously but the checkout has since been removed.
 '
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 # Tested non-UTF-8 encoding
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 879a6dce60..86258f9f43 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='git mv in subdirs'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-diff-data.sh
 
diff --git a/t/t7417-submodule-path-url.sh b/t/t7417-submodule-path-url.sh
index 5e3051da8b..dbbb3853dc 100755
--- a/t/t7417-submodule-path-url.sh
+++ b/t/t7417-submodule-path-url.sh
@@ -4,6 +4,7 @@ test_description='check handling of .gitmodule path with dash'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
diff --git a/t/t7421-submodule-summary-add.sh b/t/t7421-submodule-summary-add.sh
index ce64d8b137..479c8fdde1 100755
--- a/t/t7421-submodule-summary-add.sh
+++ b/t/t7421-submodule-summary-add.sh
@@ -10,6 +10,7 @@ while making sure to add submodules using `git submodule add` instead of
 `git add` as done in t7401.
 '
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
-- 
2.45.1.216.g4365c6fcf9.dirty


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[relevance 11%]

* [PATCH 20/20] builtin/mv: fix leaks for submodule gitfile paths
  @ 2024-05-23 12:26 11% ` Patrick Steinhardt
    1 sibling, 0 replies; 200+ results
From: Patrick Steinhardt @ 2024-05-23 12:26 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 7494 bytes --]

Similar to the preceding commit, we have effectively given tracking
memory ownership of submodule gitfile paths. Refactor the code to start
tracking allocated strings in a separate `struct strvec` such that we
can easily plug those leaks. Mark now-passing tests as leak free.

Note that ideally, we wouldn't require two separate data structures to
track those paths. But we do need to store `NULL` pointers for the
gitfile paths such that we can indicate that its corresponding entries
in the other arrays do not have such a path at all. And given that
`struct strvec`s cannot store `NULL` pointers we cannot use them to
store this information.

There is another small gotcha that is easy to miss: you may be wondering
why we don't want to store `SUBMODULE_WITH_GITDIR` in the strvec. This
is because this is a mere sentinel value and not actually a string at
all.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 builtin/mv.c                              | 44 +++++++++++++----------
 t/t4059-diff-submodule-not-initialized.sh |  1 +
 t/t7001-mv.sh                             |  2 ++
 t/t7417-submodule-path-url.sh             |  1 +
 t/t7421-submodule-summary-add.sh          |  1 +
 5 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index e461d29ca1..81ca910de6 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -82,21 +82,23 @@ static char *add_slash(const char *path)
 
 #define SUBMODULE_WITH_GITDIR ((const char *)1)
 
-static void prepare_move_submodule(const char *src, int first,
-				   const char **submodule_gitfile)
+static const char *submodule_gitfile_path(const char *src, int first)
 {
 	struct strbuf submodule_dotgit = STRBUF_INIT;
+	const char *path;
+
 	if (!S_ISGITLINK(the_repository->index->cache[first]->ce_mode))
 		die(_("Directory %s is in index and no submodule?"), src);
 	if (!is_staging_gitmodules_ok(the_repository->index))
 		die(_("Please stage your changes to .gitmodules or stash them to proceed"));
+
 	strbuf_addf(&submodule_dotgit, "%s/.git", src);
-	*submodule_gitfile = read_gitfile(submodule_dotgit.buf);
-	if (*submodule_gitfile)
-		*submodule_gitfile = xstrdup(*submodule_gitfile);
-	else
-		*submodule_gitfile = SUBMODULE_WITH_GITDIR;
+
+	path = read_gitfile(submodule_dotgit.buf);
 	strbuf_release(&submodule_dotgit);
+	if (path)
+		return path;
+	return SUBMODULE_WITH_GITDIR;
 }
 
 static int index_range_of_same_dir(const char *src, int length,
@@ -170,7 +172,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	struct strvec sources = STRVEC_INIT;
 	struct strvec dest_paths = STRVEC_INIT;
 	struct strvec destinations = STRVEC_INIT;
-	const char **submodule_gitfile;
+	struct strvec submodule_gitfiles_to_free = STRVEC_INIT;
+	const char **submodule_gitfiles;
 	char *dst_w_slash = NULL;
 	const char **src_dir = NULL;
 	int src_dir_nr = 0, src_dir_alloc = 0;
@@ -208,7 +211,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		flags = 0;
 	internal_prefix_pathspec(&dest_paths, prefix, argv + argc, 1, flags);
 	dst_w_slash = add_slash(dest_paths.v[0]);
-	submodule_gitfile = xcalloc(argc, sizeof(char *));
+	submodule_gitfiles = xcalloc(argc, sizeof(char *));
 
 	if (dest_paths.v[0][0] == '\0')
 		/* special case: "." was normalized to "" */
@@ -306,8 +309,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			int first = index_name_pos(the_repository->index, src, length), last;
 
 			if (first >= 0) {
-				prepare_move_submodule(src, first,
-						       submodule_gitfile + i);
+				const char *path = submodule_gitfile_path(src, first);
+				if (path != SUBMODULE_WITH_GITDIR)
+					path = strvec_push(&submodule_gitfiles_to_free, path);
+				submodule_gitfiles[i] = path;
 				goto act_on_entry;
 			} else if (index_range_of_same_dir(src, length,
 							   &first, &last) < 1) {
@@ -323,7 +328,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 			n = argc + last - first;
 			REALLOC_ARRAY(modes, n);
-			REALLOC_ARRAY(submodule_gitfile, n);
+			REALLOC_ARRAY(submodule_gitfiles, n);
 
 			dst_with_slash = add_slash(dst);
 			dst_with_slash_len = strlen(dst_with_slash);
@@ -338,7 +343,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 				memset(modes + argc + j, 0, sizeof(enum update_mode));
 				modes[argc + j] |= ce_skip_worktree(ce) ? SPARSE : INDEX;
-				submodule_gitfile[argc + j] = NULL;
+				submodule_gitfiles[argc + j] = NULL;
 
 				free(prefixed_path);
 			}
@@ -427,8 +432,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			strvec_remove(&sources, i);
 			strvec_remove(&destinations, i);
 			MOVE_ARRAY(modes + i, modes + i + 1, n);
-			MOVE_ARRAY(submodule_gitfile + i,
-				   submodule_gitfile + i + 1, n);
+			MOVE_ARRAY(submodule_gitfiles + i,
+				   submodule_gitfiles + i + 1, n);
 			i--;
 		}
 	}
@@ -462,12 +467,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				continue;
 			die_errno(_("renaming '%s' failed"), src);
 		}
-		if (submodule_gitfile[i]) {
+		if (submodule_gitfiles[i]) {
 			if (!update_path_in_gitmodules(src, dst))
 				gitmodules_modified = 1;
-			if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
+			if (submodule_gitfiles[i] != SUBMODULE_WITH_GITDIR)
 				connect_work_tree_and_git_dir(dst,
-							      submodule_gitfile[i],
+							      submodule_gitfiles[i],
 							      1);
 		}
 
@@ -573,7 +578,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	strvec_clear(&sources);
 	strvec_clear(&dest_paths);
 	strvec_clear(&destinations);
-	free(submodule_gitfile);
+	strvec_clear(&submodule_gitfiles_to_free);
+	free(submodule_gitfiles);
 	free(modes);
 	return ret;
 }
diff --git a/t/t4059-diff-submodule-not-initialized.sh b/t/t4059-diff-submodule-not-initialized.sh
index d489230df8..668f526303 100755
--- a/t/t4059-diff-submodule-not-initialized.sh
+++ b/t/t4059-diff-submodule-not-initialized.sh
@@ -9,6 +9,7 @@ This test tries to verify that add_submodule_odb works when the submodule was
 initialized previously but the checkout has since been removed.
 '
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 # Tested non-UTF-8 encoding
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 879a6dce60..86258f9f43 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='git mv in subdirs'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-diff-data.sh
 
diff --git a/t/t7417-submodule-path-url.sh b/t/t7417-submodule-path-url.sh
index 5e3051da8b..dbbb3853dc 100755
--- a/t/t7417-submodule-path-url.sh
+++ b/t/t7417-submodule-path-url.sh
@@ -4,6 +4,7 @@ test_description='check handling of .gitmodule path with dash'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
diff --git a/t/t7421-submodule-summary-add.sh b/t/t7421-submodule-summary-add.sh
index ce64d8b137..479c8fdde1 100755
--- a/t/t7421-submodule-summary-add.sh
+++ b/t/t7421-submodule-summary-add.sh
@@ -10,6 +10,7 @@ while making sure to add submodules using `git submodule add` instead of
 `git add` as done in t7401.
 '
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
-- 
2.45.1.216.g4365c6fcf9.dirty


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[relevance 11%]

* [PATCH] mv: refresh stat info for moved entry
@ 2022-03-25  1:56 11% Victoria Dye via GitGitGadget
  2022-03-29  1:07  9% ` [PATCH v2] " Victoria Dye via GitGitGadget
  0 siblings, 1 reply; 200+ results
From: Victoria Dye via GitGitGadget @ 2022-03-25  1:56 UTC (permalink / raw)
  To: git; +Cc: reichemn, gitster, Victoria Dye, Victoria Dye

From: Victoria Dye <vdye@github.com>

Add 'refresh_cache_entry()' after moving the index entry in
'rename_index_entry_at()'. Internally, 'git mv' uses
'rename_index_entry_at()' to move the source index entry to the destination,
overwriting the old entry if '-f' is specified. However, it does not refresh
the stat information on destination index entry, making its 'CE_UPTODATE'
flag out-of-date until the index is refreshed (e.g., by 'git status').

Some commands, such as 'git reset', assume the 'CE_UPTODATE' information
they read from the index is accurate, and use that information to determine
whether the operation can be done successfully or not. In order to ensure
the index is correct for commands such as these, explicitly refresh the
destination index entry in 'git mv' before exiting.

Reported-by: Maximilian Reichel <reichemn@icloud.com>
Signed-off-by: Victoria Dye <vdye@github.com>
---
    mv: refresh stat info for moved entry
    
    This patch fixes a bug [1] encountered when executing 'git reset --merge
    HEAD' immediately after 'git mv -f' overwrites an existing index entry.
    Because the 'CE_UPTODATE' flag is not refreshed on the destination entry
    (and therefore incorrectly appeared to not be "up-to-date"), 'git reset
    --merge HEAD' fails when it should otherwise succeed.
    
    To avoid exiting 'git mv' with a stale index that may affect subsequent
    commands, 'rename_index_entry_at()' (used internally by 'git mv') is
    updated to refresh the destination index entry's stat information after
    the move is complete.
    
    [1]
    https://lore.kernel.org/git/84FF8F9A-3A9A-4F2A-8D8E-5D50F2F06203@icloud.com/

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1187%2Fvdye%2Freset%2Fmerge-inconsistency-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1187/vdye/reset/merge-inconsistency-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1187

 read-cache.c  |  1 +
 t/t7001-mv.sh | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/read-cache.c b/read-cache.c
index 1ad56d02e1d..2c5ccc48d6c 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -148,6 +148,7 @@ void rename_index_entry_at(struct index_state *istate, int nr, const char *new_n
 	untracked_cache_remove_from_index(istate, old_entry->name);
 	remove_index_entry_at(istate, nr);
 	add_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
+	refresh_cache_entry(istate, new_entry, CE_MATCH_REFRESH);
 }
 
 void fill_stat_data(struct stat_data *sd, struct stat *st)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 963356ba5f9..ab8607678e7 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -4,6 +4,17 @@ test_description='git mv in subdirs'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-diff-data.sh
 
+test_expect_success 'mv -f refreshes updated index entry' '
+	echo test >bar &&
+	git add bar &&
+	git commit -m test &&
+
+	echo foo >foo &&
+	git add foo &&
+	git mv -f foo bar &&
+	git reset --merge HEAD
+'
+
 test_expect_success 'prepare reference tree' '
 	mkdir path0 path1 &&
 	COPYING_test_data >path0/COPYING &&

base-commit: a68dfadae5e95c7f255cf38c9efdcbc2e36d1931
-- 
gitgitgadget

^ permalink raw reply related	[relevance 11%]

* [PATCH] mv: let 'git mv file no-such-dir/' error out
@ 2013-12-03  8:32 11% Matthieu Moy
    0 siblings, 1 reply; 200+ results
From: Matthieu Moy @ 2013-12-03  8:32 UTC (permalink / raw)
  To: git, gitster; +Cc: Duy Nguyen, Matthieu Moy

Git used to trim the trailing slash, and make the command equivalent to
'git mv file no-such-dir', which created the file no-such-dir (while the
trailing slash explicitly stated that it could only be a directory).

This patch skips the trailing slash removal for the destination path. The
path with its trailing slash is passed to rename(2), which errors out
with the appropriate message:

  $ git mv file no-such-dir/
  fatal: renaming 'file' failed: Not a directory

Original-patch-by: Duy Nguyen <pclouds@gmail.com>
Tests, tweaks and commit message by: Matthieu Moy <Matthieu.Moy@imag.fr>

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 builtin/mv.c  | 23 ++++++++++++++++-------
 t/t7001-mv.sh | 10 ++++++++++
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 2e0e61b..08fbc03 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -16,9 +16,12 @@ static const char * const builtin_mv_usage[] = {
 	NULL
 };
 
+#define DUP_BASENAME 1
+#define KEEP_TRAILING_SLASH 2
+
 static const char **internal_copy_pathspec(const char *prefix,
 					   const char **pathspec,
-					   int count, int base_name)
+					   int count, unsigned flags)
 {
 	int i;
 	const char **result = xmalloc((count + 1) * sizeof(const char *));
@@ -27,11 +30,12 @@ static const char **internal_copy_pathspec(const char *prefix,
 	for (i = 0; i < count; i++) {
 		int length = strlen(result[i]);
 		int to_copy = length;
-		while (to_copy > 0 && is_dir_sep(result[i][to_copy - 1]))
+		while (!(flags & KEEP_TRAILING_SLASH) &&
+		       to_copy > 0 && is_dir_sep(result[i][to_copy - 1]))
 			to_copy--;
-		if (to_copy != length || base_name) {
+		if (to_copy != length || flags & DUP_BASENAME) {
 			char *it = xmemdupz(result[i], to_copy);
-			if (base_name) {
+			if (flags & DUP_BASENAME) {
 				result[i] = xstrdup(basename(it));
 				free(it);
 			} else
@@ -87,16 +91,21 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 	source = internal_copy_pathspec(prefix, argv, argc, 0);
 	modes = xcalloc(argc, sizeof(enum update_mode));
-	dest_path = internal_copy_pathspec(prefix, argv + argc, 1, 0);
+	/*
+	 * Keep trailing slash, needed to let
+	 * "git mv file no-such-dir/" error out.
+	 */
+	dest_path = internal_copy_pathspec(prefix, argv + argc, 1,
+					   KEEP_TRAILING_SLASH);
 	submodule_gitfile = xcalloc(argc, sizeof(char *));
 
 	if (dest_path[0][0] == '\0')
 		/* special case: "." was normalized to "" */
-		destination = internal_copy_pathspec(dest_path[0], argv, argc, 1);
+		destination = internal_copy_pathspec(dest_path[0], argv, argc, DUP_BASENAME);
 	else if (!lstat(dest_path[0], &st) &&
 			S_ISDIR(st.st_mode)) {
 		dest_path[0] = add_slash(dest_path[0]);
-		destination = internal_copy_pathspec(dest_path[0], argv, argc, 1);
+		destination = internal_copy_pathspec(dest_path[0], argv, argc, DUP_BASENAME);
 	} else {
 		if (argc != 1)
 			die("destination '%s' is not a directory", dest_path[0]);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b90e985..e5c8084 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -72,6 +72,16 @@ rm -f idontexist untracked1 untracked2 \
      .git/index.lock
 
 test_expect_success \
+    'moving to target with trailing slash' \
+    'test_must_fail git mv path0/COPYING no-such-dir/ &&
+     test_must_fail git mv path0/COPYING no-such-dir// &&
+     git mv path0/ no-such-dir/'
+
+test_expect_success \
+    'clean up' \
+    'git reset --hard'
+
+test_expect_success \
     'adding another file' \
     'cp "$TEST_DIRECTORY"/../README path0/README &&
      git add path0/README &&
-- 
1.8.5.rc3.4.g8bd3721

^ permalink raw reply related	[relevance 11%]

* [PATCH] git mv: try harder to keep index entries intact
@ 2008-08-01 16:49 11% Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2008-08-01 16:49 UTC (permalink / raw)
  To: git, gitster, pasky


Some filesystems change the ctime during a rename(), for technical
reasons.  Since this is the only change, the contents need not be
rehashed.  So just update the ctime after renaming the entry.

This change requires rename_index_entry_at() to return the new
position.

As git-mv assumes that it runs in a non-bare repository, and is
marked as such in the cmd_struct in git.c, the changes do not have
to be guarded against running in a bare repository.

To test this properly, you need to run t7001 with the environment
variable TEST_CTIME_WITH_SLEEP set non-empty, since there is no way
to manipulate the ctime directly; we have to sleep.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

 builtin-mv.c  |   15 +++++++++++++--
 cache.h       |    2 +-
 read-cache.c  |    4 ++--
 t/t7001-mv.sh |   10 ++++++++--
 4 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/builtin-mv.c b/builtin-mv.c
index 4f65b5a..166a019 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -214,8 +214,19 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 		pos = cache_name_pos(src, strlen(src));
 		assert(pos >= 0);
-		if (!show_only)
-			rename_cache_entry_at(pos, dst);
+		if (!show_only) {
+			struct stat st;
+			pos = rename_cache_entry_at(pos, dst);
+
+			/*
+			 * Renaming can update the ctime.  Do not force
+			 * a complete rehash just because of that.
+			 */
+			if (!lstat(dst, &st))
+				active_cache[pos]->ce_ctime = st.st_ctime;
+			else if (!ignore_errors)
+				die ("Could not stat '%s'", dst);
+		}
 	}
 
 	if (active_cache_changed) {
diff --git a/cache.h b/cache.h
index 8155ab8..4b6876b 100644
--- a/cache.h
+++ b/cache.h
@@ -371,7 +371,7 @@ extern int index_name_pos(const struct index_state *, const char *name, int name
 #define ADD_CACHE_JUST_APPEND 8		/* Append only; tree.c::read_tree() */
 extern int add_index_entry(struct index_state *, struct cache_entry *ce, int option);
 extern struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really);
-extern void rename_index_entry_at(struct index_state *, int pos, const char *new_name);
+extern int rename_index_entry_at(struct index_state *, int pos, const char *new_name);
 extern int remove_index_entry_at(struct index_state *, int pos);
 extern int remove_file_from_index(struct index_state *, const char *path);
 #define ADD_CACHE_VERBOSE 1
diff --git a/read-cache.c b/read-cache.c
index c5aa5bc..4454686 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -43,7 +43,7 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache
 	istate->cache_changed = 1;
 }
 
-void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
+int rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
 {
 	struct cache_entry *old = istate->cache[nr], *new;
 	int namelen = strlen(new_name);
@@ -56,7 +56,7 @@ void rename_index_entry_at(struct index_state *istate, int nr, const char *new_n
 
 	cache_tree_invalidate_path(istate->cache_tree, old->name);
 	remove_index_entry_at(istate, nr);
-	add_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
+	return add_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
 }
 
 /*
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 910a28c..5f6cee5 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -180,12 +180,15 @@ test_expect_success 'git mv should overwrite symlink to a file' '
 	echo 1 >moved &&
 	ln -s moved symlink &&
 	git add moved symlink &&
+	if test ! -z "$TEST_CTIME_WITH_SLEEP"
+	then
+		sleep 1
+	fi &&
 	test_must_fail git mv moved symlink &&
 	git mv -f moved symlink &&
 	! test -e moved &&
 	test -f symlink &&
 	test "$(cat symlink)" = 1 &&
-	git update-index --refresh &&
 	git diff-files --quiet
 
 '
@@ -199,11 +202,14 @@ test_expect_success 'git mv should overwrite file with a symlink' '
 	echo 1 >moved &&
 	ln -s moved symlink &&
 	git add moved symlink &&
+	if test ! -z "$TEST_CTIME_WITH_SLEEP"
+	then
+		sleep 1
+	fi &&
 	test_must_fail git mv symlink moved &&
 	git mv -f symlink moved &&
 	! test -e symlink &&
 	test -h moved &&
-	git update-index --refresh &&
 	git diff-files --quiet
 
 '
-- 
1.6.0.rc1.55.g69db8

^ permalink raw reply related	[relevance 11%]

* [PATCH] mv: better document side effects when moving a submodule
  @ 2014-01-06 19:21 11%   ` Jens Lehmann
    0 siblings, 1 reply; 200+ results
From: Jens Lehmann @ 2014-01-06 19:21 UTC (permalink / raw)
  To: George Papanikolaou; +Cc: git, Junio C Hamano

The "Submodules" section of the "git mv" documentation mentions what will
happen when a submodule with a gitfile gets moved with newer git. But it
doesn't talk about what happens when the user changes between commits
before and after the move, which does not update the work tree like using
the mv command did the first time.

Explain what happens and what the user has to do manually to fix that.
Also document this in a new test.

Reported-by: George Papanikolaou <g3orge.app@gmail.com>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---

Am 09.12.2013 18:49, schrieb Jens Lehmann:
> Am 09.12.2013 11:59, schrieb George Papanikolaou:
>> Also after mv you need to run 'submodule update' and I think this should be
>> documented somewhere.
> 
> You're right, this should be mentioned in the mv man page. I'll
> prepare a patch for that.

Does this new paragraph make it clearer?


 Documentation/git-mv.txt | 10 ++++++++++
 t/t7001-mv.sh            | 21 +++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt
index b1f7988..c9e8568 100644
--- a/Documentation/git-mv.txt
+++ b/Documentation/git-mv.txt
@@ -52,6 +52,16 @@ core.worktree setting to make the submodule work in the new location.
 It also will attempt to update the submodule.<name>.path setting in
 the linkgit:gitmodules[5] file and stage that file (unless -n is used).

+Please note that each time a superproject update moves a populated
+submodule (e.g. when switching between commits before and after the
+move) a stale submodule checkout will remain in the old location
+and an empty directory will appear in the new location. To populate
+the submodule again in the new location the user will have to run
+"git submodule update" afterwards. Removing the old directory is
+only safe when it uses a gitfile, as otherwise the history of the
+submodule will be deleted too. Both steps will be obsolete when
+recursive submodule update has been implemented.
+
 GIT
 ---
 Part of the linkgit:git[1] suite
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 3bfdfed..e3c8c2c 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -442,4 +442,25 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
 	git diff-files --quiet -- sub .gitmodules
 '

+test_expect_success 'checking out a commit before submodule moved needs manual updates' '
+	git mv sub sub2 &&
+	git commit -m "moved sub to sub2" &&
+	git checkout -q HEAD^ 2>actual &&
+	echo "warning: unable to rmdir sub2: Directory not empty" >expected &&
+	test_i18ncmp expected actual &&
+	git status -s sub2 >actual &&
+	echo "?? sub2/" >expected &&
+	test_cmp expected actual &&
+	! test -f sub/.git &&
+	test -f sub2/.git &&
+	git submodule update &&
+	test -f sub/.git &&
+	rm -rf sub2 &&
+	git diff-index --exit-code HEAD &&
+	git update-index --refresh &&
+	git diff-files --quiet -- sub .gitmodules &&
+	git status -s sub2 >actual &&
+	! test -s actual
+'
+
 test_done
-- 
1.8.5.2.230.g9325930

^ permalink raw reply related	[relevance 11%]

* [PATCH v2] Allow git mv FileA fILEa on case ignore file systems
@ 2011-03-19 14:28 11% Torsten Bögershausen
  0 siblings, 0 replies; 200+ results
From: Torsten Bögershausen @ 2011-03-19 14:28 UTC (permalink / raw)
  To: kusmabite, git; +Cc: tboegi

The typical use case is when a file "FileA" should be renamed into fILEa
and we are on a case insenstive file system (system core.ignorecase = true).
Source and destination are the same file, it can be accessed under both names.
This makes git think that the destination file exists.
Unless used with --forced, git will refuse the "git mv FileA fILEa".
This change will allow "git mv FileA fILEa" under the following condition:
On Linux/Unix/Mac OS X the move is allowed when the inode of the source and
destination are equal (and they are on the same device).
This allows renames of MÄRCHEN into Märchen on Mac OS X.
(As a side effect, a file can be renamed to a name which is already
hard-linked to the same inode).
On Windows, the function win_is_same_file() from compat/win32/same-file.c
is used.
It calls GetFileInformationByHandle() to check if both files are
"the same".

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 Makefile                 |    8 +++++---
 builtin/mv.c             |    2 +-
 compat/win32/same-file.c |   26 ++++++++++++++++++++++++++
 git-compat-util.h        |   15 +++++++++++++++
 t/t7001-mv.sh            |   29 +++++++++++++++++++++++++++++
 5 files changed, 76 insertions(+), 4 deletions(-)
 create mode 100644 compat/win32/same-file.c

diff --git a/Makefile b/Makefile
index 5c2b797..55b9a05 100644
--- a/Makefile
+++ b/Makefile
@@ -924,7 +924,7 @@ ifeq ($(uname_O),Cygwin)
 	# Try commenting this out if you suspect MMAP is more efficient
 	NO_MMAP = YesPlease
 	X = .exe
-	COMPAT_OBJS += compat/cygwin.o
+	COMPAT_OBJS += compat/cygwin.o compat/win32/same-file.o
 	UNRELIABLE_FSTAT = UnfortunatelyYes
 endif
 ifeq ($(uname_S),FreeBSD)
@@ -1104,7 +1104,8 @@ ifeq ($(uname_S),Windows)
 	BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
 	COMPAT_OBJS = compat/msvc.o compat/winansi.o \
 		compat/win32/pthread.o compat/win32/syslog.o \
-		compat/win32/sys/poll.o compat/win32/dirent.o
+		compat/win32/sys/poll.o compat/win32/dirent.o \
+		compat/win32/same-file.o
 	COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
 	BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
 	EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib
@@ -1177,7 +1178,8 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 	COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
 	COMPAT_OBJS += compat/mingw.o compat/winansi.o \
 		compat/win32/pthread.o compat/win32/syslog.o \
-		compat/win32/sys/poll.o compat/win32/dirent.o
+		compat/win32/sys/poll.o compat/win32/dirent.o \
+		compat/win32/same-file.o
 	EXTLIBS += -lws2_32
 	PTHREAD_LIBS =
 	X = .exe
diff --git a/builtin/mv.c b/builtin/mv.c
index 93e8995..96792bd 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -166,7 +166,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			bad = "not under version control";
 		else if (lstat(dst, &st) == 0) {
 			bad = "destination exists";
-			if (force) {
+			if (force || is_same_file(src, dst)) {
 				/*
 				 * only files can overwrite each other:
 				 * check both source and destination
diff --git a/compat/win32/same-file.c b/compat/win32/same-file.c
new file mode 100644
index 0000000..bb1a791
--- /dev/null
+++ b/compat/win32/same-file.c
@@ -0,0 +1,26 @@
+#include "../../git-compat-util.h"
+#include "../win32.h"
+
+int win_is_same_file(const char *a, const char *b)
+{
+	BY_HANDLE_FILE_INFORMATION hia, hib;
+	HANDLE h;
+
+	h = CreateFile(a, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+	if (INVALID_HANDLE_VALUE == h)
+		return 0;
+	if (!(GetFileInformationByHandle(h,&hia)))
+		return 0;
+  CloseHandle(h);
+
+	h = CreateFile(b, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+	if (INVALID_HANDLE_VALUE == h)
+		return 0;
+	if (!(GetFileInformationByHandle(h,&hib)))
+		return 0;
+  CloseHandle(h);
+
+	return hia.dwVolumeSerialNumber == hib.dwVolumeSerialNumber &&
+	       hia.nFileSizeLow == hib.nFileSizeLow &&
+	       hia.nFileSizeHigh == hib.nFileSizeHigh;
+}
diff --git a/git-compat-util.h b/git-compat-util.h
index 49b50ee..df95458 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -152,6 +152,21 @@
 #include "compat/msvc.h"
 #endif
 
+#if defined (WIN32) || defined(__CYGWIN__)
+/* MinGW or MSVC or cygwin */
+int win_is_same_file(const char *a, const char *b);
+#define is_same_file(a,b) win_is_same_file((a),(b))
+#else
+static inline int is_same_file(const char *a, const char *b)
+{
+	struct stat sta, stb;
+	if (lstat(a, &sta) ||
+	    lstat(b, &stb))
+		return 0;
+	return sta.st_ino && sta.st_dev == stb.st_dev && sta.st_ino == stb.st_ino;
+}
+#endif
+
 #ifndef NO_LIBGEN_H
 #include <libgen.h>
 #else
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index a845b15..d0e73ee 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -255,4 +255,33 @@ test_expect_success SYMLINKS 'git mv should overwrite file with a symlink' '
 
 rm -f moved symlink
 
+touch x
+if ln x y 2>/dev/null; then
+	hardlinks=1
+fi
+rm -f x y
+
+if test "$(git config --bool core.ignorecase)" = true -o "$hardlinks"; then
+	test_expect_success 'git mv FileA fILEa' '
+
+		rm -fr .git * &&
+		git init &&
+		echo FileA > FileA &&
+		git add FileA &&
+		git commit -m add FileA &&
+		{
+			if ! test -f fILEa; then
+				ln FileA fILEa
+			fi
+		} &&
+		git mv FileA fILEa &&
+		git commit -m "mv FileA fILEa" &&
+		rm -f FileA fILEa &&
+		git reset --hard &&
+		test "$(echo *)" = fILEa
+	'
+else
+	say "Neither ignorecase nor hardlinks, skipping git mv FileA fILEa"
+fi
+
 test_done
-- 
1.7.4

^ permalink raw reply related	[relevance 11%]

* [PATCH v2 1/2] mv: better document side effects when moving a submodule
  @ 2014-01-07 21:31 11%           ` Jens Lehmann
  0 siblings, 0 replies; 200+ results
From: Jens Lehmann @ 2014-01-07 21:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: George Papanikolaou, git

The "Submodules" section of the "git mv" documentation mentions what will
happen when a submodule with a gitfile gets moved with newer git. But it
doesn't talk about what happens when the user changes between commits
before and after the move, which does not update the work tree like using
the mv command did the first time.

Explain what happens and what the user has to do manually to fix that in
the new BUGS section. Also document this behavior in a new test.

Reported-by: George Papanikolaou <g3orge.app@gmail.com>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
 Documentation/git-mv.txt | 12 ++++++++++++
 t/t7001-mv.sh            | 21 +++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt
index b1f7988..e453132 100644
--- a/Documentation/git-mv.txt
+++ b/Documentation/git-mv.txt
@@ -52,6 +52,18 @@ core.worktree setting to make the submodule work in the new location.
 It also will attempt to update the submodule.<name>.path setting in
 the linkgit:gitmodules[5] file and stage that file (unless -n is used).

+BUGS
+----
+Each time a superproject update moves a populated submodule (e.g. when
+switching between commits before and after the move) a stale submodule
+checkout will remain in the old location and an empty directory will
+appear in the new location. To populate the submodule again in the new
+location the user will have to run "git submodule update"
+afterwards. Removing the old directory is only safe when it uses a
+gitfile, as otherwise the history of the submodule will be deleted
+too. Both steps will be obsolete when recursive submodule update has
+been implemented.
+
 GIT
 ---
 Part of the linkgit:git[1] suite
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 3bfdfed..e3c8c2c 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -442,4 +442,25 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
 	git diff-files --quiet -- sub .gitmodules
 '

+test_expect_success 'checking out a commit before submodule moved needs manual updates' '
+	git mv sub sub2 &&
+	git commit -m "moved sub to sub2" &&
+	git checkout -q HEAD^ 2>actual &&
+	echo "warning: unable to rmdir sub2: Directory not empty" >expected &&
+	test_i18ncmp expected actual &&
+	git status -s sub2 >actual &&
+	echo "?? sub2/" >expected &&
+	test_cmp expected actual &&
+	! test -f sub/.git &&
+	test -f sub2/.git &&
+	git submodule update &&
+	test -f sub/.git &&
+	rm -rf sub2 &&
+	git diff-index --exit-code HEAD &&
+	git update-index --refresh &&
+	git diff-files --quiet -- sub .gitmodules &&
+	git status -s sub2 >actual &&
+	! test -s actual
+'
+
 test_done
-- 
1.8.5.2.231.gfc86eb1

^ permalink raw reply related	[relevance 11%]

* [PATCH] mv: Fix spurious warning when moving a file in presence of submodules
  @ 2013-10-13 11:52 11%   ` Jens Lehmann
  0 siblings, 0 replies; 200+ results
From: Jens Lehmann @ 2013-10-13 11:52 UTC (permalink / raw)
  To: Matthieu Moy, git, Jonathan Nieder, Junio C Hamano

In commit 0656781fa "git mv" learned to update the submodule path in the
.gitmodules file when moving a submodule in the work tree. But since that
commit update_path_in_gitmodules() gets called no matter if we moved a
submodule or a regular file, which is wrong and leads to a bogus warning
when moving a regular file in a repo containing a .gitmodules file:

    warning: Could not find section in .gitmodules where path=<filename>

Fix that by only calling update_path_in_gitmodules() when moving a
submodule. To achieve that, we introduce the special SUBMODULE_WITH_GITDIR
define to distinguish the cases where we also have to connect work tree
and git directory from those where we only need to update the .gitmodules
setting.

A test for submodules using a .git directory together with a .gitmodules
file has been added to t7001. Even though newer git versions will always
use a gitfile when cloning submodules, repositories cloned with older git
versions will still use this layout.

Reported-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---

Am 11.10.2013 19:53, schrieb Jens Lehmann:
> Am 11.10.2013 16:29, schrieb Matthieu Moy:
>> I'm getting this warning:
>>
>>   warning: Could not find section in .gitmodules where path=XXX
>>
>> whenever I use "git mv" to move a file in a repository containing a
>> submodule. The file is outside the submodule and is completely
>> unrelated, so I do not understand the intent of the warning.
>>
>> My understanding (without looking at the code in detail) is that Git
>> tries to be clever about submodule renames, hence checks whether the
>> source file is a submodule. But then if the lookup fails, it should just
>> silently move on to "normal file move" mode I guess...
> 
> Right. Thanks for reporting, I can reproduce that here and am currently
> looking into that.

And this is the fix for it, which I believe is stuff for maint.


 builtin/mv.c  | 13 +++++++++----
 t/t7001-mv.sh | 26 ++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index aec79d1..2e0e61b 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -55,6 +55,7 @@ static const char *add_slash(const char *path)
 }

 static struct lock_file lock_file;
+#define SUBMODULE_WITH_GITDIR ((const char *)1)

 int cmd_mv(int argc, const char **argv, const char *prefix)
 {
@@ -132,6 +133,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				submodule_gitfile[i] = read_gitfile(submodule_dotgit.buf);
 				if (submodule_gitfile[i])
 					submodule_gitfile[i] = xstrdup(submodule_gitfile[i]);
+				else
+					submodule_gitfile[i] = SUBMODULE_WITH_GITDIR;
 				strbuf_release(&submodule_dotgit);
 			} else {
 				const char *src_w_slash = add_slash(src);
@@ -230,10 +233,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		if (!show_only && mode != INDEX) {
 			if (rename(src, dst) < 0 && !ignore_errors)
 				die_errno (_("renaming '%s' failed"), src);
-			if (submodule_gitfile[i])
-				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
-			if (!update_path_in_gitmodules(src, dst))
-				gitmodules_modified = 1;
+			if (submodule_gitfile[i]) {
+				if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
+					connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
+				if (!update_path_in_gitmodules(src, dst))
+					gitmodules_modified = 1;
+			}
 		}

 		if (mode == WORKING_DIRECTORY)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index d432f42..b90e985 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -293,6 +293,32 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	git diff-files --quiet
 '

+test_expect_success 'git mv moves a submodule with a .git directory and .gitmodules' '
+	rm -rf mod &&
+	git reset --hard &&
+	git submodule update &&
+	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	(
+		cd sub &&
+		rm -f .git &&
+		cp -a ../.git/modules/sub .git &&
+		GIT_WORK_TREE=. git config --unset core.worktree
+	) &&
+	mkdir mod &&
+	git mv sub mod/sub &&
+	! test -e sub &&
+	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	(
+		cd mod/sub &&
+		git status
+	) &&
+	echo mod/sub >expected &&
+	git config -f .gitmodules submodule.sub.path >actual &&
+	test_cmp expected actual &&
+	git update-index --refresh &&
+	git diff-files --quiet
+'
+
 test_expect_success 'git mv moves a submodule with gitfile' '
 	rm -rf mod/sub &&
 	git reset --hard &&
-- 
1.8.4.474.g128a96c.dirty

^ permalink raw reply related	[relevance 11%]

* Re: [PATCH 02/11] t7001: use TAB instead of spaces
  2020-09-25 17:02 13% ` [PATCH 02/11] t7001: use TAB instead of spaces shubham verma
@ 2020-09-25 17:44 11%   ` Eric Sunshine
  0 siblings, 0 replies; 200+ results
From: Eric Sunshine @ 2020-09-25 17:44 UTC (permalink / raw)
  To: shubham verma; +Cc: Git List

On Fri, Sep 25, 2020 at 1:03 PM shubham verma <shubhunic@gmail.com> wrote:
> t7001: use TAB instead of spaces

Nit: "use" is a bit nebulous; I'd probably say:

    t7001: indent with TABs instead of spaces

> Change indentation style from spaces to TAB.

...which would also allow you to drop this line altogether.

If you feel that you must write something in the body of the commit
messages, then perhaps say something about how modern style is to
indent test bodies with TABs rather than spaces.

> Signed-off-by: shubham verma <shubhunic@gmail.com>

^ permalink raw reply	[relevance 11%]

* Re: [PATCH 01/11] t7001: convert tests from the old style to the current style
  2020-09-25 17:02 13% ` [PATCH 01/11] t7001: convert tests from the old style to the current style shubham verma
@ 2020-09-25 17:40 11%   ` Eric Sunshine
  0 siblings, 0 replies; 200+ results
From: Eric Sunshine @ 2020-09-25 17:40 UTC (permalink / raw)
  To: shubham verma; +Cc: Git List

On Fri, Sep 25, 2020 at 1:03 PM shubham verma <shubhunic@gmail.com> wrote:
> t7001: convert tests from the old style to the current style
>
> To modernize the t7001 test script, let's change the style of
> its tests from an old one to the modern one.

This commit message could help reviewers more by giving an example of
how the style is being updated because it's not so easy to pick up the
details from the patch itself since it's so noisy. Perhaps the commit
message could say something like:

    t7001: modernize test formatting

    Some tests in this script are formatted using a very old style:

        test_expect_success \
            'title' \
            'body line 1 &&
            body line 2'

    Update the formatting to the modern style:

        test_expect_success 'title' '
            body line 1 &&
            body line 2
        '

> Signed-off-by: shubham verma <shubhunic@gmail.com>

^ permalink raw reply	[relevance 11%]

* Re: [PATCH 04/11] t7001: change the style for cd according to subshell
  2020-09-25 17:02 19% ` [PATCH 04/11] t7001: change the style for cd according to subshell shubham verma
@ 2020-09-25 18:12 11%   ` Eric Sunshine
  0 siblings, 0 replies; 200+ results
From: Eric Sunshine @ 2020-09-25 18:12 UTC (permalink / raw)
  To: shubham verma; +Cc: Git List

On Fri, Sep 25, 2020 at 1:03 PM shubham verma <shubhunic@gmail.com> wrote:
> t7001: change the style for cd according to subshell
>
> In some tests there is not a proper spaces after opening paranthesis
> and before cd. So, Lets change the style for cd according to subshell.

Nits:
s/space/newline/
s/paranthesis/parenthesis/
s/So, Lets change/Change/

However, a more significant observation is that this change is
actually specific to the formatting of subshells, and has nothing to
do with placement of `cd`, so calling out `cd` in the commit message
is misleading. I'd probably drop mention of `cd` altogether and write
the commit message something like this:

    t7001: modernize subshell formatting

    Some test use an old style for formatting subshells:

        (command &&
            ...

    Update them to the modern style:

        (
            command &&
            ...

The actual patch is fine.

> Signed-off-by: shubham verma <shubhunic@gmail.com>

^ permalink raw reply	[relevance 11%]

* Re: [PATCH v3 00/10] Modernizing the t7001 test script
  2021-02-11 21:44  6% ` [PATCH v3 00/10] Modernizing the t7001 test script Junio C Hamano
@ 2021-02-23  8:26 11%   ` Shubham Verma
  2021-02-23 17:33  6%     ` Junio C Hamano
  0 siblings, 1 reply; 200+ results
From: Shubham Verma @ 2021-02-23  8:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git List, Eric Sunshine

Hello Junio,

I already corrected the author-name spelling in this v3 series
but I looking at the last "What's Cooking" message and saw that
Modernizing the t7001 test script series described as
"Expecting the final version with corrected author attribution".
Please once look at my patch series.

Thank You!


On Fri, Feb 12, 2021 at 3:14 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> Shubham Verma <shubhunic@gmail.com> writes:
>
> > In this patch series modernize the t7001 test script by changing the
> > style of its tests from an old one to the modern one and by cleaning
> > up the test script.
> >
> > Changes since v2:
> >
> > - Correct the author name spelling
> >
> > Thanks everyone for your feedback and suggestions.
>
> I've compared between v2 and v3 and verified the only change is the
> name spelling, so I'll port over Eric's reviewed-by's from the
> previous round.
>
> Thanks.
>
>
>

^ permalink raw reply	[relevance 11%]

* [PATCH 2/2] mv: allow moving nested submodules
  @ 2016-04-18 23:41 11% ` Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2016-04-18 23:41 UTC (permalink / raw)
  To: git; +Cc: gitster, Jens.Lehmann, gmane, Stefan Beller

When directories are moved using `git mv` all files in the directory
have been just moved, but no further action was taken on them. This
was done by assigning the mode = WORKING_DIRECTORY to the files
inside a moved directory.

submodules however need to update their link to the git directory as
well as updates to the .gitmodules file. By removing the condition of
`mode != INDEX` (the remaining modes are BOTH and WORKING_DIRECTORY) for
the required submodule actions, we perform these for submodules in a
moved directory.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/mv.c  | 39 ++++++++++++++++++++++-----------------
 t/t7001-mv.sh | 16 ++++++++++++++++
 2 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 74516f4..2deb95b 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -253,23 +253,28 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		int pos;
 		if (show_only || verbose)
 			printf(_("Renaming %s to %s\n"), src, dst);
-		if (!show_only && mode != INDEX) {
-			if (rename(src, dst) < 0 && !ignore_errors)
-				die_errno(_("renaming '%s' failed"), src);
-			if (submodule_gitfile[i]) {
-				if ((submodule_gitfile[i] != SUBMODULE_WITH_GITDIR &&
-				    connect_work_tree_and_git_dir(dst, submodule_gitfile[i], &err)) ||
-				    update_path_in_gitmodules(src, dst, &err)) {
-					if (err.len) {
-						if (ignore_errors) {
-							warning("%s", err.buf);
-							continue;
-						} else
-							die("%s", err.buf);
-					}
-				} else
-					gitmodules_modified = 1;
-			}
+		if (show_only)
+			continue;
+		if (mode != INDEX &&
+		    rename(src, dst) < 0) {
+			if (ignore_errors)
+				continue;
+			die_errno(_("renaming '%s' failed"), src);
+		}
+
+		if (submodule_gitfile[i]) {
+			if ((submodule_gitfile[i] != SUBMODULE_WITH_GITDIR &&
+			    connect_work_tree_and_git_dir(dst, submodule_gitfile[i], &err)) ||
+			    update_path_in_gitmodules(src, dst, &err)) {
+				if (err.len) {
+					if (ignore_errors) {
+						warning("%s", err.buf);
+						continue;
+					} else
+						die("%s", err.buf);
+				}
+			} else
+				gitmodules_modified = 1;
 		}
 
 		if (mode == WORKING_DIRECTORY)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4008fae..4a2570e 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -292,6 +292,9 @@ test_expect_success 'setup submodule' '
 	echo content >file &&
 	git add file &&
 	git commit -m "added sub and file" &&
+	mkdir -p deep/directory/hierachy &&
+	git submodule add ./. deep/directory/hierachy/sub &&
+	git commit -m "added another submodule" &&
 	git branch submodule
 '
 
@@ -475,4 +478,17 @@ test_expect_success 'mv -k does not accidentally destroy submodules' '
 	git checkout .
 '
 
+test_expect_success 'moving a submodule in nested directories' '
+	(
+		cd deep &&
+		git mv directory ../ &&
+		# git status would fail if the update of linking git dir to
+		# work dir of the submodule failed.
+		git status &&
+		git config -f ../.gitmodules submodule.deep/directory/hierachy/sub.path >../actual &&
+		echo "directory/hierachy/sub" >../expect
+	) &&
+	test_cmp actual expect
+'
+
 test_done
-- 
2.8.1.211.g24879d1

^ permalink raw reply related	[relevance 11%]

* Re: [BUG] git mv file directory/ creates the file directory
  @ 2013-12-02 17:07 11%   ` Matthieu Moy
  0 siblings, 0 replies; 200+ results
From: Matthieu Moy @ 2013-12-02 17:07 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: git

Duy Nguyen <pclouds@gmail.com> writes:

> This may be a start. Does not seem to break anything..

I did not thoroughly review/test, but it does fix my case. Below is the
same patch with one test case. No time to do more right now.

Thanks,

>From 99985341ed1312cf6a7b63e14be7da0d51c701b4 Mon Sep 17 00:00:00 2001
From: Matthieu Moy <Matthieu.Moy@imag.fr>
Date: Mon, 2 Dec 2013 18:03:20 +0100
Subject: [PATCH] WIP: error out on git mv file no-such-dir/

---
 builtin/mv.c  | 18 +++++++++++-------
 t/t7001-mv.sh |  9 +++++++++
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 2e0e61b..0fcccd5 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -16,9 +16,12 @@ static const char * const builtin_mv_usage[] = {
 	NULL
 };
 
+#define DUP_BASENAME 1
+#define KEEP_TRAILING_SLASH 2
+
 static const char **internal_copy_pathspec(const char *prefix,
 					   const char **pathspec,
-					   int count, int base_name)
+					   int count, unsigned flags)
 {
 	int i;
 	const char **result = xmalloc((count + 1) * sizeof(const char *));
@@ -27,11 +30,12 @@ static const char **internal_copy_pathspec(const char *prefix,
 	for (i = 0; i < count; i++) {
 		int length = strlen(result[i]);
 		int to_copy = length;
-		while (to_copy > 0 && is_dir_sep(result[i][to_copy - 1]))
+		while (!(flags & KEEP_TRAILING_SLASH) &&
+		       to_copy > 0 && is_dir_sep(result[i][to_copy - 1]))
 			to_copy--;
-		if (to_copy != length || base_name) {
+		if (to_copy != length || flags & DUP_BASENAME) {
 			char *it = xmemdupz(result[i], to_copy);
-			if (base_name) {
+			if (flags & DUP_BASENAME) {
 				result[i] = xstrdup(basename(it));
 				free(it);
 			} else
@@ -87,16 +91,16 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 	source = internal_copy_pathspec(prefix, argv, argc, 0);
 	modes = xcalloc(argc, sizeof(enum update_mode));
-	dest_path = internal_copy_pathspec(prefix, argv + argc, 1, 0);
+	dest_path = internal_copy_pathspec(prefix, argv + argc, 1, KEEP_TRAILING_SLASH);
 	submodule_gitfile = xcalloc(argc, sizeof(char *));
 
 	if (dest_path[0][0] == '\0')
 		/* special case: "." was normalized to "" */
-		destination = internal_copy_pathspec(dest_path[0], argv, argc, 1);
+		destination = internal_copy_pathspec(dest_path[0], argv, argc, DUP_BASENAME);
 	else if (!lstat(dest_path[0], &st) &&
 			S_ISDIR(st.st_mode)) {
 		dest_path[0] = add_slash(dest_path[0]);
-		destination = internal_copy_pathspec(dest_path[0], argv, argc, 1);
+		destination = internal_copy_pathspec(dest_path[0], argv, argc, DUP_BASENAME);
 	} else {
 		if (argc != 1)
 			die("destination '%s' is not a directory", dest_path[0]);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b90e985..7e74bf3 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -72,6 +72,15 @@ rm -f idontexist untracked1 untracked2 \
      .git/index.lock
 
 test_expect_success \
+    'moving to target with trailing slash' \
+    'test_must_fail git mv path0/COPYING no-such-dir/ &&
+     git mv path0/ no-such-dir/'
+
+test_expect_success \
+    'clean up' \
+    'git reset --hard'
+
+test_expect_success \
     'adding another file' \
     'cp "$TEST_DIRECTORY"/../README path0/README &&
      git add path0/README &&
-- 
1.8.5.rc3.4.g8bd3721

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply related	[relevance 11%]

* [PATCH] mv: allow moving nested submodules
@ 2016-04-19 18:32 11% Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2016-04-19 18:32 UTC (permalink / raw)
  To: gitster; +Cc: git, Jens.Lehmann, gmane, Stefan Beller

When directories are moved using `git mv` all files in the directory
have been just moved, but no further action was taken on them. This
was done by assigning the mode = WORKING_DIRECTORY to the files
inside a moved directory.

submodules however need to update their link to the git directory as
well as updates to the .gitmodules file. By removing the condition of
`mode != INDEX` (the remaining modes are BOTH and WORKING_DIRECTORY) for
the required submodule actions, we perform these for submodules in a
moved directory.

Signed-off-by: Stefan Beller <sbeller@google.com>
---

> Can you do only the 2/2 on top of maint (or maint-2.6) for now then?

This is developed on maint-2.6.

 builtin/mv.c  | 22 +++++++++++++---------
 t/t7001-mv.sh | 16 ++++++++++++++++
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index d1d4316..77f3ec5 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -251,15 +251,19 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		int pos;
 		if (show_only || verbose)
 			printf(_("Renaming %s to %s\n"), src, dst);
-		if (!show_only && mode != INDEX) {
-			if (rename(src, dst) < 0 && !ignore_errors)
-				die_errno(_("renaming '%s' failed"), src);
-			if (submodule_gitfile[i]) {
-				if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
-					connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
-				if (!update_path_in_gitmodules(src, dst))
-					gitmodules_modified = 1;
-			}
+		if (show_only)
+			continue;
+		if (mode != INDEX &&
+		    rename(src, dst) < 0) {
+			if (ignore_errors)
+				continue;
+			die_errno(_("renaming '%s' failed"), src);
+		}
+		if (submodule_gitfile[i]) {
+			if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
+				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
+			if (!update_path_in_gitmodules(src, dst))
+				gitmodules_modified = 1;
 		}
 
 		if (mode == WORKING_DIRECTORY)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 7b56081..fcfc953 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -292,6 +292,9 @@ test_expect_success 'setup submodule' '
 	echo content >file &&
 	git add file &&
 	git commit -m "added sub and file" &&
+	mkdir -p deep/directory/hierachy &&
+	git submodule add ./. deep/directory/hierachy/sub &&
+	git commit -m "added another submodule" &&
 	git branch submodule
 '
 
@@ -475,4 +478,17 @@ test_expect_success 'mv -k does not accidentally destroy submodules' '
 	git checkout .
 '
 
+test_expect_success 'moving a submodule in nested directories' '
+	(
+		cd deep &&
+		git mv directory ../ &&
+		# git status would fail if the update of linking git dir to
+		# work dir of the submodule failed.
+		git status &&
+		git config -f ../.gitmodules submodule.deep/directory/hierachy/sub.path >../actual &&
+		echo "directory/hierachy/sub" >../expect
+	) &&
+	test_cmp actual expect
+'
+
 test_done
-- 
2.6.6.dirty

^ permalink raw reply related	[relevance 11%]

* [PATCH] builtin-mv: minimum fix to avoid losing files
  @ 2008-02-04  8:09 11% ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2008-02-04  8:09 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

An incorrect command "git mv subdir /outer/space" threw the
subdirectory to outside of the repository and then noticed that
/outer/space/subdir/ would be outside of the repository.  The
error checking is backwards.

This fixes the issue by being careful about use of the return
value of get_pathspec().  Since the implementation already has
handcrafted loop to munge each path on the command line, we use
prefix_path() instead.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * This minimally fixes the issue and applies on top of the
   "setup: sanitize absolute and funny paths in get_pathspec()"
   patch I showed during the rc freeze.

   Dscho CC'ed as he owns the largest number of lines in this
   source file.

 builtin-mv.c  |    6 +++++-
 t/t7001-mv.sh |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/builtin-mv.c b/builtin-mv.c
index 94f6dd2..68aa2a6 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -19,6 +19,7 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
 				  int count, int base_name)
 {
 	int i;
+	int len = prefix ? strlen(prefix) : 0;
 	const char **result = xmalloc((count + 1) * sizeof(const char *));
 	memcpy(result, pathspec, count * sizeof(const char *));
 	result[count] = NULL;
@@ -32,8 +33,11 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
 			if (last_slash)
 				result[i] = last_slash + 1;
 		}
+		result[i] = prefix_path(prefix, len, result[i]);
+		if (!result[i])
+			exit(1); /* error already given */
 	}
-	return get_pathspec(prefix, result);
+	return result;
 }
 
 static void show_list(const char *label, struct path_list *list)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b1243b4..fa382c5 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -118,4 +118,42 @@ test_expect_success "Sergey Vlasov's test case" '
 	git mv ab a
 '
 
+test_expect_success 'absolute pathname' '(
+
+	rm -fr mine &&
+	mkdir mine &&
+	cd mine &&
+	test_create_repo one &&
+	cd one &&
+	mkdir sub &&
+	>sub/file &&
+	git add sub/file &&
+
+	git mv sub "$(pwd)/in" &&
+	! test -d sub &&
+	test -d in &&
+	git ls-files --error-unmatch in/file
+
+
+)'
+
+test_expect_success 'absolute pathname outside should fail' '(
+
+	rm -fr mine &&
+	mkdir mine &&
+	cd mine &&
+	out=$(pwd) &&
+	test_create_repo one &&
+	cd one &&
+	mkdir sub &&
+	>sub/file &&
+	git add sub/file &&
+
+	! git mv sub "$out/out" &&
+	test -d sub &&
+	! test -d ../in &&
+	git ls-files --error-unmatch sub/file
+
+)'
+
 test_done
-- 
1.5.4.18.gd0b8

^ permalink raw reply related	[relevance 11%]

* [PATCH 1/3] t7001: reformat to newer style
  @ 2018-09-21 23:58 11% ` Stefan Beller
  2018-09-24 13:31  6%   ` Derrick Stolee
  0 siblings, 1 reply; 200+ results
From: Stefan Beller @ 2018-09-21 23:58 UTC (permalink / raw)
  To: git; +Cc: Stefan Beller

The old formatting style is a real hindrance of getting people up to speed
contributing as they use existing code as an example and follow that style.
So let's get rid of the old style and reformat it in our current style.

Reported-by: Derrick Stolee <stolee@gmail.com>
Reported-by: Jeff Hostetler <git@jeffhostetler.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 t/t7001-mv.sh | 268 +++++++++++++++++++++++++-------------------------
 1 file changed, 134 insertions(+), 134 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 36b50d0b4c1..2251d24735c 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -3,74 +3,74 @@
 test_description='git mv in subdirs'
 . ./test-lib.sh
 
-test_expect_success \
-    'prepare reference tree' \
-    'mkdir path0 path1 &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
-     git add path0/COPYING &&
-     git commit -m add -a'
+test_expect_success 'prepare reference tree' '
+	mkdir path0 path1 &&
+	cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+	git add path0/COPYING &&
+	git commit -m add -a
+'
 
-test_expect_success \
-    'moving the file out of subdirectory' \
-    'cd path0 && git mv COPYING ../path1/COPYING'
+test_expect_success 'moving the file out of subdirectory' '
+	cd path0 && git mv COPYING ../path1/COPYING
+'
 
 # in path0 currently
-test_expect_success \
-    'commiting the change' \
-    'cd .. && git commit -m move-out -a'
+test_expect_success 'commiting the change' '
+	cd .. && git commit -m move-out -a
+'
 
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-    grep "^R100..*path0/COPYING..*path1/COPYING" actual'
+test_expect_success 'checking the commit' '
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path0/COPYING..*path1/COPYING" actual
+'
 
-test_expect_success \
-    'moving the file back into subdirectory' \
-    'cd path0 && git mv ../path1/COPYING COPYING'
+test_expect_success 'moving the file back into subdirectory' '
+	cd path0 && git mv ../path1/COPYING COPYING
+'
 
 # in path0 currently
-test_expect_success \
-    'commiting the change' \
-    'cd .. && git commit -m move-in -a'
-
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-    grep "^R100..*path1/COPYING..*path0/COPYING" actual'
-
-test_expect_success \
-    'mv --dry-run does not move file' \
-    'git mv -n path0/COPYING MOVED &&
-     test -f path0/COPYING &&
-     test ! -f MOVED'
-
-test_expect_success \
-    'checking -k on non-existing file' \
-    'git mv -k idontexist path0'
-
-test_expect_success \
-    'checking -k on untracked file' \
-    'touch untracked1 &&
-     git mv -k untracked1 path0 &&
-     test -f untracked1 &&
-     test ! -f path0/untracked1'
-
-test_expect_success \
-    'checking -k on multiple untracked files' \
-    'touch untracked2 &&
-     git mv -k untracked1 untracked2 path0 &&
-     test -f untracked1 &&
-     test -f untracked2 &&
-     test ! -f path0/untracked1 &&
-     test ! -f path0/untracked2'
-
-test_expect_success \
-    'checking -f on untracked file with existing target' \
-    'touch path0/untracked1 &&
-     test_must_fail git mv -f untracked1 path0 &&
-     test ! -f .git/index.lock &&
-     test -f untracked1 &&
-     test -f path0/untracked1'
+test_expect_success 'commiting the change' '
+	cd .. && git commit -m move-in -a
+'
+
+test_expect_success 'checking the commit' '
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path1/COPYING..*path0/COPYING" actual
+'
+
+test_expect_success 'mv --dry-run does not move file' '
+	git mv -n path0/COPYING MOVED &&
+	test -f path0/COPYING &&
+	test ! -f MOVED
+'
+
+test_expect_success 'checking -k on non-existing file' '
+	git mv -k idontexist path0
+'
+
+test_expect_success 'checking -k on untracked file' '
+	touch untracked1 &&
+	git mv -k untracked1 path0 &&
+	test -f untracked1 &&
+	test ! -f path0/untracked1
+'
+
+test_expect_success 'checking -k on multiple untracked files' '
+	touch untracked2 &&
+	git mv -k untracked1 untracked2 path0 &&
+	test -f untracked1 &&
+	test -f untracked2 &&
+	test ! -f path0/untracked1 &&
+	test ! -f path0/untracked2
+'
+
+test_expect_success 'checking -f on untracked file with existing target' '
+	touch path0/untracked1 &&
+	test_must_fail git mv -f untracked1 path0 &&
+	test ! -f .git/index.lock &&
+	test -f untracked1 &&
+	test -f path0/untracked1
+'
 
 # clean up the mess in case bad things happen
 rm -f idontexist untracked1 untracked2 \
@@ -78,79 +78,79 @@ rm -f idontexist untracked1 untracked2 \
      .git/index.lock
 rmdir path1
 
-test_expect_success \
-    'moving to absent target with trailing slash' \
-    'test_must_fail git mv path0/COPYING no-such-dir/ &&
-     test_must_fail git mv path0/COPYING no-such-dir// &&
-     git mv path0/ no-such-dir/ &&
-     test_path_is_dir no-such-dir'
-
-test_expect_success \
-    'clean up' \
-    'git reset --hard'
-
-test_expect_success \
-    'moving to existing untracked target with trailing slash' \
-    'mkdir path1 &&
-     git mv path0/ path1/ &&
-     test_path_is_dir path1/path0/'
-
-test_expect_success \
-    'moving to existing tracked target with trailing slash' \
-    'mkdir path2 &&
-     >path2/file && git add path2/file &&
-     git mv path1/path0/ path2/ &&
-     test_path_is_dir path2/path0/'
-
-test_expect_success \
-    'clean up' \
-    'git reset --hard'
-
-test_expect_success \
-    'adding another file' \
-    'cp "$TEST_DIRECTORY"/../README.md path0/README &&
-     git add path0/README &&
-     git commit -m add2 -a'
-
-test_expect_success \
-    'moving whole subdirectory' \
-    'git mv path0 path2'
-
-test_expect_success \
-    'commiting the change' \
-    'git commit -m dir-move -a'
-
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
-     grep "^R100..*path0/README..*path2/README" actual'
-
-test_expect_success \
-    'succeed when source is a prefix of destination' \
-    'git mv path2/COPYING path2/COPYING-renamed'
-
-test_expect_success \
-    'moving whole subdirectory into subdirectory' \
-    'git mv path2 path1'
-
-test_expect_success \
-    'commiting the change' \
-    'git commit -m dir-move -a'
-
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
-     grep "^R100..*path2/README..*path1/path2/README" actual'
-
-test_expect_success \
-    'do not move directory over existing directory' \
-    'mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0'
-
-test_expect_success \
-    'move into "."' \
-    'git mv path1/path2/ .'
+test_expect_success 'moving to absent target with trailing slash' '
+	test_must_fail git mv path0/COPYING no-such-dir/ &&
+	test_must_fail git mv path0/COPYING no-such-dir// &&
+	git mv path0/ no-such-dir/ &&
+	test_path_is_dir no-such-dir
+'
+
+test_expect_success 'clean up' '
+	git reset --hard
+'
+
+test_expect_success 'moving to existing untracked target with trailing slash' '
+	mkdir path1 &&
+	git mv path0/ path1/ &&
+	test_path_is_dir path1/path0/
+'
+
+test_expect_success 'moving to existing tracked target with trailing slash' '
+	mkdir path2 &&
+	>path2/file && git add path2/file &&
+	git mv path1/path0/ path2/ &&
+	test_path_is_dir path2/path0/
+'
+
+test_expect_success 'clean up' '
+	git reset --hard
+'
+
+test_expect_success 'adding another file' '
+	cp "$TEST_DIRECTORY"/../README.md path0/README &&
+	git add path0/README &&
+	git commit -m add2 -a
+'
+
+test_expect_success 'moving whole subdirectory' '
+	git mv path0 path2
+'
+
+test_expect_success 'commiting the change' '
+	git commit -m dir-move -a
+'
+
+test_expect_success 'checking the commit' '
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
+	grep "^R100..*path0/README..*path2/README" actual
+'
+
+test_expect_success 'succeed when source is a prefix of destination' '
+	git mv path2/COPYING path2/COPYING-renamed
+'
+
+test_expect_success 'moving whole subdirectory into subdirectory' '
+	git mv path2 path1
+'
+
+test_expect_success 'commiting the change' '
+	git commit -m dir-move -a
+'
+
+test_expect_success 'checking the commit' '
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
+	grep "^R100..*path2/README..*path1/path2/README" actual
+'
+
+test_expect_success 'do not move directory over existing directory' '
+	mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
+'
+
+test_expect_success 'move into "."' '
+	git mv path1/path2/ .
+'
 
 test_expect_success "Michael Cassar's test case" '
 	rm -fr .git papers partA &&
-- 
2.19.0.444.g18242da7ef-goog


^ permalink raw reply related	[relevance 11%]

* [PATCH] mv: allow moving nested submodules
  @ 2016-04-15 19:11 11% ` Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2016-04-15 19:11 UTC (permalink / raw)
  To: gitster; +Cc: git, Jens.Lehmann, gmane, Stefan Beller

When directories are moved using `git mv` all files in the directory
have been just moved, but no further action was taken on them. This
was done by assigning the mode = WORKING_DIRECTORY to the files
inside a moved directory.

submodules however need to update their link to the git directory as
well as updates to the .gitmodules file. By removing the condition of
`mode != INDEX` (the remaining modes are BOTH and WORKING_DIRECTORY) for
the required submodule actions, we perform these for submodules in a
moved directory.

Signed-off-by: Stefan Beller <sbeller@google.com>
---

Albin,
I think this would fix your problem.

Developed on origin/master (it may apply on older versions, though I did not test)

Thanks,
Stefan

 builtin/mv.c  |  7 +++++--
 t/t7001-mv.sh | 16 ++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index aeae855..65fff11 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -252,9 +252,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		int pos;
 		if (show_only || verbose)
 			printf(_("Renaming %s to %s\n"), src, dst);
-		if (!show_only && mode != INDEX) {
-			if (rename(src, dst) < 0 && !ignore_errors)
+		if (!show_only) {
+			if (mode != INDEX &&
+			    rename(src, dst) < 0 &&
+			    !ignore_errors)
 				die_errno(_("renaming '%s' failed"), src);
+
 			if (submodule_gitfile[i]) {
 				if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
 					connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4008fae..4a2570e 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -292,6 +292,9 @@ test_expect_success 'setup submodule' '
 	echo content >file &&
 	git add file &&
 	git commit -m "added sub and file" &&
+	mkdir -p deep/directory/hierachy &&
+	git submodule add ./. deep/directory/hierachy/sub &&
+	git commit -m "added another submodule" &&
 	git branch submodule
 '
 
@@ -475,4 +478,17 @@ test_expect_success 'mv -k does not accidentally destroy submodules' '
 	git checkout .
 '
 
+test_expect_success 'moving a submodule in nested directories' '
+	(
+		cd deep &&
+		git mv directory ../ &&
+		# git status would fail if the update of linking git dir to
+		# work dir of the submodule failed.
+		git status &&
+		git config -f ../.gitmodules submodule.deep/directory/hierachy/sub.path >../actual &&
+		echo "directory/hierachy/sub" >../expect
+	) &&
+	test_cmp actual expect
+'
+
 test_done
-- 
2.8.1.211.g630c034

^ permalink raw reply related	[relevance 11%]

* [PATCHv2] submodule: test moving recursive submodule
@ 2016-06-28 18:24 12% Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2016-06-28 18:24 UTC (permalink / raw)
  To: bartbogaerts; +Cc: git, Stefan Beller

This reproduces the error as pointed out in [1], but the fix is not easy,
so punt on it for now and just document what needs to be done.

[1] http://stackoverflow.com/questions/32782382/git-moving-submodules-recursively-nested-submodules

Signed-off-by: Stefan Beller <sbeller@google.com>
---

  Bart,
  
  I don't have the time fixing this properly,
  so this is the best I can come up with for now. 
  
  Thanks,
  Stefan

 builtin/mv.c  |  4 ++++
 t/t7001-mv.sh | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/builtin/mv.c b/builtin/mv.c
index a201426..36dd2fd 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -264,6 +264,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
 			if (!update_path_in_gitmodules(src, dst))
 				gitmodules_modified = 1;
+			/**
+			 * NEEDSWORK: We need to recurse into the submodule
+			 * and fix the nested submodules as well.
+			 */
 		}
 
 		if (mode == WORKING_DIRECTORY)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4a2570e..fe933f1 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -295,6 +295,28 @@ test_expect_success 'setup submodule' '
 	mkdir -p deep/directory/hierachy &&
 	git submodule add ./. deep/directory/hierachy/sub &&
 	git commit -m "added another submodule" &&
+	mkdir inner_sub &&
+	(
+		cd inner_sub &&
+		git init &&
+		test_commit initial
+	) &&
+	mkdir outer_sub &&
+	(
+		cd outer_sub &&
+		git init &&
+		test_commit initial &&
+		git submodule add ../inner_sub &&
+		git commit -a -m "add an inner submodule"
+	) &&
+	git submodule add ./outer_sub ./deep/outer_sub &&
+	git commit -a -m "add outer sub" &&
+	git -C deep ls-tree HEAD |cut -f 2 >actual &&
+	cat >expect <<-EOF &&
+	directory
+	outer_sub
+	EOF
+	test_cmp expect actual &&
 	git branch submodule
 '
 
@@ -488,6 +510,18 @@ test_expect_success 'moving a submodule in nested directories' '
 		git config -f ../.gitmodules submodule.deep/directory/hierachy/sub.path >../actual &&
 		echo "directory/hierachy/sub" >../expect
 	) &&
+	test_cmp actual expect &&
+	git commit -a -m "mv a submodule in nested dir"
+'
+
+test_expect_failure 'moving a submodule with a nested submodule' '
+	git submodule update --init --recursive &&
+	git mv deep/outer_sub outer_sub_moved &&
+	# git status would fail if the update of linking git dir to
+	# work dir of the submodule failed.
+	git status &&
+	git config -f .gitmodules submodule.deep/outer_sub.path >actual &&
+	echo "outer_sub_moved" >expect &&
 	test_cmp actual expect
 '
 
-- 
2.9.0.138.g8a4fcb8.dirty


^ permalink raw reply related	[relevance 12%]

* [PATCH] mv: allow moving nested submodules
@ 2016-04-18 16:54 12% Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2016-04-18 16:54 UTC (permalink / raw)
  To: git, gitster; +Cc: Jens.Lehmann, gmane, Stefan Beller

When directories are moved using `git mv` all files in the directory
have been just moved, but no further action was taken on them. This
was done by assigning the mode = WORKING_DIRECTORY to the files
inside a moved directory.

submodules however need to update their link to the git directory as
well as updates to the .gitmodules file. By removing the condition of
`mode != INDEX` (the remaining modes are BOTH and WORKING_DIRECTORY) for
the required submodule actions, we perform these for submodules in a
moved directory.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/mv.c  |  7 +++++--
 t/t7001-mv.sh | 16 ++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index aeae855..65fff11 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -252,9 +252,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		int pos;
 		if (show_only || verbose)
 			printf(_("Renaming %s to %s\n"), src, dst);
-		if (!show_only && mode != INDEX) {
-			if (rename(src, dst) < 0 && !ignore_errors)
+		if (!show_only) {
+			if (mode != INDEX &&
+			    rename(src, dst) < 0 &&
+			    !ignore_errors)
 				die_errno(_("renaming '%s' failed"), src);
+
 			if (submodule_gitfile[i]) {
 				if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
 					connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4008fae..4a2570e 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -292,6 +292,9 @@ test_expect_success 'setup submodule' '
 	echo content >file &&
 	git add file &&
 	git commit -m "added sub and file" &&
+	mkdir -p deep/directory/hierachy &&
+	git submodule add ./. deep/directory/hierachy/sub &&
+	git commit -m "added another submodule" &&
 	git branch submodule
 '
 
@@ -475,4 +478,17 @@ test_expect_success 'mv -k does not accidentally destroy submodules' '
 	git checkout .
 '
 
+test_expect_success 'moving a submodule in nested directories' '
+	(
+		cd deep &&
+		git mv directory ../ &&
+		# git status would fail if the update of linking git dir to
+		# work dir of the submodule failed.
+		git status &&
+		git config -f ../.gitmodules submodule.deep/directory/hierachy/sub.path >../actual &&
+		echo "directory/hierachy/sub" >../expect
+	) &&
+	test_cmp actual expect
+'
+
 test_done
-- 
2.8.0.26.gba39a1b.dirty

^ permalink raw reply related	[relevance 12%]

* [PATCH] git-mv: fix moves into a subdir from outside
@ 2006-03-03 16:23 12% Josef Weidendorfer
  0 siblings, 0 replies; 200+ results
From: Josef Weidendorfer @ 2006-03-03 16:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

git-mv needs to be run from the base directory so that
the check if a file is under revision also covers files
outside of a subdirectory. Previously, e.g. in the git repo,

  cd Documentation; git-mv ../README .

produced the error

  Error: '../README' not under version control

The test is extended for this case; it previously only tested
one direction.

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>

---

 git-mv.perl   |    8 ++++++++
 t/t7001-mv.sh |   18 ++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

08d21abe95064934ea559b88801415e09b19f628
diff --git a/git-mv.perl b/git-mv.perl
index f3e859a..0a63860 100755
--- a/git-mv.perl
+++ b/git-mv.perl
@@ -62,9 +62,17 @@ else {
     $dstDir = "";
 }
 
+my $subdir_prefix = `git rev-parse --show-prefix`;
+chomp($subdir_prefix);
+
+# run in git base directory, so that git-ls-files lists all revisioned files
+chdir "$GIT_DIR/..";
+
 # normalize paths, needed to compare against versioned files and update-index
 # also, this is nicer to end-users by doing ".//a/./b/.//./c" ==> "a/b/c"
 for (@srcArgs, @dstArgs) {
+    # prepend git prefix as we run from base directory
+    $_ = $subdir_prefix.$_;
     s|^\./||;
     s|/\./|/| while (m|/\./|);
     s|//+|/|g;
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 43d74c5..811a479 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -11,17 +11,31 @@ test_expect_success \
      git-commit -m add -a'
 
 test_expect_success \
-    'moving the file' \
+    'moving the file out of subdirectory' \
     'cd path0 && git-mv COPYING ../path1/COPYING'
 
 # in path0 currently
 test_expect_success \
     'commiting the change' \
-    'cd .. && git-commit -m move -a'
+    'cd .. && git-commit -m move-out -a'
 
 test_expect_success \
     'checking the commit' \
     'git-diff-tree -r -M --name-status  HEAD^ HEAD | \
     grep -E "^R100.+path0/COPYING.+path1/COPYING"'
 
+test_expect_success \
+    'moving the file back into subdirectory' \
+    'cd path0 && git-mv ../path1/COPYING COPYING'
+
+# in path0 currently
+test_expect_success \
+    'commiting the change' \
+    'cd .. && git-commit -m move-in -a'
+
+test_expect_success \
+    'checking the commit' \
+    'git-diff-tree -r -M --name-status  HEAD^ HEAD | \
+    grep -E "^R100.+path1/COPYING.+path0/COPYING"'
+
 test_done
-- 
1.2.0.g719b

^ permalink raw reply related	[relevance 12%]

* Re: [PATCH] mv: let 'git mv file no-such-dir/' error out
  @ 2013-12-04  8:44 12%   ` Matthieu Moy
  0 siblings, 0 replies; 200+ results
From: Matthieu Moy @ 2013-12-04  8:44 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List, Junio C Hamano

Duy Nguyen <pclouds@gmail.com> writes:

> On Tue, Dec 3, 2013 at 3:32 PM, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
>> Git used to trim the trailing slash, and make the command equivalent to
>> 'git mv file no-such-dir', which created the file no-such-dir (while the
>> trailing slash explicitly stated that it could only be a directory).
>>
>> This patch skips the trailing slash removal for the destination path. The
>> path with its trailing slash is passed to rename(2), which errors out
>> with the appropriate message:
>>
>>   $ git mv file no-such-dir/
>>   fatal: renaming 'file' failed: Not a directory
>
> There's something we probably should check. In d78b0f3 ([PATCH]
> git-mv: add more path normalization - 2006-08-16), it mentions about
>
> git mv something/ somewhere/
>
> there's no test in that commit so I don't know the actual input and
> expected outcome.

To me, the expected outcome is "behave like Unix's mv" (which works with
or without the trailing slash if somewhere exists).

> If "somewhere" is a directory, it errors out with this patch and works
> without it.

I can't reproduce. I've added this to my patch (indeed, the area wasn't
well tested), and the tests pass.

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e5c8084..3bfdfed 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -70,12 +70,31 @@ test_expect_success \
 rm -f idontexist untracked1 untracked2 \
      path0/idontexist path0/untracked1 path0/untracked2 \
      .git/index.lock
+rmdir path1
 
 test_expect_success \
-    'moving to target with trailing slash' \
+    'moving to absent target with trailing slash' \
     'test_must_fail git mv path0/COPYING no-such-dir/ &&
      test_must_fail git mv path0/COPYING no-such-dir// &&
-     git mv path0/ no-such-dir/'
+     git mv path0/ no-such-dir/ &&
+     test_path_is_dir no-such-dir'
+
+test_expect_success \
+    'clean up' \
+    'git reset --hard'
+
+test_expect_success \
+    'moving to existing untracked target with trailing slash' \
+    'mkdir path1 &&
+     git mv path0/ path1/ &&
+     test_path_is_dir path1/path0/'
+
+test_expect_success \
+    'moving to existing tracked target with trailing slash' \
+    'mkdir path2 &&
+     >path2/file && git add path2/file &&
+     git mv path1/path0/ path2/ &&
+     test_path_is_dir path2/path0/'
 
 test_expect_success \
     'clean up' \

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply related	[relevance 12%]

* [PATCH] submodule: test moving recursive submodule
@ 2016-06-28  0:15 12% Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2016-06-28  0:15 UTC (permalink / raw)
  To: bartbogaerts; +Cc: git, Stefan Beller

Signed-off-by: Stefan Beller <sbeller@google.com>
---
This tries to reproduce the error as pointed out in
http://stackoverflow.com/questions/32782382/git-moving-submodules-recursively-nested-submodules
but the tests pass. This still seems to be missing a detail.

Bart any idea how this setup may be different than what you have?
Instead of applying the patch, you can also checkout 
https://github.com/stefanbeller/git/tree/submodule_recursive_mv_test
which is the patch below applied on top of Junios (the maintainer) master branch.
To look around on the filesystem, you can drop "test_pause &&" in a test and
then run the test with `(cd t && ./t7001-mv.sh -v)` (more info how to run tests
in the Git test suite in t/README, maybe -i -v -x are interested)

Thanks,
Stefan

 t/t7001-mv.sh | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4a2570e..404e5bd 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -295,6 +295,28 @@ test_expect_success 'setup submodule' '
 	mkdir -p deep/directory/hierachy &&
 	git submodule add ./. deep/directory/hierachy/sub &&
 	git commit -m "added another submodule" &&
+	mkdir inner_sub &&
+	(
+		cd inner_sub &&
+		git init &&
+		test_commit initial
+	) &&
+	mkdir outer_sub &&
+	(
+		cd outer_sub &&
+		git init &&
+		test_commit initial &&
+		git submodule add ../inner_sub &&
+		git commit -a -m "add an inner submodule"
+	) &&
+	git submodule add ./outer_sub ./deep/outer_sub &&
+	git commit -a -m "add outer sub" &&
+	git -C deep ls-tree HEAD |cut -f 2 >actual &&
+	cat >expect <<-EOF &&
+	directory
+	outer_sub
+	EOF
+	test_cmp expect actual &&
 	git branch submodule
 '
 
@@ -488,6 +510,27 @@ test_expect_success 'moving a submodule in nested directories' '
 		git config -f ../.gitmodules submodule.deep/directory/hierachy/sub.path >../actual &&
 		echo "directory/hierachy/sub" >../expect
 	) &&
+	test_cmp actual expect &&
+	git commit -a -m "mv a submodule in nested dir"
+'
+
+test_expect_success 'moving a submodule with a nested submodule' '
+	git mv deep/outer_sub outer_sub_moved &&
+	# git status would fail if the update of linking git dir to
+	# work dir of the submodule failed.
+	git status &&
+	git config -f .gitmodules submodule.deep/outer_sub.path >actual &&
+	echo "outer_sub_moved" >expect &&
+	test_cmp actual expect
+'
+
+test_expect_success 'moving back the submodule with a nested submodule' '
+	git mv outer_sub_moved deep/outer_sub &&
+	# git status would fail if the update of linking git dir to
+	# work dir of the submodule failed.
+	git status &&
+	git config -f .gitmodules submodule.deep/outer_sub.path >actual &&
+	echo "deep/outer_sub" >expect &&
 	test_cmp actual expect
 '
 
-- 
2.9.0.4.g35eb263.dirty


^ permalink raw reply related	[relevance 12%]

* [PATCH v2] mv: prevent mismatched data when ignoring errors.
  @ 2014-03-15 18:56 12% ` brian m. carlson
  0 siblings, 0 replies; 200+ results
From: brian m. carlson @ 2014-03-15 18:56 UTC (permalink / raw)
  To: git; +Cc: Jens Lehmann, John Keeping, Junio C Hamano, Guillaume Gelin

We shrink the source and destination arrays, but not the modes or
submodule_gitfile arrays, resulting in potentially mismatched data.  Shrink
all the arrays at the same time to prevent this.  Add tests to ensure the
problem does not recur.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---

I attempted to come up with a second patch that would refactor out the
four different arrays into one array of struct, as Jeff suggested, but
it became very ugly very quickly.  So this patch simply fixes the
problem and adds tests.

 builtin/mv.c  |  5 +++++
 t/t7001-mv.sh | 13 ++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index f99c91e..09bbc63 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -230,6 +230,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 					memmove(destination + i,
 						destination + i + 1,
 						(argc - i) * sizeof(char *));
+					memmove(modes + i, modes + i + 1,
+						(argc - i) * sizeof(enum update_mode));
+					memmove(submodule_gitfile + i,
+						submodule_gitfile + i + 1,
+						(argc - i) * sizeof(char *));
 					i--;
 				}
 			} else
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e3c8c2c..215d43d 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -294,7 +294,8 @@ test_expect_success 'setup submodule' '
 	git submodule add ./. sub &&
 	echo content >file &&
 	git add file &&
-	git commit -m "added sub and file"
+	git commit -m "added sub and file" &&
+	git branch submodule
 '
 
 test_expect_success 'git mv cannot move a submodule in a file' '
@@ -463,4 +464,14 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
 	! test -s actual
 '
 
+test_expect_success 'mv -k does not accidentally destroy submodules' '
+	git checkout submodule &&
+	mkdir dummy dest &&
+	git mv -k dummy sub dest &&
+	git status --porcelain >actual &&
+	grep "^R  sub -> dest/sub" actual &&
+	git reset --hard &&
+	git checkout .
+'
+
 test_done
-- 
1.9.0.1010.g6633b85.dirty

^ permalink raw reply related	[relevance 12%]

* [PATCH] git-mv: succeed even if source is a prefix of destination
  @ 2006-08-16  0:20 12%   ` Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2006-08-16  0:20 UTC (permalink / raw)
  To: David Rientjes; +Cc: Fredrik Kuivinen, git


As noted by Fredrik Kuivinen, without this patch, git-mv fails on

	git-mv README README-renamed

because "README" is a prefix of "README-renamed".

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

---

	On Tue, 15 Aug 2006, David Rientjes wrote:

	> On Tue, 15 Aug 2006, Fredrik Kuivinen wrote:
	> > With the current master I get the following:
	> > 
	> >     $ git-mv README README-renamed
	> >     fatal: can not move directory into itself, source=README, destination=README-renamed
	> > 
	> 
	> Please try the following patch.
	> 
	> -		if (!bad &&
	> -		    !strncmp(destination[i], source[i], strlen(source[i])))
	> +		if (!bad && !strcmp(destination[i], source[i]))

	This is not sufficient. It will not catch something like

		git-mv some/path some/path/and/some/more/


 builtin-mv.c  |    5 ++++-
 t/t7001-mv.sh |    4 ++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/builtin-mv.c b/builtin-mv.c
index a731f8d..e7b5eb7 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -119,6 +119,7 @@ int cmd_mv(int argc, const char **argv, 
 
 	/* Checking */
 	for (i = 0; i < count; i++) {
+		int length;
 		const char *bad = NULL;
 
 		if (show_only)
@@ -204,7 +205,9 @@ int cmd_mv(int argc, const char **argv, 
 		}
 
 		if (!bad &&
-		    !strncmp(destination[i], source[i], strlen(source[i])))
+		    (length = strlen(source[i])) >= 0 &&
+		    !strncmp(destination[i], source[i], length) &&
+		    (destination[i][length] == 0 || destination[i][length] == '/'))
 			bad = "can not move directory into itself";
 
 		if (!bad && cache_name_pos(source[i], strlen(source[i])) < 0)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 900ca93..e5e0bb9 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -60,6 +60,10 @@ test_expect_success \
      grep -E "^R100.+path0/README.+path2/README"'
 
 test_expect_success \
+    'succeed when source is a prefix of destination' \
+    'git-mv path2/COPYING path2/COPYING-renamed'
+
+test_expect_success \
     'moving whole subdirectory into subdirectory' \
     'git-mv path2 path1'
 
-- 
1.4.2.g2e3b

^ permalink raw reply related	[relevance 12%]

* [PATCH v2 01/10] t7001: modernize test formatting
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
                   ` (8 preceding siblings ...)
  2021-02-09 17:32 13% ` [PATCH v2 02/10] t7001: indent with TABs instead of spaces shubham verma
@ 2021-02-09 17:32 12% ` shubham verma
  2021-02-09 19:24  6% ` [PATCH v2 00/10] Modernizing the t7001 test script Eric Sunshine
  2021-02-09 22:58  6% ` Junio C Hamano
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2021-02-09 17:32 UTC (permalink / raw)
  To: git

Some tests in this script are formatted using a very old style:

        test_expect_success \
            'title' \
            'body line 1 &&
            body line 2'

Update the formatting to the modern style:

        test_expect_success 'title' '
            body line 1 &&
            body line 2
        '

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 192 +++++++++++++++++++++++++-------------------------
 1 file changed, 96 insertions(+), 96 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 63d5f41a12..4bbb51e578 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -3,74 +3,74 @@
 test_description='git mv in subdirs'
 . ./test-lib.sh
 
-test_expect_success \
-    'prepare reference tree' \
-    'mkdir path0 path1 &&
+test_expect_success 'prepare reference tree' '
+     mkdir path0 path1 &&
      cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
      git add path0/COPYING &&
-     git commit -m add -a'
+     git commit -m add -a
+'
 
-test_expect_success \
-    'moving the file out of subdirectory' \
-    'cd path0 && git mv COPYING ../path1/COPYING'
+test_expect_success 'moving the file out of subdirectory' '
+     cd path0 && git mv COPYING ../path1/COPYING
+'
 
 # in path0 currently
-test_expect_success \
-    'commiting the change' \
-    'cd .. && git commit -m move-out -a'
+test_expect_success 'commiting the change' '
+     cd .. && git commit -m move-out -a
+'
 
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-    grep "^R100..*path0/COPYING..*path1/COPYING" actual'
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path0/COPYING..*path1/COPYING" actual
+'
 
-test_expect_success \
-    'moving the file back into subdirectory' \
-    'cd path0 && git mv ../path1/COPYING COPYING'
+test_expect_success 'moving the file back into subdirectory' '
+     cd path0 && git mv ../path1/COPYING COPYING
+'
 
 # in path0 currently
-test_expect_success \
-    'commiting the change' \
-    'cd .. && git commit -m move-in -a'
-
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-    grep "^R100..*path1/COPYING..*path0/COPYING" actual'
-
-test_expect_success \
-    'mv --dry-run does not move file' \
-    'git mv -n path0/COPYING MOVED &&
+test_expect_success 'commiting the change' '
+     cd .. && git commit -m move-in -a
+'
+
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path1/COPYING..*path0/COPYING" actual
+'
+
+test_expect_success 'mv --dry-run does not move file' '
+     git mv -n path0/COPYING MOVED &&
      test -f path0/COPYING &&
-     test ! -f MOVED'
+     test ! -f MOVED
+'
 
-test_expect_success \
-    'checking -k on non-existing file' \
-    'git mv -k idontexist path0'
+test_expect_success 'checking -k on non-existing file' '
+     git mv -k idontexist path0
+'
 
-test_expect_success \
-    'checking -k on untracked file' \
-    'touch untracked1 &&
+test_expect_success 'checking -k on untracked file' '
+     touch untracked1 &&
      git mv -k untracked1 path0 &&
      test -f untracked1 &&
-     test ! -f path0/untracked1'
+     test ! -f path0/untracked1
+'
 
-test_expect_success \
-    'checking -k on multiple untracked files' \
-    'touch untracked2 &&
+test_expect_success 'checking -k on multiple untracked files' '
+     touch untracked2 &&
      git mv -k untracked1 untracked2 path0 &&
      test -f untracked1 &&
      test -f untracked2 &&
      test ! -f path0/untracked1 &&
-     test ! -f path0/untracked2'
+     test ! -f path0/untracked2
+'
 
-test_expect_success \
-    'checking -f on untracked file with existing target' \
-    'touch path0/untracked1 &&
+test_expect_success 'checking -f on untracked file with existing target' '
+     touch path0/untracked1 &&
      test_must_fail git mv -f untracked1 path0 &&
      test ! -f .git/index.lock &&
      test -f untracked1 &&
-     test -f path0/untracked1'
+     test -f path0/untracked1
+'
 
 # clean up the mess in case bad things happen
 rm -f idontexist untracked1 untracked2 \
@@ -78,79 +78,79 @@ rm -f idontexist untracked1 untracked2 \
      .git/index.lock
 rmdir path1
 
-test_expect_success \
-    'moving to absent target with trailing slash' \
-    'test_must_fail git mv path0/COPYING no-such-dir/ &&
+test_expect_success 'moving to absent target with trailing slash' '
+     test_must_fail git mv path0/COPYING no-such-dir/ &&
      test_must_fail git mv path0/COPYING no-such-dir// &&
      git mv path0/ no-such-dir/ &&
-     test_path_is_dir no-such-dir'
+     test_path_is_dir no-such-dir
+'
 
-test_expect_success \
-    'clean up' \
-    'git reset --hard'
+test_expect_success 'clean up' '
+     git reset --hard
+'
 
-test_expect_success \
-    'moving to existing untracked target with trailing slash' \
-    'mkdir path1 &&
+test_expect_success 'moving to existing untracked target with trailing slash' '
+     mkdir path1 &&
      git mv path0/ path1/ &&
-     test_path_is_dir path1/path0/'
+     test_path_is_dir path1/path0/
+'
 
-test_expect_success \
-    'moving to existing tracked target with trailing slash' \
-    'mkdir path2 &&
+test_expect_success 'moving to existing tracked target with trailing slash' '
+     mkdir path2 &&
      >path2/file && git add path2/file &&
      git mv path1/path0/ path2/ &&
-     test_path_is_dir path2/path0/'
+     test_path_is_dir path2/path0/
+'
 
-test_expect_success \
-    'clean up' \
-    'git reset --hard'
+test_expect_success 'clean up' '
+     git reset --hard
+'
 
-test_expect_success \
-    'adding another file' \
-    'cp "$TEST_DIRECTORY"/../README.md path0/README &&
+test_expect_success 'adding another file' '
+     cp "$TEST_DIRECTORY"/../README.md path0/README &&
      git add path0/README &&
-     git commit -m add2 -a'
+     git commit -m add2 -a
+'
 
-test_expect_success \
-    'moving whole subdirectory' \
-    'git mv path0 path2'
+test_expect_success 'moving whole subdirectory' '
+     git mv path0 path2
+'
 
-test_expect_success \
-    'commiting the change' \
-    'git commit -m dir-move -a'
+test_expect_success 'commiting the change' '
+     git commit -m dir-move -a
+'
 
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
      grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
-     grep "^R100..*path0/README..*path2/README" actual'
+     grep "^R100..*path0/README..*path2/README" actual
+'
 
-test_expect_success \
-    'succeed when source is a prefix of destination' \
-    'git mv path2/COPYING path2/COPYING-renamed'
+test_expect_success 'succeed when source is a prefix of destination' '
+     git mv path2/COPYING path2/COPYING-renamed
+'
 
-test_expect_success \
-    'moving whole subdirectory into subdirectory' \
-    'git mv path2 path1'
+test_expect_success 'moving whole subdirectory into subdirectory' '
+     git mv path2 path1
+'
 
-test_expect_success \
-    'commiting the change' \
-    'git commit -m dir-move -a'
+test_expect_success 'commiting the change' '
+     git commit -m dir-move -a
+'
 
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
      grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
-     grep "^R100..*path2/README..*path1/path2/README" actual'
+     grep "^R100..*path2/README..*path1/path2/README" actual
+'
 
-test_expect_success \
-    'do not move directory over existing directory' \
-    'mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0'
+test_expect_success 'do not move directory over existing directory' '
+     mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
+'
 
-test_expect_success \
-    'move into "."' \
-    'git mv path1/path2/ .'
+test_expect_success 'move into "."' '
+     git mv path1/path2/ .
+'
 
 test_expect_success "Michael Cassar's test case" '
 	rm -fr .git papers partA &&
-- 
2.25.1


^ permalink raw reply related	[relevance 12%]

* [PATCH v3 01/10] t7001: modernize test formatting
  2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
                   ` (8 preceding siblings ...)
  2021-02-11 19:46 13% ` [PATCH v3 02/10] t7001: indent with TABs instead of spaces Shubham Verma
@ 2021-02-11 19:46 12% ` Shubham Verma
  2021-02-11 21:44  6% ` [PATCH v3 00/10] Modernizing the t7001 test script Junio C Hamano
  10 siblings, 0 replies; 200+ results
From: Shubham Verma @ 2021-02-11 19:46 UTC (permalink / raw)
  To: git

Some tests in this script are formatted using a very old style:

        test_expect_success \
            'title' \
            'body line 1 &&
            body line 2'

Update the formatting to the modern style:

        test_expect_success 'title' '
            body line 1 &&
            body line 2
        '

Signed-off-by: Shubham Verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 192 +++++++++++++++++++++++++-------------------------
 1 file changed, 96 insertions(+), 96 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 63d5f41a12..4bbb51e578 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -3,74 +3,74 @@
 test_description='git mv in subdirs'
 . ./test-lib.sh
 
-test_expect_success \
-    'prepare reference tree' \
-    'mkdir path0 path1 &&
+test_expect_success 'prepare reference tree' '
+     mkdir path0 path1 &&
      cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
      git add path0/COPYING &&
-     git commit -m add -a'
+     git commit -m add -a
+'
 
-test_expect_success \
-    'moving the file out of subdirectory' \
-    'cd path0 && git mv COPYING ../path1/COPYING'
+test_expect_success 'moving the file out of subdirectory' '
+     cd path0 && git mv COPYING ../path1/COPYING
+'
 
 # in path0 currently
-test_expect_success \
-    'commiting the change' \
-    'cd .. && git commit -m move-out -a'
+test_expect_success 'commiting the change' '
+     cd .. && git commit -m move-out -a
+'
 
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-    grep "^R100..*path0/COPYING..*path1/COPYING" actual'
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path0/COPYING..*path1/COPYING" actual
+'
 
-test_expect_success \
-    'moving the file back into subdirectory' \
-    'cd path0 && git mv ../path1/COPYING COPYING'
+test_expect_success 'moving the file back into subdirectory' '
+     cd path0 && git mv ../path1/COPYING COPYING
+'
 
 # in path0 currently
-test_expect_success \
-    'commiting the change' \
-    'cd .. && git commit -m move-in -a'
-
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-    grep "^R100..*path1/COPYING..*path0/COPYING" actual'
-
-test_expect_success \
-    'mv --dry-run does not move file' \
-    'git mv -n path0/COPYING MOVED &&
+test_expect_success 'commiting the change' '
+     cd .. && git commit -m move-in -a
+'
+
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path1/COPYING..*path0/COPYING" actual
+'
+
+test_expect_success 'mv --dry-run does not move file' '
+     git mv -n path0/COPYING MOVED &&
      test -f path0/COPYING &&
-     test ! -f MOVED'
+     test ! -f MOVED
+'
 
-test_expect_success \
-    'checking -k on non-existing file' \
-    'git mv -k idontexist path0'
+test_expect_success 'checking -k on non-existing file' '
+     git mv -k idontexist path0
+'
 
-test_expect_success \
-    'checking -k on untracked file' \
-    'touch untracked1 &&
+test_expect_success 'checking -k on untracked file' '
+     touch untracked1 &&
      git mv -k untracked1 path0 &&
      test -f untracked1 &&
-     test ! -f path0/untracked1'
+     test ! -f path0/untracked1
+'
 
-test_expect_success \
-    'checking -k on multiple untracked files' \
-    'touch untracked2 &&
+test_expect_success 'checking -k on multiple untracked files' '
+     touch untracked2 &&
      git mv -k untracked1 untracked2 path0 &&
      test -f untracked1 &&
      test -f untracked2 &&
      test ! -f path0/untracked1 &&
-     test ! -f path0/untracked2'
+     test ! -f path0/untracked2
+'
 
-test_expect_success \
-    'checking -f on untracked file with existing target' \
-    'touch path0/untracked1 &&
+test_expect_success 'checking -f on untracked file with existing target' '
+     touch path0/untracked1 &&
      test_must_fail git mv -f untracked1 path0 &&
      test ! -f .git/index.lock &&
      test -f untracked1 &&
-     test -f path0/untracked1'
+     test -f path0/untracked1
+'
 
 # clean up the mess in case bad things happen
 rm -f idontexist untracked1 untracked2 \
@@ -78,79 +78,79 @@ rm -f idontexist untracked1 untracked2 \
      .git/index.lock
 rmdir path1
 
-test_expect_success \
-    'moving to absent target with trailing slash' \
-    'test_must_fail git mv path0/COPYING no-such-dir/ &&
+test_expect_success 'moving to absent target with trailing slash' '
+     test_must_fail git mv path0/COPYING no-such-dir/ &&
      test_must_fail git mv path0/COPYING no-such-dir// &&
      git mv path0/ no-such-dir/ &&
-     test_path_is_dir no-such-dir'
+     test_path_is_dir no-such-dir
+'
 
-test_expect_success \
-    'clean up' \
-    'git reset --hard'
+test_expect_success 'clean up' '
+     git reset --hard
+'
 
-test_expect_success \
-    'moving to existing untracked target with trailing slash' \
-    'mkdir path1 &&
+test_expect_success 'moving to existing untracked target with trailing slash' '
+     mkdir path1 &&
      git mv path0/ path1/ &&
-     test_path_is_dir path1/path0/'
+     test_path_is_dir path1/path0/
+'
 
-test_expect_success \
-    'moving to existing tracked target with trailing slash' \
-    'mkdir path2 &&
+test_expect_success 'moving to existing tracked target with trailing slash' '
+     mkdir path2 &&
      >path2/file && git add path2/file &&
      git mv path1/path0/ path2/ &&
-     test_path_is_dir path2/path0/'
+     test_path_is_dir path2/path0/
+'
 
-test_expect_success \
-    'clean up' \
-    'git reset --hard'
+test_expect_success 'clean up' '
+     git reset --hard
+'
 
-test_expect_success \
-    'adding another file' \
-    'cp "$TEST_DIRECTORY"/../README.md path0/README &&
+test_expect_success 'adding another file' '
+     cp "$TEST_DIRECTORY"/../README.md path0/README &&
      git add path0/README &&
-     git commit -m add2 -a'
+     git commit -m add2 -a
+'
 
-test_expect_success \
-    'moving whole subdirectory' \
-    'git mv path0 path2'
+test_expect_success 'moving whole subdirectory' '
+     git mv path0 path2
+'
 
-test_expect_success \
-    'commiting the change' \
-    'git commit -m dir-move -a'
+test_expect_success 'commiting the change' '
+     git commit -m dir-move -a
+'
 
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
      grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
-     grep "^R100..*path0/README..*path2/README" actual'
+     grep "^R100..*path0/README..*path2/README" actual
+'
 
-test_expect_success \
-    'succeed when source is a prefix of destination' \
-    'git mv path2/COPYING path2/COPYING-renamed'
+test_expect_success 'succeed when source is a prefix of destination' '
+     git mv path2/COPYING path2/COPYING-renamed
+'
 
-test_expect_success \
-    'moving whole subdirectory into subdirectory' \
-    'git mv path2 path1'
+test_expect_success 'moving whole subdirectory into subdirectory' '
+     git mv path2 path1
+'
 
-test_expect_success \
-    'commiting the change' \
-    'git commit -m dir-move -a'
+test_expect_success 'commiting the change' '
+     git commit -m dir-move -a
+'
 
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
      grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
-     grep "^R100..*path2/README..*path1/path2/README" actual'
+     grep "^R100..*path2/README..*path1/path2/README" actual
+'
 
-test_expect_success \
-    'do not move directory over existing directory' \
-    'mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0'
+test_expect_success 'do not move directory over existing directory' '
+     mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
+'
 
-test_expect_success \
-    'move into "."' \
-    'git mv path1/path2/ .'
+test_expect_success 'move into "."' '
+     git mv path1/path2/ .
+'
 
 test_expect_success "Michael Cassar's test case" '
 	rm -fr .git papers partA &&
-- 
2.25.1


^ permalink raw reply related	[relevance 12%]

* [PATCH 2/2] Don't rely on strerror text when testing rmdir failure
  @ 2014-03-29 15:39 12% ` Charles Bailey
  0 siblings, 0 replies; 200+ results
From: Charles Bailey @ 2014-03-29 15:39 UTC (permalink / raw)
  To: git; +Cc: Charles Bailey

AIX doesn't make a distiction between EEXIST and ENOTEMPTY so relying on
the strerror string for the rmdir failure is fragile. Just test that the
start of the string matches the Git controlled "failed to rmdir..."
error. The exact text of the OS generated error string isn't important
to the test.

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
---
 t/t3600-rm.sh | 5 ++---
 t/t7001-mv.sh | 3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 3d30581..23eed17 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -709,10 +709,9 @@ test_expect_success 'checking out a commit after submodule removal needs manual
 	git commit -m "submodule removal" submod &&
 	git checkout HEAD^ &&
 	git submodule update &&
-	git checkout -q HEAD^ 2>actual &&
+	git checkout -q HEAD^ 2>/dev/null &&
 	git checkout -q master 2>actual &&
-	echo "warning: unable to rmdir submod: Directory not empty" >expected &&
-	test_i18ncmp expected actual &&
+	test_i18ngrep "^warning: unable to rmdir submod:" actual &&
 	git status -s submod >actual &&
 	echo "?? submod/" >expected &&
 	test_cmp expected actual &&
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 215d43d..34fb1af 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -447,8 +447,7 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
 	git mv sub sub2 &&
 	git commit -m "moved sub to sub2" &&
 	git checkout -q HEAD^ 2>actual &&
-	echo "warning: unable to rmdir sub2: Directory not empty" >expected &&
-	test_i18ncmp expected actual &&
+	test_i18ngrep "^warning: unable to rmdir sub2:" actual &&
 	git status -s sub2 >actual &&
 	echo "?? sub2/" >expected &&
 	test_cmp expected actual &&
-- 
1.8.5.1.2.ge5d1dab

^ permalink raw reply related	[relevance 12%]

* Re: [PATCHv2] git-mv: Keep moved index entries inact
  @ 2008-07-29  5:23 12%               ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2008-07-29  5:23 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Johannes Schindelin, SZEDER Gábor, git

Junio C Hamano <gitster@pobox.com> writes:

> Petr Baudis <pasky@suse.cz> writes:
>
>> On Mon, Jul 28, 2008 at 12:19:19PM -0700, Junio C Hamano wrote:
>>> We need to refresh the entry to pick up potential ctime changes.
>>> 
>>>  read-cache.c       |    7 ++++++-
>>>  builtin-ls-files.c |   21 +++++++++++++++------
>>>  2 files changed, 21 insertions(+), 7 deletions(-)
>>> 
>>> diff --git a/read-cache.c b/read-cache.c
>>> index 1cae361..834096f 100644
>>
>> Oops, silly me. Sorry for being slower than you at fixing this. ;-)
>
> I did think about ctime issues when I applied the patch.

Actually I changed my mind.

I think it is wrong for something as low-level as rename_index_entry_at()
to unconditionally look at the working tree and try refreshing the entry.
The next caller of this function may not even require a working tree.

I think Dscho is correct; expecting the saved cacheinfo to stay fresh
across rename does not make much sense.  What we care about with "git mv"
is that we keep what the user staged, i.e. kind of blob and the contents.
It cannot be guaranteed if the index entry is stat clean or not, as
st_ctime may or may not be updated across rename(2) according to POSIX.

So let's do this instead.

-- >8 --
t7001: fix "git mv" test 

The test assumed that we can keep the cached stat information fresh across
rename(2); many filesystems however update st_ctime (and POSIX allows them
to do so), so that assumption does not hold.  We can explicitly refresh
the index for the purpose of the test, as the only thing we are interested
in is the staged contents and the mode bits are preserved across "mv".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t7001-mv.sh |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b0fa407..910a28c 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -185,6 +185,7 @@ test_expect_success 'git mv should overwrite symlink to a file' '
 	! test -e moved &&
 	test -f symlink &&
 	test "$(cat symlink)" = 1 &&
+	git update-index --refresh &&
 	git diff-files --quiet
 
 '
@@ -202,6 +203,7 @@ test_expect_success 'git mv should overwrite file with a symlink' '
 	git mv -f symlink moved &&
 	! test -e symlink &&
 	test -h moved &&
+	git update-index --refresh &&
 	git diff-files --quiet
 
 '

^ permalink raw reply related	[relevance 12%]

* [PATCH 3/3] builtin-mv.c: check for unversionned files before looking at the destination.
  2009-02-04  9:32 13% ` [PATCH 2/3] [BUG] Add a testcase for "git mv -f" on untracked files Matthieu Moy
@ 2009-02-04  9:32 12%   ` Matthieu Moy
  0 siblings, 0 replies; 200+ results
From: Matthieu Moy @ 2009-02-04  9:32 UTC (permalink / raw)
  To: git, gitster; +Cc: Matthieu Moy

The previous code was failing in the case where one moves an
unversionned file to an existing destination, with mv -f: the
"existing destination" was checked first, and the error was cancelled
by the force flag.

We now check the unrecoverable error first, which fixes the bug.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 builtin-mv.c  |    8 ++++----
 t/t7001-mv.sh |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/builtin-mv.c b/builtin-mv.c
index bce9959..01270fe 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -162,7 +162,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				}
 				argc += last - first;
 			}
-		} else if (lstat(dst, &st) == 0) {
+		} else if (cache_name_pos(src, length) < 0)
+			bad = "not under version control";
+		else if (lstat(dst, &st) == 0) {
 			bad = "destination exists";
 			if (force) {
 				/*
@@ -177,9 +179,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				} else
 					bad = "Cannot overwrite";
 			}
-		} else if (cache_name_pos(src, length) < 0)
-			bad = "not under version control";
-		else if (string_list_has_string(&src_for_dst, dst))
+		} else if (string_list_has_string(&src_for_dst, dst))
 			bad = "multiple sources for the same target";
 		else
 			string_list_insert(dst, &src_for_dst);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 52a47b5..8fb3a56 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -58,7 +58,7 @@ test_expect_success \
      test ! -f path0/untracked1 &&
      test ! -f path0/untracked2'
 
-test_expect_failure \
+test_expect_success \
     'checking -f on untracked file with existing target' \
     'touch path0/untracked1 &&
      git mv -f untracked1 path0
-- 
1.6.1.2.321.g68da9

^ permalink raw reply related	[relevance 12%]

* [PATCH v2] add test for bug in git-mv for recursive submodules
  @ 2017-09-15 11:50 12%       ` Heiko Voigt
  0 siblings, 0 replies; 200+ results
From: Heiko Voigt @ 2017-09-15 11:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Stefan Beller, git@vger.kernel.org

When using git-mv with a submodule it will detect that and update the
paths for its configurations (.gitmodules, worktree and gitfile). This
does not work for recursive submodules where a user renames the root
submodule.

We discovered this fact when working on on-demand fetch for renamed
submodules. Lets add a test to document.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
On Fri, Aug 18, 2017 at 12:04:03PM -0700, Stefan Beller wrote:
> > I just copied the shortcut that they were adding themselfes as submodule
> > in 'setup submodule'. The whole setup of submodules in this test is like
> > this. This way we already had a nested submodule structure which I could
> > just add.
> >
> > I agree that this is unrealistic so I can change that in the test I am
> > adding. But from what I have seen, this shortcut is taken in quite some
> > places when dealing with submodules.
> 
> Please do not make it worse.
> Once upon a time (late '16 IIRC) I had a series floating on the
> list removing all occurrences, but there were issues with the
> series and it did not land.

Took a little while but here is a more clean patch creating individual
submodules for the nesting.

Cheers Heiko

 t/t7001-mv.sh | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e365d1ff77..cbc5fb37fe 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -491,4 +491,29 @@ test_expect_success 'moving a submodule in nested directories' '
 	test_cmp actual expect
 '
 
+test_expect_failure 'moving nested submodules' '
+	git commit -am "cleanup commit" &&
+	mkdir sub_nested_nested &&
+	(cd sub_nested_nested &&
+		touch nested_level2 &&
+		git init &&
+		git add . &&
+		git commit -m "nested level 2"
+	) &&
+	mkdir sub_nested &&
+	(cd sub_nested &&
+		touch nested_level1 &&
+		git init &&
+		git add . &&
+		git commit -m "nested level 1"
+		git submodule add ../sub_nested_nested &&
+		git commit -m "add nested level 2"
+	) &&
+	git submodule add ./sub_nested nested_move &&
+	git commit -m "add nested_move" &&
+	git submodule update --init --recursive &&
+	git mv nested_move sub_nested_moved &&
+	git status
+'
+
 test_done
-- 
2.14.1.145.gb3622a4


^ permalink raw reply related	[relevance 12%]

* Re: [BUG] mv: can trigger assertion failure with three parameters (builtin/mv.c:481)
  @ 2024-02-18 12:42 12% ` Kristoffer Haugsbakk
  0 siblings, 0 replies; 200+ results
From: Kristoffer Haugsbakk @ 2024-02-18 12:42 UTC (permalink / raw)
  To: git; +Cc: Kristoffer Haugsbakk, Junio C Hamano, Dragan Simic

Here’s a failing test. This fails on top of `master` (3e0d3cd5c7 (Merge branch
'jx/dirstat-parseopt-help', 2024-02-15)).

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>

-- >8 --
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 879a6dce601..4f180903486 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -549,4 +549,16 @@ test_expect_success 'moving nested submodules' '
 	git status
 '
 
+test_expect_success '(TODO title) nonsense move' '
+	test_when_finished git reset --hard HEAD &&
+	git reset --hard HEAD &&
+	mkdir -p a &&
+	mkdir -p b &&
+	>a/a.txt &&
+	git add a/a.txt &&
+	test_must_fail git mv a/a.txt a b &&
+	git status --porcelain >actual &&
+	grep "^A[ ]*a/a.txt$" actual
+'
+
 test_done


^ permalink raw reply related	[relevance 12%]

* Re: [PATCH 1/2] wrapper.c: consistently quote filenames in error messages
  @ 2017-11-02  5:16 12%     ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2017-11-02  5:16 UTC (permalink / raw)
  To: Simon Ruderich
  Cc: René Scharfe, Git List, Ralf Thielow, Johannes Schindelin

Junio C Hamano <gitster@pobox.com> writes:

> Simon Ruderich <simon@ruderich.org> writes:
>
>> All other error messages in the file use quotes around the file name.
>>
>> This change removes two translations as "could not write to '%s'" and
>> "could not close '%s'" are already translated and these two are the only
>> occurrences without quotes.
>>
>> Signed-off-by: Simon Ruderich <simon@ruderich.org>
>> ---
>>  wrapper.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> This patch is incomplete without adjusting a handful of tests to
> expect the updated messages, no?

I'll squash these in while queuing, but there might be more that I
didn't notice.

Thansk.

 t/t3600-rm.sh | 2 +-
 t/t7001-mv.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index f8568f8841..ab5500db44 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -688,7 +688,7 @@ test_expect_success 'checking out a commit after submodule removal needs manual
 	git submodule update &&
 	git checkout -q HEAD^ &&
 	git checkout -q master 2>actual &&
-	test_i18ngrep "^warning: unable to rmdir submod:" actual &&
+	test_i18ngrep "^warning: unable to rmdir '\''submod'\'':" actual &&
 	git status -s submod >actual &&
 	echo "?? submod/" >expected &&
 	test_cmp expected actual &&
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index f5929c46f3..6e5031f56f 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -452,7 +452,7 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
 	git mv sub sub2 &&
 	git commit -m "moved sub to sub2" &&
 	git checkout -q HEAD^ 2>actual &&
-	test_i18ngrep "^warning: unable to rmdir sub2:" actual &&
+	test_i18ngrep "^warning: unable to rmdir '\''sub2'\'':" actual &&
 	git status -s sub2 >actual &&
 	echo "?? sub2/" >expected &&
 	test_cmp expected actual &&

^ permalink raw reply related	[relevance 12%]

* [PATCH] git-mv: special case destination "."
  @ 2006-08-18 10:42 12% ` Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2006-08-18 10:42 UTC (permalink / raw)
  To: Fredrik Kuivinen; +Cc: git


Since the normalized basename of "." is "", the check for directory
failed erroneously.

Noticed by Fredrik Kuivinen.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

---

	> Subject: Re: Another git-mv bug

	... and another fix.

	On Fri, 18 Aug 2006, Fredrik Kuivinen wrote:

	> In a Git repository:
	> 
	>     $ git mv templates/info--exclude .
	>     fatal: renaming templates/info--exclude failed: No such file or directory

 builtin-mv.c  |    5 ++++-
 t/t7001-mv.sh |    4 ++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/builtin-mv.c b/builtin-mv.c
index c0c8764..b2ecc26 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -114,7 +114,10 @@ int cmd_mv(int argc, const char **argv, 
 	modes = xcalloc(count, sizeof(enum update_mode));
 	dest_path = copy_pathspec(prefix, argv + argc - 1, 1, 0);
 
-	if (!lstat(dest_path[0], &st) &&
+	if (dest_path[0][0] == '\0')
+		/* special case: "." was normalized to "" */
+		destination = copy_pathspec(dest_path[0], argv + i, count, 1);
+	else if (!lstat(dest_path[0], &st) &&
 			S_ISDIR(st.st_mode)) {
 		dest_path[0] = add_slash(dest_path[0]);
 		destination = copy_pathspec(dest_path[0], argv + i, count, 1);
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e5e0bb9..b7fcdb3 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -82,4 +82,8 @@ test_expect_failure \
     'do not move directory over existing directory' \
     'mkdir path0 && mkdir path0/path2 && git-mv path2 path0'
 
+test_expect_success \
+    'move into "."' \
+    'git-mv path1/path2/ .'
+
 test_done
-- 
1.4.2.ge0502-dirty

^ permalink raw reply related	[relevance 12%]

* [PATCH]     Allow git mv FileA fILEa when core.ignorecase = true
@ 2011-03-04 21:40 12% Torsten Bögershausen
  0 siblings, 0 replies; 200+ results
From: Torsten Bögershausen @ 2011-03-04 21:40 UTC (permalink / raw)
  To: git; +Cc: tboegi

    The typical use case is when a file "FileA" should be renamed into fILEa
    and we are on a case insenstive file system (system core.ignorecase = true).
    Source and destination are the same file, it can be accessed under both names.
    This makes git think that the destination file exists.
    Unless used with --forced, git will refuse the "git mv FileA fILEa".
    This change will allow "git mv FileA fILEa", when core.ignorecase = true
    and source and destination filenames only differ in case and the file length
    is identical.
    On Linux/Unix/Mac OS X the mv is allowed when the inode of the source and
    destination are equal.
    On  this allows renames of MÄRCHEN into Märchen on Mac OS X.
    (As a side effect, a file can be renamed to a name which is already
    hard-linked to the same inode)

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 builtin/mv.c  |   20 +++++++++++++++-----
 t/t7001-mv.sh |   29 +++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index 93e8995..e0aad62 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -62,7 +62,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	};
 	const char **source, **destination, **dest_path;
 	enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
-	struct stat st;
+	struct stat st, st_dst;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
 
 	git_config(git_default_config, NULL);
@@ -164,15 +164,25 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			}
 		} else if (cache_name_pos(src, length) < 0)
 			bad = "not under version control";
-		else if (lstat(dst, &st) == 0) {
+		else if (lstat(dst, &st_dst) == 0) {
+			int allow_force = force;
 			bad = "destination exists";
-			if (force) {
+			/* Allow when src and dst have the same inode (Mac OS X) */
+			/* Allow when ignore_case and same file length (Windows) */
+			if (((st_dst.st_ino) && (st_dst.st_ino == st.st_ino)) ||
+					((ignore_case) && !strcasecmp(src, dst) &&
+					 (st.st_size == st_dst.st_size))) {
+				allow_force = 1;
+				bad = NULL;
+			}
+			if (allow_force) {
 				/*
 				 * only files can overwrite each other:
 				 * check both source and destination
 				 */
-				if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
-					warning("%s; will overwrite!", bad);
+				if (S_ISREG(st_dst.st_mode) || S_ISLNK(st_dst.st_mode)) {
+					if (bad)
+						warning("%s; will overwrite!", bad);
 					bad = NULL;
 				} else
 					bad = "Cannot overwrite";
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index a845b15..d0e73ee 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -255,4 +255,33 @@ test_expect_success SYMLINKS 'git mv should overwrite file with a symlink' '
 
 rm -f moved symlink
 
+touch x
+if ln x y 2>/dev/null; then
+	hardlinks=1
+fi
+rm -f x y
+
+if test "$(git config --bool core.ignorecase)" = true -o "$hardlinks"; then
+	test_expect_success 'git mv FileA fILEa' '
+
+		rm -fr .git * &&
+		git init &&
+		echo FileA > FileA &&
+		git add FileA &&
+		git commit -m add FileA &&
+		{
+			if ! test -f fILEa; then
+				ln FileA fILEa
+			fi
+		} &&
+		git mv FileA fILEa &&
+		git commit -m "mv FileA fILEa" &&
+		rm -f FileA fILEa &&
+		git reset --hard &&
+		test "$(echo *)" = fILEa
+	'
+else
+	say "Neither ignorecase nor hardlinks, skipping git mv FileA fILEa"
+fi
+
 test_done
-- 
1.7.4

^ permalink raw reply related	[relevance 12%]

* [PATCH 02/11] t7001: use TAB instead of spaces
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
                   ` (9 preceding siblings ...)
  2020-09-25 17:02 13% ` [PATCH 01/11] t7001: convert tests from the old style to the current style shubham verma
@ 2020-09-25 17:02 13% ` shubham verma
  2020-09-25 17:44 11%   ` Eric Sunshine
  2020-09-25 17:33  6% ` [PATCH 00/11] Modernizing the t7001 test script Eric Sunshine
  11 siblings, 1 reply; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git; +Cc: Shubham Verma

From: Shubham Verma <shubhunic@gmail.com>

Change indentation style from spaces to TAB.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 120 +++++++++++++++++++++++++-------------------------
 1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4bbb51e578..7503233814 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -4,72 +4,72 @@ test_description='git mv in subdirs'
 . ./test-lib.sh
 
 test_expect_success 'prepare reference tree' '
-     mkdir path0 path1 &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
-     git add path0/COPYING &&
-     git commit -m add -a
+	mkdir path0 path1 &&
+	cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+	git add path0/COPYING &&
+	git commit -m add -a
 '
 
 test_expect_success 'moving the file out of subdirectory' '
-     cd path0 && git mv COPYING ../path1/COPYING
+	cd path0 && git mv COPYING ../path1/COPYING
 '
 
 # in path0 currently
 test_expect_success 'commiting the change' '
-     cd .. && git commit -m move-out -a
+	cd .. && git commit -m move-out -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path0/COPYING..*path1/COPYING" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path0/COPYING..*path1/COPYING" actual
 '
 
 test_expect_success 'moving the file back into subdirectory' '
-     cd path0 && git mv ../path1/COPYING COPYING
+	cd path0 && git mv ../path1/COPYING COPYING
 '
 
 # in path0 currently
 test_expect_success 'commiting the change' '
-     cd .. && git commit -m move-in -a
+	cd .. && git commit -m move-in -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path1/COPYING..*path0/COPYING" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path1/COPYING..*path0/COPYING" actual
 '
 
 test_expect_success 'mv --dry-run does not move file' '
-     git mv -n path0/COPYING MOVED &&
-     test -f path0/COPYING &&
-     test ! -f MOVED
+	git mv -n path0/COPYING MOVED &&
+	test -f path0/COPYING &&
+	test ! -f MOVED
 '
 
 test_expect_success 'checking -k on non-existing file' '
-     git mv -k idontexist path0
+	git mv -k idontexist path0
 '
 
 test_expect_success 'checking -k on untracked file' '
-     touch untracked1 &&
-     git mv -k untracked1 path0 &&
-     test -f untracked1 &&
-     test ! -f path0/untracked1
+	touch untracked1 &&
+	git mv -k untracked1 path0 &&
+	test -f untracked1 &&
+	test ! -f path0/untracked1
 '
 
 test_expect_success 'checking -k on multiple untracked files' '
-     touch untracked2 &&
-     git mv -k untracked1 untracked2 path0 &&
-     test -f untracked1 &&
-     test -f untracked2 &&
-     test ! -f path0/untracked1 &&
-     test ! -f path0/untracked2
+	touch untracked2 &&
+	git mv -k untracked1 untracked2 path0 &&
+	test -f untracked1 &&
+	test -f untracked2 &&
+	test ! -f path0/untracked1 &&
+	test ! -f path0/untracked2
 '
 
 test_expect_success 'checking -f on untracked file with existing target' '
-     touch path0/untracked1 &&
-     test_must_fail git mv -f untracked1 path0 &&
-     test ! -f .git/index.lock &&
-     test -f untracked1 &&
-     test -f path0/untracked1
+	touch path0/untracked1 &&
+	test_must_fail git mv -f untracked1 path0 &&
+	test ! -f .git/index.lock &&
+	test -f untracked1 &&
+	test -f path0/untracked1
 '
 
 # clean up the mess in case bad things happen
@@ -79,77 +79,77 @@ rm -f idontexist untracked1 untracked2 \
 rmdir path1
 
 test_expect_success 'moving to absent target with trailing slash' '
-     test_must_fail git mv path0/COPYING no-such-dir/ &&
-     test_must_fail git mv path0/COPYING no-such-dir// &&
-     git mv path0/ no-such-dir/ &&
-     test_path_is_dir no-such-dir
+	test_must_fail git mv path0/COPYING no-such-dir/ &&
+	test_must_fail git mv path0/COPYING no-such-dir// &&
+	git mv path0/ no-such-dir/ &&
+	test_path_is_dir no-such-dir
 '
 
 test_expect_success 'clean up' '
-     git reset --hard
+	git reset --hard
 '
 
 test_expect_success 'moving to existing untracked target with trailing slash' '
-     mkdir path1 &&
-     git mv path0/ path1/ &&
-     test_path_is_dir path1/path0/
+	mkdir path1 &&
+	git mv path0/ path1/ &&
+	test_path_is_dir path1/path0/
 '
 
 test_expect_success 'moving to existing tracked target with trailing slash' '
-     mkdir path2 &&
-     >path2/file && git add path2/file &&
-     git mv path1/path0/ path2/ &&
-     test_path_is_dir path2/path0/
+	mkdir path2 &&
+	>path2/file && git add path2/file &&
+	git mv path1/path0/ path2/ &&
+	test_path_is_dir path2/path0/
 '
 
 test_expect_success 'clean up' '
-     git reset --hard
+	git reset --hard
 '
 
 test_expect_success 'adding another file' '
-     cp "$TEST_DIRECTORY"/../README.md path0/README &&
-     git add path0/README &&
-     git commit -m add2 -a
+	cp "$TEST_DIRECTORY"/../README.md path0/README &&
+	git add path0/README &&
+	git commit -m add2 -a
 '
 
 test_expect_success 'moving whole subdirectory' '
-     git mv path0 path2
+	git mv path0 path2
 '
 
 test_expect_success 'commiting the change' '
-     git commit -m dir-move -a
+	git commit -m dir-move -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
-     grep "^R100..*path0/README..*path2/README" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
+	grep "^R100..*path0/README..*path2/README" actual
 '
 
 test_expect_success 'succeed when source is a prefix of destination' '
-     git mv path2/COPYING path2/COPYING-renamed
+	git mv path2/COPYING path2/COPYING-renamed
 '
 
 test_expect_success 'moving whole subdirectory into subdirectory' '
-     git mv path2 path1
+	git mv path2 path1
 '
 
 test_expect_success 'commiting the change' '
-     git commit -m dir-move -a
+	git commit -m dir-move -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
-     grep "^R100..*path2/README..*path1/path2/README" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
+	grep "^R100..*path2/README..*path1/path2/README" actual
 '
 
 test_expect_success 'do not move directory over existing directory' '
-     mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
+	mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
 '
 
 test_expect_success 'move into "."' '
-     git mv path1/path2/ .
+	git mv path1/path2/ .
 '
 
 test_expect_success "Michael Cassar's test case" '
-- 
2.25.1


^ permalink raw reply related	[relevance 13%]

* [PATCH v2] t7001-mv.sh: modernizing test script using functions
  2022-10-30 17:20 13% [PATCH] t7001-mv.sh:modernizing test script using function Debra Obondo via GitGitGadget
@ 2022-11-03 18:39 13% ` Debra Obondo via GitGitGadget
  2022-11-04 15:05 13%   ` [PATCH v3] " Debra Obondo via GitGitGadget
  2022-10-31 18:04 10% ` [PATCH] t7001-mv.sh:modernizing test script using function Martin Ågren
  2022-10-30 18:00  6% ` Taylor Blau
  2 siblings, 1 reply; 200+ results
From: Debra Obondo via GitGitGadget @ 2022-11-03 18:39 UTC (permalink / raw)
  To: git; +Cc: Taylor Blau, Martin Ågren, Debra Obondo, Debra Obondo

From: Debra Obondo <debraobondo@gmail.com>

Test script to verify the presence/absence of files, paths, directories,
symlinks and other features in 'git mv' command are using the command
format:

'test (-e|f|d|h|...)'

Replace them with helper functions of format:

'test_path_is_*'

Changes since v1

Replacing idiomatic helper functions

'! test_path_is_*'

with

'test_path_is_missing'

This uses values of 'test_path_bar' in place of '! test_path_foo' to
bring in the helpful factor of indicating the failure of tests after the
mv command has been used, that is, it echoes if the feature/test_path
exists.

Signed-off-by: Debra Obondo <debraobondo@gmail.com>
---
    [PATCH v2] [OUTREACHY] t7001-mv.sh : Use test_path_is_* functions in
    test script
    
    Changes since v1:
    
    Replacing idiomatic helper functions
    
    '! test_path_is_*'
    
    with
    
    'test_path_is_missing'
    
    This uses values of 'test_path_bar' in place of '! test_path_foo' to
    bring in the helpful factor of indicating the failure of tests after the
    mv command has been used, that is, it echoes if the feature/test_path
    exists (This was suggested by Martin Ågren).
    
    Older test scripts use the command 'test -' to verify the presence or
    absence of features such as files, directories and symbolic links. This
    however requires slightly complicated uses, such as 'test ! -f '. The
    helper functions 'test_path_is_' located in t/test-lib-functions.sh have
    taken into account all scenarios of the 'test -*' to reduce errors. This
    was a microproject to replace them with the helper functions.
    
    Test script to verify the presence/absence of files, paths,
    directories,symboliclinks and many other features in mv command are
    using the command format
    
    'test -(e|f|s|h|...).
    
    Replace them with helper functions of format
    
    'test_path_is_*'
    
    Signed-off-by: Debra Obondo debraobondo@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1372%2Ffobiasic07%2Ft7001-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1372/fobiasic07/t7001-v2
Pull-Request: https://github.com/git/git/pull/1372

Range-diff vs v1:

 1:  b977c4ad26a ! 1:  c6640ebff66 t7001-mv.sh:modernizing test script using function
     @@ Metadata
      Author: Debra Obondo <debraobondo@gmail.com>
      
       ## Commit message ##
     -    t7001-mv.sh:modernizing test script using function
     +    t7001-mv.sh: modernizing test script using functions
      
          Test script to verify the presence/absence of files, paths, directories,
          symlinks and other features in 'git mv' command are using the command
     @@ Commit message
      
          'test_path_is_*'
      
     +    Changes since v1
     +
     +    Replacing idiomatic helper functions
     +
     +    '! test_path_is_*'
     +
     +    with
     +
     +    'test_path_is_missing'
     +
     +    This uses values of 'test_path_bar' in place of '! test_path_foo' to
     +    bring in the helpful factor of indicating the failure of tests after the
     +    mv command has been used, that is, it echoes if the feature/test_path
     +    exists.
     +
          Signed-off-by: Debra Obondo <debraobondo@gmail.com>
      
       ## t/t7001-mv.sh ##
     @@ t/t7001-mv.sh: test_expect_success 'checking the commit' '
      -	test -f path0/COPYING &&
      -	test ! -f MOVED
      +	test_path_is_file path0/COPYING &&
     -+	! test_path_is_file MOVED
     ++	test_path_is_missing MOVED
       '
       
       test_expect_success 'checking -k on non-existing file' '
     @@ t/t7001-mv.sh: test_expect_success 'checking -k on non-existing file' '
      -	test -f untracked1 &&
      -	test ! -f path0/untracked1
      +	test_path_is_file untracked1 &&
     -+	! test_path_is_file path0/untracked1
     ++	test_path_is_missing path0/untracked1
       '
       
       test_expect_success 'checking -k on multiple untracked files' '
     @@ t/t7001-mv.sh: test_expect_success 'checking -k on non-existing file' '
      -	test ! -f path0/untracked2
      +	test_path_is_file untracked1 &&
      +	test_path_is_file untracked2 &&
     -+	! test_path_is_file path0/untracked1 &&
     -+	! test_path_is_file path0/untracked2
     ++	test_path_is_missing path0/untracked1 &&
     ++	test_path_is_missing path0/untracked2
       '
       
       test_expect_success 'checking -f on untracked file with existing target' '
     @@ t/t7001-mv.sh: test_expect_success 'checking -k on non-existing file' '
      -	test ! -f .git/index.lock &&
      -	test -f untracked1 &&
      -	test -f path0/untracked1
     -+	! test_path_is_file .git/index.lock &&
     ++	test_path_is_missing .git/index.lock &&
      +	test_path_is_file untracked1 &&
      +	test_path_is_file path0/untracked1
       '
     @@ t/t7001-mv.sh: test_expect_success 'absolute pathname' '
       		git mv sub "$(pwd)/in" &&
      -		! test -d sub &&
      -		test -d in &&
     -+		! test_path_is_dir sub &&
     ++		test_path_is_missing sub &&
      +		test_path_is_dir in &&
       		git ls-files --error-unmatch in/file
       	)
     @@ t/t7001-mv.sh: test_expect_success 'absolute pathname outside should fail' '
      -		test -d sub &&
      -		! test -d ../in &&
      +		test_path_is_dir sub &&
     -+		! test_path_is_dir ../in &&
     ++		test_path_is_missing ../in &&
       		git ls-files --error-unmatch sub/file
       	)
       '
     @@ t/t7001-mv.sh: test_expect_success 'git mv should overwrite symlink to a file' '
       	git mv -f moved symlink &&
      -	! test -e moved &&
      -	test -f symlink &&
     -+	! test_path_exists moved &&
     ++	test_path_is_missing moved &&
      +	test_path_is_file symlink &&
       	test "$(cat symlink)" = 1 &&
       	git update-index --refresh &&
     @@ t/t7001-mv.sh: test_expect_success 'git mv should overwrite file with a symlink'
       	test_must_fail git mv symlink moved &&
       	git mv -f symlink moved &&
      -	! test -e symlink &&
     -+	! test_path_exists symlink &&
     ++	test_path_is_missing symlink &&
       	git update-index --refresh &&
       	git diff-files --quiet
       '
     @@ t/t7001-mv.sh: test_expect_success 'git mv moves a submodule with a .git directo
       	mkdir mod &&
       	git mv sub mod/sub &&
      -	! test -e sub &&
     -+	! test_path_exists sub &&
     ++	test_path_is_missing sub &&
       	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
       	git -C mod/sub status &&
       	git update-index --refresh &&
     @@ t/t7001-mv.sh: test_expect_success 'git mv moves a submodule with a .git directo
       	mkdir mod &&
       	git mv sub mod/sub &&
      -	! test -e sub &&
     -+	! test_path_exists sub &&
     ++	test_path_is_missing sub &&
       	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
       	git -C mod/sub status &&
       	echo mod/sub >expected &&
     @@ t/t7001-mv.sh: test_expect_success 'git mv moves a submodule with gitfile' '
       	mkdir mod &&
       	git -C mod mv ../sub/ . &&
      -	! test -e sub &&
     -+	! test_path_exists sub &&
     ++	test_path_is_missing sub &&
       	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
       	git -C mod/sub status &&
       	echo mod/sub >expected &&
     @@ t/t7001-mv.sh: test_expect_success 'mv does not complain when no .gitmodules fil
       	git mv sub mod/sub 2>actual.err &&
       	test_must_be_empty actual.err &&
      -	! test -e sub &&
     -+	! test_path_exists sub &&
     ++	test_path_is_missing sub &&
       	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
       	git -C mod/sub status &&
       	git update-index --refresh &&
     @@ t/t7001-mv.sh: test_expect_success 'mv will error out on a modified .gitmodules
       	git mv sub mod/sub 2>actual.err &&
       	test_must_be_empty actual.err &&
      -	! test -e sub &&
     -+	! test_path_exists sub &&
     ++	test_path_is_missing sub &&
       	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
       	git -C mod/sub status &&
       	git update-index --refresh &&
     @@ t/t7001-mv.sh: test_expect_success 'mv issues a warning when section is not foun
       	git mv sub mod/sub 2>actual.err &&
       	test_cmp expect.err actual.err &&
      -	! test -e sub &&
     -+	! test_path_exists sub &&
     ++	test_path_is_missing sub &&
       	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
       	git -C mod/sub status &&
       	git update-index --refresh &&
     @@ t/t7001-mv.sh: test_expect_success 'checking out a commit before submodule moved
       	test_cmp expected actual &&
      -	! test -f sub/.git &&
      -	test -f sub2/.git &&
     -+	! test_path_is_file sub/.git &&
     ++	test_path_is_missing sub/.git &&
      +	test_path_is_file sub2/.git &&
       	git submodule update &&
      -	test -f sub/.git &&


 t/t7001-mv.sh | 62 +++++++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 8c37bceb336..d72cef88264 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -60,8 +60,8 @@ test_expect_success 'checking the commit' '
 
 test_expect_success 'mv --dry-run does not move file' '
 	git mv -n path0/COPYING MOVED &&
-	test -f path0/COPYING &&
-	test ! -f MOVED
+	test_path_is_file path0/COPYING &&
+	test_path_is_missing MOVED
 '
 
 test_expect_success 'checking -k on non-existing file' '
@@ -71,25 +71,25 @@ test_expect_success 'checking -k on non-existing file' '
 test_expect_success 'checking -k on untracked file' '
 	>untracked1 &&
 	git mv -k untracked1 path0 &&
-	test -f untracked1 &&
-	test ! -f path0/untracked1
+	test_path_is_file untracked1 &&
+	test_path_is_missing path0/untracked1
 '
 
 test_expect_success 'checking -k on multiple untracked files' '
 	>untracked2 &&
 	git mv -k untracked1 untracked2 path0 &&
-	test -f untracked1 &&
-	test -f untracked2 &&
-	test ! -f path0/untracked1 &&
-	test ! -f path0/untracked2
+	test_path_is_file untracked1 &&
+	test_path_is_file untracked2 &&
+	test_path_is_missing path0/untracked1 &&
+	test_path_is_missing path0/untracked2
 '
 
 test_expect_success 'checking -f on untracked file with existing target' '
 	>path0/untracked1 &&
 	test_must_fail git mv -f untracked1 path0 &&
-	test ! -f .git/index.lock &&
-	test -f untracked1 &&
-	test -f path0/untracked1
+	test_path_is_missing .git/index.lock &&
+	test_path_is_file untracked1 &&
+	test_path_is_file path0/untracked1
 '
 
 # clean up the mess in case bad things happen
@@ -215,8 +215,8 @@ test_expect_success 'absolute pathname' '
 		git add sub/file &&
 
 		git mv sub "$(pwd)/in" &&
-		! test -d sub &&
-		test -d in &&
+		test_path_is_missing sub &&
+		test_path_is_dir in &&
 		git ls-files --error-unmatch in/file
 	)
 '
@@ -234,8 +234,8 @@ test_expect_success 'absolute pathname outside should fail' '
 		git add sub/file &&
 
 		test_must_fail git mv sub "$out/out" &&
-		test -d sub &&
-		! test -d ../in &&
+		test_path_is_dir sub &&
+		test_path_is_missing ../in &&
 		git ls-files --error-unmatch sub/file
 	)
 '
@@ -295,8 +295,8 @@ test_expect_success 'git mv should overwrite symlink to a file' '
 	git add moved &&
 	test_must_fail git mv moved symlink &&
 	git mv -f moved symlink &&
-	! test -e moved &&
-	test -f symlink &&
+	test_path_is_missing moved &&
+	test_path_is_file symlink &&
 	test "$(cat symlink)" = 1 &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -312,13 +312,13 @@ test_expect_success 'git mv should overwrite file with a symlink' '
 	git add moved &&
 	test_must_fail git mv symlink moved &&
 	git mv -f symlink moved &&
-	! test -e symlink &&
+	test_path_is_missing symlink &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
 
 test_expect_success SYMLINKS 'check moved symlink' '
-	test -h moved
+	test_path_is_symlink moved
 '
 
 rm -f moved symlink
@@ -352,7 +352,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	) &&
 	mkdir mod &&
 	git mv sub mod/sub &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -372,7 +372,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	) &&
 	mkdir mod &&
 	git mv sub mod/sub &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
@@ -389,7 +389,7 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	mkdir mod &&
 	git -C mod mv ../sub/ . &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
@@ -408,7 +408,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -423,13 +423,13 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	mkdir mod &&
 	test_must_fail git mv sub mod/sub 2>actual.err &&
-	test -s actual.err &&
-	test -e sub &&
+	test_file_not_empty actual.err &&
+	test_path_exists sub &&
 	git diff-files --quiet -- sub &&
 	git add .gitmodules &&
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -447,7 +447,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	test_cmp expect.err actual.err &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -460,7 +460,7 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
 	git submodule update &&
 	mkdir mod &&
 	git mv -n sub mod/sub 2>actual.err &&
-	test -f sub/.git &&
+	test_path_is_file sub/.git &&
 	git diff-index --exit-code HEAD &&
 	git update-index --refresh &&
 	git diff-files --quiet -- sub .gitmodules
@@ -474,10 +474,10 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
 	git status -s sub2 >actual &&
 	echo "?? sub2/" >expected &&
 	test_cmp expected actual &&
-	! test -f sub/.git &&
-	test -f sub2/.git &&
+	test_path_is_missing sub/.git &&
+	test_path_is_file sub2/.git &&
 	git submodule update &&
-	test -f sub/.git &&
+	test_path_is_file sub/.git &&
 	rm -rf sub2 &&
 	git diff-index --exit-code HEAD &&
 	git update-index --refresh &&

base-commit: 1fc3c0ad407008c2f71dd9ae1241d8b75f8ef886
-- 
gitgitgadget

^ permalink raw reply related	[relevance 13%]

* [PATCH] Fixed typo
@ 2009-12-02  1:35 13% Richard Hartmann
  0 siblings, 0 replies; 200+ results
From: Richard Hartmann @ 2009-12-02  1:35 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 40 bytes --]

Hi all,

please see attached.


Richard

[-- Attachment #2: 0001-Typos-commiting-committing.patch --]
[-- Type: text/x-diff, Size: 1751 bytes --]

From 138b95638693b47251d61ed5f316b6e68002b766 Mon Sep 17 00:00:00 2001
From: Richard Hartmann <richih.mailinglist@gmail.com>
Date: Wed, 2 Dec 2009 02:33:17 +0100
Subject: [PATCH] Typos: commiting -> committing

---
 builtin-revert.c |    2 +-
 t/t7001-mv.sh    |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/builtin-revert.c b/builtin-revert.c
index 151aa6a..5708908 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -216,7 +216,7 @@ static char *help_msg(const unsigned char *sha1)
 
 	if (action == CHERRY_PICK) {
 		sprintf(helpbuf + strlen(helpbuf),
-			"\nWhen commiting, use the option "
+			"\nWhen committing, use the option "
 			"'-c %s' to retain authorship and message.",
 			find_unique_abbrev(sha1, DEFAULT_ABBREV));
 	}
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 10b8f8c..ad93a97 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -16,7 +16,7 @@ test_expect_success \
 
 # in path0 currently
 test_expect_success \
-    'commiting the change' \
+    'committing the change' \
     'cd .. && git commit -m move-out -a'
 
 test_expect_success \
@@ -30,7 +30,7 @@ test_expect_success \
 
 # in path0 currently
 test_expect_success \
-    'commiting the change' \
+    'committing the change' \
     'cd .. && git commit -m move-in -a'
 
 test_expect_success \
@@ -82,7 +82,7 @@ test_expect_success \
     'git mv path0 path2'
 
 test_expect_success \
-    'commiting the change' \
+    'committing the change' \
     'git commit -m dir-move -a'
 
 test_expect_success \
@@ -101,7 +101,7 @@ test_expect_success \
     'git mv path2 path1'
 
 test_expect_success \
-    'commiting the change' \
+    'committing the change' \
     'git commit -m dir-move -a'
 
 test_expect_success \
-- 
1.6.5.2


^ permalink raw reply related	[relevance 13%]

* [PATCH v2 1/3] add test cases for "git mv -k"
  @ 2009-01-14 17:03 13%       ` Michael J Gruber
    0 siblings, 1 reply; 200+ results
From: Michael J Gruber @ 2009-01-14 17:03 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

Add test cases for ignoring nonexisting and untracked files using the -k
option to "git mv". There is one known breakage related to multiple
untracked files specfied as consecutive arguments.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/t7001-mv.sh |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 575ef5b..5c1485d 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -39,6 +39,31 @@ test_expect_success \
     grep "^R100..*path1/COPYING..*path0/COPYING"'
 
 test_expect_success \
+    'checking -k on non-existing file' \
+    'git mv -k idontexist path0'
+
+test_expect_success \
+    'checking -k on untracked file' \
+    'touch untracked1 &&
+     git mv -k untracked1 path0 &&
+     test -f untracked1 &&
+     test ! -f path0/untracked1'
+
+test_expect_failure \
+    'checking -k on multiple untracked files' \
+    'touch untracked2 &&
+     git mv -k untracked1 untracked2 path0 &&
+     test -f untracked1 &&
+     test -f untracked2 &&
+     test ! -f path0/untracked1
+     test ! -f path0/untracked2'
+
+# clean up the mess in case bad things happen
+rm -f idontexist untracked1 untracked2 \
+     path0/idontexist path0/untracked1 path0/untracked2 \
+     .git/index.lock
+
+test_expect_success \
     'adding another file' \
     'cp "$TEST_DIRECTORY"/../README path0/README &&
      git add path0/README &&
-- 
1.6.0.6

^ permalink raw reply related	[relevance 13%]

* [PATCH v2 02/10] t7001: indent with TABs instead of spaces
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
                   ` (7 preceding siblings ...)
  2021-02-09 17:32 15% ` [PATCH v2 06/10] t7001: avoid using `cd` outside of subshells shubham verma
@ 2021-02-09 17:32 13% ` shubham verma
  2021-02-09 17:32 12% ` [PATCH v2 01/10] t7001: modernize test formatting shubham verma
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2021-02-09 17:32 UTC (permalink / raw)
  To: git

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 120 +++++++++++++++++++++++++-------------------------
 1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4bbb51e578..7503233814 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -4,72 +4,72 @@ test_description='git mv in subdirs'
 . ./test-lib.sh
 
 test_expect_success 'prepare reference tree' '
-     mkdir path0 path1 &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
-     git add path0/COPYING &&
-     git commit -m add -a
+	mkdir path0 path1 &&
+	cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+	git add path0/COPYING &&
+	git commit -m add -a
 '
 
 test_expect_success 'moving the file out of subdirectory' '
-     cd path0 && git mv COPYING ../path1/COPYING
+	cd path0 && git mv COPYING ../path1/COPYING
 '
 
 # in path0 currently
 test_expect_success 'commiting the change' '
-     cd .. && git commit -m move-out -a
+	cd .. && git commit -m move-out -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path0/COPYING..*path1/COPYING" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path0/COPYING..*path1/COPYING" actual
 '
 
 test_expect_success 'moving the file back into subdirectory' '
-     cd path0 && git mv ../path1/COPYING COPYING
+	cd path0 && git mv ../path1/COPYING COPYING
 '
 
 # in path0 currently
 test_expect_success 'commiting the change' '
-     cd .. && git commit -m move-in -a
+	cd .. && git commit -m move-in -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path1/COPYING..*path0/COPYING" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path1/COPYING..*path0/COPYING" actual
 '
 
 test_expect_success 'mv --dry-run does not move file' '
-     git mv -n path0/COPYING MOVED &&
-     test -f path0/COPYING &&
-     test ! -f MOVED
+	git mv -n path0/COPYING MOVED &&
+	test -f path0/COPYING &&
+	test ! -f MOVED
 '
 
 test_expect_success 'checking -k on non-existing file' '
-     git mv -k idontexist path0
+	git mv -k idontexist path0
 '
 
 test_expect_success 'checking -k on untracked file' '
-     touch untracked1 &&
-     git mv -k untracked1 path0 &&
-     test -f untracked1 &&
-     test ! -f path0/untracked1
+	touch untracked1 &&
+	git mv -k untracked1 path0 &&
+	test -f untracked1 &&
+	test ! -f path0/untracked1
 '
 
 test_expect_success 'checking -k on multiple untracked files' '
-     touch untracked2 &&
-     git mv -k untracked1 untracked2 path0 &&
-     test -f untracked1 &&
-     test -f untracked2 &&
-     test ! -f path0/untracked1 &&
-     test ! -f path0/untracked2
+	touch untracked2 &&
+	git mv -k untracked1 untracked2 path0 &&
+	test -f untracked1 &&
+	test -f untracked2 &&
+	test ! -f path0/untracked1 &&
+	test ! -f path0/untracked2
 '
 
 test_expect_success 'checking -f on untracked file with existing target' '
-     touch path0/untracked1 &&
-     test_must_fail git mv -f untracked1 path0 &&
-     test ! -f .git/index.lock &&
-     test -f untracked1 &&
-     test -f path0/untracked1
+	touch path0/untracked1 &&
+	test_must_fail git mv -f untracked1 path0 &&
+	test ! -f .git/index.lock &&
+	test -f untracked1 &&
+	test -f path0/untracked1
 '
 
 # clean up the mess in case bad things happen
@@ -79,77 +79,77 @@ rm -f idontexist untracked1 untracked2 \
 rmdir path1
 
 test_expect_success 'moving to absent target with trailing slash' '
-     test_must_fail git mv path0/COPYING no-such-dir/ &&
-     test_must_fail git mv path0/COPYING no-such-dir// &&
-     git mv path0/ no-such-dir/ &&
-     test_path_is_dir no-such-dir
+	test_must_fail git mv path0/COPYING no-such-dir/ &&
+	test_must_fail git mv path0/COPYING no-such-dir// &&
+	git mv path0/ no-such-dir/ &&
+	test_path_is_dir no-such-dir
 '
 
 test_expect_success 'clean up' '
-     git reset --hard
+	git reset --hard
 '
 
 test_expect_success 'moving to existing untracked target with trailing slash' '
-     mkdir path1 &&
-     git mv path0/ path1/ &&
-     test_path_is_dir path1/path0/
+	mkdir path1 &&
+	git mv path0/ path1/ &&
+	test_path_is_dir path1/path0/
 '
 
 test_expect_success 'moving to existing tracked target with trailing slash' '
-     mkdir path2 &&
-     >path2/file && git add path2/file &&
-     git mv path1/path0/ path2/ &&
-     test_path_is_dir path2/path0/
+	mkdir path2 &&
+	>path2/file && git add path2/file &&
+	git mv path1/path0/ path2/ &&
+	test_path_is_dir path2/path0/
 '
 
 test_expect_success 'clean up' '
-     git reset --hard
+	git reset --hard
 '
 
 test_expect_success 'adding another file' '
-     cp "$TEST_DIRECTORY"/../README.md path0/README &&
-     git add path0/README &&
-     git commit -m add2 -a
+	cp "$TEST_DIRECTORY"/../README.md path0/README &&
+	git add path0/README &&
+	git commit -m add2 -a
 '
 
 test_expect_success 'moving whole subdirectory' '
-     git mv path0 path2
+	git mv path0 path2
 '
 
 test_expect_success 'commiting the change' '
-     git commit -m dir-move -a
+	git commit -m dir-move -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
-     grep "^R100..*path0/README..*path2/README" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
+	grep "^R100..*path0/README..*path2/README" actual
 '
 
 test_expect_success 'succeed when source is a prefix of destination' '
-     git mv path2/COPYING path2/COPYING-renamed
+	git mv path2/COPYING path2/COPYING-renamed
 '
 
 test_expect_success 'moving whole subdirectory into subdirectory' '
-     git mv path2 path1
+	git mv path2 path1
 '
 
 test_expect_success 'commiting the change' '
-     git commit -m dir-move -a
+	git commit -m dir-move -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
-     grep "^R100..*path2/README..*path1/path2/README" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
+	grep "^R100..*path2/README..*path1/path2/README" actual
 '
 
 test_expect_success 'do not move directory over existing directory' '
-     mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
+	mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
 '
 
 test_expect_success 'move into "."' '
-     git mv path1/path2/ .
+	git mv path1/path2/ .
 '
 
 test_expect_success "Michael Cassar's test case" '
-- 
2.25.1


^ permalink raw reply related	[relevance 13%]

* [PATCH v3 02/10] t7001: indent with TABs instead of spaces
  2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
                   ` (7 preceding siblings ...)
  2021-02-11 19:47 15% ` [PATCH v3 06/10] t7001: avoid using `cd` outside of subshells Shubham Verma
@ 2021-02-11 19:46 13% ` Shubham Verma
  2021-02-11 19:46 12% ` [PATCH v3 01/10] t7001: modernize test formatting Shubham Verma
  2021-02-11 21:44  6% ` [PATCH v3 00/10] Modernizing the t7001 test script Junio C Hamano
  10 siblings, 0 replies; 200+ results
From: Shubham Verma @ 2021-02-11 19:46 UTC (permalink / raw)
  To: git

Signed-off-by: Shubham Verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 120 +++++++++++++++++++++++++-------------------------
 1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4bbb51e578..0f74c6339c 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -4,72 +4,72 @@ test_description='git mv in subdirs'
 . ./test-lib.sh
 
 test_expect_success 'prepare reference tree' '
-     mkdir path0 path1 &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
-     git add path0/COPYING &&
-     git commit -m add -a
+	mkdir path0 path1 &&
+	cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+	git add path0/COPYING &&
+	git commit -m add -a
 '
 
 test_expect_success 'moving the file out of subdirectory' '
-     cd path0 && git mv COPYING ../path1/COPYING
+	cd path0 && git mv COPYING ../path1/COPYING
 '
 
 # in path0 currently
 test_expect_success 'commiting the change' '
-     cd .. && git commit -m move-out -a
+	cd .. && git commit -m move-out -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path0/COPYING..*path1/COPYING" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path0/COPYING..*path1/COPYING" actual
 '
 
 test_expect_success 'moving the file back into subdirectory' '
-     cd path0 && git mv ../path1/COPYING COPYING
+	cd path0 && git mv ../path1/COPYING COPYING
 '
 
 # in path0 currently
 test_expect_success 'commiting the change' '
-     cd .. && git commit -m move-in -a
+	cd .. && git commit -m move-in -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path1/COPYING..*path0/COPYING" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path1/COPYING..*path0/COPYING" actual
 '
 
 test_expect_success 'mv --dry-run does not move file' '
-     git mv -n path0/COPYING MOVED &&
-     test -f path0/COPYING &&
-     test ! -f MOVED
+	git mv -n path0/COPYING MOVED &&
+	test -f path0/COPYING &&
+	test ! -f MOVED
 '
 
 test_expect_success 'checking -k on non-existing file' '
-     git mv -k idontexist path0
+	git mv -k idontexist path0
 '
 
 test_expect_success 'checking -k on untracked file' '
-     touch untracked1 &&
-     git mv -k untracked1 path0 &&
-     test -f untracked1 &&
-     test ! -f path0/untracked1
+	touch untracked1 &&
+	git mv -k untracked1 path0 &&
+	test -f untracked1 &&
+	test ! -f path0/untracked1
 '
 
 test_expect_success 'checking -k on multiple untracked files' '
-     touch untracked2 &&
-     git mv -k untracked1 untracked2 path0 &&
-     test -f untracked1 &&
-     test -f untracked2 &&
-     test ! -f path0/untracked1 &&
-     test ! -f path0/untracked2
+	touch untracked2 &&
+	git mv -k untracked1 untracked2 path0 &&
+	test -f untracked1 &&
+	test -f untracked2 &&
+	test ! -f path0/untracked1 &&
+	test ! -f path0/untracked2
 '
 
 test_expect_success 'checking -f on untracked file with existing target' '
-     touch path0/untracked1 &&
-     test_must_fail git mv -f untracked1 path0 &&
-     test ! -f .git/index.lock &&
-     test -f untracked1 &&
-     test -f path0/untracked1
+	touch path0/untracked1 &&
+	test_must_fail git mv -f untracked1 path0 &&
+	test ! -f .git/index.lock &&
+	test -f untracked1 &&
+	test -f path0/untracked1
 '
 
 # clean up the mess in case bad things happen
@@ -79,77 +79,77 @@ rm -f idontexist untracked1 untracked2 \
 rmdir path1
 
 test_expect_success 'moving to absent target with trailing slash' '
-     test_must_fail git mv path0/COPYING no-such-dir/ &&
-     test_must_fail git mv path0/COPYING no-such-dir// &&
-     git mv path0/ no-such-dir/ &&
-     test_path_is_dir no-such-dir
+	test_must_fail git mv path0/COPYING no-such-dir/ &&
+	test_must_fail git mv path0/COPYING no-such-dir// &&
+	git mv path0/ no-such-dir/ &&
+	test_path_is_dir no-such-dir
 '
 
 test_expect_success 'clean up' '
-     git reset --hard
+	git reset --hard
 '
 
 test_expect_success 'moving to existing untracked target with trailing slash' '
-     mkdir path1 &&
-     git mv path0/ path1/ &&
-     test_path_is_dir path1/path0/
+	mkdir path1 &&
+	git mv path0/ path1/ &&
+	test_path_is_dir path1/path0/
 '
 
 test_expect_success 'moving to existing tracked target with trailing slash' '
-     mkdir path2 &&
-     >path2/file && git add path2/file &&
-     git mv path1/path0/ path2/ &&
-     test_path_is_dir path2/path0/
+	mkdir path2 &&
+	>path2/file && git add path2/file &&
+	git mv path1/path0/ path2/ &&
+	test_path_is_dir path2/path0/
 '
 
 test_expect_success 'clean up' '
-     git reset --hard
+	git reset --hard
 '
 
 test_expect_success 'adding another file' '
-     cp "$TEST_DIRECTORY"/../README.md path0/README &&
-     git add path0/README &&
-     git commit -m add2 -a
+	cp "$TEST_DIRECTORY"/../README.md path0/README &&
+	git add path0/README &&
+	git commit -m add2 -a
 '
 
 test_expect_success 'moving whole subdirectory' '
-     git mv path0 path2
+	git mv path0 path2
 '
 
 test_expect_success 'commiting the change' '
-     git commit -m dir-move -a
+	git commit -m dir-move -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
-     grep "^R100..*path0/README..*path2/README" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
+	grep "^R100..*path0/README..*path2/README" actual
 '
 
 test_expect_success 'succeed when source is a prefix of destination' '
-     git mv path2/COPYING path2/COPYING-renamed
+	git mv path2/COPYING path2/COPYING-renamed
 '
 
 test_expect_success 'moving whole subdirectory into subdirectory' '
-     git mv path2 path1
+	git mv path2 path1
 '
 
 test_expect_success 'commiting the change' '
-     git commit -m dir-move -a
+	git commit -m dir-move -a
 '
 
 test_expect_success 'checking the commit' '
-     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-     grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
-     grep "^R100..*path2/README..*path1/path2/README" actual
+	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+	grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
+ 	grep "^R100..*path2/README..*path1/path2/README" actual
 '
 
 test_expect_success 'do not move directory over existing directory' '
-     mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
+	mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
 '
 
 test_expect_success 'move into "."' '
-     git mv path1/path2/ .
+	git mv path1/path2/ .
 '
 
 test_expect_success "Michael Cassar's test case" '
-- 
2.25.1


^ permalink raw reply related	[relevance 13%]

* [PATCH] Extend testing git-mv for renaming of subdirectories
  @ 2006-07-26 13:44 13% ` Josef Weidendorfer
  0 siblings, 0 replies; 200+ results
From: Josef Weidendorfer @ 2006-07-26 13:44 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, junkio

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
---

On Wednesday 26 July 2006 03:52, Johannes Schindelin wrote:
> 	There is no test for it, and I am quite certain the old script
> 	doesn't do it either: git-mv some_tracked_dir/ there/ will
> 	not work. t7001-mv passes, though.

Hmm... Renaming full subtrees worked since the old git-rename days.
I just checked it, and it works fine.

My bad, that there was no test for this, so what about this?

Josef

 t/t7001-mv.sh |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 811a479..9270a41 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -38,4 +38,28 @@ test_expect_success \
     'git-diff-tree -r -M --name-status  HEAD^ HEAD | \
     grep -E "^R100.+path1/COPYING.+path0/COPYING"'
 
+test_expect_success \
+    'adding another file' \
+    'cp ../../README path0/README &&
+     git-add path0/README &&
+     git-commit -m add2 -a'
+
+test_expect_success \
+    'moving whole subdirectory' \
+    'git-mv path0 path2'
+
+test_expect_success \
+    'commiting the change' \
+    'git-commit -m dir-move -a'
+
+test_expect_success \
+    'checking the commit' \
+    'git-diff-tree -r -M --name-status  HEAD^ HEAD | \
+     grep -E "^R100.+path0/COPYING.+path2/COPYING" &&
+     git-diff-tree -r -M --name-status  HEAD^ HEAD | \
+     grep -E "^R100.+path0/README.+path2/README"'
+
 test_done
+
-- 
1.4.2.rc1.g791e

^ permalink raw reply related	[relevance 13%]

* [PATCH 01/11] t7001: convert tests from the old style to the current style
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
                   ` (8 preceding siblings ...)
  2020-09-25 17:02 15% ` [PATCH 06/11] t7001: change (cd <path> && git foo) to (git -C <path> foo) shubham verma
@ 2020-09-25 17:02 13% ` shubham verma
  2020-09-25 17:40 11%   ` Eric Sunshine
  2020-09-25 17:02 13% ` [PATCH 02/11] t7001: use TAB instead of spaces shubham verma
  2020-09-25 17:33  6% ` [PATCH 00/11] Modernizing the t7001 test script Eric Sunshine
  11 siblings, 1 reply; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git; +Cc: Shubham Verma

From: Shubham Verma <shubhunic@gmail.com>

To modernize the t7001 test script, let's change the style of
its tests from an old one to the modern one.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 192 +++++++++++++++++++++++++-------------------------
 1 file changed, 96 insertions(+), 96 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 63d5f41a12..4bbb51e578 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -3,74 +3,74 @@
 test_description='git mv in subdirs'
 . ./test-lib.sh
 
-test_expect_success \
-    'prepare reference tree' \
-    'mkdir path0 path1 &&
+test_expect_success 'prepare reference tree' '
+     mkdir path0 path1 &&
      cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
      git add path0/COPYING &&
-     git commit -m add -a'
+     git commit -m add -a
+'
 
-test_expect_success \
-    'moving the file out of subdirectory' \
-    'cd path0 && git mv COPYING ../path1/COPYING'
+test_expect_success 'moving the file out of subdirectory' '
+     cd path0 && git mv COPYING ../path1/COPYING
+'
 
 # in path0 currently
-test_expect_success \
-    'commiting the change' \
-    'cd .. && git commit -m move-out -a'
+test_expect_success 'commiting the change' '
+     cd .. && git commit -m move-out -a
+'
 
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-    grep "^R100..*path0/COPYING..*path1/COPYING" actual'
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path0/COPYING..*path1/COPYING" actual
+'
 
-test_expect_success \
-    'moving the file back into subdirectory' \
-    'cd path0 && git mv ../path1/COPYING COPYING'
+test_expect_success 'moving the file back into subdirectory' '
+     cd path0 && git mv ../path1/COPYING COPYING
+'
 
 # in path0 currently
-test_expect_success \
-    'commiting the change' \
-    'cd .. && git commit -m move-in -a'
-
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
-    grep "^R100..*path1/COPYING..*path0/COPYING" actual'
-
-test_expect_success \
-    'mv --dry-run does not move file' \
-    'git mv -n path0/COPYING MOVED &&
+test_expect_success 'commiting the change' '
+     cd .. && git commit -m move-in -a
+'
+
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path1/COPYING..*path0/COPYING" actual
+'
+
+test_expect_success 'mv --dry-run does not move file' '
+     git mv -n path0/COPYING MOVED &&
      test -f path0/COPYING &&
-     test ! -f MOVED'
+     test ! -f MOVED
+'
 
-test_expect_success \
-    'checking -k on non-existing file' \
-    'git mv -k idontexist path0'
+test_expect_success 'checking -k on non-existing file' '
+     git mv -k idontexist path0
+'
 
-test_expect_success \
-    'checking -k on untracked file' \
-    'touch untracked1 &&
+test_expect_success 'checking -k on untracked file' '
+     touch untracked1 &&
      git mv -k untracked1 path0 &&
      test -f untracked1 &&
-     test ! -f path0/untracked1'
+     test ! -f path0/untracked1
+'
 
-test_expect_success \
-    'checking -k on multiple untracked files' \
-    'touch untracked2 &&
+test_expect_success 'checking -k on multiple untracked files' '
+     touch untracked2 &&
      git mv -k untracked1 untracked2 path0 &&
      test -f untracked1 &&
      test -f untracked2 &&
      test ! -f path0/untracked1 &&
-     test ! -f path0/untracked2'
+     test ! -f path0/untracked2
+'
 
-test_expect_success \
-    'checking -f on untracked file with existing target' \
-    'touch path0/untracked1 &&
+test_expect_success 'checking -f on untracked file with existing target' '
+     touch path0/untracked1 &&
      test_must_fail git mv -f untracked1 path0 &&
      test ! -f .git/index.lock &&
      test -f untracked1 &&
-     test -f path0/untracked1'
+     test -f path0/untracked1
+'
 
 # clean up the mess in case bad things happen
 rm -f idontexist untracked1 untracked2 \
@@ -78,79 +78,79 @@ rm -f idontexist untracked1 untracked2 \
      .git/index.lock
 rmdir path1
 
-test_expect_success \
-    'moving to absent target with trailing slash' \
-    'test_must_fail git mv path0/COPYING no-such-dir/ &&
+test_expect_success 'moving to absent target with trailing slash' '
+     test_must_fail git mv path0/COPYING no-such-dir/ &&
      test_must_fail git mv path0/COPYING no-such-dir// &&
      git mv path0/ no-such-dir/ &&
-     test_path_is_dir no-such-dir'
+     test_path_is_dir no-such-dir
+'
 
-test_expect_success \
-    'clean up' \
-    'git reset --hard'
+test_expect_success 'clean up' '
+     git reset --hard
+'
 
-test_expect_success \
-    'moving to existing untracked target with trailing slash' \
-    'mkdir path1 &&
+test_expect_success 'moving to existing untracked target with trailing slash' '
+     mkdir path1 &&
      git mv path0/ path1/ &&
-     test_path_is_dir path1/path0/'
+     test_path_is_dir path1/path0/
+'
 
-test_expect_success \
-    'moving to existing tracked target with trailing slash' \
-    'mkdir path2 &&
+test_expect_success 'moving to existing tracked target with trailing slash' '
+     mkdir path2 &&
      >path2/file && git add path2/file &&
      git mv path1/path0/ path2/ &&
-     test_path_is_dir path2/path0/'
+     test_path_is_dir path2/path0/
+'
 
-test_expect_success \
-    'clean up' \
-    'git reset --hard'
+test_expect_success 'clean up' '
+     git reset --hard
+'
 
-test_expect_success \
-    'adding another file' \
-    'cp "$TEST_DIRECTORY"/../README.md path0/README &&
+test_expect_success 'adding another file' '
+     cp "$TEST_DIRECTORY"/../README.md path0/README &&
      git add path0/README &&
-     git commit -m add2 -a'
+     git commit -m add2 -a
+'
 
-test_expect_success \
-    'moving whole subdirectory' \
-    'git mv path0 path2'
+test_expect_success 'moving whole subdirectory' '
+     git mv path0 path2
+'
 
-test_expect_success \
-    'commiting the change' \
-    'git commit -m dir-move -a'
+test_expect_success 'commiting the change' '
+     git commit -m dir-move -a
+'
 
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
      grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
-     grep "^R100..*path0/README..*path2/README" actual'
+     grep "^R100..*path0/README..*path2/README" actual
+'
 
-test_expect_success \
-    'succeed when source is a prefix of destination' \
-    'git mv path2/COPYING path2/COPYING-renamed'
+test_expect_success 'succeed when source is a prefix of destination' '
+     git mv path2/COPYING path2/COPYING-renamed
+'
 
-test_expect_success \
-    'moving whole subdirectory into subdirectory' \
-    'git mv path2 path1'
+test_expect_success 'moving whole subdirectory into subdirectory' '
+     git mv path2 path1
+'
 
-test_expect_success \
-    'commiting the change' \
-    'git commit -m dir-move -a'
+test_expect_success 'commiting the change' '
+     git commit -m dir-move -a
+'
 
-test_expect_success \
-    'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+test_expect_success 'checking the commit' '
+     git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
      grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
-     grep "^R100..*path2/README..*path1/path2/README" actual'
+     grep "^R100..*path2/README..*path1/path2/README" actual
+'
 
-test_expect_success \
-    'do not move directory over existing directory' \
-    'mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0'
+test_expect_success 'do not move directory over existing directory' '
+     mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
+'
 
-test_expect_success \
-    'move into "."' \
-    'git mv path1/path2/ .'
+test_expect_success 'move into "."' '
+     git mv path1/path2/ .
+'
 
 test_expect_success "Michael Cassar's test case" '
 	rm -fr .git papers partA &&
-- 
2.25.1


^ permalink raw reply related	[relevance 13%]

* [PATCH v3] t7001-mv.sh: modernizing test script using functions
  2022-11-03 18:39 13% ` [PATCH v2] t7001-mv.sh: modernizing test script using functions Debra Obondo via GitGitGadget
@ 2022-11-04 15:05 13%   ` Debra Obondo via GitGitGadget
  2022-11-04 22:00  6%     ` Taylor Blau
  0 siblings, 1 reply; 200+ results
From: Debra Obondo via GitGitGadget @ 2022-11-04 15:05 UTC (permalink / raw)
  To: git; +Cc: Taylor Blau, Martin Ågren, Debra Obondo, Debra Obondo

From: Debra Obondo <debraobondo@gmail.com>

Test script to verify the presence/absence of files, paths, directories,
symlinks and other features in 'git mv' command are using the command
format:

'test (-e|f|d|h|...)'

Replace them with helper functions of format:

'test_path_is_*'

Replacing idiomatic helper functions:

'! test_path_is_*'

with

'test_path_is_missing'

This uses values of 'test_path_bar' in place of '! test_path_foo' to
bring in the helpful factor of indicating the failure of tests after the
mv command has been used, that is, it echoes if the feature/test_path
exists.

Signed-off-by: Debra Obondo <debraobondo@gmail.com>
---
    [PATCH v3] [OUTREACHY] t7001-mv.sh : Use test_path_is_* functions in
    test script
    
    Changes since prevous 2 versions:
    
    Replacing idiomatic helper functions
    
    '! test_path_is_*'
    
    with
    
    'test_path_is_missing'
    
    This uses values of 'test_path_bar' in place of '! test_path_foo' to
    bring in the helpful factor of indicating the failure of tests after the
    mv command has been used, that is, it echoes if the feature/test_path
    exists .
    
    Older test scripts use the command 'test -' to verify the presence or
    absence of features such as files, directories and symbolic links. This
    however requires slightly complicated uses, such as 'test ! -f '. The
    helper functions 'test_path_is_' located in t/test-lib-functions.sh have
    taken into account all scenarios of the 'test -' to reduce errors. This
    was a microproject to replace them with the helper functions.
    
    Test script to verify the presence/absence of files, paths,
    directories,symboliclinks and many other features in mv command are
    using the command format
    
    'test -(e|f|s|h|...).
    
    Replace them with helper functions of format
    
    'test_path_is_*'
    
    Signed-off-by: Debra Obondo debraobondo@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1372%2Ffobiasic07%2Ft7001-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1372/fobiasic07/t7001-v3
Pull-Request: https://github.com/git/git/pull/1372

Range-diff vs v2:

 1:  c6640ebff66 ! 1:  04176190ffd t7001-mv.sh: modernizing test script using functions
     @@ Commit message
      
          'test_path_is_*'
      
     -    Changes since v1
     -
     -    Replacing idiomatic helper functions
     +    Replacing idiomatic helper functions:
      
          '! test_path_is_*'
      


 t/t7001-mv.sh | 62 +++++++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 8c37bceb336..d72cef88264 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -60,8 +60,8 @@ test_expect_success 'checking the commit' '
 
 test_expect_success 'mv --dry-run does not move file' '
 	git mv -n path0/COPYING MOVED &&
-	test -f path0/COPYING &&
-	test ! -f MOVED
+	test_path_is_file path0/COPYING &&
+	test_path_is_missing MOVED
 '
 
 test_expect_success 'checking -k on non-existing file' '
@@ -71,25 +71,25 @@ test_expect_success 'checking -k on non-existing file' '
 test_expect_success 'checking -k on untracked file' '
 	>untracked1 &&
 	git mv -k untracked1 path0 &&
-	test -f untracked1 &&
-	test ! -f path0/untracked1
+	test_path_is_file untracked1 &&
+	test_path_is_missing path0/untracked1
 '
 
 test_expect_success 'checking -k on multiple untracked files' '
 	>untracked2 &&
 	git mv -k untracked1 untracked2 path0 &&
-	test -f untracked1 &&
-	test -f untracked2 &&
-	test ! -f path0/untracked1 &&
-	test ! -f path0/untracked2
+	test_path_is_file untracked1 &&
+	test_path_is_file untracked2 &&
+	test_path_is_missing path0/untracked1 &&
+	test_path_is_missing path0/untracked2
 '
 
 test_expect_success 'checking -f on untracked file with existing target' '
 	>path0/untracked1 &&
 	test_must_fail git mv -f untracked1 path0 &&
-	test ! -f .git/index.lock &&
-	test -f untracked1 &&
-	test -f path0/untracked1
+	test_path_is_missing .git/index.lock &&
+	test_path_is_file untracked1 &&
+	test_path_is_file path0/untracked1
 '
 
 # clean up the mess in case bad things happen
@@ -215,8 +215,8 @@ test_expect_success 'absolute pathname' '
 		git add sub/file &&
 
 		git mv sub "$(pwd)/in" &&
-		! test -d sub &&
-		test -d in &&
+		test_path_is_missing sub &&
+		test_path_is_dir in &&
 		git ls-files --error-unmatch in/file
 	)
 '
@@ -234,8 +234,8 @@ test_expect_success 'absolute pathname outside should fail' '
 		git add sub/file &&
 
 		test_must_fail git mv sub "$out/out" &&
-		test -d sub &&
-		! test -d ../in &&
+		test_path_is_dir sub &&
+		test_path_is_missing ../in &&
 		git ls-files --error-unmatch sub/file
 	)
 '
@@ -295,8 +295,8 @@ test_expect_success 'git mv should overwrite symlink to a file' '
 	git add moved &&
 	test_must_fail git mv moved symlink &&
 	git mv -f moved symlink &&
-	! test -e moved &&
-	test -f symlink &&
+	test_path_is_missing moved &&
+	test_path_is_file symlink &&
 	test "$(cat symlink)" = 1 &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -312,13 +312,13 @@ test_expect_success 'git mv should overwrite file with a symlink' '
 	git add moved &&
 	test_must_fail git mv symlink moved &&
 	git mv -f symlink moved &&
-	! test -e symlink &&
+	test_path_is_missing symlink &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
 
 test_expect_success SYMLINKS 'check moved symlink' '
-	test -h moved
+	test_path_is_symlink moved
 '
 
 rm -f moved symlink
@@ -352,7 +352,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	) &&
 	mkdir mod &&
 	git mv sub mod/sub &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -372,7 +372,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	) &&
 	mkdir mod &&
 	git mv sub mod/sub &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
@@ -389,7 +389,7 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	mkdir mod &&
 	git -C mod mv ../sub/ . &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
@@ -408,7 +408,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -423,13 +423,13 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	mkdir mod &&
 	test_must_fail git mv sub mod/sub 2>actual.err &&
-	test -s actual.err &&
-	test -e sub &&
+	test_file_not_empty actual.err &&
+	test_path_exists sub &&
 	git diff-files --quiet -- sub &&
 	git add .gitmodules &&
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -447,7 +447,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	test_cmp expect.err actual.err &&
-	! test -e sub &&
+	test_path_is_missing sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -460,7 +460,7 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
 	git submodule update &&
 	mkdir mod &&
 	git mv -n sub mod/sub 2>actual.err &&
-	test -f sub/.git &&
+	test_path_is_file sub/.git &&
 	git diff-index --exit-code HEAD &&
 	git update-index --refresh &&
 	git diff-files --quiet -- sub .gitmodules
@@ -474,10 +474,10 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
 	git status -s sub2 >actual &&
 	echo "?? sub2/" >expected &&
 	test_cmp expected actual &&
-	! test -f sub/.git &&
-	test -f sub2/.git &&
+	test_path_is_missing sub/.git &&
+	test_path_is_file sub2/.git &&
 	git submodule update &&
-	test -f sub/.git &&
+	test_path_is_file sub/.git &&
 	rm -rf sub2 &&
 	git diff-index --exit-code HEAD &&
 	git update-index --refresh &&

base-commit: 1fc3c0ad407008c2f71dd9ae1241d8b75f8ef886
-- 
gitgitgadget

^ permalink raw reply related	[relevance 13%]

* [PATCH v2 1/5] README: use markdown syntax
  @ 2016-02-25  8:37 13%   ` Matthieu Moy
  0 siblings, 0 replies; 200+ results
From: Matthieu Moy @ 2016-02-25  8:37 UTC (permalink / raw)
  To: gitster; +Cc: git, peff, Johannes.Schindelin, Matthieu Moy

This allows repository browsers like GitHub to display the content of
the file nicely formatted.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 README => README.md | 7 ++-----
 t/t7001-mv.sh       | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)
 rename README => README.md (93%)

diff --git a/README b/README.md
similarity index 93%
rename from README
rename to README.md
index 1083735..600779c 100644
--- a/README
+++ b/README.md
@@ -1,8 +1,5 @@
-////////////////////////////////////////////////////////////////
-
-	Git - the stupid content tracker
-
-////////////////////////////////////////////////////////////////
+Git - the stupid content tracker
+================================
 
 "git" can mean anything, depending on your mood.
 
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 51dd2b4..4008fae 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -102,7 +102,7 @@ test_expect_success \
 
 test_expect_success \
     'adding another file' \
-    'cp "$TEST_DIRECTORY"/../README path0/README &&
+    'cp "$TEST_DIRECTORY"/../README.md path0/README &&
      git add path0/README &&
      git commit -m add2 -a'
 
-- 
2.7.2.334.g35ed2ae.dirty

^ permalink raw reply related	[relevance 13%]

* [PATCH] add test for bug in git-mv with nested submodules
@ 2017-08-17 10:34 13% Heiko Voigt
    0 siblings, 1 reply; 200+ results
From: Heiko Voigt @ 2017-08-17 10:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

When using git-mv with a submodule it will detect that and update the
paths for its configurations (.gitmodules, worktree and gitfile). This
does not work for nested submodules where a user renames the root
submodule.

We discovered this fact when working on on-demand fetch for renamed
submodules. Lets add a test to document.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
 t/t7001-mv.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e365d1f..39f8aed 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -491,4 +491,13 @@ test_expect_success 'moving a submodule in nested directories' '
 	test_cmp actual expect
 '
 
+test_expect_failure 'moving nested submodules' '
+	git commit -am "cleanup commit" &&
+	git submodule add ./. sub_nested &&
+	git commit -m "add sub_nested" &&
+	git submodule update --init --recursive &&
+	git mv sub_nested sub_nested_moved &&
+	git status
+'
+
 test_done
-- 
2.0.0.274.g6b2cd91


^ permalink raw reply related	[relevance 13%]

* [PATCH] t7001-mv.sh:modernizing test script using function
@ 2022-10-30 17:20 13% Debra Obondo via GitGitGadget
  2022-11-03 18:39 13% ` [PATCH v2] t7001-mv.sh: modernizing test script using functions Debra Obondo via GitGitGadget
                   ` (2 more replies)
  0 siblings, 3 replies; 200+ results
From: Debra Obondo via GitGitGadget @ 2022-10-30 17:20 UTC (permalink / raw)
  To: git; +Cc: Debra Obondo, Debra Obondo

From: Debra Obondo <debraobondo@gmail.com>

Test script to verify the presence/absence of files, paths, directories,
symlinks and other features in 'git mv' command are using the command
format:

'test (-e|f|d|h|...)'

Replace them with helper functions of format:

'test_path_is_*'

Signed-off-by: Debra Obondo <debraobondo@gmail.com>
---
    [PATCH] [OUTREACHY] t7001-mv.sh : Use test_path_is_* functions in test
    script
    
    Older test scripts use the command 'test -' to verify the presence or
    absence of features such as files, directories and symbolic links. This
    however requires slightly complicated uses, such as 'test ! -f '. The
    helper functions 'test_path_is_' located in t/test-lib-functions.sh have
    taken into account all scenarios of the 'test -*' to reduce errors. This
    was a microproject to replace them with the helper functions.
    
    Test script to verify the presence/absence of files, paths,
    directories,symboliclinks and many other features in mv command are
    using the command format
    
    'test -(e|f|s|h|...).
    
    Replace them with helper functions of format
    
    'test_path_is_*'
    
    Signed-off-by: Debra Obondo debraobondo@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1372%2Ffobiasic07%2Ft7001-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1372/fobiasic07/t7001-v1
Pull-Request: https://github.com/git/git/pull/1372

 t/t7001-mv.sh | 62 +++++++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 8c37bceb336..aa97a2f8e1c 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -60,8 +60,8 @@ test_expect_success 'checking the commit' '
 
 test_expect_success 'mv --dry-run does not move file' '
 	git mv -n path0/COPYING MOVED &&
-	test -f path0/COPYING &&
-	test ! -f MOVED
+	test_path_is_file path0/COPYING &&
+	! test_path_is_file MOVED
 '
 
 test_expect_success 'checking -k on non-existing file' '
@@ -71,25 +71,25 @@ test_expect_success 'checking -k on non-existing file' '
 test_expect_success 'checking -k on untracked file' '
 	>untracked1 &&
 	git mv -k untracked1 path0 &&
-	test -f untracked1 &&
-	test ! -f path0/untracked1
+	test_path_is_file untracked1 &&
+	! test_path_is_file path0/untracked1
 '
 
 test_expect_success 'checking -k on multiple untracked files' '
 	>untracked2 &&
 	git mv -k untracked1 untracked2 path0 &&
-	test -f untracked1 &&
-	test -f untracked2 &&
-	test ! -f path0/untracked1 &&
-	test ! -f path0/untracked2
+	test_path_is_file untracked1 &&
+	test_path_is_file untracked2 &&
+	! test_path_is_file path0/untracked1 &&
+	! test_path_is_file path0/untracked2
 '
 
 test_expect_success 'checking -f on untracked file with existing target' '
 	>path0/untracked1 &&
 	test_must_fail git mv -f untracked1 path0 &&
-	test ! -f .git/index.lock &&
-	test -f untracked1 &&
-	test -f path0/untracked1
+	! test_path_is_file .git/index.lock &&
+	test_path_is_file untracked1 &&
+	test_path_is_file path0/untracked1
 '
 
 # clean up the mess in case bad things happen
@@ -215,8 +215,8 @@ test_expect_success 'absolute pathname' '
 		git add sub/file &&
 
 		git mv sub "$(pwd)/in" &&
-		! test -d sub &&
-		test -d in &&
+		! test_path_is_dir sub &&
+		test_path_is_dir in &&
 		git ls-files --error-unmatch in/file
 	)
 '
@@ -234,8 +234,8 @@ test_expect_success 'absolute pathname outside should fail' '
 		git add sub/file &&
 
 		test_must_fail git mv sub "$out/out" &&
-		test -d sub &&
-		! test -d ../in &&
+		test_path_is_dir sub &&
+		! test_path_is_dir ../in &&
 		git ls-files --error-unmatch sub/file
 	)
 '
@@ -295,8 +295,8 @@ test_expect_success 'git mv should overwrite symlink to a file' '
 	git add moved &&
 	test_must_fail git mv moved symlink &&
 	git mv -f moved symlink &&
-	! test -e moved &&
-	test -f symlink &&
+	! test_path_exists moved &&
+	test_path_is_file symlink &&
 	test "$(cat symlink)" = 1 &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -312,13 +312,13 @@ test_expect_success 'git mv should overwrite file with a symlink' '
 	git add moved &&
 	test_must_fail git mv symlink moved &&
 	git mv -f symlink moved &&
-	! test -e symlink &&
+	! test_path_exists symlink &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
 
 test_expect_success SYMLINKS 'check moved symlink' '
-	test -h moved
+	test_path_is_symlink moved
 '
 
 rm -f moved symlink
@@ -352,7 +352,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	) &&
 	mkdir mod &&
 	git mv sub mod/sub &&
-	! test -e sub &&
+	! test_path_exists sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -372,7 +372,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	) &&
 	mkdir mod &&
 	git mv sub mod/sub &&
-	! test -e sub &&
+	! test_path_exists sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
@@ -389,7 +389,7 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	mkdir mod &&
 	git -C mod mv ../sub/ . &&
-	! test -e sub &&
+	! test_path_exists sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
@@ -408,7 +408,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
-	! test -e sub &&
+	! test_path_exists sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -423,13 +423,13 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	mkdir mod &&
 	test_must_fail git mv sub mod/sub 2>actual.err &&
-	test -s actual.err &&
-	test -e sub &&
+	test_file_not_empty actual.err &&
+	test_path_exists sub &&
 	git diff-files --quiet -- sub &&
 	git add .gitmodules &&
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
-	! test -e sub &&
+	! test_path_exists sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -447,7 +447,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	test_cmp expect.err actual.err &&
-	! test -e sub &&
+	! test_path_exists sub &&
 	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
@@ -460,7 +460,7 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
 	git submodule update &&
 	mkdir mod &&
 	git mv -n sub mod/sub 2>actual.err &&
-	test -f sub/.git &&
+	test_path_is_file sub/.git &&
 	git diff-index --exit-code HEAD &&
 	git update-index --refresh &&
 	git diff-files --quiet -- sub .gitmodules
@@ -474,10 +474,10 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
 	git status -s sub2 >actual &&
 	echo "?? sub2/" >expected &&
 	test_cmp expected actual &&
-	! test -f sub/.git &&
-	test -f sub2/.git &&
+	! test_path_is_file sub/.git &&
+	test_path_is_file sub2/.git &&
 	git submodule update &&
-	test -f sub/.git &&
+	test_path_is_file sub/.git &&
 	rm -rf sub2 &&
 	git diff-index --exit-code HEAD &&
 	git update-index --refresh &&

base-commit: 1fc3c0ad407008c2f71dd9ae1241d8b75f8ef886
-- 
gitgitgadget

^ permalink raw reply related	[relevance 13%]

* [PATCH 1/5] README: use markdown syntax
  @ 2016-02-23 17:40 13% ` Matthieu Moy
    1 sibling, 0 replies; 200+ results
From: Matthieu Moy @ 2016-02-23 17:40 UTC (permalink / raw)
  To: git; +Cc: emma.westby, Matthieu Moy

This allows repository browsers like GitHub to display the content of
the file nicely formatted.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 README => README.md | 6 +-----
 t/t7001-mv.sh       | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)
 rename README => README.md (93%)

diff --git a/README b/README.md
similarity index 93%
rename from README
rename to README.md
index 1083735..907eb3b 100644
--- a/README
+++ b/README.md
@@ -1,8 +1,4 @@
-////////////////////////////////////////////////////////////////
-
-	Git - the stupid content tracker
-
-////////////////////////////////////////////////////////////////
+# Git - the stupid content tracker
 
 "git" can mean anything, depending on your mood.
 
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 51dd2b4..4008fae 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -102,7 +102,7 @@ test_expect_success \
 
 test_expect_success \
     'adding another file' \
-    'cp "$TEST_DIRECTORY"/../README path0/README &&
+    'cp "$TEST_DIRECTORY"/../README.md path0/README &&
      git add path0/README &&
      git commit -m add2 -a'
 
-- 
2.7.2.334.g35ed2ae.dirty

^ permalink raw reply related	[relevance 13%]

* Re: [PATCHv2] git-mv: Keep moved index entries inact
  2008-07-28 14:20  6%     ` SZEDER Gábor
@ 2008-07-28 15:06 13%       ` Johannes Schindelin
    0 siblings, 1 reply; 200+ results
From: Johannes Schindelin @ 2008-07-28 15:06 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: Junio C Hamano, Petr Baudis, git

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1086 bytes --]

Hi,

On Mon, 28 Jul 2008, SZEDER Gábor wrote:

> there is a race somewhere in these 'git-mv: Keep moved index entries
> inact' changes.
> 
> The test cases 'git mv should overwrite symlink to a file' or 'git mv
> should overwrite file with a symlink' fail occasionaly.  It's quite
> non-deterministic:  I have run t7001-mv.sh in a loop (see below) and
> one or the other usually fails around 50 runs (but sometimes only
> after 150).  Adding some tracing echos to the tests shows that both
> tests fail when running 'git diff-files' at the end.

To make it more convenient to test: with this patch it fails all the time:

-- snipsnap --

 t/t7001-mv.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b0fa407..6699abd 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -180,6 +180,7 @@ test_expect_success 'git mv should overwrite symlink to a file' '
 	echo 1 >moved &&
 	ln -s moved symlink &&
 	git add moved symlink &&
+	sleep 1 &&
 	test_must_fail git mv moved symlink &&
 	git mv -f moved symlink &&
 	! test -e moved &&

^ permalink raw reply related	[relevance 13%]

* Re: [PATCHv2] git-mv: Keep moved index entries inact
  @ 2008-07-28 23:55 13%             ` Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2008-07-28 23:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: SZEDER Gábor, Petr Baudis, git

Hi,

On Tue, 29 Jul 2008, Johannes Schindelin wrote:

> BTW I have no idea how we could test for this, short of introducing the 
> "sleep 1" I did earlier.  Maybe guard it with a TEST_EXPENSIVE_CTIME 
> variable or something similar.  Dunno.

IOW something like this squashed into your patch:

-- snipsnap --

 t/t7001-mv.sh |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b0fa407..c749059 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -179,6 +179,10 @@ test_expect_success 'git mv should overwrite symlink to a file' '
 	git init &&
 	echo 1 >moved &&
 	ln -s moved symlink &&
+	if test ! -z "$TEST_EXPENSIVE_CTIME"
+	then
+		sleep 1
+	fi &&
 	git add moved symlink &&
 	test_must_fail git mv moved symlink &&
 	git mv -f moved symlink &&

^ permalink raw reply related	[relevance 13%]

* [PATCH v2 3/3] mark fixed breakage as expect pass for "git mv -k" multiple files
  @ 2009-01-14 17:03 13%           ` Michael J Gruber
  0 siblings, 0 replies; 200+ results
From: Michael J Gruber @ 2009-01-14 17:03 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

The new tests pass now so mark them as such.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/t7001-mv.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 5c1485d..ef2e78f 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -49,7 +49,7 @@ test_expect_success \
      test -f untracked1 &&
      test ! -f path0/untracked1'
 
-test_expect_failure \
+test_expect_success \
     'checking -k on multiple untracked files' \
     'touch untracked2 &&
      git mv -k untracked1 untracked2 path0 &&
-- 
1.6.0.6

^ permalink raw reply related	[relevance 13%]

* [PATCH 2/3] [BUG] Add a testcase for "git mv -f" on untracked files.
  2009-02-04  9:32 19% [PATCH 1/3] Missing && in t/t7001.sh Matthieu Moy
@ 2009-02-04  9:32 13% ` Matthieu Moy
  2009-02-04  9:32 12%   ` [PATCH 3/3] builtin-mv.c: check for unversionned files before looking at the destination Matthieu Moy
  0 siblings, 1 reply; 200+ results
From: Matthieu Moy @ 2009-02-04  9:32 UTC (permalink / raw)
  To: git, gitster; +Cc: Matthieu Moy

This currently fails with:
git: builtin-mv.c:217: cmd_mv: Assertion `pos >= 0' failed.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 t/t7001-mv.sh |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e4dfe95..52a47b5 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -58,6 +58,14 @@ test_expect_success \
      test ! -f path0/untracked1 &&
      test ! -f path0/untracked2'
 
+test_expect_failure \
+    'checking -f on untracked file with existing target' \
+    'touch path0/untracked1 &&
+     git mv -f untracked1 path0
+     test ! -f .git/index.lock &&
+     test -f untracked1 &&
+     test -f path0/untracked1'
+
 # clean up the mess in case bad things happen
 rm -f idontexist untracked1 untracked2 \
      path0/idontexist path0/untracked1 path0/untracked2 \
-- 
1.6.1.2.321.g68da9

^ permalink raw reply related	[relevance 13%]

* [PATCH 1/3] t7001: avoid git on upstream of pipe
  2023-05-08 18:59  7% [PATCH 0/3] dropping "verbose" test helper function Jeff King
  2023-05-08 19:01 19% ` [PATCH 2/3] t7001: use "ls-files --format" instead of "cut" Jeff King
@ 2023-05-08 19:01 13% ` Jeff King
  1 sibling, 0 replies; 200+ results
From: Jeff King @ 2023-05-08 19:01 UTC (permalink / raw)
  To: git

We generally avoid git on the left-hand side of a pipe, because it loses
the exit code of the command (and thus we'd miss things like segfaults
or unexpected failures). In the cases in t7001, we wouldn't expect
failures (they are just inspecting the repository state, and are not the
main point of the test), but it doesn't hurt to be careful.

In all but one case here we're piping "ls-files --stage" to cut off the
pathname (since we compare entries before and after moving). Let's pull
that into a helper function to avoid repeating the slightly awkward
replacement.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t7001-mv.sh | 38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index d72cef8826..ea70419928 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -4,6 +4,11 @@ test_description='git mv in subdirs'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-diff-data.sh
 
+index_at_path () {
+	entry=$(git ls-files --stage "$@") &&
+	echo "$entry" | cut -f 1
+}
+
 test_expect_success 'mv -f refreshes updated index entry' '
 	echo test >bar &&
 	git add bar &&
@@ -187,7 +192,8 @@ test_expect_success "Michael Cassar's test case" '
 	git mv papers/unsorted/Thesis.pdf papers/all-papers/moo-blah.pdf &&
 
 	T=$(git write-tree) &&
-	git ls-tree -r $T | verbose grep partA/outline.txt
+	git ls-tree -r $T >out &&
+	verbose grep partA/outline.txt out
 '
 
 rm -fr papers partA path?
@@ -260,12 +266,12 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 	git init &&
 	echo 1 >dirty &&
 	git add dirty &&
-	entry="$(git ls-files --stage dirty | cut -f 1)" &&
+	entry="$(index_at_path dirty)" &&
 	git mv dirty dirty2 &&
-	test "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" &&
+	test "$entry" = "$(index_at_path dirty2)" &&
 	echo 2 >dirty2 &&
 	git mv dirty2 dirty &&
-	test "$entry" = "$(git ls-files --stage dirty | cut -f 1)"
+	test "$entry" = "$(index_at_path dirty)"
 '
 
 rm -f dirty dirty2
@@ -342,7 +348,7 @@ test_expect_success 'git mv cannot move a submodule in a file' '
 '
 
 test_expect_success 'git mv moves a submodule with a .git directory and no .gitmodules' '
-	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	entry="$(index_at_path sub)" &&
 	git rm .gitmodules &&
 	(
 		cd sub &&
@@ -353,7 +359,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	mkdir mod &&
 	git mv sub mod/sub &&
 	test_path_is_missing sub &&
-	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+	test "$entry" = "$(index_at_path mod/sub)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -363,7 +369,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
-	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	entry="$(index_at_path sub)" &&
 	(
 		cd sub &&
 		rm -f .git &&
@@ -373,7 +379,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	mkdir mod &&
 	git mv sub mod/sub &&
 	test_path_is_missing sub &&
-	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+	test "$entry" = "$(index_at_path mod/sub)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
@@ -386,11 +392,11 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 	rm -rf mod &&
 	git reset --hard &&
 	git submodule update &&
-	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	entry="$(index_at_path sub)" &&
 	mkdir mod &&
 	git -C mod mv ../sub/ . &&
 	test_path_is_missing sub &&
-	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+	test "$entry" = "$(index_at_path mod/sub)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
@@ -404,12 +410,12 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 	git reset --hard &&
 	git submodule update &&
 	git rm .gitmodules &&
-	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	entry="$(index_at_path sub)" &&
 	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
 	test_path_is_missing sub &&
-	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+	test "$entry" = "$(index_at_path mod/sub)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -420,7 +426,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 	git reset --hard &&
 	git submodule update &&
 	git config -f .gitmodules foo.bar true &&
-	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	entry="$(index_at_path sub)" &&
 	mkdir mod &&
 	test_must_fail git mv sub mod/sub 2>actual.err &&
 	test_file_not_empty actual.err &&
@@ -430,7 +436,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
 	test_path_is_missing sub &&
-	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+	test "$entry" = "$(index_at_path mod/sub)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -442,13 +448,13 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 	git submodule update &&
 	git config -f .gitmodules --remove-section submodule.sub &&
 	git add .gitmodules &&
-	entry="$(git ls-files --stage sub | cut -f 1)" &&
+	entry="$(index_at_path sub)" &&
 	echo "warning: Could not find section in .gitmodules where path=sub" >expect.err &&
 	mkdir mod &&
 	git mv sub mod/sub 2>actual.err &&
 	test_cmp expect.err actual.err &&
 	test_path_is_missing sub &&
-	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+	test "$entry" = "$(index_at_path mod/sub)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
-- 
2.40.1.802.gdef2a8734a


^ permalink raw reply related	[relevance 13%]

* Re: 'git mv' doesn't move submodule if it's in a subdirectory
  @ 2016-04-15 17:59 14%   ` Stefan Beller
  0 siblings, 0 replies; 200+ results
From: Stefan Beller @ 2016-04-15 17:59 UTC (permalink / raw)
  To: Albin Otterhäll; +Cc: git@vger.kernel.org

On Fri, Apr 15, 2016 at 10:18 AM, Stefan Beller <sbeller@google.com> wrote:
> On Fri, Apr 15, 2016 at 1:14 AM, Albin Otterhäll <gmane@otterhall.com> wrote:
>> I've a submodule located in a subdirectory
>> ({git_rep}/home/{directory}/{submodule}), and I wanted to move the whole
>> directory up a level ({git_rep}/{directory}/{submodule}). But when I
>> used 'git mv {directory} ../' the '.gitmodule' file didn't get modified.
>>
>> Best regards,
>> Albin Otterhäll
>
> Thanks for the bug report!
> Which version of Git do you use? (Did you try different versions?)

I think I can reproduce the problem. A regression test (which currently fails)
could look like
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 4008fae..3b96a9a 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -292,6 +292,9 @@ test_expect_success 'setup submodule' '
        echo content >file &&
        git add file &&
        git commit -m "added sub and file" &&
+       mkdir -p deep/directory/hierachy &&
+       git submodule add ./. deep/directory/hierachy/sub &&
+       git commit -m "added another submodule" &&
        git branch submodule
 '

@@ -475,4 +478,14 @@ test_expect_success 'mv -k does not accidentally
destroy submodules' '
        git checkout .
 '

+test_expect_failure 'moving a submodule in nested directories' '
+       (
+               cd deep &&
+               git mv directory ../ &&
+               git status
+               # currently git status exits with 128
+               # fatal: Not a git repository:
directory/hierachy/sub/../../../../.git/modules/deep/directory/hierachy/sub
+       )
+'
+
 test_done

^ permalink raw reply related	[relevance 14%]

* RE: [EXTERNAL] [PATCH v2 1/1] git mv foo FOO ; git mv foo bar gave an assert
       [not found]     ` <20210301170425.12154-1-tboegi@web.de>
@ 2021-03-01 20:23 14%   ` Dan Moseley
  0 siblings, 0 replies; 200+ results
From: Dan Moseley @ 2021-03-01 20:23 UTC (permalink / raw)
  To: tboegi@web.de; +Cc: git@vger.kernel.org

> From: Torsten Bögershausen <tboegi@web.de>
> 
> The following sequence, on a case-insensitive file system,
> (strictly speeking with core.ignorecase=true)
> leads to an assertion, and leaves .git/index.lock behind.
> 
> git init
> echo foo >foo
> git add foo
> git mv foo FOO
> git mv foo bar
> 
> This regression was introduced in Commit 9b906af657,
> "git-mv: improve error message for conflicted file"
> 
> The bugfix is to change the "file exist case-insensitive in the index"
> into the correct "file exist (case-sensitive) in the index".
> This avoids the "assert".
> 
> Reported-By: Dan Moseley <Dan.Moseley@microsoft.com>
> 
> This fixes
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgit-for-windows%2Fgit%2Fissues%2F2920&amp;data=04%7C01%7CDan.Moseley%40microsoft.com%7Cb659ba5925c543bcc3e708d8dcd41268%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637502150683596627%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=%2BLjQf5NooTUgOKbsyn10XCFIAgMw9v%2BKlhx8kDD6%2BIg%3D&amp;reserved=0
> 
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---
>  builtin/mv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/builtin/mv.c b/builtin/mv.c
> index 7dac714af9..3fccdcb645 100644
> --- a/builtin/mv.c
> +++ b/builtin/mv.c
> @@ -221,7 +221,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
>  				}
>  				argc += last - first;
>  			}
> -		} else if (!(ce = cache_file_exists(src, length, ignore_case))) {
> +		} else if (!(ce = cache_file_exists(src, length, 0))) {
>  			bad = _("not under version control");
>  		} else if (ce_stage(ce)) {
>  			bad = _("conflicted");
> --
> 2.30.0.155.g66e871b664
>

Thank you Thorsten. This makes sense to me. Do you want to add a test? 
I believe this is what I had in my original patch, that worked pretty well:

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 63d5f41a12..5c7fee9bd8 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -152,6 +152,14 @@ test_expect_success \
     'move into "."' \
     'git mv path1/path2/ .'

+test_expect_success \
+    'fail to move file already in index under different cased name' \
+    'echo 1 > foo &&
+     git add foo &&
+     git commit -m add_file -- foo &&
+     git mv foo FOO &&
+     test_expect_code 128 git mv foo BAR'
+
 test_expect_success "Michael Cassar's test case" '
        rm -fr .git papers partA &&
        git init &&
--
2.25.1

^ permalink raw reply related	[relevance 14%]

* [PATCH] git-mv: fix git mv bug with case insensitive fs
       [not found]     ` <BYAPR21MB11585FFD46DEE7AD4EEEFEABE0D89@BYAPR21MB1158.namprd21.prod.outlook.com>
@ 2020-12-29  2:06 14%   ` Dan Moseley
  0 siblings, 0 replies; 200+ results
From: Dan Moseley @ 2020-12-29  2:06 UTC (permalink / raw)
  To: git@vger.kernel.org

Fix git mv to not assert when src is already in the index under a
different casing, core.caseInsensitive=true, and the file system
is case insensitive.

Since 9b906af657 the check that git mv does to ensure the src is in the
cache respects caseInsensitive. As a result git mv allows a move from a
file that has a different case in the index than it does on disk. 
After the rename on disk, git mv fails to find the file in the cache
in order to rename it in the index, and asserts.
Assertion failed: pos >= 0, file builtin/mv.c, line 295

This is the simplest possible fix, suggested by @tboegi. It does leave
the file renamed on disk, but that is easy to reverse after the error.

Another option would be to change the aforementioned check to always
be case sensitive, but I am not sure whether there is a scenario where
it is useful to be insensitive.

Signed-off-by: Dan Moseley <danmose@microsoft.com>
---
Originally reported in https://github.com/git-for-windows/git/issues/2920
but this is not specific to Windows.

 builtin/mv.c  | 6 ++++--
 t/t7001-mv.sh | 8 ++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/builtin/mv.c b/builtin/mv.c index 7dac714af9..e1fd8a5e00 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -292,8 +292,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                        continue;

                pos = cache_name_pos(src, strlen(src));
-               assert(pos >= 0);
-               rename_cache_entry_at(pos, dst);
+               if (pos >= 0)
+                       rename_cache_entry_at(pos, dst);
+               else if (!ignore_errors)
+                       die(_("bad source: source=%s, destination=%s"), 
+ src, dst);
        }

        if (gitmodules_modified)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index 63d5f41a12..5c7fee9bd8 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -152,6 +152,14 @@ test_expect_success \
     'move into "."' \
     'git mv path1/path2/ .'

+test_expect_success \
+    'fail to move file already in index under different cased name' \
+    'echo 1 > foo &&
+     git add foo &&
+     git commit -m add_file -- foo &&
+     git mv foo FOO &&
+     test_expect_code 128 git mv foo BAR'
+
 test_expect_success "Michael Cassar's test case" '
        rm -fr .git papers partA &&
        git init &&
--
2.25.1


^ permalink raw reply	[relevance 14%]

* [PATCH v2 00/10] Modernizing the t7001 test script
@ 2021-02-09 17:32 15% shubham verma
  2021-02-09 17:32 19% ` [PATCH v2 09/10] t7001: use here-docs instead of echo shubham verma
                   ` (11 more replies)
  0 siblings, 12 replies; 200+ results
From: shubham verma @ 2021-02-09 17:32 UTC (permalink / raw)
  To: git

In this patch series modernize the t7001 test script by changing the
style of its tests from an old one to the modern one and by cleaning
up the test script.

Changes since v1:

- Change commit messages and added brief explanation about commit.
- Modernize subshell formatting
- Use ': >' rather than '>'

Thanks everyone for your feedback and suggestions.

shubham verma (10):
  t7001: modernize test formatting
  t7001: indent with TABs instead of spaces
  t7001: remove unnecessary blank lines
  t7001: modernize subshell formatting
  t7001: remove whitespace after redirect operators
  t7001: avoid using `cd` outside of subshells
  t7001: use '>' rather than 'touch'
  t7001: put each command on a separate line
  t7001: use here-docs instead of echo
  t7001: use `test` rather than `[`

 t/t7001-mv.sh | 432 ++++++++++++++++++++++++--------------------------
 1 file changed, 204 insertions(+), 228 deletions(-)

-- 
2.25.1


^ permalink raw reply	[relevance 15%]

* [PATCH v3 00/10] Modernizing the t7001 test script
@ 2021-02-11 19:46 15% Shubham Verma
  2021-02-11 19:47 19% ` [PATCH v3 07/10] t7001: use '>' rather than 'touch' Shubham Verma
                   ` (10 more replies)
  0 siblings, 11 replies; 200+ results
From: Shubham Verma @ 2021-02-11 19:46 UTC (permalink / raw)
  To: git

In this patch series modernize the t7001 test script by changing the
style of its tests from an old one to the modern one and by cleaning
up the test script.

Changes since v2:

- Correct the author name spelling

Thanks everyone for your feedback and suggestions.

Shubham Verma (10):
  t7001: modernize test formatting
  t7001: indent with TABs instead of spaces
  t7001: remove unnecessary blank lines
  t7001: modernize subshell formatting
  t7001: remove whitespace after redirect operators
  t7001: avoid using `cd` outside of subshells
  t7001: use '>' rather than 'touch'
  t7001: put each command on a separate line
  t7001: use here-docs instead of echo
  t7001: use `test` rather than `[`

 t/t7001-mv.sh | 420 ++++++++++++++++++++++++--------------------------
 1 file changed, 199 insertions(+), 221 deletions(-)

-- 
2.25.1


^ permalink raw reply	[relevance 15%]

* [PATCH 00/11] Modernizing the t7001 test script
@ 2020-09-25 17:02 15% shubham verma
  2020-09-25 17:02 19% ` [PATCH 09/11] t7001: use here-docs instead of echo shubham verma
                   ` (11 more replies)
  0 siblings, 12 replies; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git

In this patch series modernize the t7001 test script by changing the
style of its tests from an old one to the modern one and by cleaning
up the test script.

Shubham Verma (11):
  t7001: convert tests from the old style to the current style
  t7001: use TAB instead of spaces
  t7001: remove unnecessary blank lines
  t7001: change the style for cd according to subshell
  t7001: remove whitespace after redirect operators
  t7001: change (cd <path> && git foo) to (git -C <path> foo)
  t7001: use ': >' rather than 'touch'
  t7001: put each command on a separate line
  t7001: use here-docs instead of echo
  t7001: use `test` rather than `[`
  t7001: move cleanup code from outside the tests into them

 t/t7001-mv.sh | 393 +++++++++++++++++++++++---------------------------
 1 file changed, 181 insertions(+), 212 deletions(-)

-- 
2.25.1


^ permalink raw reply	[relevance 15%]

* [PATCH 11/11] t7001: move cleanup code from outside the tests into them
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
                   ` (6 preceding siblings ...)
  2020-09-25 17:02 16% ` [PATCH 10/11] t7001: use `test` rather than `[` shubham verma
@ 2020-09-25 17:02 15% ` shubham verma
  2020-09-25 17:02 15% ` [PATCH 06/11] t7001: change (cd <path> && git foo) to (git -C <path> foo) shubham verma
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git; +Cc: Shubham Verma

From: Shubham Verma <shubhunic@gmail.com>

Let's use test_when_finished() to include cleanup code inside the tests,
as it's cleaner and safer to not have any code outside the tests.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 7bb4a7b759..b4d04ceaf8 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -32,6 +32,7 @@ test_expect_success 'commiting the change' '
 '
 
 test_expect_success 'checking the commit' '
+	test_when_finished "rmdir path1" &&
 	git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
 	grep "^R100..*path1/COPYING..*path0/COPYING" actual
 '
@@ -43,6 +44,7 @@ test_expect_success 'mv --dry-run does not move file' '
 '
 
 test_expect_success 'checking -k on non-existing file' '
+	test_when_finished "rm -f idontexist path0/idontexist" &&
 	git mv -k idontexist path0
 '
 
@@ -55,6 +57,7 @@ test_expect_success 'checking -k on untracked file' '
 
 test_expect_success 'checking -k on multiple untracked files' '
 	: > untracked2 &&
+	test_when_finished "rm -f untracked2 path0/untracked2" &&
 	git mv -k untracked1 untracked2 path0 &&
 	test -f untracked1 &&
 	test -f untracked2 &&
@@ -64,18 +67,14 @@ test_expect_success 'checking -k on multiple untracked files' '
 
 test_expect_success 'checking -f on untracked file with existing target' '
 	: > path0/untracked1 &&
+	test_when_finished "rm -f untracked1 path0/untracked1" &&
+	test_when_finished "rm -f .git/index.lock" &&
 	test_must_fail git mv -f untracked1 path0 &&
 	test ! -f .git/index.lock &&
 	test -f untracked1 &&
 	test -f path0/untracked1
 '
 
-# clean up the mess in case bad things happen
-rm -f idontexist untracked1 untracked2 \
-     path0/idontexist path0/untracked1 path0/untracked2 \
-     .git/index.lock
-rmdir path1
-
 test_expect_success 'moving to absent target with trailing slash' '
 	test_must_fail git mv path0/COPYING no-such-dir/ &&
 	test_must_fail git mv path0/COPYING no-such-dir// &&
@@ -149,10 +148,12 @@ test_expect_success 'do not move directory over existing directory' '
 '
 
 test_expect_success 'move into "."' '
+	test_when_finished "rm -fr path?" &&
 	git mv path1/path2/ .
 '
 
 test_expect_success "Michael Cassar's test case" '
+	test_when_finished "rm -fr papers partA" &&
 	rm -fr .git papers partA &&
 	git init &&
 	mkdir -p papers/unsorted papers/all-papers partA &&
@@ -168,8 +169,6 @@ test_expect_success "Michael Cassar's test case" '
 	git ls-tree -r $T | verbose grep partA/outline.txt
 '
 
-rm -fr papers partA path?
-
 test_expect_success "Sergey Vlasov's test case" '
 	rm -fr .git &&
 	git init &&
@@ -230,6 +229,7 @@ test_expect_success 'git mv to move multiple sources into a directory' '
 '
 
 test_expect_success 'git mv should not change sha1 of moved cache entry' '
+	test_when_finished "rm -f dirty dirty2" &&
 	rm -fr .git &&
 	git init &&
 	echo 1 >dirty &&
@@ -242,8 +242,6 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 	test "$entry" = "$(git ls-files --stage dirty | cut -f 1)"
 '
 
-rm -f dirty dirty2
-
 # NB: This test is about the error message
 # as well as the failure.
 test_expect_success 'git mv error on conflicted file' '
@@ -262,6 +260,7 @@ test_expect_success 'git mv error on conflicted file' '
 '
 
 test_expect_success 'git mv should overwrite symlink to a file' '
+	test_when_finished "rm -f moved symlink" &&
 	rm -fr .git &&
 	git init &&
 	echo 1 >moved &&
@@ -276,9 +275,8 @@ test_expect_success 'git mv should overwrite symlink to a file' '
 	git diff-files --quiet
 '
 
-rm -f moved symlink
-
 test_expect_success 'git mv should overwrite file with a symlink' '
+	test_when_finished "rm -f symlink" &&
 	rm -fr .git &&
 	git init &&
 	echo 1 >moved &&
@@ -292,11 +290,10 @@ test_expect_success 'git mv should overwrite file with a symlink' '
 '
 
 test_expect_success SYMLINKS 'check moved symlink' '
+	test_when_finished "rm -f moved" &&
 	test -h moved
 '
 
-rm -f moved symlink
-
 test_expect_success 'setup submodule' '
 	git commit -m initial &&
 	git reset --hard &&
-- 
2.25.1


^ permalink raw reply related	[relevance 15%]

* [PATCH v2 06/10] t7001: avoid using `cd` outside of subshells
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
                   ` (6 preceding siblings ...)
  2021-02-09 17:32 16% ` [PATCH v2 10/10] t7001: use `test` rather than `[` shubham verma
@ 2021-02-09 17:32 15% ` shubham verma
  2021-02-09 17:32 13% ` [PATCH v2 02/10] t7001: indent with TABs instead of spaces shubham verma
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2021-02-09 17:32 UTC (permalink / raw)
  To: git

Avoid using `cd` outside of subshells since, if the test fails,
there is no guarantee that the current working directory is the
expected one, which may cause subsequent tests to run in the wrong
directory.

While at it, make some other tests more concise by replacing
simple subshells with `git -C`.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 45 +++++++++++----------------------------------
 1 file changed, 11 insertions(+), 34 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 02fbc90dea..81897a3095 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -11,12 +11,11 @@ test_expect_success 'prepare reference tree' '
 '
 
 test_expect_success 'moving the file out of subdirectory' '
-	cd path0 && git mv COPYING ../path1/COPYING
+	git -C path0 mv COPYING ../path1/COPYING
 '
 
-# in path0 currently
 test_expect_success 'commiting the change' '
-	cd .. && git commit -m move-out -a
+	git commit -m move-out -a
 '
 
 test_expect_success 'checking the commit' '
@@ -25,12 +24,11 @@ test_expect_success 'checking the commit' '
 '
 
 test_expect_success 'moving the file back into subdirectory' '
-	cd path0 && git mv ../path1/COPYING COPYING
+	git -C path0 mv ../path1/COPYING COPYING
 '
 
-# in path0 currently
 test_expect_success 'commiting the change' '
-	cd .. && git commit -m move-in -a
+	git commit -m move-in -a
 '
 
 test_expect_success 'checking the commit' '
@@ -328,10 +326,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	git mv sub mod/sub &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
@@ -351,10 +346,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	git mv sub mod/sub &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
 	test_cmp expected actual &&
@@ -368,16 +360,10 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 	git submodule update &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	mkdir mod &&
-	(
-		cd mod &&
-		git mv ../sub/ .
-	) &&
+	git -C mod mv ../sub/ . &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
 	test_cmp expected actual &&
@@ -396,10 +382,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 	test_must_be_empty actual.err &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
@@ -420,10 +403,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 	test_must_be_empty actual.err &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
@@ -441,10 +421,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 	test_i18ncmp expect.err actual.err &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
-- 
2.25.1


^ permalink raw reply related	[relevance 15%]

* [PATCH v3 06/10] t7001: avoid using `cd` outside of subshells
  2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
                   ` (6 preceding siblings ...)
  2021-02-11 19:47 16% ` [PATCH v3 10/10] t7001: use `test` rather than `[` Shubham Verma
@ 2021-02-11 19:47 15% ` Shubham Verma
  2021-02-11 19:46 13% ` [PATCH v3 02/10] t7001: indent with TABs instead of spaces Shubham Verma
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 200+ results
From: Shubham Verma @ 2021-02-11 19:47 UTC (permalink / raw)
  To: git

Avoid using `cd` outside of subshells since, if the test fails,
there is no guarantee that the current working directory is the
expected one, which may cause subsequent tests to run in the wrong
directory.

While at it, make some other tests more concise by replacing
simple subshells with `git -C`.

Signed-off-by: Shubham Verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 43 +++++++++++--------------------------------
 1 file changed, 11 insertions(+), 32 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 2e49e9af81..6412c4f882 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -11,12 +11,12 @@ test_expect_success 'prepare reference tree' '
 '
 
 test_expect_success 'moving the file out of subdirectory' '
-	cd path0 && git mv COPYING ../path1/COPYING
+	git -C path0 mv COPYING ../path1/COPYING
 '
 
 # in path0 currently
 test_expect_success 'commiting the change' '
-	cd .. && git commit -m move-out -a
+	git commit -m move-out -a
 '
 
 test_expect_success 'checking the commit' '
@@ -25,12 +25,12 @@ test_expect_success 'checking the commit' '
 '
 
 test_expect_success 'moving the file back into subdirectory' '
-	cd path0 && git mv ../path1/COPYING COPYING
+	git -C path0 mv ../path1/COPYING COPYING
 '
 
 # in path0 currently
 test_expect_success 'commiting the change' '
-	cd .. && git commit -m move-in -a
+	git commit -m move-in -a
 '
 
 test_expect_success 'checking the commit' '
@@ -328,10 +328,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	git mv sub mod/sub &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
@@ -351,10 +348,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	git mv sub mod/sub &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
 	test_cmp expected actual &&
@@ -368,16 +362,10 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 	git submodule update &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	mkdir mod &&
-	(
-		cd mod &&
-		git mv ../sub/ .
-	) &&
+	git -C mod mv ../sub/ . &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
 	test_cmp expected actual &&
@@ -396,10 +384,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 	test_must_be_empty actual.err &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
@@ -420,10 +405,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 	test_must_be_empty actual.err &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
@@ -441,10 +423,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 	test_i18ncmp expect.err actual.err &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
-- 
2.25.1


^ permalink raw reply related	[relevance 15%]

* [PATCH 06/11] t7001: change (cd <path> && git foo) to (git -C <path> foo)
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
                   ` (7 preceding siblings ...)
  2020-09-25 17:02 15% ` [PATCH 11/11] t7001: move cleanup code from outside the tests into them shubham verma
@ 2020-09-25 17:02 15% ` shubham verma
  2020-09-25 18:53 11%   ` Eric Sunshine
  2020-09-25 17:02 13% ` [PATCH 01/11] t7001: convert tests from the old style to the current style shubham verma
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git; +Cc: Shubham Verma

From: Shubham Verma <shubhunic@gmail.com>

Let's avoid the use of `cd` outside subshells by encapsulating them
inside subshells or by using `git -C <dir> ...`.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 45 +++++++++++----------------------------------
 1 file changed, 11 insertions(+), 34 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 7581e4b407..3a3ace6d73 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -11,12 +11,11 @@ test_expect_success 'prepare reference tree' '
 '
 
 test_expect_success 'moving the file out of subdirectory' '
-	cd path0 && git mv COPYING ../path1/COPYING
+	git -C path0 mv COPYING ../path1/COPYING
 '
 
-# in path0 currently
 test_expect_success 'commiting the change' '
-	cd .. && git commit -m move-out -a
+	git commit -m move-out -a
 '
 
 test_expect_success 'checking the commit' '
@@ -25,12 +24,11 @@ test_expect_success 'checking the commit' '
 '
 
 test_expect_success 'moving the file back into subdirectory' '
-	cd path0 && git mv ../path1/COPYING COPYING
+	git -C path0 mv ../path1/COPYING COPYING
 '
 
-# in path0 currently
 test_expect_success 'commiting the change' '
-	cd .. && git commit -m move-in -a
+	git commit -m move-in -a
 '
 
 test_expect_success 'checking the commit' '
@@ -324,10 +322,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	git mv sub mod/sub &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
@@ -347,10 +342,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	git mv sub mod/sub &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
 	test_cmp expected actual &&
@@ -364,16 +356,10 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 	git submodule update &&
 	entry="$(git ls-files --stage sub | cut -f 1)" &&
 	mkdir mod &&
-	(
-		cd mod &&
-		git mv ../sub/ .
-	) &&
+	git -C mod mv ../sub/ . &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
 	test_cmp expected actual &&
@@ -392,10 +378,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 	test_must_be_empty actual.err &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
@@ -416,10 +399,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 	test_must_be_empty actual.err &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
@@ -437,10 +417,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 	test_i18ncmp expect.err actual.err &&
 	! test -e sub &&
 	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
-	(
-		cd mod/sub &&
-		git status
-	) &&
+	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
 '
-- 
2.25.1


^ permalink raw reply related	[relevance 15%]

* Re: [PATCH] t/t7001-mv.sh: Propose ability to use git-mv on conflicting entries
  2008-07-27 13:47 18% ` [PATCH] t/t7001-mv.sh: Propose ability to use git-mv on conflicting entries Petr Baudis
@ 2008-07-28  1:13 16%   ` Junio C Hamano
  2008-07-28  1:21  6%     ` Junio C Hamano
  0 siblings, 1 reply; 200+ results
From: Junio C Hamano @ 2008-07-28  1:13 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git, gitster

Petr Baudis <pasky@suse.cz> writes:

> I don't really know if it is ok to make "feature requests" like this by
> adding failing testcases...

Of course it depends on who you are.  It's not Ok for somebody like you,
who is known to be competent, and certainly it is not Ok to do it on a
command that you know you care more about than I do.

I've neglected builtin-mv.c since its introduction, mostly because I never
say "git mv" myself (in other words, I haven't cared very much how broken
it was.  For one thing, its indentation style is peculiar and is hard to
read and maintain).

> +# Rationale: I cannot git mv around a conflicted file. This is unnecessary
> +# restriction in case another part of conflict resolution requires me to
> +# move the file around.

Yes, I would agree this is a reasonable thing to support.  Something like
this patch, perhaps.

---
 builtin-mv.c  |   21 ++++++++++++++-------
 t/t7001-mv.sh |   21 +++++++++++++++++++++
 2 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/builtin-mv.c b/builtin-mv.c
index 4f65b5a..cc9e505 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -96,7 +96,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	/* Checking */
 	for (i = 0; i < argc; i++) {
 		const char *src = source[i], *dst = destination[i];
-		int length, src_is_dir;
+		int length, src_is_dir, pos;
 		const char *bad = NULL;
 
 		if (show_only)
@@ -177,7 +177,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				} else
 					bad = "Cannot overwrite";
 			}
-		} else if (cache_name_pos(src, length) < 0)
+		} else if (((pos = cache_name_pos(src, length)) < 0) &&
+			   strcmp(active_cache[-1 - pos]->name, src))
 			bad = "not under version control";
 		else if (string_list_has_string(&src_for_dst, dst))
 			bad = "multiple sources for the same target";
@@ -202,7 +203,6 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	for (i = 0; i < argc; i++) {
 		const char *src = source[i], *dst = destination[i];
 		enum update_mode mode = modes[i];
-		int pos;
 		if (show_only || verbose)
 			printf("Renaming %s to %s\n", src, dst);
 		if (!show_only && mode != INDEX &&
@@ -212,10 +212,17 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		if (mode == WORKING_DIRECTORY)
 			continue;
 
-		pos = cache_name_pos(src, strlen(src));
-		assert(pos >= 0);
-		if (!show_only)
-			rename_cache_entry_at(pos, dst);
+		if (!show_only) {
+			while (1) {
+				int pos = cache_name_pos(src, strlen(src));
+				if (pos < 0)
+					pos = -1 - pos;
+				if ((active_nr <= pos) ||
+				    strcmp(active_cache[pos]->name, src))
+					break;
+				rename_cache_entry_at(pos, dst);
+			}
+		}
 	}
 
 	if (active_cache_changed) {
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b0fa407..d538f88 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -173,6 +173,27 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 
 rm -f dirty dirty2
 
+cat >expect <<\EOT
+100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 1	staged
+100755 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 2	staged
+100755 d00491fd7e5bb6fa28c517a0bb32b8b506539d4d 3	staged
+EOT
+
+test_expect_success 'git mv should move all stages of cache entry' '
+	rm -fr .git &&
+	git init &&
+	>staged &&
+	git update-index --index-info <expect &&
+	git ls-files --stage >actual &&
+	test_cmp expect actual &&
+	git mv staged staged-mv &&
+	sed "s/staged/staged-mv/" <expect >expect-2 &&
+	git ls-files --stage >actual &&
+	test_cmp expect-2 actual
+'
+
+rm -f expect expect-2 staged actual staged-mv
+
 test_expect_success 'git mv should overwrite symlink to a file' '
 
 	rm -fr .git &&

^ permalink raw reply related	[relevance 16%]

* [PATCH 10/11] t7001: use `test` rather than `[`
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
                   ` (5 preceding siblings ...)
  2020-09-25 17:02 17% ` [PATCH 03/11] t7001: remove unnecessary blank lines shubham verma
@ 2020-09-25 17:02 16% ` shubham verma
  2020-09-25 17:02 15% ` [PATCH 11/11] t7001: move cleanup code from outside the tests into them shubham verma
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git; +Cc: Shubham Verma

From: Shubham Verma <shubhunic@gmail.com>

According to Documentation/CodingGuidelines, we should use "test"
rather than "[ ... ]" in shell scripts, so let's replace the
"[ ... ]" with "test" in the t7001 test script.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 30714a8200..7bb4a7b759 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -236,10 +236,10 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 	git add dirty &&
 	entry="$(git ls-files --stage dirty | cut -f 1)" &&
 	git mv dirty dirty2 &&
-	[ "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" &&
 	echo 2 >dirty2 &&
 	git mv dirty2 dirty &&
-	[ "$entry" = "$(git ls-files --stage dirty | cut -f 1)" ]
+	test "$entry" = "$(git ls-files --stage dirty | cut -f 1)"
 '
 
 rm -f dirty dirty2
@@ -326,7 +326,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	mkdir mod &&
 	git mv sub mod/sub &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -346,7 +346,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	mkdir mod &&
 	git mv sub mod/sub &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
@@ -363,7 +363,7 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 	mkdir mod &&
 	git -C mod mv ../sub/ . &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
@@ -382,7 +382,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -403,7 +403,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -421,7 +421,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 	git mv sub mod/sub 2>actual.err &&
 	test_i18ncmp expect.err actual.err &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
-- 
2.25.1


^ permalink raw reply related	[relevance 16%]

* [PATCH v2 10/10] t7001: use `test` rather than `[`
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
                   ` (5 preceding siblings ...)
  2021-02-09 17:32 17% ` [PATCH v2 03/10] t7001: remove unnecessary blank lines shubham verma
@ 2021-02-09 17:32 16% ` shubham verma
  2021-02-09 17:32 15% ` [PATCH v2 06/10] t7001: avoid using `cd` outside of subshells shubham verma
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2021-02-09 17:32 UTC (permalink / raw)
  To: git

According to Documentation/CodingGuidelines, we should use "test"
rather than "[ ... ]" in shell scripts, so let's replace the
"[ ... ]" with "test" in the t7001 test script.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 2e2e60e0d3..002e188549 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -240,10 +240,10 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 	git add dirty &&
 	entry="$(git ls-files --stage dirty | cut -f 1)" &&
 	git mv dirty dirty2 &&
-	[ "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" &&
 	echo 2 >dirty2 &&
 	git mv dirty2 dirty &&
-	[ "$entry" = "$(git ls-files --stage dirty | cut -f 1)" ]
+	test "$entry" = "$(git ls-files --stage dirty | cut -f 1)"
 '
 
 rm -f dirty dirty2
@@ -330,7 +330,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	mkdir mod &&
 	git mv sub mod/sub &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -350,7 +350,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	mkdir mod &&
 	git mv sub mod/sub &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
@@ -367,7 +367,7 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 	mkdir mod &&
 	git -C mod mv ../sub/ . &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
@@ -386,7 +386,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -407,7 +407,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -425,7 +425,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 	git mv sub mod/sub 2>actual.err &&
 	test_i18ncmp expect.err actual.err &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
-- 
2.25.1


^ permalink raw reply related	[relevance 16%]

* [PATCH v3 10/10] t7001: use `test` rather than `[`
  2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
                   ` (5 preceding siblings ...)
  2021-02-11 19:46 17% ` [PATCH v3 04/10] t7001: modernize subshell formatting Shubham Verma
@ 2021-02-11 19:47 16% ` Shubham Verma
  2021-02-11 19:47 15% ` [PATCH v3 06/10] t7001: avoid using `cd` outside of subshells Shubham Verma
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 200+ results
From: Shubham Verma @ 2021-02-11 19:47 UTC (permalink / raw)
  To: git

According to Documentation/CodingGuidelines, we should use "test"
rather than "[ ... ]" in shell scripts, so let's replace the
"[ ... ]" with "test" in the t7001 test script.

Signed-off-by: Shubham Verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 36a274e96d..65807e4873 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -242,10 +242,10 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 	git add dirty &&
 	entry="$(git ls-files --stage dirty | cut -f 1)" &&
 	git mv dirty dirty2 &&
-	[ "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" &&
 	echo 2 >dirty2 &&
 	git mv dirty2 dirty &&
-	[ "$entry" = "$(git ls-files --stage dirty | cut -f 1)" ]
+	test "$entry" = "$(git ls-files --stage dirty | cut -f 1)"
 '
 
 rm -f dirty dirty2
@@ -332,7 +332,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	mkdir mod &&
 	git mv sub mod/sub &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -352,7 +352,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	mkdir mod &&
 	git mv sub mod/sub &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
@@ -369,7 +369,7 @@ test_expect_success 'git mv moves a submodule with gitfile' '
 	mkdir mod &&
 	git -C mod mv ../sub/ . &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	echo mod/sub >expected &&
 	git config -f .gitmodules submodule.sub.path >actual &&
@@ -388,7 +388,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -409,7 +409,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
 	git mv sub mod/sub 2>actual.err &&
 	test_must_be_empty actual.err &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
@@ -427,7 +427,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
 	git mv sub mod/sub 2>actual.err &&
 	test_i18ncmp expect.err actual.err &&
 	! test -e sub &&
-	[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
+	test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
 	git -C mod/sub status &&
 	git update-index --refresh &&
 	git diff-files --quiet
-- 
2.25.1


^ permalink raw reply related	[relevance 16%]

* [PATCH 03/11] t7001: remove unnecessary blank lines
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
                   ` (4 preceding siblings ...)
  2020-09-25 17:02 18% ` [PATCH 07/11] t7001: use ': >' rather than 'touch' shubham verma
@ 2020-09-25 17:02 17% ` shubham verma
    2020-09-25 17:02 16% ` [PATCH 10/11] t7001: use `test` rather than `[` shubham verma
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git; +Cc: Shubham Verma

From: Shubham Verma <shubhunic@gmail.com>

Some tests use a deprecated style in which there are unnecessary
blank lines after the opening quote of the test body and before the
closing quote. So we should removed these unnecessary blank lines.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 7503233814..f63802442b 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -182,7 +182,6 @@ test_expect_success "Sergey Vlasov's test case" '
 '
 
 test_expect_success 'absolute pathname' '(
-
 	rm -fr mine &&
 	mkdir mine &&
 	cd mine &&
@@ -196,12 +195,9 @@ test_expect_success 'absolute pathname' '(
 	! test -d sub &&
 	test -d in &&
 	git ls-files --error-unmatch in/file
-
-
 )'
 
 test_expect_success 'absolute pathname outside should fail' '(
-
 	rm -fr mine &&
 	mkdir mine &&
 	cd mine &&
@@ -216,7 +212,6 @@ test_expect_success 'absolute pathname outside should fail' '(
 	test -d sub &&
 	! test -d ../in &&
 	git ls-files --error-unmatch sub/file
-
 )'
 
 test_expect_success 'git mv to move multiple sources into a directory' '
@@ -232,7 +227,6 @@ test_expect_success 'git mv to move multiple sources into a directory' '
 '
 
 test_expect_success 'git mv should not change sha1 of moved cache entry' '
-
 	rm -fr .git &&
 	git init &&
 	echo 1 >dirty &&
@@ -243,7 +237,6 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 	echo 2 >dirty2 &&
 	git mv dirty2 dirty &&
 	[ "$entry" = "$(git ls-files --stage dirty | cut -f 1)" ]
-
 '
 
 rm -f dirty dirty2
@@ -266,7 +259,6 @@ test_expect_success 'git mv error on conflicted file' '
 '
 
 test_expect_success 'git mv should overwrite symlink to a file' '
-
 	rm -fr .git &&
 	git init &&
 	echo 1 >moved &&
@@ -279,13 +271,11 @@ test_expect_success 'git mv should overwrite symlink to a file' '
 	test "$(cat symlink)" = 1 &&
 	git update-index --refresh &&
 	git diff-files --quiet
-
 '
 
 rm -f moved symlink
 
 test_expect_success 'git mv should overwrite file with a symlink' '
-
 	rm -fr .git &&
 	git init &&
 	echo 1 >moved &&
@@ -296,11 +286,9 @@ test_expect_success 'git mv should overwrite file with a symlink' '
 	! test -e symlink &&
 	git update-index --refresh &&
 	git diff-files --quiet
-
 '
 
 test_expect_success SYMLINKS 'check moved symlink' '
-
 	test -h moved
 '
 
-- 
2.25.1


^ permalink raw reply related	[relevance 17%]

* [PATCH v2 04/10] t7001: modernize subshell formatting
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
                   ` (3 preceding siblings ...)
  2021-02-09 17:32 19% ` [PATCH v2 08/10] t7001: put each command on a separate line shubham verma
@ 2021-02-09 17:32 17% ` shubham verma
  2021-02-09 17:32 17% ` [PATCH v2 03/10] t7001: remove unnecessary blank lines shubham verma
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2021-02-09 17:32 UTC (permalink / raw)
  To: git

Some test use an old style for formatting subshells:

        (command &&
            ...

Update them to the modern style:

        (
            command &&
            ...

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 74 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 40 insertions(+), 34 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index f63802442b..a4a14a3b2e 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -181,38 +181,42 @@ test_expect_success "Sergey Vlasov's test case" '
 	git mv ab a
 '
 
-test_expect_success 'absolute pathname' '(
-	rm -fr mine &&
-	mkdir mine &&
-	cd mine &&
-	test_create_repo one &&
-	cd one &&
-	mkdir sub &&
-	>sub/file &&
-	git add sub/file &&
-
-	git mv sub "$(pwd)/in" &&
-	! test -d sub &&
-	test -d in &&
-	git ls-files --error-unmatch in/file
-)'
-
-test_expect_success 'absolute pathname outside should fail' '(
-	rm -fr mine &&
-	mkdir mine &&
-	cd mine &&
-	out=$(pwd) &&
-	test_create_repo one &&
-	cd one &&
-	mkdir sub &&
-	>sub/file &&
-	git add sub/file &&
-
-	test_must_fail git mv sub "$out/out" &&
-	test -d sub &&
-	! test -d ../in &&
-	git ls-files --error-unmatch sub/file
-)'
+test_expect_success 'absolute pathname' '
+	(
+		rm -fr mine &&
+		mkdir mine &&
+		cd mine &&
+		test_create_repo one &&
+		cd one &&
+		mkdir sub &&
+		>sub/file &&
+		git add sub/file &&
+
+		git mv sub "$(pwd)/in" &&
+		! test -d sub &&
+		test -d in &&
+		git ls-files --error-unmatch in/file
+	)
+'
+
+test_expect_success 'absolute pathname outside should fail' '
+	(
+		rm -fr mine &&
+		mkdir mine &&
+		cd mine &&
+		out=$(pwd) &&
+		test_create_repo one &&
+		cd one &&
+		mkdir sub &&
+		>sub/file &&
+		git add sub/file &&
+
+		test_must_fail git mv sub "$out/out" &&
+		test -d sub &&
+		! test -d ../in &&
+		git ls-files --error-unmatch sub/file
+	)
+'
 
 test_expect_success 'git mv to move multiple sources into a directory' '
 	rm -fr .git && git init &&
@@ -503,14 +507,16 @@ test_expect_success 'moving a submodule in nested directories' '
 test_expect_success 'moving nested submodules' '
 	git commit -am "cleanup commit" &&
 	mkdir sub_nested_nested &&
-	(cd sub_nested_nested &&
+	(
+		cd sub_nested_nested &&
 		touch nested_level2 &&
 		git init &&
 		git add . &&
 		git commit -m "nested level 2"
 	) &&
 	mkdir sub_nested &&
-	(cd sub_nested &&
+	(
+		cd sub_nested &&
 		touch nested_level1 &&
 		git init &&
 		git add . &&
-- 
2.25.1


^ permalink raw reply related	[relevance 17%]

* [PATCH v3 04/10] t7001: modernize subshell formatting
  2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
                   ` (4 preceding siblings ...)
  2021-02-11 19:46 17% ` [PATCH v3 03/10] t7001: remove unnecessary blank lines Shubham Verma
@ 2021-02-11 19:46 17% ` Shubham Verma
  2021-02-11 19:47 16% ` [PATCH v3 10/10] t7001: use `test` rather than `[` Shubham Verma
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 200+ results
From: Shubham Verma @ 2021-02-11 19:46 UTC (permalink / raw)
  To: git

Some test use an old style for formatting subshells:

        (command &&
            ...

Update them to the modern style:

        (
            command &&
            ...

Signed-off-by: Shubham Verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 74 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 40 insertions(+), 34 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e98b44f7a1..7fd4341988 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -181,38 +181,42 @@ test_expect_success "Sergey Vlasov's test case" '
 	git mv ab a
 '
 
-test_expect_success 'absolute pathname' '(
-	rm -fr mine &&
-	mkdir mine &&
-	cd mine &&
-	test_create_repo one &&
-	cd one &&
-	mkdir sub &&
-	>sub/file &&
-	git add sub/file &&
-
-	git mv sub "$(pwd)/in" &&
-	! test -d sub &&
-	test -d in &&
-	git ls-files --error-unmatch in/file
-)'
-
-test_expect_success 'absolute pathname outside should fail' '(
-	rm -fr mine &&
-	mkdir mine &&
-	cd mine &&
-	out=$(pwd) &&
-	test_create_repo one &&
-	cd one &&
-	mkdir sub &&
-	>sub/file &&
-	git add sub/file &&
-
-	test_must_fail git mv sub "$out/out" &&
-	test -d sub &&
-	! test -d ../in &&
-	git ls-files --error-unmatch sub/file
-)'
+test_expect_success 'absolute pathname' '
+	(
+		rm -fr mine &&
+		mkdir mine &&
+		cd mine &&
+		test_create_repo one &&
+		cd one &&
+		mkdir sub &&
+		>sub/file &&
+		git add sub/file &&
+
+		git mv sub "$(pwd)/in" &&
+		! test -d sub &&
+		test -d in &&
+		git ls-files --error-unmatch in/file
+	)
+'
+
+test_expect_success 'absolute pathname outside should fail' '
+	(
+		rm -fr mine &&
+		mkdir mine &&
+		cd mine &&
+		out=$(pwd) &&
+		test_create_repo one &&
+		cd one &&
+		mkdir sub &&
+		>sub/file &&
+		git add sub/file &&
+
+		test_must_fail git mv sub "$out/out" &&
+		test -d sub &&
+		! test -d ../in &&
+		git ls-files --error-unmatch sub/file
+	)
+'
 
 test_expect_success 'git mv to move multiple sources into a directory' '
 	rm -fr .git && git init &&
@@ -503,14 +507,16 @@ test_expect_success 'moving a submodule in nested directories' '
 test_expect_success 'moving nested submodules' '
 	git commit -am "cleanup commit" &&
 	mkdir sub_nested_nested &&
-	(cd sub_nested_nested &&
+	(
+		cd sub_nested_nested &&
 		touch nested_level2 &&
 		git init &&
 		git add . &&
 		git commit -m "nested level 2"
 	) &&
 	mkdir sub_nested &&
-	(cd sub_nested &&
+	(
+		cd sub_nested &&
 		touch nested_level1 &&
 		git init &&
 		git add . &&
-- 
2.25.1


^ permalink raw reply related	[relevance 17%]

* [PATCH v2 03/10] t7001: remove unnecessary blank lines
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
                   ` (4 preceding siblings ...)
  2021-02-09 17:32 17% ` [PATCH v2 04/10] t7001: modernize subshell formatting shubham verma
@ 2021-02-09 17:32 17% ` shubham verma
  2021-02-09 17:32 16% ` [PATCH v2 10/10] t7001: use `test` rather than `[` shubham verma
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2021-02-09 17:32 UTC (permalink / raw)
  To: git

Some tests use a deprecated style in which there are unnecessary
blank lines after the opening quote of the test body and before the
closing quote. So we should remove these unnecessary blank lines.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 7503233814..f63802442b 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -182,7 +182,6 @@ test_expect_success "Sergey Vlasov's test case" '
 '
 
 test_expect_success 'absolute pathname' '(
-
 	rm -fr mine &&
 	mkdir mine &&
 	cd mine &&
@@ -196,12 +195,9 @@ test_expect_success 'absolute pathname' '(
 	! test -d sub &&
 	test -d in &&
 	git ls-files --error-unmatch in/file
-
-
 )'
 
 test_expect_success 'absolute pathname outside should fail' '(
-
 	rm -fr mine &&
 	mkdir mine &&
 	cd mine &&
@@ -216,7 +212,6 @@ test_expect_success 'absolute pathname outside should fail' '(
 	test -d sub &&
 	! test -d ../in &&
 	git ls-files --error-unmatch sub/file
-
 )'
 
 test_expect_success 'git mv to move multiple sources into a directory' '
@@ -232,7 +227,6 @@ test_expect_success 'git mv to move multiple sources into a directory' '
 '
 
 test_expect_success 'git mv should not change sha1 of moved cache entry' '
-
 	rm -fr .git &&
 	git init &&
 	echo 1 >dirty &&
@@ -243,7 +237,6 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 	echo 2 >dirty2 &&
 	git mv dirty2 dirty &&
 	[ "$entry" = "$(git ls-files --stage dirty | cut -f 1)" ]
-
 '
 
 rm -f dirty dirty2
@@ -266,7 +259,6 @@ test_expect_success 'git mv error on conflicted file' '
 '
 
 test_expect_success 'git mv should overwrite symlink to a file' '
-
 	rm -fr .git &&
 	git init &&
 	echo 1 >moved &&
@@ -279,13 +271,11 @@ test_expect_success 'git mv should overwrite symlink to a file' '
 	test "$(cat symlink)" = 1 &&
 	git update-index --refresh &&
 	git diff-files --quiet
-
 '
 
 rm -f moved symlink
 
 test_expect_success 'git mv should overwrite file with a symlink' '
-
 	rm -fr .git &&
 	git init &&
 	echo 1 >moved &&
@@ -296,11 +286,9 @@ test_expect_success 'git mv should overwrite file with a symlink' '
 	! test -e symlink &&
 	git update-index --refresh &&
 	git diff-files --quiet
-
 '
 
 test_expect_success SYMLINKS 'check moved symlink' '
-
 	test -h moved
 '
 
-- 
2.25.1


^ permalink raw reply related	[relevance 17%]

* [PATCH v3 03/10] t7001: remove unnecessary blank lines
  2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
                   ` (3 preceding siblings ...)
  2021-02-11 19:47 19% ` [PATCH v3 08/10] t7001: put each command on a separate line Shubham Verma
@ 2021-02-11 19:46 17% ` Shubham Verma
  2021-02-11 19:46 17% ` [PATCH v3 04/10] t7001: modernize subshell formatting Shubham Verma
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 200+ results
From: Shubham Verma @ 2021-02-11 19:46 UTC (permalink / raw)
  To: git

Some tests use a deprecated style in which there are unnecessary
blank lines after the opening quote of the test body and before the
closing quote. So we should remove these unnecessary blank lines.

Signed-off-by: Shubham Verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 0f74c6339c..e98b44f7a1 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -182,7 +182,6 @@ test_expect_success "Sergey Vlasov's test case" '
 '
 
 test_expect_success 'absolute pathname' '(
-
 	rm -fr mine &&
 	mkdir mine &&
 	cd mine &&
@@ -196,12 +195,9 @@ test_expect_success 'absolute pathname' '(
 	! test -d sub &&
 	test -d in &&
 	git ls-files --error-unmatch in/file
-
-
 )'
 
 test_expect_success 'absolute pathname outside should fail' '(
-
 	rm -fr mine &&
 	mkdir mine &&
 	cd mine &&
@@ -216,7 +212,6 @@ test_expect_success 'absolute pathname outside should fail' '(
 	test -d sub &&
 	! test -d ../in &&
 	git ls-files --error-unmatch sub/file
-
 )'
 
 test_expect_success 'git mv to move multiple sources into a directory' '
@@ -232,7 +227,6 @@ test_expect_success 'git mv to move multiple sources into a directory' '
 '
 
 test_expect_success 'git mv should not change sha1 of moved cache entry' '
-
 	rm -fr .git &&
 	git init &&
 	echo 1 >dirty &&
@@ -243,7 +237,6 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 	echo 2 >dirty2 &&
 	git mv dirty2 dirty &&
 	[ "$entry" = "$(git ls-files --stage dirty | cut -f 1)" ]
-
 '
 
 rm -f dirty dirty2
@@ -266,7 +259,6 @@ test_expect_success 'git mv error on conflicted file' '
 '
 
 test_expect_success 'git mv should overwrite symlink to a file' '
-
 	rm -fr .git &&
 	git init &&
 	echo 1 >moved &&
@@ -279,13 +271,11 @@ test_expect_success 'git mv should overwrite symlink to a file' '
 	test "$(cat symlink)" = 1 &&
 	git update-index --refresh &&
 	git diff-files --quiet
-
 '
 
 rm -f moved symlink
 
 test_expect_success 'git mv should overwrite file with a symlink' '
-
 	rm -fr .git &&
 	git init &&
 	echo 1 >moved &&
@@ -296,11 +286,9 @@ test_expect_success 'git mv should overwrite file with a symlink' '
 	! test -e symlink &&
 	git update-index --refresh &&
 	git diff-files --quiet
-
 '
 
 test_expect_success SYMLINKS 'check moved symlink' '
-
 	test -h moved
 '
 
-- 
2.25.1


^ permalink raw reply related	[relevance 17%]

* [PATCH] t/t7001-mv.sh: Propose ability to use git-mv on conflicting entries
  @ 2008-07-27 13:47 18% ` Petr Baudis
  2008-07-28  1:13 16%   ` Junio C Hamano
  0 siblings, 1 reply; 200+ results
From: Petr Baudis @ 2008-07-27 13:47 UTC (permalink / raw)
  To: git; +Cc: gitster

Currently, git-mv will declare "not under source control" on an attempt
to move a conflicted index entry. This patch adds an expect_failure
testcase for this case, since this is an artificial restriction. (However,
the scenario is not critical enough for the author to fix right now.)

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

I don't really know if it is ok to make "feature requests" like this by
adding failing testcases...

 t/t7001-mv.sh |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 7e47931..241e9a2 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -173,6 +173,33 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
 
 rm -f dirty dirty2
 
+cat >multistage <<EOT
+100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 1	staged
+100755 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 2	staged
+100755 d00491fd7e5bb6fa28c517a0bb32b8b506539d4d 3	staged
+EOT
+
+# Rationale: I cannot git mv around a conflicted file. This is unnecessary
+# restriction in case another part of conflict resolution requires me to
+# move the file around.
+test_expect_failure 'git mv should move all stages of cache entry' '
+
+	rm -fr .git &&
+	git init &&
+	# git mv requires object to exist in working tree (bug?)
+	touch staged &&
+	git update-index --index-info <multistage &&
+	git ls-files --stage >lsf_output &&
+	test_cmp multistage lsf_output &&
+	git mv staged staged-mv &&
+	sed "s/staged/staged-mv/" <multistage >multistage-mv &&
+	git ls-files --stage >lsf_output &&
+	test_cmp multistage-mv lsf_output
+
+'
+
+rm -f multistage multistage-mv lsf_output staged
+
 test_expect_failure 'git mv should overwrite symlink to a file' '
 
 	rm -fr .git &&

^ permalink raw reply related	[relevance 18%]

* Re: [PATCH] test: fix t7001 cp to use POSIX options
  2014-04-11 11:43  6% ` Jeff King
@ 2014-04-11 13:44 18%   ` Kyle J. McKay
  0 siblings, 0 replies; 200+ results
From: Kyle J. McKay @ 2014-04-11 13:44 UTC (permalink / raw)
  To: Jeff King; +Cc: git, Junio C Hamano, Jens Lehmann

On Apr 11, 2014, at 04:43, Jeff King wrote:
> On Fri, Apr 11, 2014 at 01:24:02AM -0700, Kyle J. McKay wrote:
>
>> Since 11502468 and 04c1ee57 (both first appearing in v1.8.5), the
>> t7001-mv test has used "cp -a" to perform a copy in several of the
>> tests.
>>
>> However, the "-a" option is not required for a POSIX cp utility and
>> some platforms' cp utilities do not support it.
>>
>> The POSIX equivalent of -a is -R -P -p.
>>
>> Change "cp -a" to "cp -R -P -p" so that the t7001-mv test works
>> on systems with a cp utility that only implements the POSIX
>> required set of options and not the "-a" option.
>
> I wonder if the "-R" is the part that we actually care about here.
> Including the others does not hurt in that case, but using only "-R"
> would perhaps make it more obvious to a later reader of the code  
> exactly
> what we are trying to do.

I was wondering the same thing myself, but Jens is on the Cc: list and  
added both of those, so I'm hoping he'll pipe in here about that.  I  
did notice that the other test scripts seem to only use -R, so that  
would definitely be a more consistent change to match the rest of the  
tests.

In any case v2 of the patch with just -R is attached below.  It seems
to pass the tests so it's probably fine.

--Kyle

---- 8< ----

Subject: [PATCH v2] test: fix t7001 cp to use POSIX options

Since 11502468 and 04c1ee57 (both first appearing in v1.8.5), the
t7001-mv test has used "cp -a" to perform a copy in several of the
tests.

However, the "-a" option is not required for a POSIX cp utility and
some platforms' cp utilities do not support it.

The POSIX equivalent of -a is -R -P -p, but the only option we
actually care about for the test is -R.

Change "cp -a" to "cp -R" so that the t7001-mv test works
on systems with a cp utility that only implements the POSIX
required set of options and not the "-a" option.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>

---
 t/t7001-mv.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 215d43d6..675ca5bd 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -308,7 +308,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	(
 		cd sub &&
 		rm -f .git &&
-		cp -a ../.git/modules/sub .git &&
+		cp -R ../.git/modules/sub .git &&
 		GIT_WORK_TREE=. git config --unset core.worktree
 	) &&
 	mkdir mod &&
@@ -331,7 +331,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	(
 		cd sub &&
 		rm -f .git &&
-		cp -a ../.git/modules/sub .git &&
+		cp -R ../.git/modules/sub .git &&
 		GIT_WORK_TREE=. git config --unset core.worktree
 	) &&
 	mkdir mod &&
-- 
tg: (0bc85abb..) t/t7001-posix-cp (depends on: maint)

^ permalink raw reply related	[relevance 18%]

* [PATCH 07/11] t7001: use ': >' rather than 'touch'
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
                   ` (3 preceding siblings ...)
  2020-09-25 17:02 19% ` [PATCH 04/11] t7001: change the style for cd according to subshell shubham verma
@ 2020-09-25 17:02 18% ` shubham verma
  2020-09-25 18:57  6%   ` Eric Sunshine
  2020-09-25 17:02 17% ` [PATCH 03/11] t7001: remove unnecessary blank lines shubham verma
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git; +Cc: Shubham Verma

From: Shubham Verma <shubhunic@gmail.com>

Use `>` rather than `touch` to create an empty file when the
timestamp isn't relevant to the test.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 3a3ace6d73..728a937eeb 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -47,14 +47,14 @@ test_expect_success 'checking -k on non-existing file' '
 '
 
 test_expect_success 'checking -k on untracked file' '
-	touch untracked1 &&
+	: > untracked1 &&
 	git mv -k untracked1 path0 &&
 	test -f untracked1 &&
 	test ! -f path0/untracked1
 '
 
 test_expect_success 'checking -k on multiple untracked files' '
-	touch untracked2 &&
+	: > untracked2 &&
 	git mv -k untracked1 untracked2 path0 &&
 	test -f untracked1 &&
 	test -f untracked2 &&
@@ -63,7 +63,7 @@ test_expect_success 'checking -k on multiple untracked files' '
 '
 
 test_expect_success 'checking -f on untracked file with existing target' '
-	touch path0/untracked1 &&
+	: > path0/untracked1 &&
 	test_must_fail git mv -f untracked1 path0 &&
 	test ! -f .git/index.lock &&
 	test -f untracked1 &&
@@ -482,7 +482,7 @@ test_expect_success 'moving nested submodules' '
 	mkdir sub_nested_nested &&
 	(
 		cd sub_nested_nested &&
-		touch nested_level2 &&
+		: > nested_level2 &&
 		git init &&
 		git add . &&
 		git commit -m "nested level 2"
@@ -490,7 +490,7 @@ test_expect_success 'moving nested submodules' '
 	mkdir sub_nested &&
 	(
 		cd sub_nested &&
-		touch nested_level1 &&
+		: > nested_level1 &&
 		git init &&
 		git add . &&
 		git commit -m "nested level 1" &&
-- 
2.25.1


^ permalink raw reply related	[relevance 18%]

* [PATCH 07/10] t/t7001-mv.sh: use the $( ... ) construct for command substitution
  2016-01-07 13:51  6% [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
@ 2016-01-07 13:51 18% ` Elia Pinto
  0 siblings, 0 replies; 200+ results
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
	perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg'  "${_f}"
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 t/t7001-mv.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 7b56081..51dd2b4 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -156,11 +156,11 @@ test_expect_success "Michael Cassar's test case" '
 	echo b > partA/outline.txt &&
 	echo c > papers/unsorted/_another &&
 	git add papers partA &&
-	T1=`git write-tree` &&
+	T1=$(git write-tree) &&
 
 	git mv papers/unsorted/Thesis.pdf papers/all-papers/moo-blah.pdf &&
 
-	T=`git write-tree` &&
+	T=$(git write-tree) &&
 	git ls-tree -r $T | verbose grep partA/outline.txt
 '
 
-- 
2.3.3.GIT

^ permalink raw reply related	[relevance 18%]

* [PATCH v2 07/10] t7001: use '>' rather than 'touch'
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
  2021-02-09 17:32 19% ` [PATCH v2 09/10] t7001: use here-docs instead of echo shubham verma
  2021-02-09 17:32 19% ` [PATCH v2 05/10] t7001: remove whitespace after redirect operators shubham verma
@ 2021-02-09 17:32 19% ` shubham verma
  2021-02-09 17:32 19% ` [PATCH v2 08/10] t7001: put each command on a separate line shubham verma
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2021-02-09 17:32 UTC (permalink / raw)
  To: git

Use `>` rather than `touch` to create an empty file when the
timestamp isn't relevant to the test.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 81897a3095..1671241fc8 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -47,14 +47,14 @@ test_expect_success 'checking -k on non-existing file' '
 '
 
 test_expect_success 'checking -k on untracked file' '
-	touch untracked1 &&
+	>untracked1 &&
 	git mv -k untracked1 path0 &&
 	test -f untracked1 &&
 	test ! -f path0/untracked1
 '
 
 test_expect_success 'checking -k on multiple untracked files' '
-	touch untracked2 &&
+	>untracked2 &&
 	git mv -k untracked1 untracked2 path0 &&
 	test -f untracked1 &&
 	test -f untracked2 &&
@@ -63,7 +63,7 @@ test_expect_success 'checking -k on multiple untracked files' '
 '
 
 test_expect_success 'checking -f on untracked file with existing target' '
-	touch path0/untracked1 &&
+	>path0/untracked1 &&
 	test_must_fail git mv -f untracked1 path0 &&
 	test ! -f .git/index.lock &&
 	test -f untracked1 &&
@@ -486,7 +486,7 @@ test_expect_success 'moving nested submodules' '
 	mkdir sub_nested_nested &&
 	(
 		cd sub_nested_nested &&
-		touch nested_level2 &&
+		>nested_level2 &&
 		git init &&
 		git add . &&
 		git commit -m "nested level 2"
@@ -494,7 +494,7 @@ test_expect_success 'moving nested submodules' '
 	mkdir sub_nested &&
 	(
 		cd sub_nested &&
-		touch nested_level1 &&
+		>nested_level1 &&
 		git init &&
 		git add . &&
 		git commit -m "nested level 1" &&
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH v3 07/10] t7001: use '>' rather than 'touch'
  2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
@ 2021-02-11 19:47 19% ` Shubham Verma
  2021-02-11 19:46 19% ` [PATCH v3 05/10] t7001: remove whitespace after redirect operators Shubham Verma
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 200+ results
From: Shubham Verma @ 2021-02-11 19:47 UTC (permalink / raw)
  To: git

Use `>` rather than `touch` to create an empty file when the
timestamp isn't relevant to the test.

Signed-off-by: Shubham Verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 6412c4f882..a56580b26d 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -49,14 +49,14 @@ test_expect_success 'checking -k on non-existing file' '
 '
 
 test_expect_success 'checking -k on untracked file' '
-	touch untracked1 &&
+	>untracked1 &&
 	git mv -k untracked1 path0 &&
 	test -f untracked1 &&
 	test ! -f path0/untracked1
 '
 
 test_expect_success 'checking -k on multiple untracked files' '
-	touch untracked2 &&
+	>untracked2 &&
 	git mv -k untracked1 untracked2 path0 &&
 	test -f untracked1 &&
 	test -f untracked2 &&
@@ -65,7 +65,7 @@ test_expect_success 'checking -k on multiple untracked files' '
 '
 
 test_expect_success 'checking -f on untracked file with existing target' '
-	touch path0/untracked1 &&
+	>path0/untracked1 &&
 	test_must_fail git mv -f untracked1 path0 &&
 	test ! -f .git/index.lock &&
 	test -f untracked1 &&
@@ -488,7 +488,7 @@ test_expect_success 'moving nested submodules' '
 	mkdir sub_nested_nested &&
 	(
 		cd sub_nested_nested &&
-		touch nested_level2 &&
+		>nested_level2 &&
 		git init &&
 		git add . &&
 		git commit -m "nested level 2"
@@ -496,7 +496,7 @@ test_expect_success 'moving nested submodules' '
 	mkdir sub_nested &&
 	(
 		cd sub_nested &&
-		touch nested_level1 &&
+		>nested_level1 &&
 		git init &&
 		git add . &&
 		git commit -m "nested level 1" &&
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH] test: fix t7001 cp to use POSIX options
@ 2014-04-11  8:24 19% Kyle J. McKay
  2014-04-11 11:43  6% ` Jeff King
  0 siblings, 1 reply; 200+ results
From: Kyle J. McKay @ 2014-04-11  8:24 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jens Lehmann

Since 11502468 and 04c1ee57 (both first appearing in v1.8.5), the
t7001-mv test has used "cp -a" to perform a copy in several of the
tests.

However, the "-a" option is not required for a POSIX cp utility and
some platforms' cp utilities do not support it.

The POSIX equivalent of -a is -R -P -p.

Change "cp -a" to "cp -R -P -p" so that the t7001-mv test works
on systems with a cp utility that only implements the POSIX
required set of options and not the "-a" option.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>

---
 t/t7001-mv.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 215d43d6..c8ff9115 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -308,7 +308,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
 	(
 		cd sub &&
 		rm -f .git &&
-		cp -a ../.git/modules/sub .git &&
+		cp -R -P -p ../.git/modules/sub .git &&
 		GIT_WORK_TREE=. git config --unset core.worktree
 	) &&
 	mkdir mod &&
@@ -331,7 +331,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
 	(
 		cd sub &&
 		rm -f .git &&
-		cp -a ../.git/modules/sub .git &&
+		cp -R -P -p ../.git/modules/sub .git &&
 		GIT_WORK_TREE=. git config --unset core.worktree
 	) &&
 	mkdir mod &&
-- 
tg: (0bc85abb..) t/t7001-posix-cp (depends on: maint)

^ permalink raw reply related	[relevance 19%]

* [PATCH 1/2] t7001: add test for git-mv dir1 dir2/
@ 2006-07-26 17:41 19% Johannes Schindelin
  2006-07-26 17:50  6% ` Jon Smirl
    0 siblings, 2 replies; 200+ results
From: Johannes Schindelin @ 2006-07-26 17:41 UTC (permalink / raw)
  To: Jon Smirl, git, junkio


If dir2 already exists, git-mv should move dir1 _into_dir2/.
Noticed by Jon Smirl.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---

	Jon, this was your problem, right?

 t/t7001-mv.sh |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index d78c56a..322eaad 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -59,4 +59,19 @@ test_expect_success \
      git-diff-tree -r -M --name-status  HEAD^ HEAD | \
      grep -E "^R100.+path0/README.+path2/README"'
 
+test_expect_success \
+    'moving whole subdirectory into subdirectory' \
+    'git-mv path2 path1'
+
+test_expect_success \
+    'commiting the change' \
+    'git-commit -m dir-move -a'
+
+test_expect_success \
+    'checking the commit' \
+    'git-diff-tree -r -M --name-status  HEAD^ HEAD | \
+     grep -E "^R100.+path2/COPYING.+path1/path2/COPYING" &&
+     git-diff-tree -r -M --name-status  HEAD^ HEAD | \
+     grep -E "^R100.+path2/README.+path1/path2/README"'
+
 test_done
-- 
1.4.2.rc2.g96f2-dirty

^ permalink raw reply related	[relevance 19%]

* [PATCH 05/11] t7001: remove whitespace after redirect operators
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
  2020-09-25 17:02 19% ` [PATCH 09/11] t7001: use here-docs instead of echo shubham verma
  2020-09-25 17:02 19% ` [PATCH 08/11] t7001: put each command on a separate line shubham verma
@ 2020-09-25 17:02 19% ` shubham verma
  2020-09-25 17:02 19% ` [PATCH 04/11] t7001: change the style for cd according to subshell shubham verma
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git; +Cc: Shubham Verma

From: Shubham Verma <shubhunic@gmail.com>

According to Documentation/CodingGuidelines, there should be no
whitespace after redirect operators. So, we should remove these
whitespaces after redirect operators.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 67585b7d94..7581e4b407 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -156,9 +156,9 @@ test_expect_success "Michael Cassar's test case" '
 	rm -fr .git papers partA &&
 	git init &&
 	mkdir -p papers/unsorted papers/all-papers partA &&
-	echo a > papers/unsorted/Thesis.pdf &&
-	echo b > partA/outline.txt &&
-	echo c > papers/unsorted/_another &&
+	echo a >papers/unsorted/Thesis.pdf &&
+	echo b >partA/outline.txt &&
+	echo c >papers/unsorted/_another &&
 	git add papers partA &&
 	T1=$(git write-tree) &&
 
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH 1/3] Missing && in t/t7001.sh.
@ 2009-02-04  9:32 19% Matthieu Moy
  2009-02-04  9:32 13% ` [PATCH 2/3] [BUG] Add a testcase for "git mv -f" on untracked files Matthieu Moy
  0 siblings, 1 reply; 200+ results
From: Matthieu Moy @ 2009-02-04  9:32 UTC (permalink / raw)
  To: git, gitster; +Cc: Matthieu Moy

Without this, the exit status is only the one of the last line.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 t/t7001-mv.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index ef2e78f..e4dfe95 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -55,7 +55,7 @@ test_expect_success \
      git mv -k untracked1 untracked2 path0 &&
      test -f untracked1 &&
      test -f untracked2 &&
-     test ! -f path0/untracked1
+     test ! -f path0/untracked1 &&
      test ! -f path0/untracked2'
 
 # clean up the mess in case bad things happen
-- 
1.6.1.2.321.g68da9

^ permalink raw reply related	[relevance 19%]

* [RFC PATCHv2 13/16] t7001 (mv): add missing &&
  @ 2010-09-24 22:22 19% ` Elijah Newren
  2010-09-24 23:00  6%   ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 200+ results
From: Elijah Newren @ 2010-09-24 22:22 UTC (permalink / raw)
  To: git; +Cc: Elijah Newren

FIXME: I believe the mv was meant to fail here so I added a test_must_fail;
was that the right change?

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t7001-mv.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 65a35d9..624e6d2 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -61,7 +61,7 @@ test_expect_success \
 test_expect_success \
     'checking -f on untracked file with existing target' \
     'touch path0/untracked1 &&
-     git mv -f untracked1 path0
+     test_must_fail git mv -f untracked1 path0 &&
      test ! -f .git/index.lock &&
      test -f untracked1 &&
      test -f path0/untracked1'
-- 
1.7.3.95.g14291

^ permalink raw reply related	[relevance 19%]

* [PATCHv3 12/16] t7001 (mv): add missing &&
  @ 2010-09-25 19:07 19% ` Elijah Newren
  0 siblings, 0 replies; 200+ results
From: Elijah Newren @ 2010-09-25 19:07 UTC (permalink / raw)
  To: git; +Cc: Elijah Newren

Also, prefix an expected-to-fail git mv command with 'test_must_fail'.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t7001-mv.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 65a35d9..624e6d2 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -61,7 +61,7 @@ test_expect_success \
 test_expect_success \
     'checking -f on untracked file with existing target' \
     'touch path0/untracked1 &&
-     git mv -f untracked1 path0
+     test_must_fail git mv -f untracked1 path0 &&
      test ! -f .git/index.lock &&
      test -f untracked1 &&
      test -f path0/untracked1'
-- 
1.7.3.95.g14291

^ permalink raw reply related	[relevance 19%]

* [PATCH 1/2] Add test case for mv --dry-run to t7001-mv.sh
  @ 2017-12-31 19:11 19%   ` Stefan Moch
  0 siblings, 0 replies; 200+ results
From: Stefan Moch @ 2017-12-31 19:11 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Simon Doodkin, git, Stefan Moch

It checks if mv --dry-run does not move file.

Signed-off-by: Stefan Moch <stefanmoch@mail.de>
---
 t/t7001-mv.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 6e5031f56..d4e6485a2 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -38,6 +38,12 @@ test_expect_success \
     'git diff-tree -r -M --name-status  HEAD^ HEAD | \
     grep "^R100..*path1/COPYING..*path0/COPYING"'
 
+test_expect_success \
+    'mv --dry-run does not move file' \
+    'git mv -n path0/COPYING MOVED &&
+     test -f path0/COPYING &&
+     test ! -f MOVED'
+
 test_expect_success \
     'checking -k on non-existing file' \
     'git mv -k idontexist path0'
-- 
2.14.3


^ permalink raw reply related	[relevance 19%]

* [PATCH 09/11] t7001: use here-docs instead of echo
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
@ 2020-09-25 17:02 19% ` shubham verma
  2020-09-25 20:23  6%   ` Junio C Hamano
  2020-09-25 17:02 19% ` [PATCH 08/11] t7001: put each command on a separate line shubham verma
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git; +Cc: Shubham Verma

From: Shubham Verma <shubhunic@gmail.com>

Change from old style to current style by taking advantage of
here-docs instead of echo commands.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 94c5b10f8a..30714a8200 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -222,7 +222,10 @@ test_expect_success 'git mv to move multiple sources into a directory' '
 	git add dir/?.txt &&
 	git mv dir/a.txt dir/b.txt other &&
 	git ls-files >actual &&
-	{ echo other/a.txt; echo other/b.txt; } >expect &&
+	cat >expect <<-\EOF &&
+	other/a.txt
+	other/b.txt
+	EOF
 	test_cmp expect actual
 '
 
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH 08/11] t7001: put each command on a separate line
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
  2020-09-25 17:02 19% ` [PATCH 09/11] t7001: use here-docs instead of echo shubham verma
@ 2020-09-25 17:02 19% ` shubham verma
  2020-09-25 19:01  6%   ` Eric Sunshine
  2020-09-25 17:02 19% ` [PATCH 05/11] t7001: remove whitespace after redirect operators shubham verma
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git; +Cc: Shubham Verma

From: Shubham Verma <shubhunic@gmail.com>

Multiple commands on one line  should be split across multiple lines.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 728a937eeb..94c5b10f8a 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -143,7 +143,9 @@ test_expect_success 'checking the commit' '
 '
 
 test_expect_success 'do not move directory over existing directory' '
-	mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
+	mkdir path0 &&
+	mkdir path0/path2 &&
+	test_must_fail git mv path2 path0
 '
 
 test_expect_success 'move into "."' '
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH 04/11] t7001: change the style for cd according to subshell
  2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
                   ` (2 preceding siblings ...)
  2020-09-25 17:02 19% ` [PATCH 05/11] t7001: remove whitespace after redirect operators shubham verma
@ 2020-09-25 17:02 19% ` shubham verma
  2020-09-25 18:12 11%   ` Eric Sunshine
  2020-09-25 17:02 18% ` [PATCH 07/11] t7001: use ': >' rather than 'touch' shubham verma
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 200+ results
From: shubham verma @ 2020-09-25 17:02 UTC (permalink / raw)
  To: git; +Cc: Shubham Verma

From: Shubham Verma <shubhunic@gmail.com>

In some tests there is not a proper spaces after opening paranthesis
and before cd. So, Lets change the style for cd according to subshell.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index f63802442b..67585b7d94 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -503,14 +503,16 @@ test_expect_success 'moving a submodule in nested directories' '
 test_expect_success 'moving nested submodules' '
 	git commit -am "cleanup commit" &&
 	mkdir sub_nested_nested &&
-	(cd sub_nested_nested &&
+	(
+		cd sub_nested_nested &&
 		touch nested_level2 &&
 		git init &&
 		git add . &&
 		git commit -m "nested level 2"
 	) &&
 	mkdir sub_nested &&
-	(cd sub_nested &&
+	(
+		cd sub_nested &&
 		touch nested_level1 &&
 		git init &&
 		git add . &&
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH v2 09/10] t7001: use here-docs instead of echo
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
@ 2021-02-09 17:32 19% ` shubham verma
  2021-02-09 17:32 19% ` [PATCH v2 05/10] t7001: remove whitespace after redirect operators shubham verma
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2021-02-09 17:32 UTC (permalink / raw)
  To: git

Change from old style to current style by taking advantage of
here-docs instead of echo commands.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 9a73232c7c..2e2e60e0d3 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -226,7 +226,10 @@ test_expect_success 'git mv to move multiple sources into a directory' '
 	git add dir/?.txt &&
 	git mv dir/a.txt dir/b.txt other &&
 	git ls-files >actual &&
-	{ echo other/a.txt; echo other/b.txt; } >expect &&
+	cat >expect <<-\EOF &&
+	other/a.txt
+	other/b.txt
+	EOF
 	test_cmp expect actual
 '
 
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH v2 05/10] t7001: remove whitespace after redirect operators
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
  2021-02-09 17:32 19% ` [PATCH v2 09/10] t7001: use here-docs instead of echo shubham verma
@ 2021-02-09 17:32 19% ` shubham verma
  2021-02-09 17:32 19% ` [PATCH v2 07/10] t7001: use '>' rather than 'touch' shubham verma
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2021-02-09 17:32 UTC (permalink / raw)
  To: git

According to Documentation/CodingGuidelines, there should be no
whitespace after redirect operators. So, we should remove these
whitespaces after redirect operators.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index a4a14a3b2e..02fbc90dea 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -156,9 +156,9 @@ test_expect_success "Michael Cassar's test case" '
 	rm -fr .git papers partA &&
 	git init &&
 	mkdir -p papers/unsorted papers/all-papers partA &&
-	echo a > papers/unsorted/Thesis.pdf &&
-	echo b > partA/outline.txt &&
-	echo c > papers/unsorted/_another &&
+	echo a >papers/unsorted/Thesis.pdf &&
+	echo b >partA/outline.txt &&
+	echo c >papers/unsorted/_another &&
 	git add papers partA &&
 	T1=$(git write-tree) &&
 
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH v2 08/10] t7001: put each command on a separate line
  2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
                   ` (2 preceding siblings ...)
  2021-02-09 17:32 19% ` [PATCH v2 07/10] t7001: use '>' rather than 'touch' shubham verma
@ 2021-02-09 17:32 19% ` shubham verma
  2021-02-09 17:32 17% ` [PATCH v2 04/10] t7001: modernize subshell formatting shubham verma
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 200+ results
From: shubham verma @ 2021-02-09 17:32 UTC (permalink / raw)
  To: git

Modern practice is to avoid multiple commands per line, and
instead place each command on its own line.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 1671241fc8..9a73232c7c 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -143,7 +143,9 @@ test_expect_success 'checking the commit' '
 '
 
 test_expect_success 'do not move directory over existing directory' '
-	mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
+	mkdir path0 &&
+	mkdir path0/path2 &&
+	test_must_fail git mv path2 path0
 '
 
 test_expect_success 'move into "."' '
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH v3 05/10] t7001: remove whitespace after redirect operators
  2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
  2021-02-11 19:47 19% ` [PATCH v3 07/10] t7001: use '>' rather than 'touch' Shubham Verma
@ 2021-02-11 19:46 19% ` Shubham Verma
  2021-02-11 19:47 19% ` [PATCH v3 09/10] t7001: use here-docs instead of echo Shubham Verma
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 200+ results
From: Shubham Verma @ 2021-02-11 19:46 UTC (permalink / raw)
  To: git

According to Documentation/CodingGuidelines, there should be no
whitespace after redirect operators. So, we should remove these
whitespaces after redirect operators.

Signed-off-by: Shubham Verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 7fd4341988..2e49e9af81 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -156,9 +156,9 @@ test_expect_success "Michael Cassar's test case" '
 	rm -fr .git papers partA &&
 	git init &&
 	mkdir -p papers/unsorted papers/all-papers partA &&
-	echo a > papers/unsorted/Thesis.pdf &&
-	echo b > partA/outline.txt &&
-	echo c > papers/unsorted/_another &&
+	echo a >papers/unsorted/Thesis.pdf &&
+	echo b >partA/outline.txt &&
+	echo c >papers/unsorted/_another &&
 	git add papers partA &&
 	T1=$(git write-tree) &&
 
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH v3 09/10] t7001: use here-docs instead of echo
  2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
  2021-02-11 19:47 19% ` [PATCH v3 07/10] t7001: use '>' rather than 'touch' Shubham Verma
  2021-02-11 19:46 19% ` [PATCH v3 05/10] t7001: remove whitespace after redirect operators Shubham Verma
@ 2021-02-11 19:47 19% ` Shubham Verma
  2021-02-11 19:47 19% ` [PATCH v3 08/10] t7001: put each command on a separate line Shubham Verma
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 200+ results
From: Shubham Verma @ 2021-02-11 19:47 UTC (permalink / raw)
  To: git

Change from old style to current style by taking advantage of
here-docs instead of echo commands.

Signed-off-by: Shubham Verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 93d6767951..36a274e96d 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -228,7 +228,10 @@ test_expect_success 'git mv to move multiple sources into a directory' '
 	git add dir/?.txt &&
 	git mv dir/a.txt dir/b.txt other &&
 	git ls-files >actual &&
-	{ echo other/a.txt; echo other/b.txt; } >expect &&
+	cat >expect <<-\EOF &&
+	other/a.txt
+	other/b.txt
+	EOF
 	test_cmp expect actual
 '
 
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH v3 08/10] t7001: put each command on a separate line
  2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
                   ` (2 preceding siblings ...)
  2021-02-11 19:47 19% ` [PATCH v3 09/10] t7001: use here-docs instead of echo Shubham Verma
@ 2021-02-11 19:47 19% ` Shubham Verma
  2021-02-11 19:46 17% ` [PATCH v3 03/10] t7001: remove unnecessary blank lines Shubham Verma
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 200+ results
From: Shubham Verma @ 2021-02-11 19:47 UTC (permalink / raw)
  To: git

Modern practice is to avoid multiple commands per line, and
instead place each command on its own line.

Signed-off-by: Shubham Verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index a56580b26d..93d6767951 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -145,7 +145,9 @@ test_expect_success 'checking the commit' '
 '
 
 test_expect_success 'do not move directory over existing directory' '
-	mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0
+	mkdir path0 &&
+	mkdir path0/path2 &&
+	test_must_fail git mv path2 path0
 '
 
 test_expect_success 'move into "."' '
-- 
2.25.1


^ permalink raw reply related	[relevance 19%]

* [PATCH 2/3] t7001: use "ls-files --format" instead of "cut"
  2023-05-08 18:59  7% [PATCH 0/3] dropping "verbose" test helper function Jeff King
@ 2023-05-08 19:01 19% ` Jeff King
  2023-05-08 19:01 13% ` [PATCH 1/3] t7001: avoid git on upstream of pipe Jeff King
  1 sibling, 0 replies; 200+ results
From: Jeff King @ 2023-05-08 19:01 UTC (permalink / raw)
  To: git

Since ls-files recently learned a "--format" option, we can use that
rather than asking for all of "--stage" and then pulling out the bits we
want with "cut". That's simpler and avoids two extra processes (one for
cut, and one for the subshell to hold the intermediate result).

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t7001-mv.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index ea70419928..2e6a3c0a54 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -5,8 +5,7 @@ test_description='git mv in subdirs'
 . "$TEST_DIRECTORY"/lib-diff-data.sh
 
 index_at_path () {
-	entry=$(git ls-files --stage "$@") &&
-	echo "$entry" | cut -f 1
+	git ls-files --format='%(objectmode) %(objectname) %(stage)' "$@"
 }
 
 test_expect_success 'mv -f refreshes updated index entry' '
-- 
2.40.1.802.gdef2a8734a


^ permalink raw reply related	[relevance 19%]

* [PATCH v2 084/142] t7001-mv.sh: use the $( ... ) construct for command substitution
  @ 2014-03-25 17:23 20% ` Elia Pinto
  0 siblings, 0 replies; 200+ results
From: Elia Pinto @ 2014-03-25 17:23 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

The Git CodingGuidelines prefer the $( ... ) construct for command
substitution instead of using the back-quotes, or grave accents (`..`).

The backquoted form is the historical method for command substitution,
and is supported by POSIX. However, all but the simplest uses become
complicated quickly. In particular, embedded command substitutions
and/or the use of double quotes require careful escaping with the backslash
character. Because of this the POSIX shell adopted the $(…) feature from
the Korn shell.

The patch was generated by the simple script

for _f in $(find . -name "*.sh")
do
  sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 t/t7001-mv.sh |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e3c8c2c..23564bf 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -156,11 +156,11 @@ test_expect_success "Michael Cassar's test case" '
 	echo b > partA/outline.txt &&
 	echo c > papers/unsorted/_another &&
 	git add papers partA &&
-	T1=`git write-tree` &&
+	T1=$(git write-tree) &&
 
 	git mv papers/unsorted/Thesis.pdf papers/all-papers/moo-blah.pdf &&
 
-	T=`git write-tree` &&
+	T=$(git write-tree) &&
 	git ls-tree -r $T | grep partA/outline.txt || {
 		git ls-tree -r $T
 		(exit 1)
-- 
1.7.10.4

^ permalink raw reply related	[relevance 20%]

* [PATCH 086/144] t7001-mv.sh: use the $( ... ) construct for command substitution
  @ 2014-03-25  8:25 20% ` Elia Pinto
  0 siblings, 0 replies; 200+ results
From: Elia Pinto @ 2014-03-25  8:25 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

The Git CodingGuidelines prefer the $( ... ) construct for command
substitution instead of using the back-quotes, or grave accents (`..`).

The backquoted form is the historical method for command substitution,
and is supported by POSIX. However,all but the simplest uses become
complicated quickly. In particular,embedded command substitutions
and/or the use of double quotes require careful escaping with the backslash
character. Because of this the POSIX shell adopted the $(…) feature from
the Korn shell.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 t/t7001-mv.sh |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e3c8c2c..23564bf 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -156,11 +156,11 @@ test_expect_success "Michael Cassar's test case" '
 	echo b > partA/outline.txt &&
 	echo c > papers/unsorted/_another &&
 	git add papers partA &&
-	T1=`git write-tree` &&
+	T1=$(git write-tree) &&
 
 	git mv papers/unsorted/Thesis.pdf papers/all-papers/moo-blah.pdf &&
 
-	T=`git write-tree` &&
+	T=$(git write-tree) &&
 	git ls-tree -r $T | grep partA/outline.txt || {
 		git ls-tree -r $T
 		(exit 1)
-- 
1.7.10.4

^ permalink raw reply related	[relevance 20%]

* [PATCHv4 11/15] t7001 (mv): add missing &&
  @ 2010-09-26 23:14 21% ` Elijah Newren
  0 siblings, 0 replies; 200+ results
From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

Also, prefix an expected-to-fail git mv command with 'test_must_fail'.

Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t7001-mv.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 65a35d9..624e6d2 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -61,7 +61,7 @@ test_expect_success \
 test_expect_success \
     'checking -f on untracked file with existing target' \
     'touch path0/untracked1 &&
-     git mv -f untracked1 path0
+     test_must_fail git mv -f untracked1 path0 &&
      test ! -f .git/index.lock &&
      test -f untracked1 &&
      test -f path0/untracked1'
-- 
1.7.3.95.g14291

^ permalink raw reply related	[relevance 21%]

* [PATCHv5 12/16] t7001 (mv): add missing &&
  @ 2010-10-03  5:10 21% ` Elijah Newren
  0 siblings, 0 replies; 200+ results
From: Elijah Newren @ 2010-10-03  5:10 UTC (permalink / raw)
  To: git; +Cc: gitster, avarab, jrnieder, Elijah Newren

Also, prefix an expected-to-fail git mv command with 'test_must_fail'.

Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t7001-mv.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 65a35d9..624e6d2 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -61,7 +61,7 @@ test_expect_success \
 test_expect_success \
     'checking -f on untracked file with existing target' \
     'touch path0/untracked1 &&
-     git mv -f untracked1 path0
+     test_must_fail git mv -f untracked1 path0 &&
      test ! -f .git/index.lock &&
      test -f untracked1 &&
      test -f path0/untracked1'
-- 
1.7.3.1.66.gab790

^ permalink raw reply related	[relevance 21%]

* [PATCHv6 12/16] t7001 (mv): add missing &&
  @ 2010-10-03 20:00 21% ` Elijah Newren
    1 sibling, 0 replies; 200+ results
From: Elijah Newren @ 2010-10-03 20:00 UTC (permalink / raw)
  To: git; +Cc: gitster, avarab, jrnieder, Elijah Newren

Also, prefix an expected-to-fail git mv command with 'test_must_fail'.

Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t7001-mv.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 65a35d9..624e6d2 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -61,7 +61,7 @@ test_expect_success \
 test_expect_success \
     'checking -f on untracked file with existing target' \
     'touch path0/untracked1 &&
-     git mv -f untracked1 path0
+     test_must_fail git mv -f untracked1 path0 &&
      test ! -f .git/index.lock &&
      test -f untracked1 &&
      test -f path0/untracked1'
-- 
1.7.3.1.66.gab790

^ permalink raw reply related	[relevance 21%]

Results 1-200 of ~700   | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2009-02-04  9:32 19% [PATCH 1/3] Missing && in t/t7001.sh Matthieu Moy
2009-02-04  9:32 13% ` [PATCH 2/3] [BUG] Add a testcase for "git mv -f" on untracked files Matthieu Moy
2009-02-04  9:32 12%   ` [PATCH 3/3] builtin-mv.c: check for unversionned files before looking at the destination Matthieu Moy
2006-07-26 17:41 19% [PATCH 1/2] t7001: add test for git-mv dir1 dir2/ Johannes Schindelin
2006-07-26 17:50  6% ` Jon Smirl
2006-07-26 18:47  6%   ` Johannes Schindelin
2006-07-26 18:23       ` Junio C Hamano
2006-07-26 18:31         ` Jon Smirl
2006-07-26 18:58  6%       ` Junio C Hamano
2006-07-26 19:31  6%         ` Junio C Hamano
2006-07-26 20:33  6%           ` Jon Smirl
2006-07-26 18:39     ` Josef Weidendorfer
2006-07-26 19:05  6%   ` Junio C Hamano
2006-07-28  1:30       ` Petr Baudis
2006-07-28  2:41  6%     ` Junio C Hamano
2006-07-28  2:56  6%       ` Petr Baudis
2006-07-28  4:48  6%         ` Junio C Hamano
2006-07-28 15:47  6%           ` Petr Baudis
2014-04-11  8:24 19% [PATCH] test: fix t7001 cp to use POSIX options Kyle J. McKay
2014-04-11 11:43  6% ` Jeff King
2014-04-11 13:44 18%   ` Kyle J. McKay
2020-09-25 17:02 15% [PATCH 00/11] Modernizing the t7001 test script shubham verma
2020-09-25 17:02 19% ` [PATCH 09/11] t7001: use here-docs instead of echo shubham verma
2020-09-25 20:23  6%   ` Junio C Hamano
2020-09-25 17:02 19% ` [PATCH 08/11] t7001: put each command on a separate line shubham verma
2020-09-25 19:01  6%   ` Eric Sunshine
2020-09-25 17:02 19% ` [PATCH 05/11] t7001: remove whitespace after redirect operators shubham verma
2020-09-25 17:02 19% ` [PATCH 04/11] t7001: change the style for cd according to subshell shubham verma
2020-09-25 18:12 11%   ` Eric Sunshine
2020-09-25 17:02 18% ` [PATCH 07/11] t7001: use ': >' rather than 'touch' shubham verma
2020-09-25 18:57  6%   ` Eric Sunshine
2020-09-25 20:21  6%     ` Junio C Hamano
2020-09-25 17:02 17% ` [PATCH 03/11] t7001: remove unnecessary blank lines shubham verma
2020-09-25 17:50       ` Eric Sunshine
2020-09-25 20:19  6%     ` Junio C Hamano
2020-09-25 17:02 16% ` [PATCH 10/11] t7001: use `test` rather than `[` shubham verma
2020-09-25 17:02 15% ` [PATCH 11/11] t7001: move cleanup code from outside the tests into them shubham verma
2020-09-25 17:02 15% ` [PATCH 06/11] t7001: change (cd <path> && git foo) to (git -C <path> foo) shubham verma
2020-09-25 18:53 11%   ` Eric Sunshine
2020-09-25 17:02 13% ` [PATCH 01/11] t7001: convert tests from the old style to the current style shubham verma
2020-09-25 17:40 11%   ` Eric Sunshine
2020-09-25 17:02 13% ` [PATCH 02/11] t7001: use TAB instead of spaces shubham verma
2020-09-25 17:44 11%   ` Eric Sunshine
2020-09-25 17:33  6% ` [PATCH 00/11] Modernizing the t7001 test script Eric Sunshine
2020-10-01  5:42  6%   ` Shubham Verma
2020-12-22 19:22  6%     ` Junio C Hamano
2021-02-09 17:32 15% [PATCH v2 00/10] " shubham verma
2021-02-09 17:32 19% ` [PATCH v2 09/10] t7001: use here-docs instead of echo shubham verma
2021-02-09 17:32 19% ` [PATCH v2 05/10] t7001: remove whitespace after redirect operators shubham verma
2021-02-09 17:32 19% ` [PATCH v2 07/10] t7001: use '>' rather than 'touch' shubham verma
2021-02-09 17:32 19% ` [PATCH v2 08/10] t7001: put each command on a separate line shubham verma
2021-02-09 17:32 17% ` [PATCH v2 04/10] t7001: modernize subshell formatting shubham verma
2021-02-09 17:32 17% ` [PATCH v2 03/10] t7001: remove unnecessary blank lines shubham verma
2021-02-09 17:32 16% ` [PATCH v2 10/10] t7001: use `test` rather than `[` shubham verma
2021-02-09 17:32 15% ` [PATCH v2 06/10] t7001: avoid using `cd` outside of subshells shubham verma
2021-02-09 17:32 13% ` [PATCH v2 02/10] t7001: indent with TABs instead of spaces shubham verma
2021-02-09 17:32 12% ` [PATCH v2 01/10] t7001: modernize test formatting shubham verma
2021-02-09 19:24  6% ` [PATCH v2 00/10] Modernizing the t7001 test script Eric Sunshine
2021-02-09 22:58  6% ` Junio C Hamano
2021-02-11  7:28  6%   ` Eric Sunshine
2021-02-11  7:37  6%     ` Junio C Hamano
2021-02-11  7:56  6%       ` Shubham Verma
2021-02-11  7:59  6%         ` Eric Sunshine
2021-02-11 19:46 15% [PATCH v3 " Shubham Verma
2021-02-11 19:47 19% ` [PATCH v3 07/10] t7001: use '>' rather than 'touch' Shubham Verma
2021-02-11 19:46 19% ` [PATCH v3 05/10] t7001: remove whitespace after redirect operators Shubham Verma
2021-02-11 19:47 19% ` [PATCH v3 09/10] t7001: use here-docs instead of echo Shubham Verma
2021-02-11 19:47 19% ` [PATCH v3 08/10] t7001: put each command on a separate line Shubham Verma
2021-02-11 19:46 17% ` [PATCH v3 03/10] t7001: remove unnecessary blank lines Shubham Verma
2021-02-11 19:46 17% ` [PATCH v3 04/10] t7001: modernize subshell formatting Shubham Verma
2021-02-11 19:47 16% ` [PATCH v3 10/10] t7001: use `test` rather than `[` Shubham Verma
2021-02-11 19:47 15% ` [PATCH v3 06/10] t7001: avoid using `cd` outside of subshells Shubham Verma
2021-02-11 19:46 13% ` [PATCH v3 02/10] t7001: indent with TABs instead of spaces Shubham Verma
2021-02-11 19:46 12% ` [PATCH v3 01/10] t7001: modernize test formatting Shubham Verma
2021-02-11 21:44  6% ` [PATCH v3 00/10] Modernizing the t7001 test script Junio C Hamano
2021-02-23  8:26 11%   ` Shubham Verma
2021-02-23 17:33  6%     ` Junio C Hamano
     [not found]     <BYAPR21MB1158F64E1141453F7D00B46CE0D89@BYAPR21MB1158.namprd21.prod.outlook.com>
     [not found]     ` <BYAPR21MB11585FFD46DEE7AD4EEEFEABE0D89@BYAPR21MB1158.namprd21.prod.outlook.com>
2020-12-29  2:06 14%   ` [PATCH] git-mv: fix git mv bug with case insensitive fs Dan Moseley
2017-08-17 10:34 13% [PATCH] add test for bug in git-mv with nested submodules Heiko Voigt
2017-08-17 19:05     ` Stefan Beller
2017-08-18 16:06       ` Heiko Voigt
2017-08-18 19:04         ` Stefan Beller
2017-09-15 11:50 12%       ` [PATCH v2] add test for bug in git-mv for recursive submodules Heiko Voigt
2009-12-02  1:35 13% [PATCH] Fixed typo Richard Hartmann
2022-10-30 17:20 13% [PATCH] t7001-mv.sh:modernizing test script using function Debra Obondo via GitGitGadget
2022-11-03 18:39 13% ` [PATCH v2] t7001-mv.sh: modernizing test script using functions Debra Obondo via GitGitGadget
2022-11-04 15:05 13%   ` [PATCH v3] " Debra Obondo via GitGitGadget
2022-11-04 22:00  6%     ` Taylor Blau
2022-10-31 18:04 10% ` [PATCH] t7001-mv.sh:modernizing test script using function Martin Ågren
2022-11-01  1:14  6%   ` Taylor Blau
2022-10-30 18:00  6% ` Taylor Blau
2006-03-03 16:23 12% [PATCH] git-mv: fix moves into a subdir from outside Josef Weidendorfer
2016-06-28 18:24 12% [PATCHv2] submodule: test moving recursive submodule Stefan Beller
2011-03-04 21:40 12% [PATCH] Allow git mv FileA fILEa when core.ignorecase = true Torsten Bögershausen
2016-04-18 16:54 12% [PATCH] mv: allow moving nested submodules Stefan Beller
2016-06-28  0:15 12% [PATCH] submodule: test moving recursive submodule Stefan Beller
2022-03-25  1:56 11% [PATCH] mv: refresh stat info for moved entry Victoria Dye via GitGitGadget
2022-03-29  1:07  9% ` [PATCH v2] " Victoria Dye via GitGitGadget
2013-12-03  8:32 11% [PATCH] mv: let 'git mv file no-such-dir/' error out Matthieu Moy
2013-12-03 10:06     ` Duy Nguyen
2013-12-04  8:44 12%   ` Matthieu Moy
2008-08-01 16:49 11% [PATCH] git mv: try harder to keep index entries intact Johannes Schindelin
2016-04-19 18:32 11% [PATCH] mv: allow moving nested submodules Stefan Beller
2011-03-19 14:28 11% [PATCH v2] Allow git mv FileA fILEa on case ignore file systems Torsten Bögershausen
2011-01-14 13:41 10% [PATCH] handle rename of case only, for windows Tim Abell
2023-08-08 14:53 10% [PATCH] fix `git mv existing-dir non-existing-dir`* Sebastian Thiel via GitGitGadget
2023-08-09  7:47  9% ` [PATCH v2] fix `git mv existing-dir non-existing-dir` in some environments Sebastian Thiel via GitGitGadget
2006-07-26 17:47 10% [PATCH 2/2] builtin git-mv: support moving directories Johannes Schindelin
2020-07-17 23:24 10% [PATCH] git-mv: improve error message for conflicted file Chris Torek via GitGitGadget
2020-07-20  6:17 10% ` [PATCH v2] " Chris Torek via GitGitGadget
2011-01-14 13:44 10% [PATCH] handle rename of case only, for windows Tim Abell
2011-01-14 13:54 10% [PATCH] handle rename of case only, for windows (resend) Tim Abell
2011-01-29 23:45  9% [PATCH] Handle rename of case only, for Windows Tim Abell
2011-04-10  5:50  9% [PATCH] Allow git mv FILENAME Filename when core.ignorecase = true Torsten Bögershausen
2005-05-16  6:06  8% [PATCH 2/2] Add sample ignore logic to git-run-with-user-path command Junio C Hamano
2023-05-08 18:59  7% [PATCH 0/3] dropping "verbose" test helper function Jeff King
2023-05-08 19:01 19% ` [PATCH 2/3] t7001: use "ls-files --format" instead of "cut" Jeff King
2023-05-08 19:01 13% ` [PATCH 1/3] t7001: avoid git on upstream of pipe Jeff King
2016-01-07 13:51  6% [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
2016-01-07 13:51 18% ` [PATCH 07/10] t/t7001-mv.sh: " Elia Pinto
2020-10-09 15:59  6% What's cooking in git.git (Oct 2020, #02; Fri, 9) Junio C Hamano
2013-07-30 19:48  6% [PATCH v3 0/5] Teach mv to move submodules Jens Lehmann
2013-07-30 19:49 10% ` [PATCH v3 1/5] Teach mv to move submodules together with their work trees Jens Lehmann
2013-07-30 19:50  9% ` [PATCH v3 2/5] Teach mv to move submodules using a gitfile Jens Lehmann
2013-07-30 19:51  8% ` [PATCH v3 4/5] Teach mv to update the path entry in .gitmodules for moved submodules Jens Lehmann
2013-08-06 19:15  8%   ` [PATCH v4 " Jens Lehmann
2020-09-25 22:57  6% What's cooking in git.git (Sep 2020, #07; Fri, 25) Junio C Hamano
2018-03-13 20:19  6% [GSoC] [PATCH] test: avoid pipes in git related commands for test suite Pratik Karki
2020-10-06 20:11  6% What's cooking in git.git (Oct 2020, #01; Mon, 5) Junio C Hamano
2020-10-19 18:13  6% What's cooking in git.git (Oct 2020, #03; Mon, 19) Junio C Hamano
     [not found]     <1233309819-777-?= =?ISO-8859-1?Q?1-git-send-email?= =?ISO-8859-1?Q?-=0E=10>
2009-01-30 10:36  6% ` [PATCH 1/2] Missing && in t/t7001.sh Matthieu Moy
2016-08-09  8:53  6% [PATCH] Spelling fixes Ville Skyttä
2020-09-29 22:06  6% What's cooking in git.git (Sep 2020, #08; Tue, 29) Junio C Hamano
2016-08-05 14:41     [PATCH] git mv: do not keep slash in `git mv dir non-existing-dir/` Johannes Schindelin
2016-08-05 15:52     ` Junio C Hamano
2016-08-05 15:58  6%   ` Johannes Schindelin
2008-07-21  0:23     [PATCH] git-mv: Keep moved index entries inact Petr Baudis
2008-07-21  0:25  8% ` [PATCHv2] " Petr Baudis
2008-07-26  6:46       ` Junio C Hamano
2008-07-28 14:20  6%     ` SZEDER Gábor
2008-07-28 15:06 13%       ` Johannes Schindelin
2008-07-28 19:19             ` Junio C Hamano
2008-07-28 23:41               ` Johannes Schindelin
2008-07-28 23:55 13%             ` Johannes Schindelin
2008-07-29  0:17               ` Petr Baudis
2008-07-29  0:46                 ` Junio C Hamano
2008-07-29  5:23 12%               ` Junio C Hamano
2017-10-06 19:00     [PATCH 1/2] tests: use shell negation instead of test_must_fail for test_cmp Stefan Beller
2017-10-06 19:00  6% ` [PATCH 2/2] tests: fix diff order arguments in test_cmp Stefan Beller
2017-11-01 13:00     [PATCH 1/2] sequencer: factor out rewrite_file() René Scharfe
2017-11-01 14:44     ` [PATCH 1/2] wrapper.c: consistently quote filenames in error messages Simon Ruderich
2017-11-02  4:40       ` Junio C Hamano
2017-11-02  5:16 12%     ` Junio C Hamano
2014-03-25 17:22     [PATCH v2 000/142] Use the $( ... ) construct for command substitution instead of using the back-quotes Elia Pinto
2014-03-25 17:23 20% ` [PATCH v2 084/142] t7001-mv.sh: use the $( ... ) construct for command substitution Elia Pinto
2016-04-15  8:14     'git mv' doesn't move submodule if it's in a subdirectory Albin Otterhäll
2016-04-15 17:18     ` Stefan Beller
2016-04-15 17:59 14%   ` Stefan Beller
2018-09-21 23:58     [PATCH 0/3] bring some tests to newer style Stefan Beller
2018-09-21 23:58 11% ` [PATCH 1/3] t7001: reformat " Stefan Beller
2018-09-24 13:31  6%   ` Derrick Stolee
2018-09-24 18:51         ` Stefan Beller
2018-09-25 20:36  6%       ` Junio C Hamano
2016-04-15 18:24     'git mv' doesn't move submodule if it's in a subdirectory Stefan Beller
2016-04-15 19:11 11% ` [PATCH] mv: allow moving nested submodules Stefan Beller
2018-08-02 13:46     [RFC PATCH v2 00/12] Make submodules work if .gitmodules is not checked out Antonio Ospite
2018-08-02 13:46  6% ` [RFC PATCH v2 10/12] t7416: add new test about HEAD:.gitmodules and not existing .gitmodules Antonio Ospite
2021-05-26 23:58     [PATCH] t2080: fix cp invocation to copy symlinks instead of following them Matheus Tavares
2021-05-27  7:25  6% ` Christian Couder
2013-10-11 14:29     Spurious warning when moving a file in presence of submodules Matthieu Moy
2013-10-11 17:53     ` Jens Lehmann
2013-10-13 11:52 11%   ` [PATCH] mv: Fix spurious " Jens Lehmann
2006-12-17 14:46     [PATCH] Adjust t5510 to put remotes in config Johannes Schindelin
     [not found]     ` <7v7iwox59i.fsf@assigned-by-dhcp.cox.net>
2006-12-18 22:28       ` Johannes Schindelin
2006-12-18 22:42         ` Junio C Hamano
2006-12-18 22:47           ` Johannes Schindelin
2006-12-18 22:49             ` Johannes Schindelin
2006-12-18 22:58               ` Junio C Hamano
2006-12-18 23:27  8%             ` Junio C Hamano
2014-07-22 21:44     What's cooking in git.git (Jul 2014, #04; Tue, 22) Junio C Hamano
2014-07-23 14:17  6% ` Karsten Blees
2013-12-09 10:59     mv/rm submodules George Papanikolaou
2013-12-09 17:49     ` Jens Lehmann
2014-01-06 19:21 11%   ` [PATCH] mv: better document side effects when moving a submodule Jens Lehmann
2014-01-06 22:40         ` Junio C Hamano
2014-01-07 17:57           ` Jens Lehmann
2014-01-07 21:30             ` [PATCH v2 0/2] better document side effects when [re]moving " Jens Lehmann
2014-01-07 21:31 11%           ` [PATCH v2 1/2] mv: better document side effects when moving " Jens Lehmann
2010-09-24 22:22     [RFC PATCHv2 00/16] Add missing &&'s in the testsuite Elijah Newren
2010-09-24 22:22 19% ` [RFC PATCHv2 13/16] t7001 (mv): add missing && Elijah Newren
2010-09-24 23:00  6%   ` Ævar Arnfjörð Bjarmason
2013-12-04 13:10     [PATCH] mv: let 'git mv file no-such-dir/' error out Duy Nguyen
2013-12-04 17:37 10% ` [PATCH v2] " Matthieu Moy
2014-10-15  0:45     [PATCH v23 0/25] rs/ref-transaction ("Use ref transactions", part 3) Jonathan Nieder
2014-10-15  0:46 10% ` [PATCH 01/25] mv test: recreate mod/ directory instead of relying on stale copy Jonathan Nieder
2020-10-10 11:48     [Outreachy] Introduction Charvi Mendiratta
2020-10-11  8:09  6% ` Christian Couder
2006-08-18  7:23     Another git-mv bug Fredrik Kuivinen
2006-08-18 10:42 12% ` [PATCH] git-mv: special case destination "." Johannes Schindelin
2010-09-26 23:14     [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren
2010-09-26 23:14 21% ` [PATCHv4 11/15] t7001 (mv): add missing && Elijah Newren
2014-07-30 17:10     Transaction patch series overview Ronnie Sahlberg
2014-07-31 21:41     ` Ronnie Sahlberg
2014-08-08 16:50       ` Ronnie Sahlberg
2014-08-19 19:54         ` Ronnie Sahlberg
2014-08-20 23:17           ` Jonathan Nieder
2014-09-11  3:03             ` [PATCH v21 0/19] rs/ref-transaction (Re: Transaction patch series overview) Jonathan Nieder
2014-09-11  3:04 10%           ` [PATCH 01/19] mv test: recreate mod/ directory instead of relying on stale copy Jonathan Nieder
2014-10-02  1:48               ` [PATCH v22 0/24] rs/ref-transaction Jonathan Nieder
2014-10-02  1:50 10%             ` [PATCH 01/24] mv test: recreate mod/ directory instead of relying on stale copy Jonathan Nieder
2016-04-18 23:41     [PATCH 0/2] WAS: [PATCH] mv: allow moving nested submodules Stefan Beller
2016-04-18 23:41 11% ` [PATCH 2/2] " Stefan Beller
2009-01-14 13:20     [BUG] assertion failure in builtin-mv.c with "git mv -k" Matthieu Moy
2009-01-14 14:53     ` Michael J Gruber
2009-01-14 15:54       ` Johannes Schindelin
2009-01-14 17:03         ` [PATCH v2 0/3] Add test cases for "git mv -k" and fix a known breakage Michael J Gruber
2009-01-14 17:03 13%       ` [PATCH v2 1/3] add test cases for "git mv -k" Michael J Gruber
2009-01-14 17:03             ` [PATCH v2 2/3] fix handling of multiple untracked files for git mv -k Michael J Gruber
2009-01-14 17:03 13%           ` [PATCH v2 3/3] mark fixed breakage as expect pass for "git mv -k" multiple files Michael J Gruber
2009-01-14 16:04         ` [BUG] assertion failure in builtin-mv.c with "git mv -k" Michael J Gruber
2009-01-14 19:02  6%       ` Junio C Hamano
2009-01-15 10:53  6%         ` Michael J Gruber
2018-07-02  0:23     [PATCH 00/25] fix buggy tests, modernize tests, fix broken &&-chains Eric Sunshine
2018-07-02  0:24  8% ` [PATCH 23/25] t7000-t7999: " Eric Sunshine
2014-03-29 15:38     AIX fixes Charles Bailey
2014-03-29 15:39 12% ` [PATCH 2/2] Don't rely on strerror text when testing rmdir failure Charles Bailey
2017-01-04  1:48     [PATCHv4 0/2] pathspec: give better message for submodule related pathspec error Stefan Beller
2017-01-04  1:48 10% ` [PATCH 1/2] submodule tests: don't use itself as a submodule Stefan Beller
2018-03-27 21:39     [PATCH 0/5] Moving submodules with nested submodules Stefan Beller
2018-03-27 21:39  9% ` [PATCH 5/5] submodule: fixup nested submodules after moving the submodule Stefan Beller
2008-07-17 13:06     [PATCH 5/7] git mv: Support moving submodules Petr Baudis
2008-07-17 22:31  8% ` [PATCH] git-mv: Keep moved index entries inact Petr Baudis
2010-09-25 19:06     [PATCHv3 00/16] Add missing &&'s in the testsuite Elijah Newren
2010-09-25 19:07 19% ` [PATCHv3 12/16] t7001 (mv): add missing && Elijah Newren
2008-02-04  7:03     [PATCH] fix misuse of prefix_path() Junio C Hamano
2008-02-04  8:09 11% ` [PATCH] builtin-mv: minimum fix to avoid losing files Junio C Hamano
2017-12-16  1:31     feature-request: git "cp" like there is git mv Jonathan Nieder
2017-12-31 19:11     ` Stefan Moch
2017-12-31 19:11 19%   ` [PATCH 1/2] Add test case for mv --dry-run to t7001-mv.sh Stefan Moch
2024-01-05 17:41     [BUG] mv: can trigger assertion failure with three parameters (builtin/mv.c:481) Kristoffer Haugsbakk
2024-02-18 12:42 12% ` Kristoffer Haugsbakk
2017-01-05 19:29     [PATCHv6 0/2] pathspec: give better message for submodule related pathspec error Stefan Beller
2017-01-05 19:29 10% ` [PATCHv6 1/2] submodule tests: don't use itself as a submodule Stefan Beller
2005-05-16  6:04     [PATCH 0/2] Introducing git-run-with-user-path program Junio C Hamano
2005-05-16 23:21     ` Junio C Hamano
2005-05-16 23:41  8%   ` [PATCH 2/2] Add sample ignore logic to git-run-with-user-path command Junio C Hamano
2010-10-03  5:10     [PATCHv5 00/16] Add missing &&'s in the testsuite Elijah Newren
2010-10-03  5:10 21% ` [PATCHv5 12/16] t7001 (mv): add missing && Elijah Newren
2024-05-23 12:25     [PATCH 00/20] Various memory leak fixes Patrick Steinhardt
2024-05-23 12:26 11% ` [PATCH 20/20] builtin/mv: fix leaks for submodule gitfile paths Patrick Steinhardt
2024-05-24 10:03     ` [PATCH v2 00/21] Various memory leak fixes Patrick Steinhardt
2024-05-24 10:04 11%   ` [PATCH v2 21/21] builtin/mv: fix leaks for submodule gitfile paths Patrick Steinhardt
2016-02-23 17:40     [RFC/PATCH 0/5] Make README more pleasant to read Matthieu Moy
2016-02-23 17:40 13% ` [PATCH 1/5] README: use markdown syntax Matthieu Moy
2016-02-25  8:37     ` [PATCH v2 0/5] Make README more pleasant to read Matthieu Moy
2016-02-25  8:37 13%   ` [PATCH v2 1/5] README: use markdown syntax Matthieu Moy
2008-07-27 13:41     [PATCHv2] git-mv: Keep moved index entries inact Petr Baudis
2008-07-27 13:47 18% ` [PATCH] t/t7001-mv.sh: Propose ability to use git-mv on conflicting entries Petr Baudis
2008-07-28  1:13 16%   ` Junio C Hamano
2008-07-28  1:21  6%     ` Junio C Hamano
2006-08-15 20:51     git-mv is broken in master Fredrik Kuivinen
2006-08-15 21:02     ` David Rientjes
2006-08-16  0:20 12%   ` [PATCH] git-mv: succeed even if source is a prefix of destination Johannes Schindelin
2021-01-06  4:05     [PATCH] git-mv: fix git mv bug with case insensitive fs Junio C Hamano
     [not found]     ` <20210301170425.12154-1-tboegi@web.de>
2021-03-01 20:23 14%   ` [EXTERNAL] [PATCH v2 1/1] git mv foo FOO ; git mv foo bar gave an assert Dan Moseley
2014-03-08 19:21     [PATCH] mv: prevent mismatched data when ignoring errors brian m. carlson
2014-03-15 18:56 12% ` [PATCH v2] " brian m. carlson
2006-07-26  1:52     [PATCH] Make git-mv a builtin Johannes Schindelin
2006-07-26 13:44 13% ` [PATCH] Extend testing git-mv for renaming of subdirectories Josef Weidendorfer
2010-10-03 19:59     [PATCHv6 00/16] Add missing &&'s in the testsuite Elijah Newren
2010-10-03 20:00 21% ` [PATCHv6 12/16] t7001 (mv): add missing && Elijah Newren
2010-10-03 20:00     ` [PATCHv6 15/16] Add missing &&'s throughout the testsuite Elijah Newren
2010-10-31  1:46       ` [PATCH en/cascade-tests] tests: add missing && Jonathan Nieder
2010-10-31  3:31         ` Junio C Hamano
2010-10-31  7:26           ` [PATCH/RFC 00/10] " Jonathan Nieder
2010-10-31  7:30  6%         ` [PATCH 01/10] tests: add missing &&, batch 2 Jonathan Nieder
2015-03-20 10:04     [PATCH 0/25] detecting &&-chain breakage Jeff King
2015-03-20 10:09 10% ` [PATCH 06/25] t: use verbose instead of hand-rolled errors Jeff King
2018-03-28  0:42     [PATCH 5/5] submodule: fixup nested submodules after moving the submodule Stefan Beller
2018-03-28 17:24     ` [PATCHv2 0/6] Moving submodules with nested submodules Stefan Beller
2018-03-28 17:24  9%   ` [PATCH 5/6] submodule: fixup nested submodules after moving the submodule Stefan Beller
2018-03-28 17:54     [PATCHv2 0/6] Moving submodules with nested submodules Jonathan Tan
2018-03-28 22:35     ` [PATCHv3 " Stefan Beller
2018-03-28 22:35  8%   ` [PATCHv3 6/6] submodule: fixup nested submodules after moving the submodule Stefan Beller
2018-06-26  7:29     [PATCH 00/29] t: detect and fix broken &&-chains in subshells Eric Sunshine
2018-06-26  7:29  8% ` [PATCH 26/29] t7000-t7999: " Eric Sunshine
2013-12-02 10:04     [BUG] git mv file directory/ creates the file directory Matthieu Moy
2013-12-02 13:35     ` Duy Nguyen
2013-12-02 17:07 11%   ` Matthieu Moy
2017-02-15  0:34     [RFCv3 PATCH 00/14] Checkout aware of Submodules! Stefan Beller
2017-02-15  0:34     ` [PATCH 02/14] lib-submodule-update.sh: define tests for recursing into submodules Stefan Beller
2017-02-15 16:51       ` Brandon Williams
2017-02-15 18:52  6%     ` Stefan Beller
2020-08-02 14:30     [PATCH] t1450: fix quoting of NUL byte when corrupting pack Martin Ågren
2020-08-06 20:08     ` [PATCH v2 0/2] t: don't spuriously close and reopen quotes Martin Ågren
2020-08-06 20:08  6%   ` [PATCH v2 1/2] " Martin Ågren
2014-03-25  8:24     [PATCH 000/144] Use the $( ... ) construct for command substitution instead of using the back-quotes Elia Pinto
2014-03-25  8:25 20% ` [PATCH 086/144] t7001-mv.sh: use the $( ... ) construct for command substitution Elia Pinto
2013-04-03 19:54     [PATCH/RFC 0/3] Teach mv to move submodules Jens Lehmann
2013-04-03 19:56 10% ` [PATCH/RFC 1/3] Teach mv to move submodules together with their work trees Jens Lehmann
2013-04-03 19:56  9% ` [PATCH/RFC 2/3] Teach mv to move submodules using a gitfile Jens Lehmann
2013-04-09 23:08       ` Junio C Hamano
2013-04-10 16:59         ` Jens Lehmann
2013-04-10 21:06  9%       ` [PATCH v2 " Jens Lehmann
2013-04-03 19:57  9% ` [PATCH/RFC 3/3] Teach mv to update the path entry in .gitmodules for moved submodules Jens Lehmann
2009-05-07 15:05     [JGIT PATCH 1/2] Add support for boolean config values "yes", "no" Shawn O. Pearce
2009-05-07 15:05     ` [JGIT PATCH 2/2] Make Repository.isValidRefName compatible with Git 1.6.3 Shawn O. Pearce
2009-05-07 23:02       ` Robin Rosenberg
2009-05-07 23:29         ` Linus Torvalds
2009-05-08  0:32           ` Junio C Hamano
2009-05-08  0:47  7%         ` Shawn O. Pearce
2021-10-02  9:19     [PATCH 0/5] COPYING: modernize, steal boilerplate from linux.git Ævar Arnfjörð Bjarmason
2021-10-02  9:19 10% ` [PATCH 2/5] tests: stop using top-level "README" and "COPYING" files Ævar Arnfjörð Bjarmason
2021-10-05 17:01     ` [PATCH v2 0/5] COPYING: modernize, steal boilerplate from linux.git Ævar Arnfjörð Bjarmason
2021-10-05 17:01 10%   ` [PATCH v2 2/5] tests: stop using top-level "README" and "COPYING" files Ævar Arnfjörð Bjarmason
2021-10-15  9:30       ` [PATCH v3 0/2] tests: stop relying on top-level COPYING and README Ævar Arnfjörð Bjarmason
2021-10-15  9:30 10%     ` [PATCH v3 2/2] tests: stop using top-level "README" and "COPYING" files Ævar Arnfjörð Bjarmason

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).