Two friends or brother fall for the same girl; the girl has a little brother that ends up being a spy for the other team and gets hanged, which the sister sees through some binoculors. One of the guys sticks his head out of a building on purpose knowing he will be sniped
“Enemy at the Gates” (2001)
https://www.imdb.com/title/tt0215750/
Detailed plot summray on Wikipedia here:
https://en.wikipedia.org/wiki/Enemy_at_the_Gates
Quotes from the above Wikipedia page:
“Both also become romantically interested in Tania Chernova, a citizen of Stalingrad who has become a private in the local militia.”
“Sasha, a young Soviet boy, volunteers to act as a double agent by passing König false information about Vasily’s whereabouts to give Vasily a chance to ambush the major.”
“König tells Sasha where he will be next, suspecting that the boy will tell Vasily.”
“König spots Tania and Vasily waiting for him at his next ambush spot, confirming his suspicions about Sasha.”
“He then kills the boy and hangs his body off a pole to bait Vasily.”
“Finding Vasily waiting to ambush König, Danilov intentionally exposes himself in order to provoke König into shooting him and revealing his hidden position, sacrificing his life in the process.”
I am pretty sure that this is the movie you are looking for. If you agree, then please select my answer as Best Answer by clicking on the “Select” button.