The solution can be found hidden in the documentation on this page in a section beginning "When alternate endings are added..."
In short, we have to tell LilyPond to change some measure lengths. For the first ending, we have to specify \set Timing.measureLength = #(ly:make-moment 2/4)
; then we return to \set Timing.measureLength = #(ly:make-moment 3/4)
for the second ending.
Thus in order to compile this:

...you would use the following code. Note that I cleaned it up a bit, and decided to include the initial e4
of the repeat as a part of the volta.
\version "2.18.2"
\include "bagpipe.ly"
\header {
title = "O Christmas Tree"
composer = "German Carol"
}
\score {
{
\time 3/4
\hideKeySignature
\tempo "Andante moderato" 4 = 72
{
\repeat volta 2 {
\partial 4 a4
\thrwd d8. \grg d16 \grc d4 e4
\grg f8. \gre f16 \grg f4. \gre f8
\grg e8 f8 \dblg g4 c4 | }
%\grg e4|} % I removed this to include this E in the volta itself
\alternative {
{
\set Timing.measureLength = #(ly:make-moment 2/4)
\grg e4 \thrwd d4 | } % First ending
{
\set Timing.measureLength = #(ly:make-moment 3/4)
\grg e4 \thrwd d4. A8 | } % Second ending
}
\grg A8 f8 b4. A8
\grg A8 g8 \grA g4. \grf g8
\grA g8 e8 \dblA A4. g8
\grA g8 f8 \gre f4 a4
\thrwd d8. \grg d16 \grc d4 e4
\grg f8. \gre f16 \grg f4. \gre f8
\grg e8 f8 \dblg g4 c4
\grg e4 \thrwd d2 \bar "|."
}
}
\layout {
indent = 0.0\cm
}
}
% end score
If you really liked not having the initial e4
in the volta, you can change it to:
\version "2.18.2"
\include "bagpipe.ly"
\header {
title = "O Christmas Tree"
composer = "German Carol"
}
\score {
{
\time 3/4
\hideKeySignature
\tempo "Andante moderato" 4 = 72
{
\repeat volta 2 {
\partial 4 a4
\thrwd d8. \grg d16 \grc d4 e4
\grg f8. \gre f16 \grg f4. \gre f8
\grg e8 f8 \dblg g4 c4 |
\grg e4 }
\alternative {
{
\set Timing.measureLength = #(ly:make-moment 1/4)
\thrwd d4 | } % First ending
{
\set Timing.measureLength = #(ly:make-moment 2/4)
\thrwd d4. A8 | } % Second ending
}
\set Timing.measureLength = #(ly:make-moment 3/4)
\grg A8 f8 b4. A8
\grg A8 g8 \grA g4. \grf g8
\grA g8 e8 \dblA A4. g8
\grA g8 f8 \gre f4 a4
\thrwd d8. \grg d16 \grc d4 e4
\grg f8. \gre f16 \grg f4. \gre f8
\grg e8 f8 \dblg g4 c4
\grg e4 \thrwd d2 \bar "|."
}
}
\layout {
indent = 0.0\cm
}
}
% end score
Which compiles:

But you'll notice that that changes the measure numbering; this is one of the reasons I think it's easier to include the e4
in the volta.