Re: [PATCHv2 1/3] t6022: New test checking for unnecessary updates of renamed+modified files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 3/1/2011 2:08, schrieb Elijah Newren:
> +test_expect_failure 'avoid unnecessary update, normal rename' '
> +	git checkout -q avoid-unnecessary-update-1^0 &&
> +	touch -t 197001010000.01 rename &&

Use
	test-chmtime =1000000000 rename &&

> +	orig=$(stat --format="%Y" rename) &&

	orig=$(test-chmtime -v +0 rename) &&

> +	git merge merge-branch-1 &&
> +	new=$(stat --format="%Y" rename) &&

	new=$(test-chmtime -v +0 rename) &&

> +	echo "Checking whether stat times are same: $orig vs $new" &&

	echo "Checking whether stat times are same: ${orig%%	*} vs ${new%%	*}" &&

(that's TAB after the %%)

> +	test "$orig" == "$new" &&

	test "${orig%%	*}" = "${new%%	*}" &&

== is not portable. Actually, since the file name is the same in both
$orig and $new, you wouldn't need the %% magic in this statement.

> +	git diff-files --exit-code # Is "rename" clean, or only racily clean?

What you see here, is not "racily clean", but "stat dirty". "Racily clean"
means that git thinks that the file is clean (because the stat information
matches), but in fact the file content is not identical to the content
recorded in the index.

> +'
> +
>  test_done

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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]