On Sat, Feb 14, 2009 at 12:54 PM, Jeff King [off-list ref] wrote:
quoted
+ if (opt_a)
+ printf("%s/HEAD set to %s\n", argv[0], head_name);
This was a surprise based on reading the commit message, but I think it
is a sensible enhancement.
It seemed that when doing something "--automatically" it might be nice
to tell the user what we just did, but I'm confused why this was a
surprise.
quoted
+cat > test/expect <<EOF
+origin/HEAD set to master
+EOF
+
+test_expect_success 'set-head --auto' '
+ (cd test &&
+ git remote set-head --auto origin > output &&
+ git symbolic-ref refs/remotes/origin/HEAD &&
+ test_cmp expect output)
+'
I had to read this test a few times to convince myself it was right,
since you throw away the output of symbolic-ref. I think it makes more
sense to just test the post-command state, which is what you actually
care about (and then you are also not dependent on the human-readable
output of "remote set-head"). I.e.:
cat > test/expect <<EOF
refs/remotes/origin/master
EOF
test_expect_success 'set-head --auto' '
(cd test &&
git remote set-head --auto origin &&
git symbolic-ref refs/remotes/origin/HEAD > output &&
test_cmp expect output)
'
Right.
j.