Does it make a difference if the proposed ally partner is at war or not when gifting them something? Do they appreciate it more when they are at war?
In some ways, yes. If a war goes bad for a civ it might take their Military Rating down - so they will more look up to you, which might translate into a strong diplo bonus.
The other thing is that they occasionally ask you to help them. Gift them something (until the dialogue gets green) and you'll get another strong bonus (+ they appreciate our past help).
Tip: be careful when joining an alliance, because you can easily get into an universe-wide war if your ally is not very cautious or a warmonger or weak military.
AFAIK the game will ask you if you will honour the alliance, so you can even step out of this alliance-war right off the start. The alliance will be terminated if you choose to not help, but the relation will be set to "friendly" from which it is easy to have "close" again.