Thread (4 messages) 4 messages, 2 authors, 2016-06-16

Re: [PATCH v2 1/8] t4051: rewrite, add more tests

flat view

From: René Scharfe <hidden>
Date: 2016-06-16 02:19:39

Possibly related (same subject, not in this thread)

Am 30.05.2016 um 01:55 schrieb Junio C Hamano:
René Scharfe [off-list ref] writes:
quoted
+commit_and_tag () {
+	message=$1 &&
+	shift &&
+	git add $@ &&
Lack of dq around $@ makes me wonder if there is something funny
going on (looking at the callers, there isn't, so we'd better quote
it to avoid wasting time, I think).
OK.
quoted
+	test_tick &&
+	git commit -m $message &&
+	git tag $message
  }
The use of $message as the sole argument to "git tag" makes the
readers guess that it must be a single token without any funny
character, so the readers would probably do not waste too much time
wondreing if the lack of dq around $message in the last two is
problematic.
Well, let's call it $tag; $message is a bit misleading here.  The saved letters can be invested in quotes. ;)
quoted
+last_context_line () {
+	sed -n '$ p'
  }
I have a vague recollection that some implementations of sed are
unhappy to see that space between the address and the operation; I'd
feel safer without it.
Indeed most sed calls in t/ have no space there (found counter-examples only in annotate-tests.sh, t4201-shortlog.sh, t9824-git-p4-git-lfs.sh).
quoted
+check_diff () {
+	name=$1
+	desc=$2
+	options="-W $3"
+
+	test_expect_success "$desc" '
+		git diff $options "$name^" "$name" >"$name.diff"
+	'
+
+	test_expect_success ' diff applies' '
+		test_when_finished "git reset --hard" &&
+		git checkout --detach "$name^" &&
With the presence of ^ there, --detach is unnecessary; it would not
hurt, though.
Right.  It's just there to make that intent clear.
quoted
+		git apply "$name.diff" &&
+		git diff --exit-code "$name"
Even though we may know that $name.diff" will never have a creation
of new paths, I'd feel safer if "apply" is run with "--index".
Makes sense; the less we assume about the diff to be checked the better.

Thanks a lot!

René
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help