Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
d248161e
Commit
d248161e
authored
Jan 28, 2010
by
Robert Ricci
Committed by
Ryan Jackson
Feb 01, 2010
Browse files
Add functions to filter out objects that exist in another repository.
parent
63525f01
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/git/gitmail
View file @
d248161e
...
...
@@ -190,6 +190,8 @@ sub send_mail($$@);
sub
short_refname
($);
sub
debug
(@);
sub
rev_string
($$);
sub
object_exists
($$);
sub
filter_out_objects_in_repo
($@);
######################################################################
# Main Body
...
...
@@ -772,3 +774,32 @@ sub rev_string($$) {
return
undef
;
}
}
#
# Returns 1 if the given object (identified by hash) exists in the given
# repository (identified by path); 0 if it does not .
#
sub
object_exists
($$)
{
my
(
$obj
,
$repo
)
=
@_
;
#
# 'cat-file -e' is like 'test -e', and don't be fooled by the name, it
# works on non-files too
#
debug
("
running
$GIT
--git-dir='
$repo
' cat-file -e
$obj
");
my
$rv
=
system
"
$GIT
--git-dir='
$repo
' cat-file -e
$obj
";
if
(
$rv
)
{
return
0
;
}
else
{
return
1
;
}
}
#
# Return a list of all objects from the input list that do *not* exist in
# the given repo
#
sub
filter_out_objects_in_repo
($@)
{
my
$repo
=
shift
@_
;
return
grep
{
!
object_exists
(
$_
,
$repo
)}
@_
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment