git-submodule: Instead of using only annotated tags, use any tags.
Some repositories might not use/have annotated tags (for example the ones created with git-cvsimport) and git-submodule status might fail because git-describe might fail to find a tag. This change allows the status of a submodule to be described/displayed relative to lightweight tags as well. Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
ecda072380
commit
bffe71f4cd
@ -199,6 +199,18 @@ modules_update()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_name_rev () {
|
||||||
|
revname=$( (
|
||||||
|
unset GIT_DIR &&
|
||||||
|
cd "$1" && {
|
||||||
|
git-describe "$2" 2>/dev/null ||
|
||||||
|
git-describe --tags "$2" 2>/dev/null ||
|
||||||
|
git-describe --contains --tags "$2"
|
||||||
|
}
|
||||||
|
) )
|
||||||
|
test -z "$revname" || revname=" ($revname)"
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# List all submodules, prefixed with:
|
# List all submodules, prefixed with:
|
||||||
# - submodule not initialized
|
# - submodule not initialized
|
||||||
@ -221,17 +233,18 @@ modules_list()
|
|||||||
say "-$sha1 $path"
|
say "-$sha1 $path"
|
||||||
continue;
|
continue;
|
||||||
fi
|
fi
|
||||||
revname=$(unset GIT_DIR && cd "$path" && git-describe $sha1)
|
revname=$(unset GIT_DIR && cd "$path" && git-describe --tags $sha1)
|
||||||
|
set_name_rev "$path" $"sha1"
|
||||||
if git diff-files --quiet -- "$path"
|
if git diff-files --quiet -- "$path"
|
||||||
then
|
then
|
||||||
say " $sha1 $path ($revname)"
|
say " $sha1 $path$revname"
|
||||||
else
|
else
|
||||||
if test -z "$cached"
|
if test -z "$cached"
|
||||||
then
|
then
|
||||||
sha1=$(unset GIT_DIR && cd "$path" && git-rev-parse --verify HEAD)
|
sha1=$(unset GIT_DIR && cd "$path" && git-rev-parse --verify HEAD)
|
||||||
revname=$(unset GIT_DIR && cd "$path" && git-describe $sha1)
|
set_name_rev "$path" $"sha1"
|
||||||
fi
|
fi
|
||||||
say "+$sha1 $path ($revname)"
|
say "+$sha1 $path$revname"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user