Sahil Dua <[email protected]> writes:
> + cat >expect <<-\EOF &&
> + branch.dest.key1=value1
> + some.gar.b=age
> + branch.dest.key2=value2
> + EOF
> + cat >config.branch <<\EOF &&
> +;; Comment for source
> +[branch "source"]
> + ;; Comment for the source value
> + key1 = value1
> + ;; Comment for some.gar
> +[some "gar"]
> + ;; Comment for the some.gar value
> + b = age
> + ;; Comment for source, again
> +[branch "source"]
> + ;; Comment for the source value, again
> + key2 = value2
> +EOF
Indenting using <<- would make it easier to read. I.e.
cat >config.branch <<-\EOF &&
;; Comment for ...
[branch "source"]
;; Comment for ...
...
EOF
> + cat config.branch >>.git/config &&
> + git branch -m source dest &&
> + git config -f .git/config -l | grep -F -e source -e dest -e some.gar
> >actual &&
> + test_cmp expect actual &&
> +
> + # ...and that the comments for those sections are also
> + # preserved.
> + cat config.branch | sed "s/\"source\"/\"dest\"/" >expect &&
> + grep -A 9001 "Comment for source" .git/config >actual &&
Where does 9001 come from? Is that just "an arbitrary large
number"?
Besides, "grep -A" is quite unportable. Would
sed -n -e "/Comment for source/,$p" .git/config >actual
work equally well?
> + test_cmp expect actual
> +'
> +
> test_expect_success 'deleting a symref' '
> git branch target &&
> git symbolic-ref refs/heads/symref refs/heads/target &&
>
> --
> https://github.com/git/git/pull/363