git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: "SZEDER Gábor" <szeder.dev@gmail.com>, git@jeffhostetler.com
Cc: git@vger.kernel.org, gitster@pobox.com, peff@peff.net,
	Jeff Hostetler <jeffhost@microsoft.com>,
	Brandon Williams <bwilliamseng@gmail.com>
Subject: Re: [PATCH v12 5/5] read-cache: speed up has_dir_name (part 2)
Date: Sun, 5 Jul 2020 07:27:57 +0200	[thread overview]
Message-ID: <fd593c77-ac40-9c4a-7556-2f10d60e2cee@web.de> (raw)
In-Reply-To: <20200704172708.GC11341@szeder.dev>

Am 04.07.20 um 19:27 schrieb SZEDER Gábor:
> diff --git a/t/t9999-test.sh b/t/t9999-test.sh
> new file mode 100755
> index 0000000000..4c802d5940
> --- /dev/null
> +++ b/t/t9999-test.sh
> @@ -0,0 +1,47 @@
> +#!/bin/sh
> +
> +test_description='test'
> +
> +. ./test-lib.sh
> +
> +test_expect_success 'file to dir breakage' '
> +	>file-to-dir &&
> +	# This sorts between "file-to-dir" as a file and "file-to-dir"
> +	# as a directory (with the trailing / appended implicitly.
> +	>file-to-dir.uh-oh &&
> +	git add file-to-dir file-to-dir.uh-oh &&
> +	git commit -m "add a file" &&
> +
> +	# Not "git rm", to preserve "file-to-dir" in the index.
> +	rm file-to-dir &&
> +	mkdir file-to-dir &&
> +	>file-to-dir/file &&
> +
> +	# It is important to add the file in the directory; adding only
> +	# the directory doesnt trigger the bug.
> +	git add file-to-dir/file &&
> +
> +	git diff --cached --no-renames --name-status >actual &&
> +
> +	cat >expect <<-\EOF &&
> +	D	file-to-dir
> +	A	file-to-dir/file
> +	EOF
> +	test_cmp expect actual
> +'
> +
> +test_expect_success 'is it committed as-is?' '
> +	git commit -m "replace file with a dir" &&
> +	git ls-tree HEAD >actual &&
> +
> +	# Hardcoded SHA-1 oid :(, because with this bug present
> +	# "git rev-parse HEAD:file-to-dir" doesnt show the oid of
> +	# the tree, but the oid of the blob that shouldnt be there.
> +	cat >expect <<-EOF &&
> +	100644 blob $EMPTY_BLOB	file-to-dir.uh-oh
> +	040000 tree df2b8fc99e1c1d4dbc0a854d9f72157f1d6ea078	file-to-dir

You can get the hash of the tree with:

  echo "100644 blob $EMPTY_BLOB	file" | git mktree

(TAB before "file", the rest of the whitespace are regular spaces)

> +	EOF
> +	test_cmp expect actual
> +'
> +
> +test_done
>

  reply	other threads:[~2020-07-05  5:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19 17:06 [PATCH v12 0/5] read-cache: speed up add_index_entry git
2017-04-19 17:06 ` [PATCH v12 1/5] read-cache: add strcmp_offset function git
2017-04-19 17:06 ` [PATCH v12 2/5] p0006-read-tree-checkout: perf test to time read-tree git
2017-04-19 17:06 ` [PATCH v12 3/5] read-cache: speed up add_index_entry during checkout git
2017-04-19 17:06 ` [PATCH v12 4/5] read-cache: speed up has_dir_name (part 1) git
2017-04-19 17:06 ` [PATCH v12 5/5] read-cache: speed up has_dir_name (part 2) git
2020-07-04 17:27   ` SZEDER Gábor
2020-07-05  5:27     ` René Scharfe [this message]
2020-07-06  6:39     ` Junio C Hamano
2020-07-08 13:49       ` Jeff Hostetler
2020-07-16 17:11         ` René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd593c77-ac40-9c4a-7556-2f10d60e2cee@web.de \
    --to=l.s.r@web.de \
    --cc=bwilliamseng@gmail.com \
    --cc=git@jeffhostetler.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    --cc=peff@peff.net \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).